()
| 168 | } |
| 169 | |
| 170 | func (emailService *EmailService) StoreEmails() (err error) { |
| 171 | activate := []string{"activate", "Welcome"} |
| 172 | activationLink := []string{"activationLink", "Activation link"} |
| 173 | forgotPassword := []string{"forgotPassword", "Forgot password"} |
| 174 | notification := []string{"notification", "Notification"} |
| 175 | for _, email := range [][]string{activate, activationLink, forgotPassword, notification} { |
| 176 | code := email[0] |
| 177 | title := email[1] |
| 178 | storedEmail, _ := loadEmail(code, "en") |
| 179 | if storedEmail.Code == "" { |
| 180 | template, _ := ioutil.ReadFile(fmt.Sprintf("./emails/%s.email.liquid", code)) |
| 181 | email := &models.Email{} |
| 182 | email.Body = string(template) |
| 183 | email.Code = code |
| 184 | email.Lang = "en" |
| 185 | email.Subject = fmt.Sprintf("[StarterSaaS] %s", title) |
| 186 | err = emailService.getCollection().Create(email) |
| 187 | } |
| 188 | } |
| 189 | return err |
| 190 | } |
no test coverage detected