Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Commit

Permalink
changed location of siteurl check
Browse files Browse the repository at this point in the history
  • Loading branch information
scottleedavis committed Jun 14, 2019
1 parent bebcdea commit 14c7b5d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 13 additions & 7 deletions server/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func (p *Plugin) OnActivate() error {
return err
}

p.ServerConfig = p.API.GetConfig()
if p.ServerConfig.ServiceSettings.SiteURL == nil {
return errors.New("siteURL is not set. Please set a siteURL and restart the plugin")
}

teams, err := p.API.GetTeams()
if err != nil {
return errors.Wrap(err, "failed to query teams OnActivate")
Expand All @@ -48,6 +53,7 @@ func (p *Plugin) OnActivate() error {
}
}

p.activated = true
p.Run()

return nil
Expand All @@ -68,17 +74,17 @@ func (p *Plugin) OnDeactivate() error {
}
}

p.activated = false

return nil
}

func (p *Plugin) OnConfigurationChange() error {
p.ServerConfig = p.API.GetConfig()
if p.ServerConfig.ServiceSettings.SiteURL == nil {
return errors.New("siteURL is not set. Please set a siteURL and restart the plugin")
}
p.URL = fmt.Sprintf("%s", *p.ServerConfig.ServiceSettings.SiteURL)
if err := p.TranslationsPreInit(); err != nil {
return errors.Wrap(err, "failed to initialize translations")
if p.activated {
p.URL = fmt.Sprintf("%s", *p.ServerConfig.ServiceSettings.SiteURL)
if err := p.TranslationsPreInit(); err != nil {
return errors.Wrap(err, "failed to initialize translations")
}
}
return nil
}
Expand Down
2 changes: 2 additions & 0 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type Plugin struct {

remindUserId string

activated bool

running bool

emptyTime time.Time
Expand Down

0 comments on commit 14c7b5d

Please sign in to comment.