mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-09 02:05:28 +00:00
everyoneeee
This commit is contained in:
2
external/revolt.js
vendored
2
external/revolt.js
vendored
Submodule external/revolt.js updated: e650b73359...62d4a668b2
@@ -257,10 +257,14 @@ export default observer(({ channel }: Props) => {
|
|||||||
</Base>
|
</Base>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
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") {
|
|
||||||
|
|
||||||
|
if (
|
||||||
|
channel.channel_type != "SavedMessages" &&
|
||||||
|
((!channel.havePermission("SendMessage") &&
|
||||||
|
channel.channel_type == "TextChannel") ||
|
||||||
|
channel.recipient?.relationship == "Blocked" ||
|
||||||
|
channel.recipient?.relationship == "BlockedOther")
|
||||||
|
) {
|
||||||
return (
|
return (
|
||||||
<Base>
|
<Base>
|
||||||
<Blocked>
|
<Blocked>
|
||||||
@@ -331,17 +335,7 @@ export default observer(({ channel }: Props) => {
|
|||||||
|
|
||||||
// Check for @everyone mentions first
|
// Check for @everyone mentions first
|
||||||
if (content.includes("@everyone")) {
|
if (content.includes("@everyone")) {
|
||||||
// Check if user has permission to mention everyone
|
// kept for potential future logic, but currently does nothing
|
||||||
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 <>)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert @username mentions to <@USER_ID> format
|
// Convert @username mentions to <@USER_ID> format
|
||||||
@@ -350,17 +344,19 @@ export default observer(({ channel }: Props) => {
|
|||||||
|
|
||||||
if (mentionMatches) {
|
if (mentionMatches) {
|
||||||
for (const mention of mentionMatches) {
|
for (const mention of mentionMatches) {
|
||||||
const username = mention.substring(1); // Remove the @ symbol
|
const username = mention.substring(1);
|
||||||
// Make sure it's not 'everyone' (already handled)
|
|
||||||
if (username.toLowerCase() !== "everyone") {
|
if (username.toLowerCase() !== "everyone") {
|
||||||
// Find the user with this username
|
|
||||||
const user = Array.from(client.users.values()).find(
|
const user = Array.from(client.users.values()).find(
|
||||||
(u) => u.username.toLowerCase() === username.toLowerCase()
|
(u) =>
|
||||||
|
u.username.toLowerCase() ===
|
||||||
|
username.toLowerCase(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
// Replace @username with <@USER_ID>
|
content = content.replace(
|
||||||
content = content.replace(mention, `<@${user._id}>`);
|
mention,
|
||||||
|
`<@${user._id}>`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,14 +164,6 @@ export default class State {
|
|||||||
|
|
||||||
// Register events for notifications.
|
// Register events for notifications.
|
||||||
client.addListener("message", this.notifications.onMessage);
|
client.addListener("message", this.notifications.onMessage);
|
||||||
client.addListener(
|
|
||||||
"message/mention",
|
|
||||||
this.notifications.onMessage,
|
|
||||||
);
|
|
||||||
client.addListener(
|
|
||||||
"message/mention/everyone",
|
|
||||||
this.notifications.onMessage,
|
|
||||||
);
|
|
||||||
client.addListener(
|
client.addListener(
|
||||||
"user/relationship",
|
"user/relationship",
|
||||||
this.notifications.onRelationship,
|
this.notifications.onRelationship,
|
||||||
@@ -276,14 +268,6 @@ export default class State {
|
|||||||
client.removeListener("message", this.queue.onMessage);
|
client.removeListener("message", this.queue.onMessage);
|
||||||
client.removeListener("packet", this.onPacket);
|
client.removeListener("packet", this.onPacket);
|
||||||
client.removeListener("message", this.notifications.onMessage);
|
client.removeListener("message", this.notifications.onMessage);
|
||||||
client.removeListener(
|
|
||||||
"message/mention",
|
|
||||||
this.notifications.onMessage,
|
|
||||||
);
|
|
||||||
client.removeListener(
|
|
||||||
"message/mention/everyone",
|
|
||||||
this.notifications.onMessage,
|
|
||||||
);
|
|
||||||
client.removeListener(
|
client.removeListener(
|
||||||
"user/relationship",
|
"user/relationship",
|
||||||
this.notifications.onRelationship,
|
this.notifications.onRelationship,
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export default class NotificationOptions
|
|||||||
|
|
||||||
// Check channel notification settings
|
// Check channel notification settings
|
||||||
const mentioned = message.mention_ids?.includes(user._id) ||
|
const mentioned = message.mention_ids?.includes(user._id) ||
|
||||||
(message as any).mentionsEveryone;
|
message.mentionsEveryone;
|
||||||
switch (this.computeForChannel(message.channel!)) {
|
switch (this.computeForChannel(message.channel!)) {
|
||||||
case "muted":
|
case "muted":
|
||||||
case "none":
|
case "none":
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import isEqual from "lodash.isequal";
|
import isEqual from "lodash.isequal";
|
||||||
import { observer } from "mobx-react-lite";
|
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 { Text } from "preact-i18n";
|
||||||
import { useState } from "preact/hooks";
|
import { useState } from "preact/hooks";
|
||||||
@@ -100,7 +100,7 @@ export default observer(({ channel }: Props) => {
|
|||||||
filter={[
|
filter={[
|
||||||
...(channel.channel_type === "Group"
|
...(channel.channel_type === "Group"
|
||||||
? []
|
? []
|
||||||
: ["ViewChannel" as const]),
|
: ["ViewChannel", "MentionEveryone"]),
|
||||||
"ReadMessageHistory",
|
"ReadMessageHistory",
|
||||||
"SendMessage",
|
"SendMessage",
|
||||||
"ManageMessages",
|
"ManageMessages",
|
||||||
@@ -109,10 +109,9 @@ export default observer(({ channel }: Props) => {
|
|||||||
"UploadFiles",
|
"UploadFiles",
|
||||||
"Masquerade",
|
"Masquerade",
|
||||||
"React",
|
"React",
|
||||||
"MentionEveryone",
|
|
||||||
"ManageChannel",
|
"ManageChannel",
|
||||||
"ManagePermissions",
|
"ManagePermissions",
|
||||||
]}
|
] as (keyof typeof Permission)[]}
|
||||||
target={channel}
|
target={channel}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user