Skip to content

Commit

Permalink
Merge pull request #34780 from dukenv0307/fix/33735
Browse files Browse the repository at this point in the history
fix logic clear status and save status
  • Loading branch information
amyevans authored Jan 29, 2024
2 parents d7be964 + 3f0be39 commit c35e963
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/components/EmojiPicker/EmojiPickerButtonDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ function EmojiPickerButtonDropdown(props) {
style={styles.emojiPickerButtonDropdownIcon}
numberOfLines={1}
>
{props.value}
{props.value || (
<Icon
src={Expensicons.Emoji}
fill={StyleUtils.getIconFillColor(CONST.BUTTON_STATES.DISABLED)}
/>
)}
</Text>
<View style={[styles.popoverMenuIcon, styles.pointerEventsAuto, props.disabled && styles.cursorDisabled, styles.rotate90]}>
<Icon
Expand Down
10 changes: 6 additions & 4 deletions src/pages/settings/Profile/CustomStatus/StatusPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function StatusPage({draftStatus, currentUserPersonalDetails}) {
const draftText = lodashGet(draftStatus, 'text');
const draftClearAfter = lodashGet(draftStatus, 'clearAfter');

const defaultEmoji = draftEmojiCode || currentUserEmojiCode || initialEmoji;
const defaultEmoji = draftEmojiCode || currentUserEmojiCode;
const defaultText = draftText || currentUserStatusText;

const customClearAfter = useMemo(() => {
Expand All @@ -79,10 +79,9 @@ function StatusPage({draftStatus, currentUserPersonalDetails}) {
setBrickRoadIndicator(isValidClearAfterDate() ? null : CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR);
return;
}

User.updateCustomStatus({
text: statusText,
emojiCode,
emojiCode: !emojiCode && statusText ? initialEmoji : emojiCode,
clearAfter: clearAfterTime !== CONST.CUSTOM_STATUS_TYPES.NEVER ? clearAfterTime : '',
});

Expand All @@ -101,7 +100,10 @@ function StatusPage({draftStatus, currentUserPersonalDetails}) {
emojiCode: '',
clearAfter: DateUtils.getEndOfToday(),
});
formRef.current.resetForm({[INPUT_IDS.EMOJI_CODE]: initialEmoji});
formRef.current.resetForm({[INPUT_IDS.EMOJI_CODE]: ''});
InteractionManager.runAfterInteractions(() => {
navigateBackToPreviousScreen();
});
};

useEffect(() => setBrickRoadIndicator(isValidClearAfterDate() ? null : CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR), [isValidClearAfterDate]);
Expand Down

0 comments on commit c35e963

Please sign in to comment.