parent
50a96e8047
commit
bb398970ef
@ -99,7 +99,7 @@ export default definePlugin({
|
|||||||
icon: isHidden ? ImageVisible : ImageInvisible,
|
icon: isHidden ? ImageVisible : ImageInvisible,
|
||||||
message: msg,
|
message: msg,
|
||||||
channel: ChannelStore.getChannel(msg.channel_id),
|
channel: ChannelStore.getChannel(msg.channel_id),
|
||||||
onClick: () => this.toggleHide(msg)
|
onClick: () => this.toggleHide(msg.id)
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
new Logger("HideAttachments").error(err);
|
new Logger("HideAttachments").error(err);
|
||||||
@ -107,10 +107,10 @@ export default definePlugin({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async toggleHide(message: Message) {
|
async toggleHide(id: string) {
|
||||||
const ids = await getHiddenMessages();
|
const ids = await getHiddenMessages();
|
||||||
if (!ids.delete(message.id))
|
if (!ids.delete(id))
|
||||||
ids.add(message.id);
|
ids.add(id);
|
||||||
|
|
||||||
await saveHiddenMessages(ids);
|
await saveHiddenMessages(ids);
|
||||||
await this.buildCss();
|
await this.buildCss();
|
||||||
@ -118,7 +118,7 @@ export default definePlugin({
|
|||||||
// update is necessary to rerender the PopOver
|
// update is necessary to rerender the PopOver
|
||||||
FluxDispatcher.dispatch({
|
FluxDispatcher.dispatch({
|
||||||
type: "MESSAGE_UPDATE",
|
type: "MESSAGE_UPDATE",
|
||||||
message
|
message: { id }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user