Renaming flagged to saved (#6021)
* Renaming flagged to saved * post isSaved property
This commit is contained in:
parent
162bc6cc3f
commit
e93c570562
6 changed files with 26 additions and 25 deletions
|
|
@ -17,7 +17,7 @@ export interface ClientPostsMix {
|
|||
getPostsBefore: (channelId: string, postId: string, page?: number, perPage?: number) => Promise<PostResponse>;
|
||||
getPostsAfter: (channelId: string, postId: string, page?: number, perPage?: number) => Promise<PostResponse>;
|
||||
getFileInfosForPost: (postId: string) => Promise<FileInfo[]>;
|
||||
getFlaggedPosts: (userId: string, channelId?: string, teamId?: string, page?: number, perPage?: number) => Promise<any>;
|
||||
getSavedPosts: (userId: string, channelId?: string, teamId?: string, page?: number, perPage?: number) => Promise<any>;
|
||||
getPinnedPosts: (channelId: string) => Promise<any>;
|
||||
markPostAsUnread: (userId: string, postId: string) => Promise<any>;
|
||||
pinPost: (postId: string) => Promise<any>;
|
||||
|
|
@ -125,7 +125,7 @@ const ClientPosts = (superclass: any) => class extends superclass {
|
|||
);
|
||||
};
|
||||
|
||||
getFlaggedPosts = async (userId: string, channelId = '', teamId = '', page = 0, perPage = PER_PAGE_DEFAULT) => {
|
||||
getSavedPosts = async (userId: string, channelId = '', teamId = '', page = 0, perPage = PER_PAGE_DEFAULT) => {
|
||||
this.analytics.trackAPI('api_posts_get_flagged', {team_id: teamId});
|
||||
|
||||
return this.doFetch(
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ const withPost = withObservables(
|
|||
const author = post.author.observe();
|
||||
const canDelete = from$(hasPermissionForPost(post, currentUser, isOwner ? Permissions.DELETE_POST : Permissions.DELETE_OTHERS_POSTS, false));
|
||||
const isEphemeral = of$(isPostEphemeral(post));
|
||||
const isFlagged = database.get<PreferenceModel>(PREFERENCE).query(
|
||||
const isSaved = database.get<PreferenceModel>(PREFERENCE).query(
|
||||
Q.where('category', Preferences.CATEGORY_SAVED_POST),
|
||||
Q.where('name', post.id),
|
||||
).observe().pipe(switchMap((pref) => of$(Boolean(pref.length))));
|
||||
|
|
@ -149,7 +149,7 @@ const withPost = withObservables(
|
|||
isConsecutivePost,
|
||||
isEphemeral,
|
||||
isFirstReply: of$(isFirstReply(post, previousPost)),
|
||||
isFlagged,
|
||||
isSaved,
|
||||
isJumboEmoji,
|
||||
isLastReply,
|
||||
isPostAddChannelMember,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ type PostProps = {
|
|||
isConsecutivePost?: boolean;
|
||||
isEphemeral: boolean;
|
||||
isFirstReply?: boolean;
|
||||
isFlagged?: boolean;
|
||||
isSaved?: boolean;
|
||||
isJumboEmoji: boolean;
|
||||
isLastReply?: boolean;
|
||||
isPostAddChannelMember: boolean;
|
||||
|
|
@ -52,7 +52,7 @@ type PostProps = {
|
|||
reactionsCount: number;
|
||||
shouldRenderReplyButton?: boolean;
|
||||
showAddReaction?: boolean;
|
||||
skipFlaggedHeader?: boolean;
|
||||
skipSavedHeader?: boolean;
|
||||
skipPinnedHeader?: boolean;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
testID?: string;
|
||||
|
|
@ -97,8 +97,8 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
|
|||
|
||||
const Post = ({
|
||||
appsEnabled, canDelete, currentUser, differentThreadSequence, files, hasReplies, highlight, highlightPinnedOrSaved = true, highlightReplyBar,
|
||||
isConsecutivePost, isEphemeral, isFirstReply, isFlagged, isJumboEmoji, isLastReply, isPostAddChannelMember,
|
||||
location, post, reactionsCount, shouldRenderReplyButton, skipFlaggedHeader, skipPinnedHeader, showAddReaction = true, style,
|
||||
isConsecutivePost, isEphemeral, isFirstReply, isSaved, isJumboEmoji, isLastReply, isPostAddChannelMember,
|
||||
location, post, reactionsCount, shouldRenderReplyButton, skipSavedHeader, skipPinnedHeader, showAddReaction = true, style,
|
||||
testID, previousPost,
|
||||
}: PostProps) => {
|
||||
const pressDetected = useRef(false);
|
||||
|
|
@ -176,7 +176,7 @@ const Post = ({
|
|||
}
|
||||
};
|
||||
|
||||
const highlightFlagged = isFlagged && !skipFlaggedHeader;
|
||||
const highlightSaved = isSaved && !skipSavedHeader;
|
||||
const hightlightPinned = post.isPinned && !skipPinnedHeader;
|
||||
const itemTestID = `${testID}.${post.id}`;
|
||||
const rightColumnStyle = [styles.rightColumn, (post.rootId && isLastReply && styles.rightColumnPadding)];
|
||||
|
|
@ -185,7 +185,7 @@ const Post = ({
|
|||
let highlightedStyle: StyleProp<ViewStyle>;
|
||||
if (highlight) {
|
||||
highlightedStyle = styles.highlight;
|
||||
} else if ((highlightFlagged || hightlightPinned) && highlightPinnedOrSaved) {
|
||||
} else if ((highlightSaved || hightlightPinned) && highlightPinnedOrSaved) {
|
||||
highlightedStyle = styles.highlightPinnedOrSaved;
|
||||
}
|
||||
|
||||
|
|
@ -279,9 +279,9 @@ const Post = ({
|
|||
<>
|
||||
<PreHeader
|
||||
isConsecutivePost={isConsecutivePost}
|
||||
isFlagged={isFlagged}
|
||||
isSaved={isSaved}
|
||||
isPinned={post.isPinned}
|
||||
skipFlaggedHeader={skipFlaggedHeader}
|
||||
skipSavedHeader={skipSavedHeader}
|
||||
skipPinnedHeader={skipPinnedHeader}
|
||||
/>
|
||||
<View style={[styles.container, consecutiveStyle]}>
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import {makeStyleSheetFromTheme} from '@utils/theme';
|
|||
|
||||
type PreHeaderProps = {
|
||||
isConsecutivePost?: boolean;
|
||||
isFlagged?: boolean;
|
||||
isSaved?: boolean;
|
||||
isPinned: boolean;
|
||||
skipFlaggedHeader?: boolean;
|
||||
skipSavedHeader?: boolean;
|
||||
skipPinnedHeader?: boolean;
|
||||
}
|
||||
|
||||
|
|
@ -56,15 +56,15 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
|
|||
};
|
||||
});
|
||||
|
||||
const PreHeader = ({isConsecutivePost, isFlagged, isPinned, skipFlaggedHeader, skipPinnedHeader}: PreHeaderProps) => {
|
||||
const PreHeader = ({isConsecutivePost, isSaved, isPinned, skipSavedHeader, skipPinnedHeader}: PreHeaderProps) => {
|
||||
const theme = useTheme();
|
||||
const style = getStyleSheet(theme);
|
||||
const isPinnedAndFlagged = isPinned && isFlagged && !skipFlaggedHeader && !skipPinnedHeader;
|
||||
const isPinnedAndSaved = isPinned && isSaved && !skipSavedHeader && !skipPinnedHeader;
|
||||
|
||||
let text;
|
||||
if (isPinnedAndFlagged) {
|
||||
if (isPinnedAndSaved) {
|
||||
text = {
|
||||
id: t('mobile.post_pre_header.pinned_flagged'),
|
||||
id: t('mobile.post_pre_header.pinned_saved'),
|
||||
defaultMessage: 'Pinned and Saved',
|
||||
};
|
||||
} else if (isPinned && !skipPinnedHeader) {
|
||||
|
|
@ -72,9 +72,9 @@ const PreHeader = ({isConsecutivePost, isFlagged, isPinned, skipFlaggedHeader, s
|
|||
id: t('mobile.post_pre_header.pinned'),
|
||||
defaultMessage: 'Pinned',
|
||||
};
|
||||
} else if (isFlagged && !skipFlaggedHeader) {
|
||||
} else if (isSaved && !skipSavedHeader) {
|
||||
text = {
|
||||
id: t('mobile.post_pre_header.flagged'),
|
||||
id: t('mobile.post_pre_header.saved'),
|
||||
defaultMessage: 'Saved',
|
||||
};
|
||||
}
|
||||
|
|
@ -93,10 +93,10 @@ const PreHeader = ({isConsecutivePost, isFlagged, isPinned, skipFlaggedHeader, s
|
|||
style={style.icon}
|
||||
/>
|
||||
}
|
||||
{isPinnedAndFlagged &&
|
||||
{isPinnedAndSaved &&
|
||||
<View style={style.iconsSeparator}/>
|
||||
}
|
||||
{isFlagged && !skipFlaggedHeader &&
|
||||
{isSaved && !skipSavedHeader &&
|
||||
<CompassIcon
|
||||
name='bookmark'
|
||||
size={14}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ const SaveOption = ({isSaved, postId}: CopyTextProps) => {
|
|||
defaultMessage={defaultMessage}
|
||||
iconName='bookmark-outline'
|
||||
onPress={onHandlePress}
|
||||
testID='post.options.flag.unflag'
|
||||
testID={id}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@
|
|||
"emoji_skin.medium_light_skin_tone": "medium light skin tone",
|
||||
"emoji_skin.medium_skin_tone": "medium skin tone",
|
||||
"file_upload.fileAbove": "Files must be less than {max}",
|
||||
"gallery.copy_link.failed": "Failed to copy link to clipboard",
|
||||
"gallery.downloading": "Downloading...",
|
||||
"gallery.footer.channel_name": "Shared in {channelName}",
|
||||
"gallery.image_saved": "Image saved",
|
||||
|
|
@ -286,9 +287,9 @@
|
|||
"mobile.post_info.save": "Save",
|
||||
"mobile.post_info.unpin": "Unpin from Channel",
|
||||
"mobile.post_info.unsave": "Unsave",
|
||||
"mobile.post_pre_header.flagged": "Saved",
|
||||
"mobile.post_pre_header.pinned": "Pinned",
|
||||
"mobile.post_pre_header.pinned_flagged": "Pinned and Saved",
|
||||
"mobile.post_pre_header.pinned_saved": "Pinned and Saved",
|
||||
"mobile.post_pre_header.saved": "Saved",
|
||||
"mobile.post_textbox.entire_channel_here.message": "By using @here you are about to send notifications to up to {totalMembers, number} {totalMembers, plural, one {person} other {people}}. Are you sure you want to do this?",
|
||||
"mobile.post_textbox.entire_channel_here.message.with_timezones": "By using @here you are about to send notifications up to {totalMembers, number} {totalMembers, plural, one {person} other {people}} in {timezones, number} {timezones, plural, one {timezone} other {timezones}}. Are you sure you want to do this?",
|
||||
"mobile.post_textbox.entire_channel.cancel": "Cancel",
|
||||
|
|
|
|||
Loading…
Reference in a new issue