From 9ebc0ab404004c909c4e1f5eac69cb7a699574a2 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 13 Jun 2022 15:03:35 -0400 Subject: [PATCH] Ensure emoji name is set for CustomStatusEmoji --- .../custom_status/custom_status.tsx | 2 +- .../custom_status/custom_status_emoji.tsx | 26 +++++++++++-------- app/components/user_item/user_item.tsx | 4 +-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/components/channel_item/custom_status/custom_status.tsx b/app/components/channel_item/custom_status/custom_status.tsx index 671c92234..6170a9212 100644 --- a/app/components/channel_item/custom_status/custom_status.tsx +++ b/app/components/channel_item/custom_status/custom_status.tsx @@ -25,7 +25,7 @@ const style = StyleSheet.create({ }); const CustomStatus = ({customStatus, customStatusExpired, isCustomStatusEnabled, isInfo}: Props) => { - const showCustomStatusEmoji = Boolean(isCustomStatusEnabled && customStatus && !customStatusExpired); + const showCustomStatusEmoji = Boolean(isCustomStatusEnabled && customStatus?.emoji && !customStatusExpired); if (!showCustomStatusEmoji) { return null; diff --git a/app/components/custom_status/custom_status_emoji.tsx b/app/components/custom_status/custom_status_emoji.tsx index 5fffcdfe6..8476b219c 100644 --- a/app/components/custom_status/custom_status_emoji.tsx +++ b/app/components/custom_status/custom_status_emoji.tsx @@ -15,17 +15,21 @@ interface ComponentProps { const CustomStatusEmoji = ({customStatus, emojiSize = 16, style, testID}: ComponentProps) => { const testIdPrefix = testID ? `${testID}.` : ''; - return ( - - - - ); + if (customStatus.emoji) { + return ( + + + + ); + } + + return null; }; export default CustomStatusEmoji; diff --git a/app/components/user_item/user_item.tsx b/app/components/user_item/user_item.tsx index 621d7a264..1c95f8f41 100644 --- a/app/components/user_item/user_item.tsx +++ b/app/components/user_item/user_item.tsx @@ -149,9 +149,9 @@ const UserItem = ({ } - {isCustomStatusEnabled && !bot && customStatus && ( + {Boolean(isCustomStatusEnabled && !bot && customStatus?.emoji) && ( )}