mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Message is displayed when user joins Off_Topic (#4067)
This commit is contained in:
committed by
Joram Wilander
parent
6a59913609
commit
1479c4a2ca
@@ -211,7 +211,7 @@ func TestGetTeamAnalyticsStandard(t *testing.T) {
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
if rows[2].Value != 3 {
|
||||
if rows[2].Value != 5 {
|
||||
t.Log(rows.ToJson())
|
||||
t.Fatal()
|
||||
}
|
||||
|
||||
@@ -591,6 +591,14 @@ func JoinDefaultChannels(teamId string, user *model.User, channelRole string) *m
|
||||
|
||||
var err *model.AppError = nil
|
||||
|
||||
fakeContext := &Context{
|
||||
Session: model.Session{
|
||||
UserId: user.Id,
|
||||
},
|
||||
TeamId: teamId,
|
||||
T: utils.TfuncWithFallback(user.Locale),
|
||||
}
|
||||
|
||||
if result := <-Srv.Store.Channel().GetByName(teamId, "town-square"); result.Err != nil {
|
||||
err = result.Err
|
||||
} else {
|
||||
@@ -608,14 +616,6 @@ func JoinDefaultChannels(teamId string, user *model.User, channelRole string) *m
|
||||
UserId: user.Id,
|
||||
}
|
||||
|
||||
fakeContext := &Context{
|
||||
Session: model.Session{
|
||||
UserId: user.Id,
|
||||
},
|
||||
TeamId: teamId,
|
||||
T: utils.TfuncWithFallback(user.Locale),
|
||||
}
|
||||
|
||||
if _, err := CreatePost(fakeContext, post, false); err != nil {
|
||||
l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
|
||||
}
|
||||
@@ -630,6 +630,17 @@ func JoinDefaultChannels(teamId string, user *model.User, channelRole string) *m
|
||||
if cmResult := <-Srv.Store.Channel().SaveMember(cm); cmResult.Err != nil {
|
||||
err = cmResult.Err
|
||||
}
|
||||
|
||||
post := &model.Post{
|
||||
ChannelId: result.Data.(*model.Channel).Id,
|
||||
Message: fmt.Sprintf(utils.T("api.channel.join_channel.post_and_forget"), user.Username),
|
||||
Type: model.POST_JOIN_LEAVE,
|
||||
UserId: user.Id,
|
||||
}
|
||||
|
||||
if _, err := CreatePost(fakeContext, post, false); err != nil {
|
||||
l4g.Error(utils.T("api.channel.post_user_add_remove_message_and_forget.error"), err)
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user