Handle system ephemeral post
This commit is contained in:
parent
941aa9d0d0
commit
86ae1fc9cc
4 changed files with 5 additions and 12 deletions
|
|
@ -8,7 +8,6 @@ import FastImage from 'react-native-fast-image';
|
|||
|
||||
import CompassIcon from '@components/compass_icon';
|
||||
import ProfilePicture from '@components/profile_picture';
|
||||
import SystemAvatar from '@components/system_avatar';
|
||||
import {View as ViewConstant} from '@constants';
|
||||
import {useServerUrl} from '@context/server';
|
||||
import {useTheme} from '@context/theme';
|
||||
|
|
@ -25,7 +24,6 @@ type AvatarProps = {
|
|||
author: UserModel;
|
||||
enablePostIconOverride?: boolean;
|
||||
isAutoReponse: boolean;
|
||||
isSystemPost: boolean;
|
||||
post: PostModel;
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +33,7 @@ const style = StyleSheet.create({
|
|||
},
|
||||
});
|
||||
|
||||
const Avatar = ({author, enablePostIconOverride, isAutoReponse, isSystemPost, post}: AvatarProps) => {
|
||||
const Avatar = ({author, enablePostIconOverride, isAutoReponse, post}: AvatarProps) => {
|
||||
const closeButton = useRef<ImageSource>();
|
||||
const intl = useIntl();
|
||||
const theme = useTheme();
|
||||
|
|
@ -47,10 +45,6 @@ const Avatar = ({author, enablePostIconOverride, isAutoReponse, isSystemPost, po
|
|||
// do nothing, client is not set
|
||||
}
|
||||
|
||||
if (isSystemPost && !isAutoReponse && !author.isBot) {
|
||||
return (<SystemAvatar theme={theme}/>);
|
||||
}
|
||||
|
||||
const fromWebHook = post.props?.from_webhook === 'true';
|
||||
const iconOverride = enablePostIconOverride && post.props?.use_user_icon !== 'true';
|
||||
if (fromWebHook && iconOverride) {
|
||||
|
|
@ -125,7 +119,7 @@ const Avatar = ({author, enablePostIconOverride, isAutoReponse, isSystemPost, po
|
|||
author={author}
|
||||
size={ViewConstant.PROFILE_PICTURE_SIZE}
|
||||
iconSize={24}
|
||||
showStatus={!isAutoReponse}
|
||||
showStatus={!isAutoReponse || author.isBot}
|
||||
testID='post_profile_picture.profile_picture'
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ const withPost = withObservables(
|
|||
let isLastReply = of$(true);
|
||||
let isPostAddChannelMember = of$(false);
|
||||
const isOwner = currentUser.id === post.userId;
|
||||
const author = post.author.observe();
|
||||
const author = post.userId ? post.author.observe() : of$(null);
|
||||
const canDelete = from$(hasPermissionForPost(post, currentUser, isOwner ? Permissions.DELETE_POST : Permissions.DELETE_OTHERS_POSTS, false));
|
||||
const isEphemeral = of$(isPostEphemeral(post));
|
||||
const isSaved = queryPreferencesByCategoryAndName(database, Preferences.CATEGORY_SAVED_POST, post.id).observe().pipe(
|
||||
|
|
|
|||
|
|
@ -199,12 +199,11 @@ const Post = ({
|
|||
} else {
|
||||
postAvatar = (
|
||||
<View style={[styles.profilePictureContainer, pendingPostStyle]}>
|
||||
{isAutoResponder ? (
|
||||
{(isAutoResponder || isSystemPost) ? (
|
||||
<SystemAvatar theme={theme}/>
|
||||
) : (
|
||||
<Avatar
|
||||
isAutoReponse={isAutoResponder}
|
||||
isSystemPost={isSystemPost}
|
||||
post={post}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ const ProfilePicture = ({
|
|||
size={size}
|
||||
source={source}
|
||||
/>
|
||||
{showStatus &&
|
||||
{showStatus && !isBot &&
|
||||
<Status
|
||||
author={author}
|
||||
statusSize={statusSize}
|
||||
|
|
|
|||
Loading…
Reference in a new issue