From 194cfc577beffd075ee6077e854fa70a1219e82f Mon Sep 17 00:00:00 2001 From: Sean Sackowitz Date: Tue, 18 Sep 2018 09:32:46 -0400 Subject: [PATCH] Updated as a temporary fix for pr-mattermost-server-9405 --- server/plugin.go | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/server/plugin.go b/server/plugin.go index 2669f32e..b85d709a 100644 --- a/server/plugin.go +++ b/server/plugin.go @@ -22,17 +22,25 @@ type Plugin struct { JitsiURL string } -func (p *Plugin) OnActivate() error { - if err := p.IsConfigurationValid(); err != nil { - return err - } +// func (p *Plugin) OnActivate() error { +// if err := p.IsConfigurationValid(); err != nil { +// return err +// } - return nil -} +// return nil +// } + +// func (p *Plugin) OnConfigurationChange() error { +// if err := p.IsConfigurationValid(); err != nil { +// return err +// } + +// return nil +// } func (p *Plugin) IsConfigurationValid() error { if len(p.JitsiURL) == 0 { - return fmt.Errorf("Jitsi URL is not configured.") + return fmt.Errorf("Jitsi URL is not configured") } return nil } @@ -62,6 +70,11 @@ func encodeJitsiMeetingID(meeting string) string { } func (p *Plugin) handleStartMeeting(w http.ResponseWriter, r *http.Request) { + if err := p.IsConfigurationValid(); err != nil { + http.Error(w, err.Error(), http.StatusTeapot) + return + } + userId := r.Header.Get("Mattermost-User-Id") if userId == "" {