Open platform to collect and prioritize feedback
chore: change 'e-mail' to 'email' (#265)
Guilherme Oenning81a6118e1789
diff --git a/app/actions/user.go b/app/actions/user.goindex 980076af3..a495485c9 100644--- a/app/actions/user.go+++ b/app/actions/user.go@@ -47,7 +47,7 @@ func (input *ChangeUserRole) Validate(user *models.User, services *app.Services)return result}-//ChangeUserEmail is the action used to change current user's e-mail+//ChangeUserEmail is the action used to change current user's emailtype ChangeUserEmail struct {Model *models.ChangeUserEmail}@@ -79,7 +79,7 @@ func (input *ChangeUserEmail) Validate(user *models.User, services *app.Services}if user.Email == input.Model.Email {- result.AddFieldFailure("email", "Choose a different e-mail.")+ result.AddFieldFailure("email", "Choose a different email.")return result}@@ -94,7 +94,7 @@ func (input *ChangeUserEmail) Validate(user *models.User, services *app.Servicesreturn validate.Error(err)}if err == nil && existing.ID != user.ID {- result.AddFieldFailure("email", "This e-mail is already in use by someone else")+ result.AddFieldFailure("email", "This email is already in use by someone else")return result}input.Model.Requestor = userdiff --git a/app/handlers/settings.go b/app/handlers/settings.goindex ea0b730de..c84286a74 100644--- a/app/handlers/settings.go+++ b/app/handlers/settings.go@@ -11,7 +11,7 @@ import ("github.com/getfider/fider/app/pkg/web")-// ChangeUserEmail register the intent of changing user e-mail+// ChangeUserEmail register the intent of changing user emailfunc ChangeUserEmail() web.HandlerFunc {return func(c web.Context) error {input := new(actions.ChangeUserEmail)diff --git a/app/handlers/signin.go b/app/handlers/signin.goindex 7c8aeb948..364ff7d18 100644--- a/app/handlers/signin.go+++ b/app/handlers/signin.go@@ -131,7 +131,7 @@ func SignIn(provider string) web.HandlerFunc {}}-// SignInByEmail sends a new e-mail with verification key+// SignInByEmail sends a new email with verification keyfunc SignInByEmail() web.HandlerFunc {return func(c web.Context) error {input := new(actions.SignInByEmail)diff --git a/app/models/feedback.go b/app/models/feedback.goindex ead153174..ec7a0ad82 100644--- a/app/models/feedback.go+++ b/app/models/feedback.go@@ -165,7 +165,7 @@ type NotificationChannel intvar (//NotificationChannelWeb is a in-app notificationNotificationChannelWeb NotificationChannel = 1- //NotificationChannelEmail is an e-mail notification+ //NotificationChannelEmail is an email notificationNotificationChannelEmail NotificationChannel = 2)diff --git a/app/models/identity.go b/app/models/identity.goindex 71155bb00..57496f433 100644--- a/app/models/identity.go+++ b/app/models/identity.go@@ -20,7 +20,7 @@ type Tenant struct {var (//TenantActive is the default status for most tenantsTenantActive = 1- //TenantInactive is used for signup via e-mail that requires user confirmation+ //TenantInactive is used for signup via email that requires user confirmationTenantInactive = 2)@@ -46,15 +46,15 @@ const (RoleAdministrator Role = 3)-//EmailVerificationKind specifies which kind of process is being verified by e-mail+//EmailVerificationKind specifies which kind of process is being verified by emailtype EmailVerificationKind int16const (- //EmailVerificationKindSignIn is the sign in by e-mail process+ //EmailVerificationKindSignIn is the sign in by email processEmailVerificationKindSignIn EmailVerificationKind = 1- //EmailVerificationKindSignUp is the sign up (create tenant) by name and e-mail process+ //EmailVerificationKindSignUp is the sign up (create tenant) by name and email processEmailVerificationKindSignUp EmailVerificationKind = 2- //EmailVerificationKindChangeEmail is the change user e-mail process+ //EmailVerificationKindChangeEmail is the change user email processEmailVerificationKindChangeEmail EmailVerificationKind = 3)@@ -167,7 +167,7 @@ func (e *SignInByEmail) GetKind() EmailVerificationKind {return EmailVerificationKindSignIn}-//ChangeUserEmail is the input model used to change current user's e-mail+//ChangeUserEmail is the input model used to change current user's emailtype ChangeUserEmail struct {Email string `json:"email" format:"lower"`VerificationKey string@@ -194,7 +194,7 @@ func (e *ChangeUserEmail) GetKind() EmailVerificationKind {return EmailVerificationKindChangeEmail}-//NewEmailVerification is used to register a new e-mail verification process+//NewEmailVerification is used to register a new email verification processtype NewEmailVerification interface {GetEmail() stringGetName() string@@ -202,7 +202,7 @@ type NewEmailVerification interface {GetKind() EmailVerificationKind}-//EmailVerification is the model used by e-mail verification process+//EmailVerification is the model used by email verification processtype EmailVerification struct {Email stringName string@@ -214,7 +214,7 @@ type EmailVerification struct {VerifiedOn *time.Time}-// CompleteProfile is the model used to complete user profile during e-mail sign in+// CompleteProfile is the model used to complete user profile during email sign intype CompleteProfile struct {Key string `json:"key"`Name string `json:"name"`diff --git a/app/pkg/email/email.go b/app/pkg/email/email.goindex 85be2218d..cc9092e8e 100644--- a/app/pkg/email/email.go+++ b/app/pkg/email/email.go@@ -11,7 +11,7 @@ import (var cache = make(map[string]*template.Template, 0)-// Params used to replace variables on e-mails+// Params used to replace variables on emailstype Params map[string]interface{}// Merge given params into current params@@ -22,13 +22,13 @@ func (p Params) Merge(p2 Params) Params {return p}-// Message represents what is sent by e-mail+// Message represents what is sent by emailtype Message struct {Subject stringBody string}-// RenderMessage returns the HTML of an e-mail based on template and params+// RenderMessage returns the HTML of an email based on template and paramsfunc RenderMessage(templateName string, params Params) *Message {tpl, ok := cache[templateName]if !ok || env.IsDevelopment() {@@ -53,7 +53,7 @@ func RenderMessage(templateName string, params Params) *Message {// NoReply is the default 'from' addressvar NoReply = env.MustGet("NOREPLY_EMAIL")-// Recipient contains details of who is receiving the e-mail+// Recipient contains details of who is receiving the emailtype Recipient struct {Name stringAddress string@@ -72,13 +72,13 @@ func NewRecipient(name, address string, params Params) Recipient {var whitelist = env.GetEnvOrDefault("EMAIL_WHITELIST", "")var whitelistRegex = regexp.MustCompile(whitelist)-// SetWhitelist can be used to change e-mail whitelist during rutime+// SetWhitelist can be used to change email whitelist during rutimefunc SetWhitelist(s string) {whitelist = swhitelistRegex = regexp.MustCompile(whitelist)}-// CanSendTo returns true if Fider is allowed to send e-mail to given address+// CanSendTo returns true if Fider is allowed to send email to given addressfunc CanSendTo(address string) bool {if strings.TrimSpace(address) == "" {return false@@ -89,13 +89,13 @@ func CanSendTo(address string) bool {return whitelistRegex.MatchString(address)}-// Sender is used to send e-mails+// Sender is used to send emailstype Sender interface {Send(templateName string, params Params, from string, to Recipient) errorBatchSend(templateName string, params Params, from string, to []Recipient) error}-// NoopSender does not send e-mails+// NoopSender does not send emailstype NoopSender struct {}@@ -104,13 +104,13 @@ func NewNoopSender() *NoopSender {return &NoopSender{}}-// Send an e-mail+// Send an emailfunc (s *NoopSender) Send(templateName string, params Params, from string, to Recipient) error {return nil}-// BatchSend an e-mail to multiple recipients+// BatchSend an email to multiple recipientsfunc (s *NoopSender) BatchSend(templateName string, params Params, from string, to []Recipient) error {return nil}diff --git a/app/pkg/email/mailgun/mailgun.go b/app/pkg/email/mailgun/mailgun.goindex d1b7a15ff..592fcf7fa 100644--- a/app/pkg/email/mailgun/mailgun.go+++ b/app/pkg/email/mailgun/mailgun.go@@ -13,24 +13,24 @@ import (var baseURL = "https://api.mailgun.net/v3/%s/messages"-//Sender is used to send e-mails+//Sender is used to send emailstype Sender struct {logger log.Loggerdomain stringapiKey string}-//NewSender creates a new mailgun e-mail sender+//NewSender creates a new mailgun email senderfunc NewSender(logger log.Logger, domain, apiKey string) *Sender {return &Sender{logger, domain, apiKey}}-//Send an e-mail+//Send an emailfunc (s *Sender) Send(templateName string, params email.Params, from string, to email.Recipient) error {return s.BatchSend(templateName, params, from, []email.Recipient{to})}-// BatchSend an e-mail to multiple recipients+// BatchSend an email to multiple recipientsfunc (s *Sender) BatchSend(templateName string, params email.Params, from string, to []email.Recipient) error {if len(to) == 0 {return nil@@ -61,7 +61,7 @@ func (s *Sender) BatchSend(templateName string, params email.Params, from stringform.Add("to", fmt.Sprintf("%s <%s>", r.Name, r.Address))recipientVariables[r.Address] = r.Params} else {- s.logger.Warnf("Skipping e-mail to '%s <%s>' due to whitelist.", r.Name, r.Address)+ s.logger.Warnf("Skipping email to '%s <%s>' due to whitelist.", r.Name, r.Address)}}@@ -80,9 +80,9 @@ func (s *Sender) BatchSend(templateName string, params email.Params, from string}if isBatch {- s.logger.Debugf("Sending e-mail to %d recipients with template %s.", len(recipientVariables), templateName)+ s.logger.Debugf("Sending email to %d recipients with template %s.", len(recipientVariables), templateName)} else {- s.logger.Debugf("Sending e-mail to %s with template %s.", to[0].Address, templateName)+ s.logger.Debugf("Sending email to %s with template %s.", to[0].Address, templateName)}url := fmt.Sprintf(baseURL, s.domain)@@ -96,7 +96,7 @@ func (s *Sender) BatchSend(templateName string, params email.Params, from stringresp, err := http.DefaultClient.Do(request)if err != nil {- s.logger.Errorf("Failed to send e-mail")+ s.logger.Errorf("Failed to send email")return err}s.logger.Debugf("E-mail sent with response code %d.", resp.StatusCode)diff --git a/app/pkg/email/smtp/smtp.go b/app/pkg/email/smtp/smtp.goindex 56804f245..e3bf628c3 100644--- a/app/pkg/email/smtp/smtp.go+++ b/app/pkg/email/smtp/smtp.go@@ -8,7 +8,7 @@ import ("github.com/getfider/fider/app/pkg/log")-//Sender is used to send e-mails+//Sender is used to send emailstype Sender struct {logger log.Loggerhost string@@ -17,19 +17,19 @@ type Sender struct {password string}-//NewSender creates a new mailgun e-mail sender+//NewSender creates a new mailgun email senderfunc NewSender(logger log.Logger, host, port, username, password string) *Sender {return &Sender{logger, host, port, username, password}}-//Send an e-mail+//Send an emailfunc (s *Sender) Send(templateName string, params email.Params, from string, to email.Recipient) error {if !email.CanSendTo(to.Address) {- s.logger.Warnf("Skipping e-mail to %s <%s> due to whitelist.", to.Name, to.Address)+ s.logger.Warnf("Skipping email to %s <%s> due to whitelist.", to.Name, to.Address)return nil}- s.logger.Debugf("Sending e-mail to %s with template %s and params %s.", to.Address, templateName, to.Params)+ s.logger.Debugf("Sending email to %s with template %s and params %s.", to.Address, templateName, to.Params)message := email.RenderMessage(templateName, params.Merge(to.Params))headers := make(map[string]string)@@ -49,14 +49,14 @@ func (s *Sender) Send(templateName string, params email.Params, from string, toauth := gosmtp.PlainAuth("", s.username, s.password, s.host)err := gosmtp.SendMail(servername, auth, email.NoReply, []string{to.Address}, []byte(body))if err != nil {- s.logger.Errorf("Failed to send e-mail")+ s.logger.Errorf("Failed to send email")return err}s.logger.Debugf("E-mail sent.")return nil}-// BatchSend an e-mail to multiple recipients+// BatchSend an email to multiple recipientsfunc (s *Sender) BatchSend(templateName string, params email.Params, from string, to []email.Recipient) error {for _, r := range to {if err := s.Send(templateName, params, from, r); err != nil {diff --git a/app/storage/inmemory/tenant.go b/app/storage/inmemory/tenant.goindex 10099a3c9..677cd794d 100644--- a/app/storage/inmemory/tenant.go+++ b/app/storage/inmemory/tenant.go@@ -101,7 +101,7 @@ func (s *TenantStorage) Activate(id int) error {return app.ErrNotFound}-// SaveVerificationKey used by e-mail verification+// SaveVerificationKey used by email verificationfunc (s *TenantStorage) SaveVerificationKey(key string, duration time.Duration, request models.NewEmailVerification) error {userID := 0if request.GetUser() != nil {diff --git a/app/storage/postgres/tenant.go b/app/storage/postgres/tenant.goindex ec435046b..3d7ac7fbf 100644--- a/app/storage/postgres/tenant.go+++ b/app/storage/postgres/tenant.go@@ -153,7 +153,7 @@ func (s *TenantStorage) Activate(id int) error {return s.trx.Execute(query, models.TenantActive, id)}-// SaveVerificationKey used by e-mail verification process+// SaveVerificationKey used by email verification processfunc (s *TenantStorage) SaveVerificationKey(key string, duration time.Duration, request models.NewEmailVerification) error {var userID interface{}if request.GetUser() != nil {diff --git a/app/tasks/tasks.go b/app/tasks/tasks.goindex 478d67ae4..070dadccd 100644--- a/app/tasks/tasks.go+++ b/app/tasks/tasks.go@@ -25,7 +25,7 @@ func linkWithText(text, baseURL, path string, args ...interface{}) template.HTML//SendSignUpEmail is used to send the sign up email to requestorfunc SendSignUpEmail(model *models.CreateTenant, baseURL string) worker.Task {- return describe("Send sign up e-mail", func(c *worker.Context) error {+ return describe("Send sign up email", func(c *worker.Context) error {to := email.NewRecipient(model.Name, model.Email, email.Params{"link": link(baseURL, "/signup/verify?k=%s", model.VerificationKey),})@@ -35,7 +35,7 @@ func SendSignUpEmail(model *models.CreateTenant, baseURL string) worker.Task {//SendSignInEmail is used to send the sign in email to requestorfunc SendSignInEmail(model *models.SignInByEmail) worker.Task {- return describe("Send sign in e-mail", func(c *worker.Context) error {+ return describe("Send sign in email", func(c *worker.Context) error {to := email.NewRecipient("", model.Email, email.Params{"tenantName": c.Tenant().Name,"link": link(c.BaseURL(), "/signin/verify?k=%s", model.VerificationKey),@@ -44,9 +44,9 @@ func SendSignInEmail(model *models.SignInByEmail) worker.Task {})}-//SendChangeEmailConfirmation is used to send the change e-mail confirmation e-mail to requestor+//SendChangeEmailConfirmation is used to send the change email confirmation email to requestorfunc SendChangeEmailConfirmation(model *models.ChangeUserEmail) worker.Task {- return describe("Send change e-mail confirmation", func(c *worker.Context) error {+ return describe("Send change email confirmation", func(c *worker.Context) error {previous := c.User().Emailif previous == "" {previous = "(empty)"@@ -62,7 +62,7 @@ func SendChangeEmailConfirmation(model *models.ChangeUserEmail) worker.Task {})}-//NotifyAboutNewIdea sends a notification (web and e-mail) to subscribers+//NotifyAboutNewIdea sends a notification (web and email) to subscribersfunc NotifyAboutNewIdea(idea *models.Idea) worker.Task {return describe("Notify about new idea", func(c *worker.Context) error {if env.GetEnvOrDefault("NOTIFICATIONS_ENABLED", "true") == "false" {@@ -93,7 +93,7 @@ func NotifyAboutNewIdea(idea *models.Idea) worker.Task {})}-//NotifyAboutNewComment sends a notification (web and e-mail) to subscribers+//NotifyAboutNewComment sends a notification (web and email) to subscribersfunc NotifyAboutNewComment(idea *models.Idea, comment *models.NewComment) worker.Task {return describe("Notify about new comment", func(c *worker.Context) error {if env.GetEnvOrDefault("NOTIFICATIONS_ENABLED", "true") == "false" {@@ -125,7 +125,7 @@ func NotifyAboutNewComment(idea *models.Idea, comment *models.NewComment) worker})}-//NotifyAboutStatusChange sends a notification (web and e-mail) to subscribers+//NotifyAboutStatusChange sends a notification (web and email) to subscribersfunc NotifyAboutStatusChange(idea *models.Idea, response *models.SetResponse) worker.Task {return describe("Notify about idea status change", func(c *worker.Context) error {if env.GetEnvOrDefault("NOTIFICATIONS_ENABLED", "true") == "false" {diff --git a/public/components/common/SignInControl.tsx b/public/components/common/SignInControl.tsxindex 6931324f6..7679cc167 100644--- a/public/components/common/SignInControl.tsx+++ b/public/components/common/SignInControl.tsx@@ -91,7 +91,7 @@ export class SignInControl extends React.Component<SignInControlProps, SignInCon}{ this.props.signInByEmail && <div>- <p>Enter your e-mail address to sign in</p>+ <p>Enter your email address to sign in</p><Form ref={(f) => { this.form = f!; }}><div id="email-signin" className="ui small action fluid input"><input onChange={(e) => this.setState({ email: e.currentTarget.value })} type="text" placeholder="[email protected]" className="small" />diff --git a/public/pages/site/UserSettingsPage/NotificationSettings.tsx b/public/pages/site/UserSettingsPage/NotificationSettings.tsxindex 31065e723..e6278951e 100644--- a/public/pages/site/UserSettingsPage/NotificationSettings.tsx+++ b/public/pages/site/UserSettingsPage/NotificationSettings.tsx@@ -64,9 +64,9 @@ export class NotificationSettings extends React.Component<NotificationSettingsPr} else if (webEnabled && !emailEnabled) {return <p className="info">You'll receive <strong>web</strong> notifications about {about}.</p>;} else if (!webEnabled && emailEnabled) {- return <p className="info">You'll receive <strong>e-mail</strong> notifications about {about}.</p>;+ return <p className="info">You'll receive <strong>email</strong> notifications about {about}.</p>;} else if (webEnabled && emailEnabled) {- return <p className="info">You'll receive <strong>web</strong> and <strong>e-mail</strong> notifications about {about}.</p>;+ return <p className="info">You'll receive <strong>web</strong> and <strong>email</strong> notifications about {about}.</p>;}return null;}diff --git a/public/pages/site/UserSettingsPage/UserSettingsPage.tsx b/public/pages/site/UserSettingsPage/UserSettingsPage.tsxindex e187f79a0..1aaedfc66 100644--- a/public/pages/site/UserSettingsPage/UserSettingsPage.tsx+++ b/public/pages/site/UserSettingsPage/UserSettingsPage.tsx@@ -57,10 +57,10 @@ export class UserSettingsPage extends React.Component<UserSettingsPageProps, Usereturn (<div className="page ui container"><div id="confirmation-modal" className="ui mini modal">- <div className="header">Confirm your new e-mail</div>+ <div className="header">Confirm your new email</div><div className="content"><div>- <p>We have just sent a confirmation link to <b>{this.state.newEmail}</b>. <br /> Click the link to update your e-mail.</p>+ <p>We have just sent a confirmation link to <b>{this.state.newEmail}</b>. <br /> Click the link to update your email.</p><p><a href="#" onClick={() => $('#confirmation-modal').modal('hide')}>OK</a></p></div></div>@@ -89,7 +89,7 @@ export class UserSettingsPage extends React.Component<UserSettingsPageProps, Use</div><DisplayError fields={['email']} error={this.state.error} /><div className="field">- <label htmlFor="email">E-mail <span className="info">Your e-mail is private and will never be displayed to anyone.</span></label>+ <label htmlFor="email">E-mail <span className="info">Your email is private and will never be displayed to anyone.</span></label>{this.state.changingEmail ?<>@@ -112,7 +112,7 @@ export class UserSettingsPage extends React.Component<UserSettingsPageProps, Use{this.props.user.email? <b>{this.props.user.email}</b>- : <span className="info">Your account doesn't have an e-mail.</span>+ : <span className="info">Your account doesn't have an email.</span>}<span className="ui info clickable" onClick={() => this.setState({ changingEmail: true })}>change</span></p>diff --git a/tests/testcases/email-signup.ts b/tests/testcases/email-signup.tsindex 59008cecd..9183757cb 100644--- a/tests/testcases/email-signup.ts+++ b/tests/testcases/email-signup.ts@@ -1,7 +1,7 @@import { ensure, elementIsVisible, mailgun, Browser } from '../lib';import { AllPages } from '../pages';-describe('Sign up by e-mail', () => {+describe('Sign up by email', () => {let browser: Browser;let pages: AllPages;@@ -14,7 +14,7 @@ describe('Sign up by e-mail', () => {await pages.dispose();});- it('User can sign up using e-mail', async () => {+ it('User can sign up using email', async () => {const now = new Date().getTime();// Actiondiff --git a/tests/testcases/signin.ts b/tests/testcases/signin.tsindex ccecaac4e..3b1a6c50b 100644--- a/tests/testcases/signin.ts+++ b/tests/testcases/signin.ts@@ -14,7 +14,7 @@ it('Can sign in with Google and support an idea', async () => {await ensure(await pages.home.IdeaList.at(0)).textIs('2');});-it('User can sign in using e-mail on existing tenant', async () => {+it('User can sign in using email on existing tenant', async () => {const now = new Date().getTime();// Actiondiff --git a/views/templates/change_emailaddress_email.tpl b/views/templates/change_emailaddress_email.tplindex 464ae8006..687aae7bb 100644--- a/views/templates/change_emailaddress_email.tpl+++ b/views/templates/change_emailaddress_email.tpl@@ -1,8 +1,8 @@-subject: Confirm your new e-mail+subject: Confirm your new emailbody:Hi {{ .name }},<br /><br />-Looks like you have requested to change your e-mail from {{ .oldEmail }} to {{ .newEmail }}.+Looks like you have requested to change your email from {{ .oldEmail }} to {{ .newEmail }}.<br />Click the link below to confirm this operation.<br /><br />diff --git a/views/templates/change_status.tpl b/views/templates/change_status.tplindex c2b6a5799..656a654e7 100644--- a/views/templates/change_status.tpl+++ b/views/templates/change_status.tpl@@ -11,6 +11,6 @@ body:<span style="color:#666;font-size:11px">— <br />-You are receiving this because you are subscribed to this thread. Please do not reply to this e-mail. <br />+You are receiving this because you are subscribed to this thread. Please do not reply to this email. <br />{{ .view }}, {{ .unsubscribe }} or {{ .change }}.</span>\ No newline at end of filediff --git a/views/templates/new_comment.tpl b/views/templates/new_comment.tplindex 7d89c7677..0e10a47a6 100644--- a/views/templates/new_comment.tpl+++ b/views/templates/new_comment.tpl@@ -4,6 +4,6 @@ body:<span style="color:#666;font-size:11px">— <br />-You are receiving this because you are subscribed to this thread. Please do not reply to this e-mail. <br />+You are receiving this because you are subscribed to this thread. Please do not reply to this email. <br />{{ .view }}, {{ .unsubscribe }} or {{ .change }}.</span>\ No newline at end of filediff --git a/views/templates/new_idea.tpl b/views/templates/new_idea.tplindex d73fc05b0..6438d849c 100644--- a/views/templates/new_idea.tpl+++ b/views/templates/new_idea.tpl@@ -4,6 +4,6 @@ body:<span style="color:#666;font-size:11px">— <br />-You are receiving this because you are subscribed to this event. Please do not reply to this e-mail. <br />+You are receiving this because you are subscribed to this event. Please do not reply to this email. <br />{{ .view }} or {{ .change }}.</span>\ No newline at end of file