Skip to content

Commit 023d62c

Browse files
authored
Merge pull request #36395 from ZhenjaHorbach/clicking-on-avatar-of-invited-workspace-does-not-open-avatar-in-full-screen-view
Fix bug with Clicking on avatar of invited workspace does not open avatar in full screen view
2 parents 67dd595 + 2b6abfe commit 023d62c

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/components/AvatarWithImagePicker.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ const propTypes = {
100100
horizontal: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL)),
101101
vertical: PropTypes.oneOf(_.values(CONST.MODAL.ANCHOR_ORIGIN_VERTICAL)),
102102
}),
103+
104+
/** Allows to open an image without Attachment Picker. */
105+
enablePreview: PropTypes.bool,
103106
};
104107

105108
const defaultProps = {
@@ -127,6 +130,7 @@ const defaultProps = {
127130
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.LEFT,
128131
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
129132
},
133+
enablePreview: false,
130134
};
131135

132136
function AvatarWithImagePicker({
@@ -152,6 +156,7 @@ function AvatarWithImagePicker({
152156
avatarStyle,
153157
disabled,
154158
onViewPhotoPress,
159+
enablePreview,
155160
}) {
156161
const theme = useTheme();
157162
const styles = useThemeStyles();
@@ -330,10 +335,16 @@ function AvatarWithImagePicker({
330335
text={translate('avatarWithImagePicker.editImage')}
331336
>
332337
<PressableWithoutFeedback
333-
onPress={() => setIsMenuVisible((prev) => !prev)}
338+
onPress={() => {
339+
if (disabled && enablePreview && onViewPhotoPress) {
340+
onViewPhotoPress();
341+
return;
342+
}
343+
setIsMenuVisible((prev) => !prev);
344+
}}
334345
accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON}
335346
accessibilityLabel={translate('avatarWithImagePicker.editImage')}
336-
disabled={isAvatarCropModalOpen || disabled}
347+
disabled={isAvatarCropModalOpen || (disabled && !enablePreview)}
337348
disabledStyle={disabledStyle}
338349
ref={anchorRef}
339350
>

src/pages/workspace/WorkspaceAvatar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function WorkspaceAvatar({policy, isLoadingApp = true}: WorkspaceAvatarProps) {
3131
originalFileName={policy?.originalFileName ?? policy?.name ?? ''}
3232
shouldShowNotFoundPage={!Object.keys(policy ?? {}).length && !isLoadingApp}
3333
isLoading={!Object.keys(policy ?? {}).length && !!isLoadingApp}
34+
maybeIcon
3435
/>
3536
);
3637
}

src/pages/workspace/WorkspaceProfilePage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ function WorkspaceProfilePage({policy, currencyList, route}) {
7979
source={lodashGet(policy, 'avatar')}
8080
size={CONST.AVATAR_SIZE.XLARGE}
8181
avatarStyle={styles.avatarXLarge}
82+
enablePreview
8283
DefaultAvatar={() => (
8384
<Avatar
8485
containerStyles={styles.avatarXLarge}

0 commit comments

Comments
 (0)