Use flags for create post (#28857)
* Use flags for create post * Remove unintended file * Fix unintended change and types --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
43a06d1b78
Коммит
2d96053012
@@ -758,7 +758,7 @@ func (a *App) postChannelPrivacyMessage(c request.CTX, user *model.User, channel
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("postChannelPrivacyMessage", "api.channel.post_channel_privacy_message.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -813,7 +813,7 @@ func (a *App) RestoreChannel(c request.CTX, channel *model.Channel, userID strin
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
c.Logger().Warn("Failed to post unarchive message", mlog.Err(err))
|
||||
}
|
||||
} else {
|
||||
@@ -834,7 +834,7 @@ func (a *App) RestoreChannel(c request.CTX, channel *model.Channel, userID strin
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
c.Logger().Error("Failed to post unarchive message", mlog.Err(err))
|
||||
}
|
||||
})
|
||||
@@ -1464,7 +1464,7 @@ func (a *App) DeleteChannel(c request.CTX, channel *model.Channel, userID string
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
c.Logger().Warn("Failed to post archive message", mlog.Err(err))
|
||||
}
|
||||
} else {
|
||||
@@ -1482,7 +1482,7 @@ func (a *App) DeleteChannel(c request.CTX, channel *model.Channel, userID string
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
c.Logger().Warn("Failed to post archive message", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
@@ -1761,7 +1761,7 @@ func (a *App) PostUpdateChannelHeaderMessage(c request.CTX, userID string, chann
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("", "api.channel.post_update_channel_header_message_and_forget.post.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -1794,7 +1794,7 @@ func (a *App) PostUpdateChannelPurposeMessage(c request.CTX, userID string, chan
|
||||
"new_purpose": newChannelPurpose,
|
||||
},
|
||||
}
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("", "app.channel.post_update_channel_purpose_message.post.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -1821,7 +1821,7 @@ func (a *App) PostUpdateChannelDisplayNameMessage(c request.CTX, userID string,
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("PostUpdateChannelDisplayNameMessage", "api.channel.post_update_channel_displayname_message_and_forget.create_post.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -2314,7 +2314,7 @@ func (a *App) postJoinChannelMessage(c request.CTX, user *model.User, channel *m
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("postJoinChannelMessage", "api.channel.post_user_add_remove_message_and_forget.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -2332,7 +2332,7 @@ func (a *App) postJoinTeamMessage(c request.CTX, user *model.User, channel *mode
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("postJoinTeamMessage", "api.channel.post_user_add_remove_message_and_forget.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -2431,7 +2431,7 @@ func (a *App) postLeaveChannelMessage(c request.CTX, user *model.User, channel *
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("postLeaveChannelMessage", "api.channel.post_user_add_remove_message_and_forget.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -2460,7 +2460,7 @@ func (a *App) PostAddToChannelMessage(c request.CTX, user *model.User, addedUser
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("postAddToChannelMessage", "api.channel.post_user_add_remove_message_and_forget.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -2482,7 +2482,7 @@ func (a *App) postAddToTeamMessage(c request.CTX, user *model.User, addedUser *m
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("postAddToTeamMessage", "api.channel.post_user_add_remove_message_and_forget.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -2514,7 +2514,7 @@ func (a *App) postRemoveFromChannelMessage(c request.CTX, removerUserId string,
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("postRemoveFromChannelMessage", "api.channel.post_user_add_remove_message_and_forget.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -3259,7 +3259,7 @@ func (a *App) postChannelMoveMessage(c request.CTX, user *model.User, channel *m
|
||||
},
|
||||
}
|
||||
|
||||
if _, err := a.CreatePost(c, post, channel, false, true); err != nil {
|
||||
if _, err := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); err != nil {
|
||||
return model.NewAppError("postChannelMoveMessage", "api.team.move_channel.post.error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
|
||||
@@ -3743,7 +3743,7 @@ func (a *App) postMessageForConvertGroupMessageToChannel(c request.CTX, channelI
|
||||
return appErr
|
||||
}
|
||||
|
||||
if _, appErr := a.CreatePost(c, post, channel, false, true); appErr != nil {
|
||||
if _, appErr := a.CreatePost(c, post, channel, model.CreatePostFlags{SetOnline: true}); appErr != nil {
|
||||
c.Logger().Error("Failed to create post for notifying about GM converted to private channel", mlog.Err(appErr))
|
||||
|
||||
return model.NewAppError(
|
||||
|
||||
Ссылка в новой задаче
Block a user