fix: only decrypt blocklist when newer event received

This commit is contained in:
Alejandro Gomez 2023-02-05 12:47:26 +01:00
parent 86043e813f
commit e058e7a28c
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817

View File

@ -20,7 +20,7 @@ import useModeration from "Hooks/useModeration";
*/
export default function useLoginFeed() {
const dispatch = useDispatch();
const { publicKey: pubKey, privateKey: privKey } = useSelector((s: RootState) => s.login);
const { publicKey: pubKey, privateKey: privKey, latestMuted } = useSelector((s: RootState) => s.login);
const { isMuted } = useModeration();
const db = useDb();
@ -132,7 +132,7 @@ export default function useLoginFeed() {
dispatch(setMuted(muted))
const newest = getNewest(mutedFeed.store.notes)
if (newest && newest.content.length > 0 && pubKey) {
if (newest && newest.content.length > 0 && pubKey && newest.created_at > latestMuted) {
decryptBlocked(newest, pubKey, privKey).then((plaintext) => {
try {
const blocked = JSON.parse(plaintext)