* Add webhook cache

* Add channel by name cache

* Fxing profiles in channels cache

* Fix merge
Этот коммит содержится в:
Joram Wilander
2017-01-27 14:07:34 -05:00
коммит произвёл GitHub
родитель 8eab04e944
Коммит 097289f8e4
19 изменённых файлов: 173 добавлений и 51 удалений

Просмотреть файл

@@ -34,7 +34,7 @@ func (me *JoinProvider) GetCommand(c *Context) *model.Command {
}
func (me *JoinProvider) DoCommand(c *Context, args *model.CommandArgs, message string) *model.CommandResponse {
if result := <-app.Srv.Store.Channel().GetByName(c.TeamId, message); result.Err != nil {
if result := <-app.Srv.Store.Channel().GetByName(c.TeamId, message, true); result.Err != nil {
return &model.CommandResponse{Text: c.T("api.command_join.list.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL}
} else {
channel := result.Data.(*model.Channel)

Просмотреть файл

@@ -64,7 +64,7 @@ func (me *msgProvider) DoCommand(c *Context, args *model.CommandArgs, message st
channelName := model.GetDMNameFromIds(c.Session.UserId, userProfile.Id)
targetChannelId := ""
if channel := <-app.Srv.Store.Channel().GetByName(c.TeamId, channelName); channel.Err != nil {
if channel := <-app.Srv.Store.Channel().GetByName(c.TeamId, channelName, true); channel.Err != nil {
if channel.Err.Id == "store.sql_channel.get_by_name.missing.app_error" {
if directChannel, err := app.CreateDirectChannel(c.Session.UserId, userProfile.Id); err != nil {
c.Err = err

Просмотреть файл

@@ -109,7 +109,7 @@ func deleteIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if result := <-app.Srv.Store.Webhook().GetIncoming(id); result.Err != nil {
if result := <-app.Srv.Store.Webhook().GetIncoming(id, true); result.Err != nil {
c.Err = result.Err
return
} else {
@@ -125,6 +125,8 @@ func deleteIncomingHook(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
app.InvalidateCacheForWebhook(id)
c.LogAudit("success")
w.Write([]byte(model.MapToJson(props)))
}
@@ -352,7 +354,7 @@ func incomingWebhook(c *Context, w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
id := params["id"]
hchan := app.Srv.Store.Webhook().GetIncoming(id)
hchan := app.Srv.Store.Webhook().GetIncoming(id, true)
r.ParseForm()
@@ -448,7 +450,7 @@ func incomingWebhook(c *Context, w http.ResponseWriter, r *http.Request) {
channelName = channelName[1:]
}
cchan = app.Srv.Store.Channel().GetByName(hook.TeamId, channelName)
cchan = app.Srv.Store.Channel().GetByName(hook.TeamId, channelName, true)
} else {
cchan = app.Srv.Store.Channel().Get(hook.ChannelId, true)
}