diff --git a/api4/channel.go b/api4/channel.go index 920140311a..1dfafd394d 100644 --- a/api4/channel.go +++ b/api4/channel.go @@ -1182,7 +1182,7 @@ func addChannelMember(c *Context, w http.ResponseWriter, r *http.Request) { } } - cm, err := c.App.AddChannelMember(member.UserId, channel, c.App.Session.UserId, postRootId, c.App.Session.Id) + cm, err := c.App.AddChannelMember(member.UserId, channel, c.App.Session.UserId, postRootId) if err != nil { c.Err = err return diff --git a/app/channel.go b/app/channel.go index 363f279295..928514182d 100644 --- a/app/channel.go +++ b/app/channel.go @@ -915,7 +915,7 @@ func (a *App) AddUserToChannel(user *model.User, channel *model.Channel) (*model return newMember, nil } -func (a *App) AddChannelMember(userId string, channel *model.Channel, userRequestorId string, postRootId string, currentSessionId string) (*model.ChannelMember, *model.AppError) { +func (a *App) AddChannelMember(userId string, channel *model.Channel, userRequestorId string, postRootId string) (*model.ChannelMember, *model.AppError) { if member, err := a.Srv.Store.Channel().GetMember(channel.Id, userId); err != nil { if err.Id != store.MISSING_CHANNEL_MEMBER_ERROR { return nil, err @@ -970,10 +970,6 @@ func (a *App) AddChannelMember(userId string, channel *model.Channel, userReques }) } - if userRequestor != nil { - a.MarkChannelsAsViewed([]string{channel.Id}, userRequestor.Id, currentSessionId) - } - return cm, nil } diff --git a/app/channel_test.go b/app/channel_test.go index 9d0809eebe..09073bd6b6 100644 --- a/app/channel_test.go +++ b/app/channel_test.go @@ -438,7 +438,7 @@ func TestAddChannelMemberNoUserRequestor(t *testing.T) { channel := th.createChannel(th.BasicTeam, model.CHANNEL_OPEN) userRequestorId := "" postRootId := "" - if _, err := th.App.AddChannelMember(user.Id, channel, userRequestorId, postRootId, ""); err != nil { + if _, err := th.App.AddChannelMember(user.Id, channel, userRequestorId, postRootId); err != nil { t.Fatal("Failed to add user to channel. Error: " + err.Message) } @@ -738,7 +738,7 @@ func TestGetChannelMembersTimezones(t *testing.T) { userRequestorId := "" postRootId := "" - if _, err := th.App.AddChannelMember(th.BasicUser2.Id, th.BasicChannel, userRequestorId, postRootId, ""); err != nil { + if _, err := th.App.AddChannelMember(th.BasicUser2.Id, th.BasicChannel, userRequestorId, postRootId); err != nil { t.Fatal("Failed to add user to channel. Error: " + err.Message) } diff --git a/app/command_invite.go b/app/command_invite.go index 5a9745ddfc..d2574aec03 100644 --- a/app/command_invite.go +++ b/app/command_invite.go @@ -141,7 +141,7 @@ func (me *InviteProvider) DoCommand(a *App, args *model.CommandArgs, message str } } - if _, err := a.AddChannelMember(userProfile.Id, channelToJoin, args.Session.UserId, "", args.Session.Id); err != nil { + if _, err := a.AddChannelMember(userProfile.Id, channelToJoin, args.Session.UserId, ""); err != nil { return &model.CommandResponse{ Text: args.T("api.command_invite.fail.app_error"), ResponseType: model.COMMAND_RESPONSE_TYPE_EPHEMERAL, diff --git a/app/plugin_api.go b/app/plugin_api.go index 40344cc48f..7c0cbcc48d 100644 --- a/app/plugin_api.go +++ b/app/plugin_api.go @@ -392,7 +392,7 @@ func (api *PluginAPI) AddChannelMember(channelId, userId string) (*model.Channel return nil, err } - return api.app.AddChannelMember(userId, channel, userRequestorId, postRootId, "") + return api.app.AddChannelMember(userId, channel, userRequestorId, postRootId) } func (api *PluginAPI) GetChannelMember(channelId, userId string) (*model.ChannelMember, *model.AppError) { diff --git a/app/syncables.go b/app/syncables.go index 50d7a4f977..39512782c8 100644 --- a/app/syncables.go +++ b/app/syncables.go @@ -55,7 +55,7 @@ func (a *App) CreateDefaultMemberships(since int64) error { ) } - _, err = a.AddChannelMember(userChannel.UserID, channel, "", "", "") + _, err = a.AddChannelMember(userChannel.UserID, channel, "", "") if err != nil { return err } diff --git a/app/syncables_test.go b/app/syncables_test.go index cca329d4e1..c493b45d0e 100644 --- a/app/syncables_test.go +++ b/app/syncables_test.go @@ -257,7 +257,7 @@ func TestCreateDefaultMemberships(t *testing.T) { } // Ensure members are in channel - _, err = th.App.AddChannelMember(scientist1.Id, experimentsChannel, "", "", "") + _, err = th.App.AddChannelMember(scientist1.Id, experimentsChannel, "", "") if err != nil { t.Errorf("unable to add user to channel: %s", err.Error()) } @@ -267,7 +267,7 @@ func TestCreateDefaultMemberships(t *testing.T) { if err != nil { t.Errorf("unable to add user to team: %s", err.Error()) } - _, err = th.App.AddChannelMember(singer1.Id, experimentsChannel, "", "", "") + _, err = th.App.AddChannelMember(singer1.Id, experimentsChannel, "", "") if err != nil { t.Errorf("unable to add user to channel: %s", err.Error()) } @@ -341,7 +341,7 @@ func TestDeleteGroupMemberships(t *testing.T) { _, err = th.App.AddTeamMember(th.BasicTeam.Id, userID) require.Nil(t, err) - _, err = th.App.AddChannelMember(userID, th.BasicChannel, "", "", "") + _, err = th.App.AddChannelMember(userID, th.BasicChannel, "", "") require.Nil(t, err) }