Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes /welcomebot preview teamname command not working. #74

Merged
merged 4 commits into from
Aug 19, 2021
Merged
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
8 changes: 4 additions & 4 deletions server/welcomebot.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (p *Plugin) getSiteURL() string {
return *config.ServiceSettings.SiteURL
}

func (p *Plugin) newSampleMessageTemplate(teamName, userID string) (*MessageTemplate, error) {
func (p *Plugin) newSampleMessageTemplate(teamName string, userID string) (*MessageTemplate, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit pick: Unrelated change

data := &MessageTemplate{}
var err *model.AppError

Expand All @@ -66,14 +66,14 @@ func (p *Plugin) newSampleMessageTemplate(teamName, userID string) (*MessageTemp
return nil, fmt.Errorf("failed to query user %s: %w", userID, err)
}

if data.Team, err = p.API.GetTeamByName(teamName); err != nil {
if data.Team, err = p.API.GetTeamByName(strings.ToLower(teamName)); err != nil {
p.API.LogError("failed to query team", "team_name", teamName, "err", err)
return nil, fmt.Errorf("failed to query team %s: %w", teamName, err)
}

if data.Townsquare, err = p.API.GetChannelByName(data.Team.Id, "town-square", false); err != nil {
p.API.LogError("failed to query town-square", "team_name", teamName)
return nil, fmt.Errorf("failed to query town-square %s: %w", teamName, err)
p.API.LogError("failed to query town-square", "team_name", data.Team.Name)
return nil, fmt.Errorf("failed to query town-square %s: %w", data.Team.Name, err)
}

if data.DirectMessage, err = p.API.GetDirectChannel(data.User.Id, p.botUserID); err != nil {
Expand Down