mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
feat(threads): thread and forum UI on web (#3252)
This commit is contained in:
1 parent
3f4160b138
commit
ba59a13149
258 files changed
+63052
-15599
No files matched your search
+15
-5
@@ -11,6 +11,7 @@ import {formatBotPermissionsQuery, getAllBotPermissions} from '@app/features/per
|
||||
import {http} from '@app/features/platform/transport/RestTransport';
|
||||
import {Logger} from '@app/features/platform/utils/AppLogger';
|
||||
import {remFromPx} from '@app/features/theme/layout/RemFromPx';
|
||||
import ThreadGuilds from '@app/features/threads/state/ThreadGuilds';
|
||||
import {Button} from '@app/features/ui/button/Button';
|
||||
import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
|
||||
import {modal} from '@app/features/ui/commands/ModalCommands';
|
||||
@@ -497,7 +498,11 @@ export const ApplicationDetail: React.FC<ApplicationDetailProps> = observer(
|
||||
.map(([scope]) => scope),
|
||||
[builderScopes],
|
||||
);
|
||||
const botPermissionsList = useMemo(() => getAllBotPermissions(i18n), [i18n.locale]);
|
||||
const threadsActive = ThreadGuilds.anyActive;
|
||||
const botPermissionsList = useMemo(
|
||||
() => getAllBotPermissions(i18n, {threads: threadsActive}),
|
||||
[i18n.locale, threadsActive],
|
||||
);
|
||||
const builderUrl = useMemo(() => {
|
||||
if (!application) return '';
|
||||
const authorizeUrl = new URL(Endpoints.OAUTH_AUTHORIZE, window.location.origin);
|
||||
@@ -507,9 +512,7 @@ export const ApplicationDetail: React.FC<ApplicationDetailProps> = observer(
|
||||
}
|
||||
const isBotOnly = builderScopeList.length === 1 && builderScopeList[0] === 'bot';
|
||||
const requireRedirectUri = builderScopeList.length > 0 && (!isBotOnly || botRequireCodeGrant);
|
||||
const botPerms = Object.entries(builderPermissions)
|
||||
.filter(([, enabled]) => enabled)
|
||||
.map(([perm]) => perm);
|
||||
const botPerms = botPermissionsList.filter((perm) => builderPermissions[perm.id]).map((perm) => perm.id);
|
||||
if (builderScopeList.includes('bot') && botPerms.length > 0) {
|
||||
authorizeUrl.searchParams.set('permissions', formatBotPermissionsQuery(botPerms));
|
||||
}
|
||||
@@ -525,7 +528,14 @@ export const ApplicationDetail: React.FC<ApplicationDetailProps> = observer(
|
||||
return '';
|
||||
}
|
||||
return authorizeUrl.toString();
|
||||
}, [application, builderScopeList, builderPermissions, builderRedirectUri, botRequireCodeGrant]);
|
||||
}, [
|
||||
application,
|
||||
builderScopeList,
|
||||
builderPermissions,
|
||||
botPermissionsList,
|
||||
builderRedirectUri,
|
||||
botRequireCodeGrant,
|
||||
]);
|
||||
const redirectOptions = useMemo(() => {
|
||||
const normalized = Array.from(new Set((redirectInputs ?? []).map((u) => u.trim()).filter(Boolean)));
|
||||
const current = builderRedirectUri?.trim();
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ const SYSTEM_WIDE_TRIGGER_DESCRIPTOR = msg({
|
||||
'Hint under a shortcut on Linux showing the key the desktop assigned. {trigger} is the key, as named by the desktop.',
|
||||
});
|
||||
const SYSTEM_WIDE_NOT_ASSIGNED_DESCRIPTOR = msg({
|
||||
message: 'System-wide: Not assigned',
|
||||
message: 'System-wide: not assigned',
|
||||
comment: 'Hint under a shortcut on Linux when the desktop has no key assigned for it system-wide.',
|
||||
});
|
||||
const EXTRA_MODIFIERS_DESCRIPTOR = msg({
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import ChannelInvitesTab from '@app/features/channel/components/modals/channel_tabs/ChannelInvitesTab';
|
||||
import ChannelOverviewTab from '@app/features/channel/components/modals/channel_tabs/ChannelOverviewTab';
|
||||
import ChannelPermissionsTab from '@app/features/channel/components/modals/channel_tabs/ChannelPermissionsTab';
|
||||
import ChannelWebhooksTab from '@app/features/channel/components/modals/channel_tabs/ChannelWebhooksTab';
|
||||
import {ChannelOverviewTabForType} from '@app/features/forum/components/settings/ForumOverviewTab';
|
||||
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
|
||||
import type {I18n, MessageDescriptor} from '@lingui/core';
|
||||
import {msg} from '@lingui/core/macro';
|
||||
@@ -62,7 +62,7 @@ const CHANNEL_SETTINGS_TABS_DESCRIPTORS: Array<ChannelSettingsTabDescriptor> = [
|
||||
category: 'channel_settings',
|
||||
label: OVERVIEW_DESCRIPTOR,
|
||||
icon: GearIcon,
|
||||
component: ChannelOverviewTab,
|
||||
component: ChannelOverviewTabForType,
|
||||
permission: Permissions.MANAGE_CHANNELS,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user