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
@@ -102,9 +102,9 @@ func (_m *MockAppIface) CreateChannelWithUser(c request.CTX, channel *model.Chan
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CreatePost provides a mock function with given fields: c, post, channel, triggerWebhooks, setOnline
|
||||
func (_m *MockAppIface) CreatePost(c request.CTX, post *model.Post, channel *model.Channel, triggerWebhooks bool, setOnline bool) (*model.Post, *model.AppError) {
|
||||
ret := _m.Called(c, post, channel, triggerWebhooks, setOnline)
|
||||
// CreatePost provides a mock function with given fields: c, post, channel, flags
|
||||
func (_m *MockAppIface) CreatePost(c request.CTX, post *model.Post, channel *model.Channel, flags model.CreatePostFlags) (*model.Post, *model.AppError) {
|
||||
ret := _m.Called(c, post, channel, flags)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for CreatePost")
|
||||
@@ -112,19 +112,19 @@ func (_m *MockAppIface) CreatePost(c request.CTX, post *model.Post, channel *mod
|
||||
|
||||
var r0 *model.Post
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(request.CTX, *model.Post, *model.Channel, bool, bool) (*model.Post, *model.AppError)); ok {
|
||||
return rf(c, post, channel, triggerWebhooks, setOnline)
|
||||
if rf, ok := ret.Get(0).(func(request.CTX, *model.Post, *model.Channel, model.CreatePostFlags) (*model.Post, *model.AppError)); ok {
|
||||
return rf(c, post, channel, flags)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(request.CTX, *model.Post, *model.Channel, bool, bool) *model.Post); ok {
|
||||
r0 = rf(c, post, channel, triggerWebhooks, setOnline)
|
||||
if rf, ok := ret.Get(0).(func(request.CTX, *model.Post, *model.Channel, model.CreatePostFlags) *model.Post); ok {
|
||||
r0 = rf(c, post, channel, flags)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Post)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(request.CTX, *model.Post, *model.Channel, bool, bool) *model.AppError); ok {
|
||||
r1 = rf(c, post, channel, triggerWebhooks, setOnline)
|
||||
if rf, ok := ret.Get(1).(func(request.CTX, *model.Post, *model.Channel, model.CreatePostFlags) *model.AppError); ok {
|
||||
r1 = rf(c, post, channel, flags)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
|
||||
@@ -57,7 +57,7 @@ type AppIface interface {
|
||||
AddUserToChannel(c request.CTX, user *model.User, channel *model.Channel, skipTeamMemberIntegrityCheck bool) (*model.ChannelMember, *model.AppError)
|
||||
AddUserToTeamByTeamId(c request.CTX, teamId string, user *model.User) *model.AppError
|
||||
PermanentDeleteChannel(c request.CTX, channel *model.Channel) *model.AppError
|
||||
CreatePost(c request.CTX, post *model.Post, channel *model.Channel, triggerWebhooks bool, setOnline bool) (savedPost *model.Post, err *model.AppError)
|
||||
CreatePost(c request.CTX, post *model.Post, channel *model.Channel, flags model.CreatePostFlags) (savedPost *model.Post, err *model.AppError)
|
||||
UpdatePost(c request.CTX, post *model.Post, safeUpdate bool) (*model.Post, *model.AppError)
|
||||
DeletePost(c request.CTX, postID, deleteByID string) (*model.Post, *model.AppError)
|
||||
SaveReactionForPost(c request.CTX, reaction *model.Reaction) (*model.Reaction, *model.AppError)
|
||||
|
||||
@@ -385,7 +385,7 @@ func (scs *Service) upsertSyncPost(post *model.Post, targetChannel *model.Channe
|
||||
return nil, fmt.Errorf("post sync failed: %w", ErrRemoteIDMismatch)
|
||||
}
|
||||
|
||||
rpost, appErr = scs.app.CreatePost(rctx, post, targetChannel, true, true)
|
||||
rpost, appErr = scs.app.CreatePost(rctx, post, targetChannel, model.CreatePostFlags{TriggerWebhooks: true, SetOnline: true})
|
||||
if appErr == nil {
|
||||
scs.server.Log().Log(mlog.LvlSharedChannelServiceDebug, "Created sync post",
|
||||
mlog.String("post_id", post.Id),
|
||||
|
||||
Ссылка в новой задаче
Block a user