-
Notifications
You must be signed in to change notification settings - Fork 25
feat: remove team member #136
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
Conversation
✅ Deploy Preview for hoppdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR mate.
Some minor nits, that I fixed.
I can also see that updateSubscriptionQuantity
was un-exported, but turns out we will need to use it in the handlers so exported it.
backend/internal/email/email.go
Outdated
htmlBody := string(templateBytes) | ||
htmlBody = strings.Replace(htmlBody, "{first_name}", user.FirstName, -1) | ||
htmlBody = strings.Replace(htmlBody, "{old_team_name}", oldTeamName, -1) | ||
htmlBody = strings.Replace(htmlBody, "{new_team_name}", newTeamName, -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Recently I learned this is a good use case for strings.Replacer
backend/internal/email/email.go
Outdated
htmlBody = strings.Replace(htmlBody, "{old_team_name}", oldTeamName, -1) | ||
htmlBody = strings.Replace(htmlBody, "{new_team_name}", newTeamName, -1) | ||
|
||
subject := fmt.Sprintf("You've been removed from %s", oldTeamName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could prefix the subject line with Hopp
so folks will know who this message comes from immediately
if !user.IsAdmin { | ||
return echo.NewHTTPError(http.StatusForbidden, "admin required") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: those checks are preferable to be highest priority, as you avoid doing any roundtrips to the DB. Fail fast type of thing.
Notes
closes #135