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

Commit

Permalink
clarified URL name vs. siteURL
Browse files Browse the repository at this point in the history
  • Loading branch information
scottleedavis committed May 5, 2019
1 parent f5926b3 commit 0f20849
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion server/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (p *Plugin) OnActivate() error {
p.emptyTime = time.Time{}.AddDate(1, 1, 1)
p.supportedLocales = []string{"en"}
p.ServerConfig = p.API.GetConfig()
p.siteURL = "http://127.0.0.1" + fmt.Sprintf("%s", *p.ServerConfig.ServiceSettings.ListenAddress)
p.URL = "http://127.0.0.1" + fmt.Sprintf("%s", *p.ServerConfig.ServiceSettings.ListenAddress)

p.Run()

Expand Down
4 changes: 2 additions & 2 deletions server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (p *Plugin) handleDialog(w http.ResponseWriter, req *http.Request) {
"occurrence_id": r.Reminder.Occurrences[0].Id,
"action": "delete/ephemeral",
},
URL: fmt.Sprintf("%s/plugins/%s/delete/ephemeral", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/delete/ephemeral", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.delete"),
Expand All @@ -156,7 +156,7 @@ func (p *Plugin) handleDialog(w http.ResponseWriter, req *http.Request) {
"occurrence_id": r.Reminder.Occurrences[0].Id,
"action": "view/ephemeral",
},
URL: fmt.Sprintf("%s/plugins/%s/view/ephemeral", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/view/ephemeral", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.view.reminders"),
Expand Down
38 changes: 19 additions & 19 deletions server/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ func (p *Plugin) listControl(

T, _ := p.translation(user)

if p.siteURL == "" {
p.API.LogError("SiteURL not set.")
if p.URL == "" {
p.API.LogError("URL not set.")
return []*model.SlackAttachment{}
}
reminderCount := map[string]interface{}{
Expand Down Expand Up @@ -280,7 +280,7 @@ func (p *Plugin) listControl(
"action": "next/reminders",
"offset": endOffset + 1,
},
URL: fmt.Sprintf("%s/plugins/%s/next/reminders", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/next/reminders", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.next.reminders", reminderCount),
Expand All @@ -295,7 +295,7 @@ func (p *Plugin) listControl(
"action": "previous/reminders",
"offset": offset - RemindersPerPage,
},
URL: fmt.Sprintf("%s/plugins/%s/next/reminders", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/next/reminders", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.previous.reminders", reminderCount),
Expand All @@ -310,7 +310,7 @@ func (p *Plugin) listControl(
"action": "previous/reminders",
"offset": offset - RemindersPerPage,
},
URL: fmt.Sprintf("%s/plugins/%s/next/reminders", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/next/reminders", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.previous.reminders", reminderCount),
Expand All @@ -322,7 +322,7 @@ func (p *Plugin) listControl(
"action": "next/reminders",
"offset": endOffset + 1,
},
URL: fmt.Sprintf("%s/plugins/%s/next/reminders", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/next/reminders", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.next.reminders", reminderCount),
Expand All @@ -340,7 +340,7 @@ func (p *Plugin) listControl(
Context: model.StringInterface{
"action": "view/complete/list",
},
URL: fmt.Sprintf("%s/plugins/%s/view/complete/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/view/complete/list", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.view.complete"),
Expand All @@ -352,7 +352,7 @@ func (p *Plugin) listControl(
Context: model.StringInterface{
"action": "delete/complete/list",
},
URL: fmt.Sprintf("%s/plugins/%s/delete/complete/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/delete/complete/list", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.delete.complete"),
Expand All @@ -366,7 +366,7 @@ func (p *Plugin) listControl(
Context: model.StringInterface{
"action": "close/list",
},
URL: fmt.Sprintf("%s/plugins/%s/close/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/close/list", p.URL, manifest.Id),
},
Name: T("button.close.list"),
Type: "action",
Expand All @@ -383,8 +383,8 @@ func (p *Plugin) addAttachment(user *model.User, occurrence Occurrence, reminder
location := p.location(user)
T, _ := p.translation(user)

if p.siteURL == "" {
p.API.LogError("SiteURL not set.")
if p.URL == "" {
p.API.LogError("URL not set.")
return &model.SlackAttachment{}
}
reminder := p.findReminder(reminders, occurrence)
Expand Down Expand Up @@ -424,7 +424,7 @@ func (p *Plugin) addAttachment(user *model.User, occurrence Occurrence, reminder
"occurrence_id": occurrence.Id,
"action": "complete/list",
},
URL: fmt.Sprintf("%s/plugins/%s/complete/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/complete/list", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.complete"),
Expand All @@ -436,7 +436,7 @@ func (p *Plugin) addAttachment(user *model.User, occurrence Occurrence, reminder
"occurrence_id": occurrence.Id,
"action": "delete/list",
},
URL: fmt.Sprintf("%s/plugins/%s/delete/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/delete/list", p.URL, manifest.Id),
},
Name: T("button.delete"),
Type: model.POST_ACTION_TYPE_BUTTON,
Expand All @@ -460,7 +460,7 @@ func (p *Plugin) addAttachment(user *model.User, occurrence Occurrence, reminder
"occurrence_id": occurrence.Id,
"action": "delete/list",
},
URL: fmt.Sprintf("%s/plugins/%s/delete/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/delete/list", p.URL, manifest.Id),
},
Name: T("button.delete"),
Type: model.POST_ACTION_TYPE_BUTTON,
Expand All @@ -484,7 +484,7 @@ func (p *Plugin) addAttachment(user *model.User, occurrence Occurrence, reminder
"occurrence_id": occurrence.Id,
"action": "complete/list",
},
URL: fmt.Sprintf("%s/plugins/%s/complete/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/complete/list", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.complete"),
Expand All @@ -496,7 +496,7 @@ func (p *Plugin) addAttachment(user *model.User, occurrence Occurrence, reminder
"occurrence_id": occurrence.Id,
"action": "delete/list",
},
URL: fmt.Sprintf("%s/plugins/%s/delete/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/delete/list", p.URL, manifest.Id),
},
Name: T("button.delete"),
Type: model.POST_ACTION_TYPE_BUTTON,
Expand All @@ -508,7 +508,7 @@ func (p *Plugin) addAttachment(user *model.User, occurrence Occurrence, reminder
"occurrence_id": occurrence.Id,
"action": "snooze/list",
},
URL: fmt.Sprintf("%s/plugins/%s/snooze/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/snooze/list", p.URL, manifest.Id),
},
Name: T("button.snooze"),
Type: "select",
Expand Down Expand Up @@ -554,7 +554,7 @@ func (p *Plugin) addAttachment(user *model.User, occurrence Occurrence, reminder
"occurrence_id": occurrence.Id,
"action": "complete/list",
},
URL: fmt.Sprintf("%s/plugins/%s/complete/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/complete/list", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.complete"),
Expand All @@ -566,7 +566,7 @@ func (p *Plugin) addAttachment(user *model.User, occurrence Occurrence, reminder
"occurrence_id": occurrence.Id,
"action": "delete/list",
},
URL: fmt.Sprintf("%s/plugins/%s/delete/list", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/delete/list", p.URL, manifest.Id),
},
Name: T("button.delete"),
Type: model.POST_ACTION_TYPE_BUTTON,
Expand Down
2 changes: 1 addition & 1 deletion server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Plugin struct {

ServerConfig *model.Config

siteURL string
URL string

remindUserId string

Expand Down
12 changes: 6 additions & 6 deletions server/reminder.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func (p *Plugin) TriggerReminders() {
"Message": reminder.Message,
}

if p.siteURL == "" {
p.API.LogError("SiteURL not set.")
if p.URL == "" {
p.API.LogError("URL not set.")
return
}

Expand All @@ -140,7 +140,7 @@ func (p *Plugin) TriggerReminders() {
"occurrence_id": occurrence.Id,
"action": "complete",
},
URL: fmt.Sprintf("%s/plugins/%s/complete", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/complete", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.complete"),
Expand All @@ -152,7 +152,7 @@ func (p *Plugin) TriggerReminders() {
"occurrence_id": occurrence.Id,
"action": "delete",
},
URL: fmt.Sprintf("%s/plugins/%s/delete", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/delete", p.URL, manifest.Id),
},
Name: T("button.delete"),
Type: "action",
Expand All @@ -164,7 +164,7 @@ func (p *Plugin) TriggerReminders() {
"occurrence_id": occurrence.Id,
"action": "snooze",
},
URL: fmt.Sprintf("%s/plugins/%s/snooze", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/snooze", p.URL, manifest.Id),
},
Name: T("button.snooze"),
Type: "select",
Expand Down Expand Up @@ -215,7 +215,7 @@ func (p *Plugin) TriggerReminders() {
"occurrence_id": occurrence.Id,
"action": "snooze",
},
URL: fmt.Sprintf("%s/plugins/%s/snooze", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/snooze", p.URL, manifest.Id),
},
Name: T("button.snooze"),
Type: "select",
Expand Down
6 changes: 3 additions & 3 deletions server/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (p *Plugin) ScheduleReminder(request *ReminderRequest, channelId string) (*
"occurrence_id": request.Reminder.Occurrences[0].Id,
"action": "delete/ephemeral",
},
URL: fmt.Sprintf("%s/plugins/%s/delete/ephemeral", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/delete/ephemeral", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.delete"),
Expand All @@ -98,7 +98,7 @@ func (p *Plugin) ScheduleReminder(request *ReminderRequest, channelId string) (*
"occurrence_id": request.Reminder.Occurrences[0].Id,
"action": "view/ephemeral",
},
URL: fmt.Sprintf("%s/plugins/%s/view/ephemeral", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/view/ephemeral", p.URL, manifest.Id),
},
Type: model.POST_ACTION_TYPE_BUTTON,
Name: T("button.view.reminders"),
Expand All @@ -117,7 +117,7 @@ func (p *Plugin) InteractiveSchedule(triggerId string, user *model.User) {

dialogRequest := model.OpenDialogRequest{
TriggerId: triggerId,
URL: fmt.Sprintf("%s/plugins/%s/dialog", p.siteURL, manifest.Id),
URL: fmt.Sprintf("%s/plugins/%s/dialog", p.URL, manifest.Id),
Dialog: model.Dialog{
Title: T("schedule.reminder"),
CallbackId: model.NewId(),
Expand Down

0 comments on commit 0f20849

Please sign in to comment.