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

hotfix: panic due to location object #239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"strings"
"time"

"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/plugin"
Expand Down Expand Up @@ -31,7 +32,7 @@ func (p *Plugin) ExecuteCommand(c *plugin.Context, args *model.CommandArgs) (*mo
}

T, locale := p.translation(user)
location := p.location(user)
location, _ := time.LoadLocation(p.location(user).String())
command := strings.Trim(args.Command, " ")

if strings.Trim(command, " ") == "/"+CommandTrigger {
Expand Down
4 changes: 2 additions & 2 deletions server/occurrence.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ func (p *Plugin) at(when string, user *model.User) (times []time.Time, err error

func (p *Plugin) atEN(when string, user *model.User) (times []time.Time, err error) {
T, _ := p.translation(user)
location := p.location(user)
location, _ := time.LoadLocation(p.location(user).String())

whenTrim := strings.Trim(when, " ")
whenSplit := strings.Split(whenTrim, " ")
Expand Down Expand Up @@ -1254,7 +1254,7 @@ func (p *Plugin) formatWhenEN(username string, when string, occurrence string, s
return ""
}
T, _ := p.translation(user)
location := p.location(user)
location, _ := time.LoadLocation(p.location(user).String())
now := time.Now().In(location)
t, _ := time.Parse(time.RFC3339, occurrence)

Expand Down
2 changes: 1 addition & 1 deletion server/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (p *Plugin) ScheduleReminder(request *ReminderRequest, channelId string) (*
return nil, uErr
}
T, _ := p.translation(user)
location := p.location(user)
location, _ := time.LoadLocation(p.location(user).String())

if pErr := p.ParseRequest(request); pErr != nil {
p.API.LogError(pErr.Error())
Expand Down