summaryrefslogtreecommitdiffstats
path: root/app/channel.go
diff options
context:
space:
mode:
authorMartin Kraft <martinkraft@gmail.com>2018-05-01 18:59:20 -0400
committerMartin Kraft <martinkraft@gmail.com>2018-05-01 18:59:20 -0400
commitff6c42309c4dd328b5841cfeef6b59ea59a4379c (patch)
treec2c3b4938588549ea69653a46d98b27f6fe37b80 /app/channel.go
parent2386acb3ddabd8827e21b1862c338a8b13a25de6 (diff)
parente73f1d73143ebba9c7e80d21c45bba9b61f2611c (diff)
downloadchat-ff6c42309c4dd328b5841cfeef6b59ea59a4379c.tar.gz
chat-ff6c42309c4dd328b5841cfeef6b59ea59a4379c.tar.bz2
chat-ff6c42309c4dd328b5841cfeef6b59ea59a4379c.zip
Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Diffstat (limited to 'app/channel.go')
-rw-r--r--app/channel.go44
1 files changed, 22 insertions, 22 deletions
diff --git a/app/channel.go b/app/channel.go
index 9a8f66fc7..516e8d094 100644
--- a/app/channel.go
+++ b/app/channel.go
@@ -9,7 +9,7 @@ import (
"strings"
"time"
- l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/mattermost-server/mlog"
"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/store"
"github.com/mattermost/mattermost-server/utils"
@@ -61,17 +61,17 @@ func (a *App) JoinDefaultChannels(teamId string, user *model.User, shouldBeAdmin
err = cmResult.Err
}
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(user.Id, townSquare.Id, model.GetMillis()); result.Err != nil {
- l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
+ mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}
if *a.Config().ServiceSettings.ExperimentalEnableDefaultChannelLeaveJoinMessages {
if requestor == nil {
if err := a.postJoinTeamMessage(user, townSquare); err != nil {
- l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
+ mlog.Error(fmt.Sprint("Failed to post join/leave message", err))
}
} else {
if err := a.postAddToTeamMessage(requestor, user, townSquare, ""); err != nil {
- l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
+ mlog.Error(fmt.Sprint("Failed to post join/leave message", err))
}
}
}
@@ -95,16 +95,16 @@ func (a *App) JoinDefaultChannels(teamId string, user *model.User, shouldBeAdmin
err = cmResult.Err
}
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(user.Id, offTopic.Id, model.GetMillis()); result.Err != nil {
- l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
+ mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}
if requestor == nil {
if err := a.postJoinChannelMessage(user, offTopic); err != nil {
- l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
+ mlog.Error(fmt.Sprint("Failed to post join/leave message", err))
}
} else {
if err := a.PostAddToChannelMessage(requestor, user, offTopic, ""); err != nil {
- l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
+ mlog.Error(fmt.Sprint("Failed to post join/leave message", err))
}
}
@@ -177,7 +177,7 @@ func (a *App) CreateChannel(channel *model.Channel, addMember bool) (*model.Chan
return nil, cmresult.Err
}
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(channel.CreatorId, sc.Id, model.GetMillis()); result.Err != nil {
- l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
+ mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}
a.InvalidateCacheForUser(channel.CreatorId)
@@ -230,10 +230,10 @@ func (a *App) createDirectChannel(userId string, otherUserId string) (*model.Cha
channel := result.Data.(*model.Channel)
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(userId, channel.Id, model.GetMillis()); result.Err != nil {
- l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
+ mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(otherUserId, channel.Id, model.GetMillis()); result.Err != nil {
- l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
+ mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}
return channel, nil
@@ -261,7 +261,7 @@ func (a *App) WaitForChannelMembership(channelId string, userId string) {
}
}
- l4g.Error("WaitForChannelMembership giving up channelId=%v userId=%v", channelId, userId)
+ mlog.Error(fmt.Sprintf("WaitForChannelMembership giving up channelId=%v userId=%v", channelId, userId), mlog.String("user_id", userId))
}
}
@@ -332,7 +332,7 @@ func (a *App) createGroupChannel(userIds []string, creatorId string) (*model.Cha
return nil, result.Err
}
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(user.Id, channel.Id, model.GetMillis()); result.Err != nil {
- l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
+ mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}
}
@@ -416,19 +416,19 @@ func (a *App) PatchChannel(channel *model.Channel, patch *model.ChannelPatch, us
if oldChannelDisplayName != channel.DisplayName {
if err := a.PostUpdateChannelDisplayNameMessage(userId, channel, oldChannelDisplayName, channel.DisplayName); err != nil {
- l4g.Error(err.Error())
+ mlog.Error(err.Error())
}
}
if channel.Header != oldChannelHeader {
if err := a.PostUpdateChannelHeaderMessage(userId, channel, oldChannelHeader, channel.Header); err != nil {
- l4g.Error(err.Error())
+ mlog.Error(err.Error())
}
}
if channel.Purpose != oldChannelPurpose {
if err := a.PostUpdateChannelPurposeMessage(userId, channel, oldChannelPurpose, channel.Purpose); err != nil {
- l4g.Error(err.Error())
+ mlog.Error(err.Error())
}
}
@@ -600,21 +600,21 @@ func (a *App) DeleteChannel(channel *model.Channel, userId string) *model.AppErr
}
if _, err := a.CreatePost(post, channel, false); err != nil {
- l4g.Error(utils.T("api.channel.delete_channel.failed_post.error"), err)
+ mlog.Error(fmt.Sprintf("Failed to post archive message %v", err))
}
}
now := model.GetMillis()
for _, hook := range incomingHooks {
if result := <-a.Srv.Store.Webhook().DeleteIncoming(hook.Id, now); result.Err != nil {
- l4g.Error(utils.T("api.channel.delete_channel.incoming_webhook.error"), hook.Id)
+ mlog.Error(fmt.Sprintf("Encountered error deleting incoming webhook, id=%v", hook.Id))
}
a.InvalidateCacheForWebhook(hook.Id)
}
for _, hook := range outgoingHooks {
if result := <-a.Srv.Store.Webhook().DeleteOutgoing(hook.Id, now); result.Err != nil {
- l4g.Error(utils.T("api.channel.delete_channel.outgoing_webhook.error"), hook.Id)
+ mlog.Error(fmt.Sprintf("Encountered error deleting outgoing webhook, id=%v", hook.Id))
}
}
@@ -658,13 +658,13 @@ func (a *App) addUserToChannel(user *model.User, channel *model.Channel, teamMem
SchemeUser: true,
}
if result := <-a.Srv.Store.Channel().SaveMember(newMember); result.Err != nil {
- l4g.Error("Failed to add member user_id=%v channel_id=%v err=%v", user.Id, channel.Id, result.Err)
+ mlog.Error(fmt.Sprintf("Failed to add member user_id=%v channel_id=%v err=%v", user.Id, channel.Id, result.Err), mlog.String("user_id", user.Id))
return nil, model.NewAppError("AddUserToChannel", "api.channel.add_user.to.channel.failed.app_error", nil, "", http.StatusInternalServerError)
}
a.WaitForChannelMembership(channel.Id, user.Id)
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(user.Id, channel.Id, model.GetMillis()); result.Err != nil {
- l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
+ mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}
a.InvalidateCacheForUser(user.Id)
@@ -1513,10 +1513,10 @@ func (a *App) GetDirectChannel(userId1, userId2 string) (*model.Channel, *model.
channel := result.Data.(*model.Channel)
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(userId1, channel.Id, model.GetMillis()); result.Err != nil {
- l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
+ mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}
if result := <-a.Srv.Store.ChannelMemberHistory().LogJoinEvent(userId2, channel.Id, model.GetMillis()); result.Err != nil {
- l4g.Warn("Failed to update ChannelMemberHistory table %v", result.Err)
+ mlog.Warn(fmt.Sprintf("Failed to update ChannelMemberHistory table %v", result.Err))
}
return channel, nil