mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 22:50:59 -05:00
feat: add change group ownership / text system msg
This commit is contained in:
parent
1a0b4b5703
commit
73fd35bf46
5 changed files with 66 additions and 17 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 58408da6c4090dd3a7808a663eaa95b8b1da7603
|
||||
Subproject commit 58a9fb697de00f570d445be4d12e3ce4a5e3522e
|
|
@ -141,7 +141,7 @@
|
|||
"remark-math": "^5.1.1",
|
||||
"remark-parse": "^10.0.1",
|
||||
"remark-rehype": "^10.1.0",
|
||||
"revolt.js": "6.0.7",
|
||||
"revolt.js": "6.0.9",
|
||||
"rimraf": "^3.0.2",
|
||||
"sass": "^1.35.1",
|
||||
"semver": "^7.3.7",
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
EditAlt,
|
||||
Edit,
|
||||
MessageSquareEdit,
|
||||
Key,
|
||||
} from "@styled-icons/boxicons-solid";
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { Message, API } from "revolt.js";
|
||||
|
@ -18,6 +19,7 @@ import { useTriggerEvents } from "preact-context-menu";
|
|||
|
||||
import { TextReact } from "../../../lib/i18n";
|
||||
|
||||
import Markdown from "../../markdown/Markdown";
|
||||
import UserShort from "../user/UserShort";
|
||||
import MessageBase, { MessageDetail, MessageInfo } from "./MessageBase";
|
||||
|
||||
|
@ -67,12 +69,15 @@ const iconDictionary = {
|
|||
channel_renamed: EditAlt,
|
||||
channel_description_changed: Edit,
|
||||
channel_icon_changed: MessageSquareEdit,
|
||||
channel_ownership_changed: Key,
|
||||
text: InfoCircle,
|
||||
};
|
||||
|
||||
export const SystemMessage = observer(
|
||||
({ attachContext, message, highlight, hideInfo }: Props) => {
|
||||
const data = message.asSystemMessage;
|
||||
if (!data) return null;
|
||||
|
||||
const SystemMessageIcon =
|
||||
iconDictionary[data.type as API.SystemMessage["type"]] ??
|
||||
InfoCircle;
|
||||
|
@ -130,6 +135,22 @@ export const SystemMessage = observer(
|
|||
/>
|
||||
);
|
||||
break;
|
||||
case "channel_ownership_changed":
|
||||
children = (
|
||||
<TextReact
|
||||
id={`app.main.channel.system.channel_ownership_changed`}
|
||||
fields={{
|
||||
from: <UserShort user={data.from} />,
|
||||
to: <UserShort user={data.to} />,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "text":
|
||||
if (message.system?.type === "text") {
|
||||
children = <Markdown content={message.system?.content} />;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -69,6 +69,7 @@ type Action =
|
|||
| { action: "copy_file_link"; attachment: API.File }
|
||||
| { action: "open_link"; link: string }
|
||||
| { action: "copy_link"; link: string }
|
||||
| { action: "make_owner"; channel: Channel; user: User }
|
||||
| { action: "remove_member"; channel: Channel; user: User }
|
||||
| { action: "kick_member"; target: Member }
|
||||
| { action: "ban_member"; target: Member }
|
||||
|
@ -307,6 +308,15 @@ export default function ContextMenus() {
|
|||
}
|
||||
break;
|
||||
|
||||
case "make_owner":
|
||||
{
|
||||
// FIXME: add a modal for this
|
||||
data.channel.edit({
|
||||
owner: data.user._id,
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
||||
case "remove_member":
|
||||
{
|
||||
data.channel.removeMember(data.user._id);
|
||||
|
@ -667,11 +677,29 @@ export default function ContextMenus() {
|
|||
contextualChannel.owner_id === userId &&
|
||||
userId !== uid
|
||||
) {
|
||||
generateAction({
|
||||
action: "remove_member",
|
||||
channel: contextualChannel,
|
||||
user: user!,
|
||||
});
|
||||
generateAction(
|
||||
{
|
||||
action: "make_owner",
|
||||
channel: contextualChannel,
|
||||
user: user!,
|
||||
},
|
||||
undefined,
|
||||
false,
|
||||
undefined,
|
||||
"var(--error)",
|
||||
);
|
||||
|
||||
generateAction(
|
||||
{
|
||||
action: "remove_member",
|
||||
channel: contextualChannel,
|
||||
user: user!,
|
||||
},
|
||||
undefined,
|
||||
false,
|
||||
undefined,
|
||||
"var(--error)",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
20
yarn.lock
20
yarn.lock
|
@ -3696,7 +3696,7 @@ __metadata:
|
|||
remark-math: ^5.1.1
|
||||
remark-parse: ^10.0.1
|
||||
remark-rehype: ^10.1.0
|
||||
revolt.js: 6.0.7
|
||||
revolt.js: 6.0.9
|
||||
rimraf: ^3.0.2
|
||||
sass: ^1.35.1
|
||||
semver: ^7.3.7
|
||||
|
@ -7879,20 +7879,20 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"revolt-api@npm:0.5.4":
|
||||
version: 0.5.4
|
||||
resolution: "revolt-api@npm:0.5.4"
|
||||
"revolt-api@npm:0.5.5":
|
||||
version: 0.5.5
|
||||
resolution: "revolt-api@npm:0.5.5"
|
||||
dependencies:
|
||||
"@insertish/oapi": 0.1.16
|
||||
axios: ^0.26.1
|
||||
lodash.defaultsdeep: ^4.6.1
|
||||
checksum: bd40acabac1b6c5848b1d6e555297de5aa3e0950a4de67523c4cf986a8037380e3addc5e16babebc8dfa6570cd1d1957efe9a3aaa6a206b9286e5b7f5941d699
|
||||
checksum: 38fa78e3f731a8753916da58347ac930ff911f7a45d67f9d3e55bdaf56be5eb11c8568803209a76d9a40e6d5faa4a5adfc80aa6377528df499080f5e3b75cd2d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"revolt.js@npm:6.0.7":
|
||||
version: 6.0.7
|
||||
resolution: "revolt.js@npm:6.0.7"
|
||||
"revolt.js@npm:6.0.9":
|
||||
version: 6.0.9
|
||||
resolution: "revolt.js@npm:6.0.9"
|
||||
dependencies:
|
||||
"@insertish/exponential-backoff": 3.1.0-patch.2
|
||||
"@insertish/isomorphic-ws": ^4.0.1
|
||||
|
@ -7903,10 +7903,10 @@ __metadata:
|
|||
lodash.isequal: ^4.5.0
|
||||
long: ^5.2.0
|
||||
mobx: ^6.3.2
|
||||
revolt-api: 0.5.4
|
||||
revolt-api: 0.5.5
|
||||
ulid: ^2.3.0
|
||||
ws: ^8.2.2
|
||||
checksum: 3c907fc38b2168c7a53703bbabb0849326bf29d8a30eea38d5d8ce9c338de93e9543734a778b6c5f4b87e1616d8c4f0f22fd2c33fa2183911a08a273af741283
|
||||
checksum: a3ea924a6793f6a4aa5f62e660b249bd76bbe2f0048d9b374a449f064ee6d65df1b8e4e3af1d15267707ea6d35b6a3101349b0bf41fa323cb5c298ab98de8d45
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
Loading…
Reference in a new issue