fix invalid id error

This commit is contained in:
Martti Malmi 2023-08-08 16:20:51 +03:00
parent 8a8b0ed2af
commit c4f4d4b3e1

View File

@ -291,12 +291,8 @@ const Events = {
let content;
try {
content = await Key.decrypt(event.content);
const blockList = JSON.parse(content);
const set = new Set<UserId>();
for (const id of blockList) {
set.add(ID(id));
}
SocialNetwork.blockedUsers = set;
const blockList = JSON.parse(content).map(ID);
SocialNetwork.blockedUsers = new Set(blockList);
} catch (e) {
console.log('failed to parse your block list', content, event);
}
@ -309,7 +305,7 @@ const Events = {
const myPub = Key.getPubKey();
if (event.pubkey === myPub) {
try {
const flaggedUsers = JSON.parse(event.content);
const flaggedUsers = JSON.parse(event.content).map(ID);
SocialNetwork.flaggedUsers = new Set(flaggedUsers);
} catch (e) {
console.log('failed to parse your flagged users list', event);