Skip to content

Commit 886ddaa

Browse files
Merge branch 'develop' into feat-a11y-select-discussion
2 parents f191af6 + 2d81c44 commit 886ddaa

File tree

88 files changed

+8840
-1435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+8840
-1435
lines changed
1 KB
Binary file not shown.

app/containers/ActionSheet/Item.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const Item = React.memo(({ item, hide }: IActionSheetItem) => {
2626
hide();
2727
item?.onPress();
2828
} else {
29-
EventEmitter.emit(LISTENER, { message: I18n.t('You_dont_have_permission_to_perform_this_action') });
29+
EventEmitter.emit(LISTENER, { message: item?.disabledReason || I18n.t('You_dont_have_permission_to_perform_this_action') });
3030
}
3131
};
3232

app/containers/ActionSheet/Provider.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type TActionSheetOptionsItem = {
1616
right?: () => React.ReactElement;
1717
enabled?: boolean;
1818
accessibilityRole?: AccessibilityRole;
19+
disabledReason?: string;
1920
};
2021

2122
export type TActionSheetOptions = {

app/containers/Chip/Chip.stories.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export default {
1515
title: 'Chip'
1616
};
1717

18-
const ChipWrapped = ({ avatar, text, onPress, testID, style }: IChip) => (
18+
const ChipWrapped = ({ avatar, text, onPress, testID, style, fullWidth }: IChip) => (
1919
<View style={styles.container}>
20-
<Chip avatar={avatar} text={text} onPress={onPress} testID={testID} style={style} />
20+
<Chip avatar={avatar} text={text} onPress={onPress} testID={testID} style={style} fullWidth={fullWidth} />
2121
</View>
2222
);
2323

@@ -30,3 +30,5 @@ export const ChipWithoutAvatar = () => <ChipWrapped text={'Without Avatar'} onPr
3030
export const ChipWithoutIcon = () => <ChipWrapped avatar='rocket.cat' text='Without Icon' />;
3131

3232
export const ChipWithoutAvatarAndIcon = () => <ChipWrapped text='Without Avatar and Icon' />;
33+
34+
export const ChipFullWidth = () => <ChipWrapped text='Full Width Text With Long Text That Should Be Wrapped' fullWidth />;

app/containers/Chip/__snapshots__/Chip.test.tsx.snap

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,108 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`Story Snapshots: ChipFullWidth should match snapshot 1`] = `
4+
<View
5+
style={
6+
{
7+
"alignItems": "flex-start",
8+
"flex": 1,
9+
"padding": 16,
10+
}
11+
}
12+
>
13+
<View
14+
accessibilityState={
15+
{
16+
"busy": undefined,
17+
"checked": undefined,
18+
"disabled": true,
19+
"expanded": undefined,
20+
"selected": undefined,
21+
}
22+
}
23+
accessibilityValue={
24+
{
25+
"max": undefined,
26+
"min": undefined,
27+
"now": undefined,
28+
"text": undefined,
29+
}
30+
}
31+
accessible={true}
32+
collapsable={false}
33+
focusable={true}
34+
onBlur={[Function]}
35+
onClick={[Function]}
36+
onFocus={[Function]}
37+
onResponderGrant={[Function]}
38+
onResponderMove={[Function]}
39+
onResponderRelease={[Function]}
40+
onResponderTerminate={[Function]}
41+
onResponderTerminationRequest={[Function]}
42+
onStartShouldSetResponder={[Function]}
43+
style={
44+
[
45+
{
46+
"borderRadius": 4,
47+
"justifyContent": "center",
48+
"marginRight": 8,
49+
"maxWidth": 192,
50+
"paddingHorizontal": 8,
51+
},
52+
{
53+
"backgroundColor": "#F2F3F5",
54+
"maxWidth": undefined,
55+
},
56+
undefined,
57+
]
58+
}
59+
>
60+
<View
61+
style={
62+
{
63+
"alignItems": "center",
64+
"flexDirection": "row",
65+
}
66+
}
67+
>
68+
<View
69+
style={
70+
[
71+
{
72+
"marginRight": 8,
73+
"maxWidth": 120,
74+
},
75+
{
76+
"maxWidth": undefined,
77+
},
78+
]
79+
}
80+
>
81+
<Text
82+
numberOfLines={1}
83+
style={
84+
[
85+
{
86+
"backgroundColor": "transparent",
87+
"fontFamily": "Inter",
88+
"fontSize": 16,
89+
"fontWeight": "500",
90+
"textAlign": "left",
91+
},
92+
{
93+
"color": "#2F343D",
94+
},
95+
]
96+
}
97+
>
98+
Full Width Text With Long Text That Should Be Wrapped
99+
</Text>
100+
</View>
101+
</View>
102+
</View>
103+
</View>
104+
`;
105+
3106
exports[`Story Snapshots: ChipText should match snapshot 1`] = `
4107
<View
5108
style={

app/containers/Chip/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ export interface IChip {
3838
onPress?: Function;
3939
testID?: string;
4040
style?: StyleProp<ViewStyle>;
41+
fullWidth?: boolean;
4142
}
4243

43-
const Chip = ({ avatar, text, onPress, testID, style }: IChip) => {
44+
const Chip = ({ avatar, text, onPress, testID, style, fullWidth }: IChip) => {
4445
const { colors } = useTheme();
4546

4647
return (
@@ -49,7 +50,8 @@ const Chip = ({ avatar, text, onPress, testID, style }: IChip) => {
4950
style={({ pressed }) => [
5051
styles.pressable,
5152
{
52-
backgroundColor: pressed ? colors.surfaceNeutral : colors.buttonBackgroundSecondaryDefault
53+
backgroundColor: pressed ? colors.surfaceNeutral : colors.buttonBackgroundSecondaryDefault,
54+
maxWidth: fullWidth ? undefined : styles.pressable.maxWidth
5355
},
5456
style
5557
]}
@@ -60,7 +62,7 @@ const Chip = ({ avatar, text, onPress, testID, style }: IChip) => {
6062
}}>
6163
<View style={styles.container}>
6264
{avatar ? <Avatar text={avatar} size={28} style={styles.avatar} /> : null}
63-
<View style={styles.textContainer}>
65+
<View style={[styles.textContainer, fullWidth && { maxWidth: undefined }]}>
6466
<Text style={[styles.name, { color: colors.fontDefault }]} numberOfLines={1}>
6567
{text}
6668
</Text>

app/containers/CustomIcon/mappedIcons.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const mappedIcons = {
106106
'google-monochromatic': 59657,
107107
'group-by-type': 59757,
108108
'hamburguer': 59758,
109+
'hash-shield': 59878,
109110
'history': 59759,
110111
'home': 59760,
111112
'ignore': 59740,
@@ -202,6 +203,7 @@ export const mappedIcons = {
202203
'sun': 59847,
203204
'support': 59848,
204205
'team': 59849,
206+
'team-shield': 59877,
205207
'teams': 59751,
206208
'teams-private': 59750,
207209
'text-format': 59839,

app/containers/CustomIcon/selection.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

app/containers/List/ListItem.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import { Icon } from '.';
1818
import { BASE_HEIGHT, ICON_SIZE, PADDING_HORIZONTAL } from './constants';
1919
import { CustomIcon } from '../CustomIcon';
2020
import { useResponsiveLayout } from '../../lib/hooks/useResponsiveLayout/useResponsiveLayout';
21+
import EventEmitter from '../../lib/methods/helpers/events';
22+
import { LISTENER } from '../Toast';
2123

2224
const styles = StyleSheet.create({
2325
container: {
@@ -90,6 +92,7 @@ interface IListItemContent {
9092
left?: () => JSX.Element | null;
9193
right?: () => JSX.Element | null;
9294
disabled?: boolean;
95+
disabledReason?: string;
9396
testID?: string;
9497
color?: string;
9598
translateTitle?: boolean;
@@ -154,7 +157,15 @@ const Content = React.memo(
154157
}
155158
}
156159
return label;
157-
}, [title, subtitle, translateTitle, translateSubtitle, additionalAccessibilityLabel, additionalAccessibilityLabelCheck]);
160+
}, [
161+
accessibilityLabel,
162+
title,
163+
subtitle,
164+
translateTitle,
165+
translateSubtitle,
166+
additionalAcessibilityLabel,
167+
additionalAcessibilityLabelCheck
168+
]);
158169

159170
return (
160171
<View
@@ -205,6 +216,7 @@ interface IListButtonPress extends IListItemButton {
205216
interface IListItemButton {
206217
title: string | (() => JSX.Element | null);
207218
disabled?: boolean;
219+
disabledReason?: string;
208220
backgroundColor?: string;
209221
underlayColor?: string;
210222
}
@@ -214,12 +226,20 @@ const Button = React.memo(({ onPress, backgroundColor, underlayColor, ...props }
214226

215227
const { colors } = useTheme();
216228

229+
const handlePress = () => {
230+
if (props.disabled && props.disabledReason) {
231+
EventEmitter.emit(LISTENER, { message: props.disabledReason });
232+
} else if (!props.disabled) {
233+
onPress(props.title);
234+
}
235+
};
236+
217237
return (
218238
<Touch
219-
onPress={() => onPress(props.title)}
239+
onPress={handlePress}
220240
style={{ backgroundColor: backgroundColor || colors.surfaceRoom }}
221241
underlayColor={underlayColor}
222-
enabled={!props.disabled}>
242+
enabled={!props.disabled || !!props.disabledReason}>
223243
<Content {...props} />
224244
</Touch>
225245
);

app/containers/MessageActions/index.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@ const MessageActions = React.memo(
442442
title: I18n.t('Reply_in_direct_message'),
443443
icon: 'arrow-back',
444444
onPress: () => handleReplyInDM(message),
445-
enabled: permissions.hasCreateDirectMessagePermission
445+
enabled: permissions.hasCreateDirectMessagePermission && !room.abacAttributes,
446+
disabledReason: room.abacAttributes && I18n.t('ABAC_disabled_action_reason')
446447
});
447448
}
448449

@@ -454,19 +455,24 @@ const MessageActions = React.memo(
454455
enabled: permissions.hasCreateDiscussionOtherUserPermission
455456
});
456457

458+
// Forward
457459
if (compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '6.2.0') && !videoConfBlock) {
458460
options.push({
459461
title: I18n.t('Forward'),
460462
icon: 'arrow-forward',
461-
onPress: () => handleShareMessage(message)
463+
onPress: () => handleShareMessage(message),
464+
enabled: !room.abacAttributes,
465+
disabledReason: room.abacAttributes && I18n.t('ABAC_disabled_action_reason')
462466
});
463467
}
464468

465-
// Permalink
469+
// Get link
466470
options.push({
467471
title: I18n.t('Get_link'),
468472
icon: 'link',
469-
onPress: () => handlePermalink(message)
473+
onPress: () => handlePermalink(message),
474+
enabled: !room.abacAttributes,
475+
disabledReason: room.abacAttributes && I18n.t('ABAC_disabled_action_reason')
470476
});
471477

472478
// Copy

0 commit comments

Comments
 (0)