From a0f75cadb2b0fa91f6e321b1b8b859519b2ec865 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Mon, 1 Oct 2018 13:51:12 +0100 Subject: MM-12110: Don't /invite or /kick deactivated users. (#9494) --- app/command_remove_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/command_remove_test.go') diff --git a/app/command_remove_test.go b/app/command_remove_test.go index f17a70bad..66257f563 100644 --- a/app/command_remove_test.go +++ b/app/command_remove_test.go @@ -106,4 +106,19 @@ func TestRemoveProviderDoCommand(t *testing.T) { actual = rp.DoCommand(th.App, args, user1.Username).Text assert.Equal(t, "api.command_remove.direct_group.app_error", actual) + + // Try a public channel with a deactivated user. + deactivatedUser := th.CreateUser() + th.App.AddUserToTeam(th.BasicTeam.Id, deactivatedUser.Id, deactivatedUser.Id) + th.App.AddUserToChannel(deactivatedUser, publicChannel) + th.App.UpdateActive(deactivatedUser, false) + + args = &model.CommandArgs{ + T: func(s string, args ...interface{}) string { return s }, + ChannelId: publicChannel.Id, + Session: model.Session{UserId: th.BasicUser.Id, TeamMembers: []*model.TeamMember{{TeamId: th.BasicTeam.Id, Roles: ""}}}, + } + + actual = rp.DoCommand(th.App, args, deactivatedUser.Username).Text + assert.Equal(t, "api.command_remove.missing.app_error", actual) } -- cgit v1.2.3-1-g7c22