mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Changed how posts are marked ephemeral
This commit is contained in:
@@ -764,9 +764,8 @@ func checkForOutOfChannelMentions(c *Context, post *model.Post, channel *model.C
|
||||
Id: model.NewId(),
|
||||
ChannelId: post.ChannelId,
|
||||
Message: messageText,
|
||||
Type: model.POST_OUT_OF_CHANNEL_MENTION,
|
||||
Type: model.POST_EPHEMERAL,
|
||||
CreateAt: post.CreateAt + 1,
|
||||
Ephemeral: true,
|
||||
Props: model.StringInterface{},
|
||||
Filenames: []string{},
|
||||
}
|
||||
|
||||
@@ -10,12 +10,13 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
POST_SYSTEM_MESSAGE_PREFIX = "system_"
|
||||
POST_DEFAULT = ""
|
||||
POST_SLACK_ATTACHMENT = "slack_attachment"
|
||||
POST_JOIN_LEAVE = "system_join_leave"
|
||||
POST_HEADER_CHANGE = "system_header_change"
|
||||
POST_OUT_OF_CHANNEL_MENTION = "system_out_of_channel_mention"
|
||||
POST_SYSTEM_MESSAGE_PREFIX = "system_"
|
||||
POST_DEFAULT = ""
|
||||
POST_SLACK_ATTACHMENT = "slack_attachment"
|
||||
POST_SYSTEM_GENERIC = "system_generic"
|
||||
POST_JOIN_LEAVE = "system_join_leave"
|
||||
POST_HEADER_CHANGE = "system_header_change"
|
||||
POST_EPHEMERAL = "system_ephemeral"
|
||||
)
|
||||
|
||||
type Post struct {
|
||||
@@ -34,7 +35,6 @@ type Post struct {
|
||||
Hashtags string `json:"hashtags"`
|
||||
Filenames StringArray `json:"filenames"`
|
||||
PendingPostId string `json:"pending_post_id" db:"-"`
|
||||
Ephemeral bool `json:"ephemeral" db:"-"`
|
||||
}
|
||||
|
||||
func (o *Post) ToJson() string {
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class PostInfo extends React.Component {
|
||||
var isOwner = UserStore.getCurrentId() === post.user_id;
|
||||
var isAdmin = Utils.isAdmin(UserStore.getCurrentUser().roles);
|
||||
|
||||
if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING || post.ephemeral) {
|
||||
if (post.state === Constants.POST_FAILED || post.state === Constants.POST_LOADING || Utils.isPostEphemeral(post)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ export default class PostInfo extends React.Component {
|
||||
EventHelpers.emitRemovePost(this.props.post);
|
||||
}
|
||||
createRemovePostButton(post) {
|
||||
if (!post.ephemeral) {
|
||||
if (!Utils.isPostEphemeral(post)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ export default class PostInfo extends React.Component {
|
||||
commentCountText = '';
|
||||
}
|
||||
|
||||
if (post.state !== Constants.POST_FAILED && post.state !== Constants.POST_LOADING && !post.ephemeral) {
|
||||
if (post.state !== Constants.POST_FAILED && post.state !== Constants.POST_LOADING && !Utils.isPostEphemeral(post)) {
|
||||
comments = (
|
||||
<a
|
||||
href='#'
|
||||
|
||||
@@ -342,8 +342,7 @@ class PostStoreClass extends EventEmitter {
|
||||
// make sure to copy the post so that component state changes work properly
|
||||
postList.posts[post.id] = Object.assign({}, post, {
|
||||
state: Constants.POST_DELETED,
|
||||
filenames: [],
|
||||
ephemeral: true
|
||||
filenames: []
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,8 +128,8 @@ export default {
|
||||
POST_LOADING: 'loading',
|
||||
POST_FAILED: 'failed',
|
||||
POST_DELETED: 'deleted',
|
||||
POST_TYPE_JOIN_LEAVE: 'system_join_leave',
|
||||
POST_TYPE_EPHEMERAL: 'system_ephemeral',
|
||||
POST_TYPE_JOIN_LEAVE: 'system_join_leave',
|
||||
SYSTEM_MESSAGE_PREFIX: 'system_',
|
||||
SYSTEM_MESSAGE_PROFILE_NAME: 'System',
|
||||
SYSTEM_MESSAGE_PROFILE_IMAGE: '/static/images/logo_compact.png',
|
||||
|
||||
@@ -1355,3 +1355,7 @@ export function languages() {
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
export function isPostEphemeral(post) {
|
||||
return post.type === Constants.POST_TYPE_EPHEMERAL || post.state === Constants.POST_DELETED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user