feat(MessageClickAction): delete message logger history (#1204)
This commit is contained in:
parent
cba810cab5
commit
4abcea61f8
1 changed files with 11 additions and 2 deletions
|
@ -67,7 +67,7 @@ export default definePlugin({
|
||||||
document.addEventListener("keydown", keydown);
|
document.addEventListener("keydown", keydown);
|
||||||
document.addEventListener("keyup", keyup);
|
document.addEventListener("keyup", keyup);
|
||||||
|
|
||||||
this.onClick = addClickListener((msg, channel, event) => {
|
this.onClick = addClickListener((msg: any, channel, event) => {
|
||||||
const isMe = msg.author.id === UserStore.getCurrentUser().id;
|
const isMe = msg.author.id === UserStore.getCurrentUser().id;
|
||||||
if (!isDeletePressed) {
|
if (!isDeletePressed) {
|
||||||
if (event.detail < 2) return;
|
if (event.detail < 2) return;
|
||||||
|
@ -90,7 +90,16 @@ export default definePlugin({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (settings.store.enableDeleteOnClick && (isMe || PermissionStore.can(MANAGE_CHANNELS, channel))) {
|
} else if (settings.store.enableDeleteOnClick && (isMe || PermissionStore.can(MANAGE_CHANNELS, channel))) {
|
||||||
MessageActions.deleteMessage(channel.id, msg.id);
|
if (msg.deleted) {
|
||||||
|
FluxDispatcher.dispatch({
|
||||||
|
type: "MESSAGE_DELETE",
|
||||||
|
channelId: channel.id,
|
||||||
|
id: msg.id,
|
||||||
|
mlDeleted: true
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
MessageActions.deleteMessage(channel.id, msg.id);
|
||||||
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue