Fix send message related context menu options when unable to send messages

- fixes `reply` and `quote message` from appearing in the context menus for messages when unable to send messages.
- fixes #265
This commit is contained in:
brecert 2021-09-19 00:47:01 -04:00
parent 3b9916c072
commit abe2e2db40
No known key found for this signature in database
GPG key ID: 1B2E56B9EC985B96

View file

@ -486,8 +486,7 @@ function ContextMenus(props: Props) {
elements.push(
<MenuItem data={action} disabled={disabled}>
<Text
id={`app.context_menu.${
locale ?? action.action
id={`app.context_menu.${locale ?? action.action
}`}
/>
{tip && <div className="tip">{tip}</div>}
@ -702,19 +701,27 @@ function ContextMenus(props: Props) {
}
if (message && !queued) {
const sendPermission =
message.channel &&
message.channel.permission & ChannelPermission.SendMessage
if (sendPermission) {
generateAction({
action: "reply_message",
target: message,
});
}
if (
typeof message.content === "string" &&
message.content.length > 0
) {
if (sendPermission) {
generateAction({
action: "quote_message",
content: message.content,
});
}
generateAction({
action: "copy_text",