-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup usage of global logger (#26835)
- Loading branch information
Showing
45 changed files
with
221 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3534,30 +3534,30 @@ func TestInviteGuestsToTeam(t *testing.T) { | |
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.RestrictCreationToDomains = "@global.com,@common.com" }) | ||
|
||
t.Run("team domain restrictions should not affect inviting guests", func(t *testing.T) { | ||
err := th.App.InviteGuestsToChannels(th.BasicTeam.Id, &model.GuestsInvite{Emails: emailList, Channels: []string{th.BasicChannel.Id}, Message: "test message"}, th.BasicUser.Id) | ||
err := th.App.InviteGuestsToChannels(th.Context, th.BasicTeam.Id, &model.GuestsInvite{Emails: emailList, Channels: []string{th.BasicChannel.Id}, Message: "test message"}, th.BasicUser.Id) | ||
require.Nil(t, err, "guest user invites should not be affected by team restrictions") | ||
}) | ||
|
||
t.Run("guest restrictions should affect guest users", func(t *testing.T) { | ||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.RestrictCreationToDomains = "@guest.com" }) | ||
|
||
err := th.App.InviteGuestsToChannels(th.BasicTeam.Id, &model.GuestsInvite{Emails: []string{"[email protected]"}, Channels: []string{th.BasicChannel.Id}, Message: "test message"}, th.BasicUser.Id) | ||
err := th.App.InviteGuestsToChannels(th.Context, th.BasicTeam.Id, &model.GuestsInvite{Emails: []string{"[email protected]"}, Channels: []string{th.BasicChannel.Id}, Message: "test message"}, th.BasicUser.Id) | ||
require.NotNil(t, err, "guest user invites should be affected by the guest domain restrictions") | ||
|
||
res, err := th.App.InviteGuestsToChannelsGracefully(th.BasicTeam.Id, &model.GuestsInvite{Emails: []string{"[email protected]", "[email protected]"}, Channels: []string{th.BasicChannel.Id}, Message: "test message"}, th.BasicUser.Id) | ||
res, err := th.App.InviteGuestsToChannelsGracefully(th.Context, th.BasicTeam.Id, &model.GuestsInvite{Emails: []string{"[email protected]", "[email protected]"}, Channels: []string{th.BasicChannel.Id}, Message: "test message"}, th.BasicUser.Id) | ||
require.Nil(t, err) | ||
require.Len(t, res, 2) | ||
require.NotNil(t, res[0].Error) | ||
require.Nil(t, res[1].Error) | ||
|
||
err = th.App.InviteGuestsToChannels(th.BasicTeam.Id, &model.GuestsInvite{Emails: []string{"[email protected]"}, Channels: []string{th.BasicChannel.Id}, Message: "test message"}, th.BasicUser.Id) | ||
err = th.App.InviteGuestsToChannels(th.Context, th.BasicTeam.Id, &model.GuestsInvite{Emails: []string{"[email protected]"}, Channels: []string{th.BasicChannel.Id}, Message: "test message"}, th.BasicUser.Id) | ||
require.Nil(t, err, "whitelisted guest user email should be allowed by the guest domain restrictions") | ||
}) | ||
|
||
t.Run("guest restrictions should not affect inviting new team members", func(t *testing.T) { | ||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.RestrictCreationToDomains = "@guest.com" }) | ||
|
||
err := th.App.InviteNewUsersToTeam([]string{"[email protected]"}, th.BasicTeam.Id, th.BasicUser.Id) | ||
err := th.App.InviteNewUsersToTeam(th.Context, []string{"[email protected]"}, th.BasicTeam.Id, th.BasicUser.Id) | ||
require.Nil(t, err, "non guest user invites should not be affected by the guest domain restrictions") | ||
}) | ||
|
||
|
@@ -3576,12 +3576,12 @@ func TestInviteGuestsToTeam(t *testing.T) { | |
Channels: []string{th.BasicChannel.Id}, | ||
Message: "test message", | ||
} | ||
err = th.App.InviteGuestsToChannels(th.BasicTeam.Id, invite, th.BasicUser.Id) | ||
err = th.App.InviteGuestsToChannels(th.Context, th.BasicTeam.Id, invite, th.BasicUser.Id) | ||
require.NotNil(t, err) | ||
assert.Equal(t, "app.email.rate_limit_exceeded.app_error", err.Id) | ||
assert.Equal(t, http.StatusRequestEntityTooLarge, err.StatusCode) | ||
|
||
_, appErr := th.App.InviteGuestsToChannelsGracefully(th.BasicTeam.Id, invite, th.BasicUser.Id) | ||
_, appErr := th.App.InviteGuestsToChannelsGracefully(th.Context, th.BasicTeam.Id, invite, th.BasicUser.Id) | ||
require.NotNil(t, appErr) | ||
assert.Equal(t, "app.email.rate_limit_exceeded.app_error", err.Id) | ||
assert.Equal(t, http.StatusRequestEntityTooLarge, err.StatusCode) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.