mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
fix(api): let channel managers edit a mature channel (#2583)
This commit is contained in:
1 parent
2019909a5e
commit
a2a68847fd
6 files changed
+44
-35
No files matched your search
+4
-14
@@ -17,7 +17,6 @@ import {
|
||||
UNPIN_GROUP_DM_DESCRIPTOR,
|
||||
} from '@app/features/channel/utils/ChannelMessageDescriptors';
|
||||
import {isGroupDmFull} from '@app/features/channel/utils/GroupDmUtils';
|
||||
import Guilds from '@app/features/guild/state/Guilds';
|
||||
import {
|
||||
ADD_TO_FAVORITES_DESCRIPTOR,
|
||||
COPY_CHANNEL_ID_DESCRIPTOR,
|
||||
@@ -32,7 +31,6 @@ import {
|
||||
REMOVE_FROM_FAVORITES_DESCRIPTOR,
|
||||
} from '@app/features/i18n/utils/CommonMessageDescriptors';
|
||||
import * as InviteUtils from '@app/features/invite/utils/InviteUtils';
|
||||
import {getEffectiveChannelMatureContent} from '@app/features/messaging/utils/ContentWarningUtils';
|
||||
import Permission from '@app/features/permissions/state/Permission';
|
||||
import ReadStates from '@app/features/read_state/state/ReadStates';
|
||||
import {AddFriendsToGroupModal} from '@app/features/relationship/components/modals/AddFriendsToGroupModal';
|
||||
@@ -56,7 +54,6 @@ import {modal} from '@app/features/ui/commands/ModalCommands';
|
||||
import type {MenuGroupType, MenuItemType} from '@app/features/ui/menu_bottom_sheet/MenuBottomSheet';
|
||||
import {MenuBottomSheet} from '@app/features/ui/menu_bottom_sheet/MenuBottomSheet';
|
||||
import type {User} from '@app/features/user/models/User';
|
||||
import Users from '@app/features/user/state/Users';
|
||||
import {Permissions} from '@fluxer/constants/src/ChannelConstants';
|
||||
import {useLingui} from '@lingui/react/macro';
|
||||
import type React from 'react';
|
||||
@@ -251,21 +248,14 @@ export const MoreOptionsSheet: React.FC<MoreOptionsSheetProps> = ({
|
||||
guildId: channel.guildId,
|
||||
});
|
||||
if (canManageChannels) {
|
||||
const guildForChannel = channel.guildId ? Guilds.getGuild(channel.guildId) : undefined;
|
||||
const currentUser = Users.getCurrentUser();
|
||||
const nsfwBlockedForMinor =
|
||||
getEffectiveChannelMatureContent(channel, guildForChannel ?? null) &&
|
||||
!!currentUser &&
|
||||
!currentUser.matureContentAllowed;
|
||||
const managerItems: Array<MenuItemType> = [];
|
||||
if (!nsfwBlockedForMinor) {
|
||||
managerItems.push({
|
||||
const managerItems: Array<MenuItemType> = [
|
||||
{
|
||||
id: 'edit-channel',
|
||||
icon: <EditIcon size={20} data-flx="channel.channel-details-bottom-sheet.edit-icon--2" />,
|
||||
label: i18n._(EDIT_CHANNEL_DESCRIPTOR),
|
||||
onClick: onEditChannel,
|
||||
});
|
||||
}
|
||||
},
|
||||
];
|
||||
managerItems.push({
|
||||
id: 'delete-channel',
|
||||
icon: <DeleteIcon size={20} data-flx="channel.channel-details-bottom-sheet.delete-icon" />,
|
||||
|
||||
Reference in new issue
Block a user