[MM-17068] Add set post as unread option to menu (#3202)
* [MM-17068] Add set post as unread option to menu * [MM-17068] Fix tests * [MM-17068] add english assets * [MM-17068] Add bookmark icons for marking as unread * [MM-17068] reorder menu items * [MM-17068] fix snapshots * [MM-17068] merge my post options and others post options
This commit is contained in:
parent
b795a0bba4
commit
c7a29eea6a
13 changed files with 368 additions and 233 deletions
|
|
@ -348,6 +348,11 @@ function lastChannelViewTime(state = {}, action) {
|
|||
return state;
|
||||
}
|
||||
|
||||
case ChannelTypes.POST_UNREAD_SUCCESS: {
|
||||
const data = action.data;
|
||||
return {...state, [data.channelId]: data.lastViewedAt};
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,192 +1,6 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`PostOptions should match snapshot, no option for system message to user who doesn't have the permission to delete 1`] = `
|
||||
<View
|
||||
style={
|
||||
Object {
|
||||
"flex": 1,
|
||||
}
|
||||
}
|
||||
>
|
||||
<ForwardRef(forwardConnectRef)
|
||||
allowStayMiddle={false}
|
||||
initialPosition={250}
|
||||
marginFromTop={350}
|
||||
onRequestClose={[Function]}
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="edit"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Edit"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="reply"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Reply"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="pin"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Pin to Channel"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="emoji"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Add Reaction"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</ForwardRef(forwardConnectRef)>
|
||||
</View>
|
||||
`;
|
||||
|
||||
exports[`PostOptions should match snapshot, showing Delete option only for system message to user who has permission to delete 1`] = `
|
||||
<View
|
||||
style={
|
||||
Object {
|
||||
|
|
@ -230,10 +44,10 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
|
|||
>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="edit"
|
||||
icon="reply"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Edit"
|
||||
text="Reply"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
|
|
@ -265,10 +79,44 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
|
|||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="reply"
|
||||
icon="emoji"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Reply"
|
||||
text="Add Reaction"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
icon="bookmark"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Mark post as unread"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
|
|
@ -333,6 +181,122 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
|
|||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="edit"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Edit"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
</ForwardRef(forwardConnectRef)>
|
||||
</View>
|
||||
`;
|
||||
|
||||
exports[`PostOptions should match snapshot, showing Delete option only for system message to user who has permission to delete 1`] = `
|
||||
<View
|
||||
style={
|
||||
Object {
|
||||
"flex": 1,
|
||||
}
|
||||
}
|
||||
>
|
||||
<ForwardRef(forwardConnectRef)
|
||||
allowStayMiddle={false}
|
||||
initialPosition={350}
|
||||
marginFromTop={250}
|
||||
onRequestClose={[Function]}
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="reply"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Reply"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="emoji"
|
||||
|
|
@ -368,6 +332,110 @@ exports[`PostOptions should match snapshot, showing Delete option only for syste
|
|||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
icon="bookmark"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Mark post as unread"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="pin"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Pin to Channel"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="edit"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Edit"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
destructive={true}
|
||||
icon="trash"
|
||||
|
|
@ -417,8 +485,8 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
|
|||
>
|
||||
<ForwardRef(forwardConnectRef)
|
||||
allowStayMiddle={false}
|
||||
initialPosition={300}
|
||||
marginFromTop={300}
|
||||
initialPosition={350}
|
||||
marginFromTop={250}
|
||||
onRequestClose={[Function]}
|
||||
theme={
|
||||
Object {
|
||||
|
|
@ -451,10 +519,10 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
|
|||
>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="edit"
|
||||
icon="reply"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Edit"
|
||||
text="Reply"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
|
|
@ -486,10 +554,44 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
|
|||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="reply"
|
||||
icon="emoji"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Reply"
|
||||
text="Add Reaction"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
"buttonBg": "#166de0",
|
||||
"buttonColor": "#ffffff",
|
||||
"centerChannelBg": "#ffffff",
|
||||
"centerChannelColor": "#3d3c40",
|
||||
"codeTheme": "github",
|
||||
"dndIndicator": "#f74343",
|
||||
"errorTextColor": "#fd5960",
|
||||
"linkColor": "#2389d7",
|
||||
"mentionBj": "#ffffff",
|
||||
"mentionColor": "#145dbf",
|
||||
"mentionHighlightBg": "#ffe577",
|
||||
"mentionHighlightLink": "#166de0",
|
||||
"newMessageSeparator": "#ff8800",
|
||||
"onlineIndicator": "#06d6a0",
|
||||
"sidebarBg": "#145dbf",
|
||||
"sidebarHeaderBg": "#1153ab",
|
||||
"sidebarHeaderTextColor": "#ffffff",
|
||||
"sidebarText": "#ffffff",
|
||||
"sidebarTextActiveBorder": "#579eff",
|
||||
"sidebarTextActiveColor": "#ffffff",
|
||||
"sidebarTextHoverBg": "#4578bf",
|
||||
"sidebarUnreadText": "#ffffff",
|
||||
"type": "Mattermost",
|
||||
}
|
||||
}
|
||||
/>
|
||||
<PostOption
|
||||
icon="bookmark"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Mark post as unread"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
|
|
@ -556,10 +658,10 @@ exports[`PostOptions should match snapshot, showing all possible options 1`] = `
|
|||
/>
|
||||
<PostOption
|
||||
destructive={false}
|
||||
icon="emoji"
|
||||
icon="edit"
|
||||
isLandscape={false}
|
||||
onPress={[Function]}
|
||||
text="Add Reaction"
|
||||
text="Edit"
|
||||
theme={
|
||||
Object {
|
||||
"awayIndicator": "#ffbc42",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
unflagPost,
|
||||
unpinPost,
|
||||
removePost,
|
||||
setUnreadPost,
|
||||
} from 'mattermost-redux/actions/posts';
|
||||
import {General, Permissions} from 'mattermost-redux/constants';
|
||||
import {getChannel, getCurrentChannelId} from 'mattermost-redux/selectors/entities/channels';
|
||||
|
|
@ -107,6 +108,7 @@ export function mapStateToProps(state, ownProps) {
|
|||
canFlag,
|
||||
canPin,
|
||||
currentTeamUrl: getCurrentTeamUrl(state),
|
||||
currentUserId: getCurrentUserId(state),
|
||||
isMyPost: currentUserId === post.user_id,
|
||||
theme: getTheme(state),
|
||||
isLandscape: isLandscape(state),
|
||||
|
|
@ -125,6 +127,7 @@ function mapDispatchToProps(dispatch) {
|
|||
unpinPost,
|
||||
dismissModal,
|
||||
showModal,
|
||||
setUnreadPost,
|
||||
}, dispatch),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import link from 'assets/images/post_menu/link.png';
|
|||
import pin from 'assets/images/post_menu/pin.png';
|
||||
import trash from 'assets/images/post_menu/trash.png';
|
||||
import reply from 'assets/images/post_menu/reply.png';
|
||||
import bookmark from 'assets/images/post_menu/bookmark.png';
|
||||
|
||||
const icons = {
|
||||
copy,
|
||||
|
|
@ -33,6 +34,7 @@ const icons = {
|
|||
pin,
|
||||
trash,
|
||||
reply,
|
||||
bookmark,
|
||||
};
|
||||
|
||||
export default class PostOption extends PureComponent {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import SlideUpPanel from 'app/components/slide_up_panel';
|
|||
import {BOTTOM_MARGIN} from 'app/components/slide_up_panel/slide_up_panel';
|
||||
import {t} from 'app/utils/i18n';
|
||||
|
||||
import {isSystemMessage} from 'mattermost-redux/utils/post_utils';
|
||||
import {OPTION_HEIGHT, getInitialPosition} from './post_options_utils';
|
||||
import PostOption from './post_option';
|
||||
|
||||
|
|
@ -28,6 +29,7 @@ export default class PostOptions extends PureComponent {
|
|||
unpinPost: PropTypes.func.isRequired,
|
||||
dismissModal: PropTypes.func.isRequired,
|
||||
showModal: PropTypes.func.isRequired,
|
||||
setUnreadPost: PropTypes.func.isRequired,
|
||||
}).isRequired,
|
||||
canAddReaction: PropTypes.bool,
|
||||
canReply: PropTypes.bool,
|
||||
|
|
@ -39,6 +41,7 @@ export default class PostOptions extends PureComponent {
|
|||
canEdit: PropTypes.bool,
|
||||
canEditUntil: PropTypes.number.isRequired,
|
||||
currentTeamUrl: PropTypes.string.isRequired,
|
||||
currentUserId: PropTypes.string.isRequired,
|
||||
deviceHeight: PropTypes.number.isRequired,
|
||||
isFlagged: PropTypes.bool,
|
||||
isMyPost: PropTypes.bool,
|
||||
|
|
@ -225,40 +228,39 @@ export default class PostOptions extends PureComponent {
|
|||
return this.getOption(key, icon, message, onPress);
|
||||
};
|
||||
|
||||
getMyPostOptions = () => {
|
||||
const actions = [
|
||||
this.getEditOption(),
|
||||
this.getReplyOption(),
|
||||
this.getFlagOption(),
|
||||
this.getPinOption(),
|
||||
this.getAddReactionOption(),
|
||||
this.getCopyPermalink(),
|
||||
this.getCopyText(),
|
||||
this.getDeleteOption(),
|
||||
];
|
||||
getMarkAsUnreadOption = () => {
|
||||
const {post, isLandscape, theme} = this.props;
|
||||
const {formatMessage} = this.context.intl;
|
||||
|
||||
return actions.filter((a) => a !== null);
|
||||
};
|
||||
|
||||
getOthersPostOptions = () => {
|
||||
const actions = [
|
||||
this.getReplyOption(),
|
||||
this.getFlagOption(),
|
||||
this.getAddReactionOption(),
|
||||
this.getPinOption(),
|
||||
this.getCopyPermalink(),
|
||||
this.getCopyText(),
|
||||
this.getEditOption(),
|
||||
this.getDeleteOption(),
|
||||
];
|
||||
|
||||
return actions.filter((a) => a !== null);
|
||||
if (!isSystemMessage(post)) {
|
||||
return (
|
||||
<PostOption
|
||||
key='markUnread'
|
||||
icon='bookmark'
|
||||
text={formatMessage({id: 'mobile.post_info.mark_unread', defaultMessage: 'Mark post as unread'})}
|
||||
onPress={this.handleMarkUnread}
|
||||
isLandscape={isLandscape}
|
||||
theme={theme}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
getPostOptions = () => {
|
||||
const {isMyPost} = this.props;
|
||||
const actions = [
|
||||
this.getReplyOption(),
|
||||
this.getAddReactionOption(),
|
||||
this.getMarkAsUnreadOption(),
|
||||
this.getCopyPermalink(),
|
||||
this.getFlagOption(),
|
||||
this.getCopyText(),
|
||||
this.getPinOption(),
|
||||
this.getEditOption(),
|
||||
this.getDeleteOption(),
|
||||
];
|
||||
|
||||
return isMyPost ? this.getMyPostOptions() : this.getOthersPostOptions();
|
||||
return actions.filter((a) => a !== null);
|
||||
};
|
||||
|
||||
handleAddReaction = () => {
|
||||
|
|
@ -325,6 +327,15 @@ export default class PostOptions extends PureComponent {
|
|||
});
|
||||
};
|
||||
|
||||
handleMarkUnread = () => {
|
||||
const {actions, post, currentUserId} = this.props;
|
||||
|
||||
this.closeWithAnimation();
|
||||
requestAnimationFrame(() => {
|
||||
actions.setUnreadPost(currentUserId, post.id);
|
||||
});
|
||||
}
|
||||
|
||||
handlePostDelete = () => {
|
||||
const {formatMessage} = this.context.intl;
|
||||
const {actions, post} = this.props;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ describe('PostOptions', () => {
|
|||
unpinPost: jest.fn(),
|
||||
dismissModal: jest.fn(),
|
||||
showModal: jest.fn(),
|
||||
setUnreadPost: jest.fn(),
|
||||
};
|
||||
|
||||
const post = {
|
||||
|
|
@ -48,6 +49,7 @@ describe('PostOptions', () => {
|
|||
canEditUntil: -1,
|
||||
channelIsReadOnly: false,
|
||||
currentTeamUrl: 'http://localhost:8065/team-name',
|
||||
currentUserId: 'user1',
|
||||
deviceHeight: 600,
|
||||
hasBeenDeleted: false,
|
||||
isFlagged: false,
|
||||
|
|
|
|||
|
|
@ -350,6 +350,7 @@
|
|||
"mobile.post_info.add_reaction": "Add Reaction",
|
||||
"mobile.post_info.copy_text": "Copy Text",
|
||||
"mobile.post_info.flag": "Flag",
|
||||
"mobile.post_info.mark_unread": "Mark post as unread",
|
||||
"mobile.post_info.pin": "Pin to Channel",
|
||||
"mobile.post_info.reply": "Reply",
|
||||
"mobile.post_info.unflag": "Unflag",
|
||||
|
|
|
|||
BIN
assets/base/images/post_menu/bookmark.png
Executable file
BIN
assets/base/images/post_menu/bookmark.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 669 B |
BIN
assets/base/images/post_menu/bookmark@2x.png
Executable file
BIN
assets/base/images/post_menu/bookmark@2x.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 840 B |
BIN
assets/base/images/post_menu/bookmark@3x.png
Executable file
BIN
assets/base/images/post_menu/bookmark@3x.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1,023 B |
18
package-lock.json
generated
18
package-lock.json
generated
|
|
@ -14039,8 +14039,8 @@
|
|||
"integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A=="
|
||||
},
|
||||
"mattermost-redux": {
|
||||
"version": "github:mattermost/mattermost-redux#6ea71dc77808041d7e953ac15cbc12e1c483ac69",
|
||||
"from": "github:mattermost/mattermost-redux#6ea71dc77808041d7e953ac15cbc12e1c483ac69",
|
||||
"version": "github:mattermost/mattermost-redux#6bdeb3fefe2c3e812247920d7a58262d927c4eea",
|
||||
"from": "github:mattermost/mattermost-redux#6bdeb3fefe2c3e812247920d7a58262d927c4eea",
|
||||
"requires": {
|
||||
"deep-equal": "1.0.1",
|
||||
"eslint-plugin-header": "3.0.0",
|
||||
|
|
@ -14053,7 +14053,7 @@
|
|||
"redux": "4.0.4",
|
||||
"redux-action-buffer": "1.2.0",
|
||||
"redux-batched-actions": "0.4.1",
|
||||
"redux-offline": "git+https://github.com/enahum/redux-offline.git#4bd85e7e3b279a2b11fb4d587808d583d2b5e7b5",
|
||||
"redux-offline": "git+https://github.com/enahum/redux-offline.git#885024de96b6ec73650c340c8928066585c413df",
|
||||
"redux-persist": "4.9.1",
|
||||
"redux-thunk": "2.3.0",
|
||||
"reselect": "4.0.0",
|
||||
|
|
@ -17434,10 +17434,18 @@
|
|||
}
|
||||
},
|
||||
"redux-offline": {
|
||||
"version": "git+https://github.com/enahum/redux-offline.git#4bd85e7e3b279a2b11fb4d587808d583d2b5e7b5",
|
||||
"from": "git+https://github.com/enahum/redux-offline.git#4bd85e7e3b279a2b11fb4d587808d583d2b5e7b5",
|
||||
"version": "git+https://github.com/enahum/redux-offline.git#885024de96b6ec73650c340c8928066585c413df",
|
||||
"from": "git+https://github.com/enahum/redux-offline.git#885024de96b6ec73650c340c8928066585c413df",
|
||||
"requires": {
|
||||
"@react-native-community/netinfo": "^4.1.3",
|
||||
"redux-persist": "^4.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-community/netinfo": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-4.2.1.tgz",
|
||||
"integrity": "sha512-kAnmYp8vXpZToPw8rgE7uO+MqmqHSR9VEDPkuZT0DnFMBJmIXCSD2NLAD28HGKVY/kujVWCknC/FuVWr5/A3uA=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"redux-persist": {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
"intl": "1.2.5",
|
||||
"jail-monkey": "2.2.0",
|
||||
"jsc-android": "241213.2.0",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#6ea71dc77808041d7e953ac15cbc12e1c483ac69",
|
||||
"mattermost-redux": "github:mattermost/mattermost-redux#6bdeb3fefe2c3e812247920d7a58262d927c4eea",
|
||||
"mime-db": "1.40.0",
|
||||
"moment-timezone": "0.5.25",
|
||||
"prop-types": "15.7.2",
|
||||
|
|
|
|||
|
|
@ -303,6 +303,7 @@ module.exports = [
|
|||
'dist/assets/images/icons/word.png',
|
||||
'dist/assets/images/post_header/flag.png',
|
||||
'dist/assets/images/post_header/pin.png',
|
||||
'dist/assets/images/post_header/bookmark.png',
|
||||
'dist/assets/images/profile.jpg',
|
||||
'dist/assets/images/status/away.png',
|
||||
'dist/assets/images/status/dnd.png',
|
||||
|
|
|
|||
Loading…
Reference in a new issue