diff --git a/external/revolt.js b/external/revolt.js
index e650b733..62d4a668 160000
--- a/external/revolt.js
+++ b/external/revolt.js
@@ -1 +1 @@
-Subproject commit e650b73359fe1a17f4b47a9df964c98a627316d4
+Subproject commit 62d4a668b2115227b7d13e5551923b676d1d8adf
diff --git a/src/components/common/messaging/MessageBox.tsx b/src/components/common/messaging/MessageBox.tsx
index ffb5d366..09397111 100644
--- a/src/components/common/messaging/MessageBox.tsx
+++ b/src/components/common/messaging/MessageBox.tsx
@@ -257,27 +257,31 @@ export default observer(({ channel }: Props) => {
);
}
- console.log(channel) //|| channel.channel_type != "DirectMessage"
- if (channel.channel_type != "SavedMessages")
- if (!channel.havePermission("SendMessage") && channel.channel_type == "TextChannel" || channel.recipient?.relationship == "Blocked" || channel.recipient?.relationship == "BlockedOther") {
- return (
-
-
-
-
-
-
-
-
-
-
-
-
- );
- }
+ if (
+ channel.channel_type != "SavedMessages" &&
+ ((!channel.havePermission("SendMessage") &&
+ channel.channel_type == "TextChannel") ||
+ channel.recipient?.relationship == "Blocked" ||
+ channel.recipient?.relationship == "BlockedOther")
+ ) {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+ }
// Push message content to draft.
const setMessage = useCallback(
(content?: string) => {
@@ -299,9 +303,9 @@ export default observer(({ channel }: Props) => {
const text =
action === "quote"
? `${content
- .split("\n")
- .map((x) => `> ${x}`)
- .join("\n")}\n\n`
+ .split("\n")
+ .map((x) => `> ${x}`)
+ .join("\n")}\n\n`
: `${content} `;
if (!state.draft.has(channel._id)) {
@@ -331,17 +335,7 @@ export default observer(({ channel }: Props) => {
// Check for @everyone mentions first
if (content.includes("@everyone")) {
- // Check if user has permission to mention everyone
- if (!channel.havePermission("MentionEveryone")) {
- // Display error toast when no permission
- modalController.push({
- type: "error",
- error: client.i18n.t("app.main.channel.misc.no_everyone_mention"),
- });
- // Remove @everyone from the message when no permission
- content = content.replace(/@everyone/g, "everyone");
- }
- // If user has permission, keep @everyone as is (don't wrap in <>)
+ // kept for potential future logic, but currently does nothing
}
// Convert @username mentions to <@USER_ID> format
@@ -350,17 +344,19 @@ export default observer(({ channel }: Props) => {
if (mentionMatches) {
for (const mention of mentionMatches) {
- const username = mention.substring(1); // Remove the @ symbol
- // Make sure it's not 'everyone' (already handled)
+ const username = mention.substring(1);
if (username.toLowerCase() !== "everyone") {
- // Find the user with this username
const user = Array.from(client.users.values()).find(
- (u) => u.username.toLowerCase() === username.toLowerCase()
+ (u) =>
+ u.username.toLowerCase() ===
+ username.toLowerCase(),
);
if (user) {
- // Replace @username with <@USER_ID>
- content = content.replace(mention, `<@${user._id}>`);
+ content = content.replace(
+ mention,
+ `<@${user._id}>`,
+ );
}
}
}
@@ -392,8 +388,8 @@ export default observer(({ channel }: Props) => {
toReplace == ""
? msg.content.toString() + newText
: msg.content
- .toString()
- .replace(new RegExp(toReplace, flags), newText);
+ .toString()
+ .replace(new RegExp(toReplace, flags), newText);
if (newContent != msg.content) {
if (newContent.length == 0) {
@@ -475,10 +471,10 @@ export default observer(({ channel }: Props) => {
files,
percent: Math.round(
(i * 100 + (100 * e.loaded) / e.total) /
- Math.min(
- files.length,
- CAN_UPLOAD_AT_ONCE,
- ),
+ Math.min(
+ files.length,
+ CAN_UPLOAD_AT_ONCE,
+ ),
),
cancel,
}),
@@ -769,13 +765,13 @@ export default observer(({ channel }: Props) => {
placeholder={
channel.channel_type === "DirectMessage"
? translate("app.main.channel.message_who", {
- person: channel.recipient?.username,
- })
+ person: channel.recipient?.username,
+ })
: channel.channel_type === "SavedMessages"
- ? translate("app.main.channel.message_saved")
- : translate("app.main.channel.message_where", {
- channel_name: channel.name ?? undefined,
- })
+ ? translate("app.main.channel.message_saved")
+ : translate("app.main.channel.message_where", {
+ channel_name: channel.name ?? undefined,
+ })
}
disabled={
uploadState.type === "uploading" ||
diff --git a/src/mobx/State.ts b/src/mobx/State.ts
index f7a99c96..02a60e7e 100644
--- a/src/mobx/State.ts
+++ b/src/mobx/State.ts
@@ -164,14 +164,6 @@ export default class State {
// Register events for notifications.
client.addListener("message", this.notifications.onMessage);
- client.addListener(
- "message/mention",
- this.notifications.onMessage,
- );
- client.addListener(
- "message/mention/everyone",
- this.notifications.onMessage,
- );
client.addListener(
"user/relationship",
this.notifications.onRelationship,
@@ -276,14 +268,6 @@ export default class State {
client.removeListener("message", this.queue.onMessage);
client.removeListener("packet", this.onPacket);
client.removeListener("message", this.notifications.onMessage);
- client.removeListener(
- "message/mention",
- this.notifications.onMessage,
- );
- client.removeListener(
- "message/mention/everyone",
- this.notifications.onMessage,
- );
client.removeListener(
"user/relationship",
this.notifications.onRelationship,
diff --git a/src/mobx/stores/NotificationOptions.ts b/src/mobx/stores/NotificationOptions.ts
index e10c7faa..5b44c6b8 100644
--- a/src/mobx/stores/NotificationOptions.ts
+++ b/src/mobx/stores/NotificationOptions.ts
@@ -158,7 +158,7 @@ export default class NotificationOptions
// Check channel notification settings
const mentioned = message.mention_ids?.includes(user._id) ||
- (message as any).mentionsEveryone;
+ message.mentionsEveryone;
switch (this.computeForChannel(message.channel!)) {
case "muted":
case "none":
diff --git a/src/pages/settings/channel/Permissions.tsx b/src/pages/settings/channel/Permissions.tsx
index 329f3619..bcfade2d 100644
--- a/src/pages/settings/channel/Permissions.tsx
+++ b/src/pages/settings/channel/Permissions.tsx
@@ -1,6 +1,6 @@
import isEqual from "lodash.isequal";
import { observer } from "mobx-react-lite";
-import { Channel, API, DEFAULT_PERMISSION_DIRECT_MESSAGE } from "revolt.js";
+import { Channel, API, DEFAULT_PERMISSION_DIRECT_MESSAGE, Permission } from "revolt.js";
import { Text } from "preact-i18n";
import { useState } from "preact/hooks";
@@ -100,7 +100,7 @@ export default observer(({ channel }: Props) => {
filter={[
...(channel.channel_type === "Group"
? []
- : ["ViewChannel" as const]),
+ : ["ViewChannel", "MentionEveryone"]),
"ReadMessageHistory",
"SendMessage",
"ManageMessages",
@@ -109,10 +109,9 @@ export default observer(({ channel }: Props) => {
"UploadFiles",
"Masquerade",
"React",
- "MentionEveryone",
"ManageChannel",
"ManagePermissions",
- ]}
+ ] as (keyof typeof Permission)[]}
target={channel}
/>