коммит произвёл
GitHub
родитель
b45ff0be5d
Коммит
717a4d04a9
16
app/post.go
16
app/post.go
@@ -44,12 +44,12 @@ func (a *App) CreatePostAsUser(c *request.Context, post *model.Post, currentSess
|
||||
// Check that channel has not been deleted
|
||||
channel, errCh := a.Srv().Store.Channel().Get(post.ChannelId, true)
|
||||
if errCh != nil {
|
||||
err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.channel_id"}, errCh.Error(), http.StatusBadRequest)
|
||||
err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]any{"Name": "post.channel_id"}, errCh.Error(), http.StatusBadRequest)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if strings.HasPrefix(post.Type, model.PostSystemMessagePrefix) {
|
||||
err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.type"}, "", http.StatusBadRequest)
|
||||
err := model.NewAppError("CreatePostAsUser", "api.context.invalid_param.app_error", map[string]any{"Name": "post.type"}, "", http.StatusBadRequest)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ func (a *App) CreatePost(c *request.Context, post *model.Post, channel *model.Ch
|
||||
if attachments, ok := post.GetProp("attachments").([]*model.SlackAttachment); ok {
|
||||
jsonAttachments, err := json.Marshal(attachments)
|
||||
if err == nil {
|
||||
attachmentsInterface := []interface{}{}
|
||||
attachmentsInterface := []any{}
|
||||
err = json.Unmarshal(jsonAttachments, &attachmentsInterface)
|
||||
post.AddProp("attachments", attachmentsInterface)
|
||||
}
|
||||
@@ -410,13 +410,13 @@ func (a *App) attachFilesToPost(post *model.Post) *model.AppError {
|
||||
// If channel is nil, FillInPostProps will look up the channel corresponding to the post.
|
||||
func (a *App) FillInPostProps(post *model.Post, channel *model.Channel) *model.AppError {
|
||||
channelMentions := post.ChannelMentions()
|
||||
channelMentionsProp := make(map[string]interface{})
|
||||
channelMentionsProp := make(map[string]any)
|
||||
|
||||
if len(channelMentions) > 0 {
|
||||
if channel == nil {
|
||||
postChannel, err := a.Srv().Store.Channel().GetForPost(post.Id)
|
||||
if err != nil {
|
||||
return model.NewAppError("FillInPostProps", "api.context.invalid_param.app_error", map[string]interface{}{"Name": "post.channel_id"}, err.Error(), http.StatusBadRequest)
|
||||
return model.NewAppError("FillInPostProps", "api.context.invalid_param.app_error", map[string]any{"Name": "post.channel_id"}, err.Error(), http.StatusBadRequest)
|
||||
}
|
||||
channel = postChannel
|
||||
}
|
||||
@@ -433,7 +433,7 @@ func (a *App) FillInPostProps(post *model.Post, channel *model.Channel) *model.A
|
||||
mlog.Warn("Failed to get team of the channel mention", mlog.String("team_id", channel.TeamId), mlog.String("channel_id", channel.Id), mlog.Err(err))
|
||||
continue
|
||||
}
|
||||
channelMentionsProp[mentioned.Name] = map[string]interface{}{
|
||||
channelMentionsProp[mentioned.Name] = map[string]any{
|
||||
"display_name": mentioned.DisplayName,
|
||||
"team_name": team.Name,
|
||||
}
|
||||
@@ -589,7 +589,7 @@ func (a *App) UpdatePost(c *request.Context, post *model.Post, safeUpdate bool)
|
||||
}
|
||||
|
||||
if oldPost.DeleteAt != 0 {
|
||||
err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_details.app_error", map[string]interface{}{"PostId": post.Id}, "", http.StatusBadRequest)
|
||||
err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_details.app_error", map[string]any{"PostId": post.Id}, "", http.StatusBadRequest)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ func (a *App) UpdatePost(c *request.Context, post *model.Post, safeUpdate bool)
|
||||
}
|
||||
|
||||
if *a.Config().ServiceSettings.PostEditTimeLimit != -1 && model.GetMillis() > oldPost.CreateAt+int64(*a.Config().ServiceSettings.PostEditTimeLimit*1000) && post.Message != oldPost.Message {
|
||||
err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_time_limit.app_error", map[string]interface{}{"timeLimit": *a.Config().ServiceSettings.PostEditTimeLimit}, "", http.StatusBadRequest)
|
||||
err = model.NewAppError("UpdatePost", "api.post.update_post.permissions_time_limit.app_error", map[string]any{"timeLimit": *a.Config().ServiceSettings.PostEditTimeLimit}, "", http.StatusBadRequest)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user