mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-14 11:15:02 -05:00
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:
parent
3b9916c072
commit
abe2e2db40
1 changed files with 43 additions and 36 deletions
|
@ -486,8 +486,7 @@ function ContextMenus(props: Props) {
|
||||||
elements.push(
|
elements.push(
|
||||||
<MenuItem data={action} disabled={disabled}>
|
<MenuItem data={action} disabled={disabled}>
|
||||||
<Text
|
<Text
|
||||||
id={`app.context_menu.${
|
id={`app.context_menu.${locale ?? action.action
|
||||||
locale ?? action.action
|
|
||||||
}`}
|
}`}
|
||||||
/>
|
/>
|
||||||
{tip && <div className="tip">{tip}</div>}
|
{tip && <div className="tip">{tip}</div>}
|
||||||
|
@ -702,19 +701,27 @@ function ContextMenus(props: Props) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message && !queued) {
|
if (message && !queued) {
|
||||||
|
const sendPermission =
|
||||||
|
message.channel &&
|
||||||
|
message.channel.permission & ChannelPermission.SendMessage
|
||||||
|
|
||||||
|
if (sendPermission) {
|
||||||
generateAction({
|
generateAction({
|
||||||
action: "reply_message",
|
action: "reply_message",
|
||||||
target: message,
|
target: message,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
typeof message.content === "string" &&
|
typeof message.content === "string" &&
|
||||||
message.content.length > 0
|
message.content.length > 0
|
||||||
) {
|
) {
|
||||||
|
if (sendPermission) {
|
||||||
generateAction({
|
generateAction({
|
||||||
action: "quote_message",
|
action: "quote_message",
|
||||||
content: message.content,
|
content: message.content,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
generateAction({
|
generateAction({
|
||||||
action: "copy_text",
|
action: "copy_text",
|
||||||
|
|
Loading…
Reference in a new issue