Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified android/app/src/main/assets/fonts/custom.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion app/containers/ActionSheet/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Item = React.memo(({ item, hide }: IActionSheetItem) => {
hide();
item?.onPress();
} else {
EventEmitter.emit(LISTENER, { message: I18n.t('You_dont_have_permission_to_perform_this_action') });
EventEmitter.emit(LISTENER, { message: item?.disabledReason || I18n.t('You_dont_have_permission_to_perform_this_action') });
}
};

Expand Down
1 change: 1 addition & 0 deletions app/containers/ActionSheet/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export type TActionSheetOptionsItem = {
onPress: () => void;
right?: () => React.ReactElement;
enabled?: boolean;
disabledReason?: string;
};

export type TActionSheetOptions = {
Expand Down
2 changes: 2 additions & 0 deletions app/containers/CustomIcon/mappedIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const mappedIcons = {
'google-monochromatic': 59657,
'group-by-type': 59757,
'hamburguer': 59758,
'hash-shield': 59878,
'history': 59759,
'home': 59760,
'ignore': 59740,
Expand Down Expand Up @@ -202,6 +203,7 @@ export const mappedIcons = {
'sun': 59847,
'support': 59848,
'team': 59849,
'team-shield': 59877,
'teams': 59751,
'teams-private': 59750,
'text-format': 59839,
Expand Down
2 changes: 1 addition & 1 deletion app/containers/CustomIcon/selection.json

Large diffs are not rendered by default.

26 changes: 23 additions & 3 deletions app/containers/List/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { Icon } from '.';
import { BASE_HEIGHT, ICON_SIZE, PADDING_HORIZONTAL } from './constants';
import { CustomIcon } from '../CustomIcon';
import { useResponsiveLayout } from '../../lib/hooks/useResponsiveLayout/useResponsiveLayout';
import EventEmitter from '../../lib/methods/helpers/events';
import { LISTENER } from '../Toast';

const styles = StyleSheet.create({
container: {
Expand Down Expand Up @@ -90,6 +92,7 @@ interface IListItemContent {
left?: () => JSX.Element | null;
right?: () => JSX.Element | null;
disabled?: boolean;
disabledReason?: string;
testID?: string;
color?: string;
translateTitle?: boolean;
Expand Down Expand Up @@ -154,7 +157,15 @@ const Content = React.memo(
}
}
return label;
}, [title, subtitle, translateTitle, translateSubtitle, additionalAcessibilityLabel, additionalAcessibilityLabelCheck]);
}, [
accessibilityLabel,
title,
subtitle,
translateTitle,
translateSubtitle,
additionalAcessibilityLabel,
additionalAcessibilityLabelCheck
]);

return (
<View
Expand Down Expand Up @@ -205,6 +216,7 @@ interface IListButtonPress extends IListItemButton {
interface IListItemButton {
title: string | (() => JSX.Element | null);
disabled?: boolean;
disabledReason?: string;
backgroundColor?: string;
underlayColor?: string;
}
Expand All @@ -214,12 +226,20 @@ const Button = React.memo(({ onPress, backgroundColor, underlayColor, ...props }

const { colors } = useTheme();

const handlePress = () => {
if (props.disabled && props.disabledReason) {
EventEmitter.emit(LISTENER, { message: props.disabledReason });
} else if (!props.disabled) {
onPress(props.title);
}
};

return (
<Touch
onPress={() => onPress(props.title)}
onPress={handlePress}
style={{ backgroundColor: backgroundColor || colors.surfaceRoom }}
underlayColor={underlayColor}
enabled={!props.disabled}>
enabled={!props.disabled || !!props.disabledReason}>
<Content {...props} />
</Touch>
);
Expand Down
14 changes: 10 additions & 4 deletions app/containers/MessageActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
});
};

const getOptions = (message: TAnyMessageModel) => {

Check warning on line 396 in app/containers/MessageActions/index.tsx

View workflow job for this annotation

GitHub Actions / format

Arrow function has a complexity of 36. Maximum allowed is 31

Check warning on line 396 in app/containers/MessageActions/index.tsx

View workflow job for this annotation

GitHub Actions / ESLint and Test / run-eslint-and-test

Arrow function has a complexity of 36. Maximum allowed is 31
const options: TActionSheetOptionsItem[] = [];
const videoConfBlock = message.t === 'videoconf';

Expand Down Expand Up @@ -442,7 +442,8 @@
title: I18n.t('Reply_in_direct_message'),
icon: 'arrow-back',
onPress: () => handleReplyInDM(message),
enabled: permissions.hasCreateDirectMessagePermission
enabled: permissions.hasCreateDirectMessagePermission && !room.abacAttributes,
disabledReason: room.abacAttributes && I18n.t('ABAC_disabled_action_reason')
});
}

Expand All @@ -454,19 +455,24 @@
enabled: permissions.hasCreateDiscussionOtherUserPermission
});

