From 8056f5a02b1289e0b4063e157ed35e9f53175e4c Mon Sep 17 00:00:00 2001 From: Ayush Thakur <100013900+ayusht2810@users.noreply.github.com> Date: Fri, 12 Jul 2024 13:29:06 +0530 Subject: [PATCH] Fix issue of settings command working for non-connected users (#384) --- server/command.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/command.go b/server/command.go index 2d6cdd60..350eac0d 100644 --- a/server/command.go +++ b/server/command.go @@ -261,6 +261,14 @@ func (p *Plugin) runHelpCommand(user *model.User) (string, error) { } func (p *Plugin) runSettingCommand(args *model.CommandArgs, params []string, user *model.User) (string, error) { + if _, authErr := p.authenticateAndFetchZoomUser(user); authErr != nil { + // the user state will be needed later while connecting the user to Zoom via OAuth + if appErr := p.storeOAuthUserState(user.Id, args.ChannelId, false); appErr != nil { + p.API.LogWarn("failed to store user state") + } + return authErr.Message, authErr.Err + } + if len(params) == 0 { if err := p.sendUserSettingForm(user.Id, args.ChannelId, args.RootId); err != nil { return "", err