Skip to content

Commit

Permalink
Merge pull request #8 from seansackowitz/onconfigchange
Browse files Browse the repository at this point in the history
Updated as a temporary fix for pr-mattermost-server-9405
  • Loading branch information
seansackowitz authored Sep 18, 2018
2 parents c2303bd + 194cfc5 commit 513cfbf
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 == "" {
Expand Down

0 comments on commit 513cfbf

Please sign in to comment.