// Forward
if (compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '6.2.0') && !videoConfBlock) {
options.push({
title: I18n.t('Forward'),
icon: 'arrow-forward',
onPress: () => handleShareMessage(message)
onPress: () => handleShareMessage(message),
enabled: !room.abacAttributes,
disabledReason: room.abacAttributes && I18n.t('ABAC_disabled_action_reason')
});
}

// Permalink
// Get link
options.push({
title: I18n.t('Get_link'),
icon: 'link',
onPress: () => handlePermalink(message)
onPress: () => handlePermalink(message),
enabled: !room.abacAttributes,
disabledReason: room.abacAttributes && I18n.t('ABAC_disabled_action_reason')
});

// Copy
Expand Down
15 changes: 15 additions & 0 deletions app/containers/RoomHeader/RoomHeader.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ export const Icons = () => (
<HeaderExample title={() => <RoomHeader title='busy dm' type='d' status='busy' />} />
<HeaderExample title={() => <RoomHeader title='loading dm' type='d' status='loading' />} />
<HeaderExample title={() => <RoomHeader title='offline dm' type='d' />} />
<HeaderExample
title={() => (
<RoomHeader title='classified' type='p' abacAttributes={[{ key: 'Attribute', values: ['Value 1', 'Value 2'] }]} />
)}
/>
<HeaderExample
title={() => (
<RoomHeader
title='classified'
type='p'
abacAttributes={[{ key: 'Attribute', values: ['Value 1', 'Value 2'] }]}
teamMain
/>
)}
/>
</>
);

Expand Down
8 changes: 6 additions & 2 deletions app/containers/RoomHeader/RoomHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import I18n from '../../i18n';
import sharedStyles from '../../views/Styles';
import { MarkdownPreview } from '../markdown';
import RoomTypeIcon from '../RoomTypeIcon';
import { type TUserStatus, type IOmnichannelSource } from '../../definitions';
import { type TUserStatus, type IOmnichannelSource, type ISubscription } from '../../definitions';
import { useTheme } from '../../theme';
import { useAppSelector } from '../../lib/hooks/useAppSelector';
import useStatusAccessibilityLabel from '../../lib/hooks/useStatusAccessibilityLabel';
Expand Down Expand Up @@ -80,6 +80,7 @@ interface IRoomHeader {
sourceType?: IOmnichannelSource;
disabled?: boolean;
rightButtonsWidth?: number;
abacAttributes?: ISubscription['abacAttributes'];
}

const SubTitle = React.memo(({ usersTyping, subtitle, renderFunc, scale }: TRoomHeaderSubTitle) => {
Expand Down Expand Up @@ -148,7 +149,8 @@ const Header = React.memo(
testID,
usersTyping = [],
sourceType,
disabled
disabled,
abacAttributes
}: IRoomHeader) => {
const statusAccessibilityLabel = useStatusAccessibilityLabel({
isGroupChat,
Expand Down Expand Up @@ -182,6 +184,7 @@ const Header = React.memo(
isGroupChat={isGroupChat}
status={status}
teamMain={teamMain}
abacAttributes={abacAttributes}
/>
<Text style={[styles.subtitle, { color: colors.fontSecondaryInfo }]} numberOfLines={1}>
{parentTitle}
Expand All @@ -208,6 +211,7 @@ const Header = React.memo(
status={status}
teamMain={teamMain}
sourceType={sourceType}
abacAttributes={abacAttributes}
/>
)}
<HeaderTitle title={title} tmid={tmid} prid={prid} scale={scale} testID={testID} />
Expand Down
Loading
Loading