forked from Ivasoft/mattermost-mobile
Do not show expired custom status in userItem (#6439)
This commit is contained in:
@@ -14,7 +14,7 @@ import {General} from '@constants';
|
||||
import {useTheme} from '@context/theme';
|
||||
import {makeStyleSheetFromTheme, changeOpacity} from '@utils/theme';
|
||||
import {typography} from '@utils/typography';
|
||||
import {getUserCustomStatus, isBot, isGuest, isShared} from '@utils/user';
|
||||
import {getUserCustomStatus, isBot, isCustomStatusExpired, isGuest, isShared} from '@utils/user';
|
||||
|
||||
import type UserModel from '@typings/database/models/servers/user';
|
||||
|
||||
@@ -107,6 +107,7 @@ const UserItem = ({
|
||||
const isCurrentUser = currentUserId === user?.id;
|
||||
const name = getName(user, showFullName, isCurrentUser, intl);
|
||||
const customStatus = getUserCustomStatus(user);
|
||||
const customStatusExpired = isCustomStatusExpired(user);
|
||||
|
||||
const userItemTestId = `${testID}.${user?.id}`;
|
||||
|
||||
@@ -154,7 +155,7 @@ const UserItem = ({
|
||||
</Text>
|
||||
}
|
||||
</View>
|
||||
{Boolean(isCustomStatusEnabled && !bot && customStatus?.emoji) && (
|
||||
{Boolean(isCustomStatusEnabled && !bot && customStatus?.emoji && !customStatusExpired) && (
|
||||
<CustomStatusEmoji
|
||||
customStatus={customStatus!}
|
||||
style={style.icon}
|
||||
|
||||
@@ -116,11 +116,11 @@ export const getUserTimezoneProps = (currentUser: UserModel) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const getUserTimezone = (user: UserModel) => {
|
||||
export const getUserTimezone = (user: UserModel | UserProfile) => {
|
||||
return getTimezone(user.timezone);
|
||||
};
|
||||
|
||||
export const getTimezone = (timezone: UserTimezone | null) => {
|
||||
export const getTimezone = (timezone?: UserTimezone | null) => {
|
||||
if (!timezone) {
|
||||
return '';
|
||||
}
|
||||
@@ -161,7 +161,7 @@ export const getUserCustomStatus = (user?: UserModel | UserProfile): UserCustomS
|
||||
}
|
||||
};
|
||||
|
||||
export function isCustomStatusExpired(user?: UserModel) {
|
||||
export function isCustomStatusExpired(user?: UserModel | UserProfile) {
|
||||
if (!user) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user