mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-09 16:53:36 -05:00
chore: refactor permission checks
This commit is contained in:
parent
b217571325
commit
14a2f4882e
6 changed files with 11 additions and 14 deletions
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 039fabd2a9663456ad28a7c456fd55bc3fd153e5
|
Subproject commit 50a710d761330632716b3f6d17ed964465d79213
|
|
@ -147,7 +147,7 @@
|
||||||
"react-scroll": "^1.8.2",
|
"react-scroll": "^1.8.2",
|
||||||
"react-virtualized-auto-sizer": "^1.0.5",
|
"react-virtualized-auto-sizer": "^1.0.5",
|
||||||
"react-virtuoso": "^1.10.4",
|
"react-virtuoso": "^1.10.4",
|
||||||
"revolt.js": "6.0.0-rc.19",
|
"revolt.js": "6.0.0-rc.20",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"sass": "^1.35.1",
|
"sass": "^1.35.1",
|
||||||
"shade-blend-color": "^1.0.0",
|
"shade-blend-color": "^1.0.0",
|
||||||
|
|
|
@ -151,7 +151,7 @@ export default observer(({ channel }: Props) => {
|
||||||
|
|
||||||
const renderer = getRenderer(channel);
|
const renderer = getRenderer(channel);
|
||||||
|
|
||||||
if (!(channel.permission & Permission.SendMessage)) {
|
if (!channel.havePermission("SendMessage")) {
|
||||||
return (
|
return (
|
||||||
<Base>
|
<Base>
|
||||||
<Blocked>
|
<Blocked>
|
||||||
|
@ -479,7 +479,7 @@ export default observer(({ channel }: Props) => {
|
||||||
setReplies={setReplies}
|
setReplies={setReplies}
|
||||||
/>
|
/>
|
||||||
<Base>
|
<Base>
|
||||||
{channel.permission & Permission.UploadFiles ? (
|
{channel.havePermission("UploadFiles") ? (
|
||||||
<FileAction>
|
<FileAction>
|
||||||
<FileUploader
|
<FileUploader
|
||||||
size={24}
|
size={24}
|
||||||
|
|
|
@ -131,7 +131,7 @@ export const MessageOverlayBar = observer(({ message, queued }: Props) => {
|
||||||
)}
|
)}
|
||||||
{isAuthor ||
|
{isAuthor ||
|
||||||
(message.channel &&
|
(message.channel &&
|
||||||
message.channel.permission & Permission.ManageMessages) ? (
|
message.channel.havePermission("ManageMessages")) ? (
|
||||||
<Tooltip content="Delete">
|
<Tooltip content="Delete">
|
||||||
<Entry
|
<Entry
|
||||||
onClick={(e) =>
|
onClick={(e) =>
|
||||||
|
|
|
@ -70,10 +70,7 @@ export default function InviteBot() {
|
||||||
onChange={(e) => setServer(e.currentTarget.value)}>
|
onChange={(e) => setServer(e.currentTarget.value)}>
|
||||||
<option value="none">Select a server</option>
|
<option value="none">Select a server</option>
|
||||||
{[...client.servers.values()]
|
{[...client.servers.values()]
|
||||||
.filter(
|
.filter((x) => x.havePermission("ManageServer"))
|
||||||
(x) =>
|
|
||||||
x.permission & Permission.ManageServer,
|
|
||||||
)
|
|
||||||
.map((server) => (
|
.map((server) => (
|
||||||
<option value={server._id} key={server._id}>
|
<option value={server._id} key={server._id}>
|
||||||
{server.name}
|
{server.name}
|
||||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -3404,7 +3404,7 @@ __metadata:
|
||||||
react-scroll: ^1.8.2
|
react-scroll: ^1.8.2
|
||||||
react-virtualized-auto-sizer: ^1.0.5
|
react-virtualized-auto-sizer: ^1.0.5
|
||||||
react-virtuoso: ^1.10.4
|
react-virtuoso: ^1.10.4
|
||||||
revolt.js: 6.0.0-rc.19
|
revolt.js: 6.0.0-rc.20
|
||||||
rimraf: ^3.0.2
|
rimraf: ^3.0.2
|
||||||
sass: ^1.35.1
|
sass: ^1.35.1
|
||||||
shade-blend-color: ^1.0.0
|
shade-blend-color: ^1.0.0
|
||||||
|
@ -6710,9 +6710,9 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"revolt.js@npm:6.0.0-rc.19":
|
"revolt.js@npm:6.0.0-rc.20":
|
||||||
version: 6.0.0-rc.19
|
version: 6.0.0-rc.20
|
||||||
resolution: "revolt.js@npm:6.0.0-rc.19"
|
resolution: "revolt.js@npm:6.0.0-rc.20"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@insertish/exponential-backoff": 3.1.0-patch.2
|
"@insertish/exponential-backoff": 3.1.0-patch.2
|
||||||
"@insertish/isomorphic-ws": ^4.0.1
|
"@insertish/isomorphic-ws": ^4.0.1
|
||||||
|
@ -6726,7 +6726,7 @@ __metadata:
|
||||||
revolt-api: 0.5.3-rc.15
|
revolt-api: 0.5.3-rc.15
|
||||||
ulid: ^2.3.0
|
ulid: ^2.3.0
|
||||||
ws: ^8.2.2
|
ws: ^8.2.2
|
||||||
checksum: 8cbc4a40c10dce858cdd792be11681580e1fdb9ee48feeac9a826ae5e797496fe5c750a41ec3a4f5610c40197e7baea7b7ae109d8b0165938d845d0251bb7d66
|
checksum: a8d6e3eca6a6d7ea96911b40262763bfc9a0cf0dc8f36b63615f4c4c0a18430fa95e49f020f153299ac518019b5c2ef7c2de5940fe83332d8edb8957e7d9e3ed
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue