app type transition (#7167)
Этот коммит содержится в:
@@ -41,7 +41,7 @@ func saveReaction(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if !app.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_READ_CHANNEL) {
|
||||
if !c.App.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_READ_CHANNEL) {
|
||||
c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
|
||||
return
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func saveReaction(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var post *model.Post
|
||||
|
||||
if result := <-app.Srv.Store.Post().Get(reaction.PostId); result.Err != nil {
|
||||
if result := <-c.App.Srv.Store.Post().Get(reaction.PostId); result.Err != nil {
|
||||
c.Err = result.Err
|
||||
return
|
||||
} else if post = result.Data.(*model.PostList).Posts[postId]; post.ChannelId != channelId {
|
||||
@@ -63,7 +63,7 @@ func saveReaction(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if reaction, err := app.SaveReactionForPost(reaction); err != nil {
|
||||
if reaction, err := c.App.SaveReactionForPost(reaction); err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
} else {
|
||||
@@ -92,7 +92,7 @@ func deleteReaction(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if !app.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_READ_CHANNEL) {
|
||||
if !c.App.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_READ_CHANNEL) {
|
||||
c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
|
||||
return
|
||||
}
|
||||
@@ -103,7 +103,7 @@ func deleteReaction(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
err := app.DeleteReactionForPost(reaction)
|
||||
err := c.App.DeleteReactionForPost(reaction)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -120,7 +120,7 @@ func sendReactionEvent(event string, channelId string, reaction *model.Reaction,
|
||||
app.Publish(message)
|
||||
|
||||
// THe post is always modified since the UpdateAt always changes
|
||||
app.InvalidateCacheForChannelPosts(post.ChannelId)
|
||||
app.Global().InvalidateCacheForChannelPosts(post.ChannelId)
|
||||
post.HasReactions = true
|
||||
post.UpdateAt = model.GetMillis()
|
||||
umessage := model.NewWebSocketEvent(model.WEBSOCKET_EVENT_POST_EDITED, "", channelId, "", nil)
|
||||
@@ -144,9 +144,9 @@ func listReactions(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
pchan := app.Srv.Store.Post().Get(postId)
|
||||
pchan := c.App.Srv.Store.Post().Get(postId)
|
||||
|
||||
if !app.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_READ_CHANNEL) {
|
||||
if !c.App.SessionHasPermissionToChannel(c.Session, channelId, model.PERMISSION_READ_CHANNEL) {
|
||||
c.SetPermissionError(model.PERMISSION_READ_CHANNEL)
|
||||
return
|
||||
}
|
||||
@@ -160,7 +160,7 @@ func listReactions(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if result := <-app.Srv.Store.Reaction().GetForPost(postId, true); result.Err != nil {
|
||||
if result := <-c.App.Srv.Store.Reaction().GetForPost(postId, true); result.Err != nil {
|
||||
c.Err = result.Err
|
||||
return
|
||||
} else {
|
||||
|
||||
Ссылка в новой задаче
Block a user