Fix typos

This commit is contained in:
Yatish Mehta 2022-02-12 23:37:00 -08:00
parent 0ecfb89f19
commit 6c903239dd
9 changed files with 16 additions and 16 deletions

View file

@ -684,7 +684,7 @@ func handleGetCampaignViewAnalytics(c echo.Context) error {
return c.JSON(http.StatusOK, okResp{out}) return c.JSON(http.StatusOK, okResp{out})
} }
// sendTestMessage takes a campaign and a subsriber and sends out a sample campaign message. // sendTestMessage takes a campaign and a subscriber and sends out a sample campaign message.
func sendTestMessage(sub models.Subscriber, camp *models.Campaign, app *App) error { func sendTestMessage(sub models.Subscriber, camp *models.Campaign, app *App) error {
if err := camp.CompileTemplate(app.manager.TemplateFuncs(camp)); err != nil { if err := camp.CompileTemplate(app.manager.TemplateFuncs(camp)); err != nil {
app.log.Printf("error compiling template: %v", err) app.log.Printf("error compiling template: %v", err)

View file

@ -22,7 +22,7 @@ func handleImportSubscribers(c echo.Context) error {
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("import.alreadyRunning")) return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("import.alreadyRunning"))
} }
// Unmarsal the JSON params. // Unmarshal the JSON params.
var opt subimporter.SessionOpt var opt subimporter.SessionOpt
if err := json.Unmarshal([]byte(c.FormValue("params")), &opt); err != nil { if err := json.Unmarshal([]byte(c.FormValue("params")), &opt); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, return echo.NewHTTPError(http.StatusBadRequest,
@ -95,7 +95,7 @@ func handleImportSubscribers(c echo.Context) error {
// keeping the global import state (failed / successful) etc. across // keeping the global import state (failed / successful) etc. across
// multiple files becomes complex. Instead, it's just easier for the // multiple files becomes complex. Instead, it's just easier for the
// end user to concat multiple CSVs (if there are multiple in the first) // end user to concat multiple CSVs (if there are multiple in the first)
// place and uploada as one in the first place. // place and upload as one in the first place.
dir, files, err := impSess.ExtractZIP(out.Name(), 1) dir, files, err := impSess.ExtractZIP(out.Name(), 1)
if err != nil { if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, return echo.NewHTTPError(http.StatusInternalServerError,

View file

@ -104,7 +104,7 @@ func initFlags() {
f.StringSlice("config", []string{"config.toml"}, f.StringSlice("config", []string{"config.toml"},
"path to one or more config files (will be merged in order)") "path to one or more config files (will be merged in order)")
f.Bool("install", false, "setup database (first time)") f.Bool("install", false, "setup database (first time)")
f.Bool("idempotent", false, "make --install run only if the databse isn't already setup") f.Bool("idempotent", false, "make --install run only if the database isn't already setup")
f.Bool("upgrade", false, "upgrade database to the current version") f.Bool("upgrade", false, "upgrade database to the current version")
f.Bool("version", false, "show current version of the build") f.Bool("version", false, "show current version of the build")
f.Bool("new-config", false, "generate sample config file") f.Bool("new-config", false, "generate sample config file")
@ -129,13 +129,13 @@ func initConfigFiles(files []string, ko *koanf.Koanf) {
if os.IsNotExist(err) { if os.IsNotExist(err) {
lo.Fatal("config file not found. If there isn't one yet, run --new-config to generate one.") lo.Fatal("config file not found. If there isn't one yet, run --new-config to generate one.")
} }
lo.Fatalf("error loadng config from file: %v.", err) lo.Fatalf("error loading config from file: %v.", err)
} }
} }
} }
// initFileSystem initializes the stuffbin FileSystem to provide // initFileSystem initializes the stuffbin FileSystem to provide
// access to bunded static assets to the app. // access to bundled static assets to the app.
func initFS(appDir, frontendDir, staticDir, i18nDir string) stuffbin.FileSystem { func initFS(appDir, frontendDir, staticDir, i18nDir string) stuffbin.FileSystem {
var ( var (
// stuffbin real_path:virtual_alias paths to map local assets on disk // stuffbin real_path:virtual_alias paths to map local assets on disk
@ -429,7 +429,7 @@ func initSMTPMessenger(m *manager.Manager) messenger.Messenger {
lo.Fatalf("no SMTP servers found in config") lo.Fatalf("no SMTP servers found in config")
} }
// Load the config for multipme SMTP servers. // Load the config for multiple SMTP servers.
for _, item := range items { for _, item := range items {
if !item.Bool("enabled") { if !item.Bool("enabled") {
continue continue

View file

@ -167,7 +167,7 @@ func handleUpdateSettings(c echo.Context) error {
has = true has = true
} }
// Assign a UUID. The frontend only sends a password when the user explictly // Assign a UUID. The frontend only sends a password when the user explicitly
// changes the password. In other cases, the existing password in the DB // changes the password. In other cases, the existing password in the DB
// is copied while updating the settings and the UUID is used to match // is copied while updating the settings and the UUID is used to match
// the incoming array of SMTP blocks with the array in the DB. // the incoming array of SMTP blocks with the array in the DB.
@ -191,7 +191,7 @@ func handleUpdateSettings(c echo.Context) error {
// Bounce boxes. // Bounce boxes.
for i, s := range set.BounceBoxes { for i, s := range set.BounceBoxes {
// Assign a UUID. The frontend only sends a password when the user explictly // Assign a UUID. The frontend only sends a password when the user explicitly
// changes the password. In other cases, the existing password in the DB // changes the password. In other cases, the existing password in the DB
// is copied while updating the settings and the UUID is used to match // is copied while updating the settings and the UUID is used to match
// the incoming array of blocks with the array in the DB. // the incoming array of blocks with the array in the DB.
@ -316,7 +316,7 @@ func getSettings(app *App) (settings, error) {
"name", "{globals.terms.settings}", "error", pqErrMsg(err))) "name", "{globals.terms.settings}", "error", pqErrMsg(err)))
} }
// Unmarshall the settings and filter out sensitive fields. // Unmarshal the settings and filter out sensitive fields.
if err := json.Unmarshal([]byte(b), &out); err != nil { if err := json.Unmarshal([]byte(b), &out); err != nil {
return out, echo.NewHTTPError(http.StatusInternalServerError, return out, echo.NewHTTPError(http.StatusInternalServerError,
app.i18n.Ts("settings.errorEncoding", "error", err.Error())) app.i18n.Ts("settings.errorEncoding", "error", err.Error()))

2
frontend/README.md vendored
View file

@ -18,7 +18,7 @@ The project uses a global `vuex` state to centrally store the responses to prett
There is a global state `loading` (eg: loading.campaigns, loading.lists) that indicates whether an API call for that particular "model" is running. This can be used anywhere in the project to show loading spinners for instance. All the API definitions are in `api/index.js`. It also describes how each API call sets the global `loading` status alongside storing the API responses. There is a global state `loading` (eg: loading.campaigns, loading.lists) that indicates whether an API call for that particular "model" is running. This can be used anywhere in the project to show loading spinners for instance. All the API definitions are in `api/index.js`. It also describes how each API call sets the global `loading` status alongside storing the API responses.
*IMPORTANT*: All JSON field names in GET API responses are automatically camel-cased when they're pulled for the sake of consistentcy in the frontend code and for complying with the linter spec in the project (Vue/AirBnB schema). For example, `content_type` becomes `contentType`. When sending responses to the backend, however, they should be snake-cased manually. This is overridden for certain calls such as `/api/config` and `/api/settings` using the `preserveCase: true` param in `api/index.js`. *IMPORTANT*: All JSON field names in GET API responses are automatically camel-cased when they're pulled for the sake of consistency in the frontend code and for complying with the linter spec in the project (Vue/AirBnB schema). For example, `content_type` becomes `contentType`. When sending responses to the backend, however, they should be snake-cased manually. This is overridden for certain calls such as `/api/config` and `/api/settings` using the `preserveCase: true` param in `api/index.js`.
## Icon pack ## Icon pack

View file

@ -93,7 +93,7 @@ export default {
computed: { computed: {
// Return the list of unselected lists. // Return the list of unselected lists.
filteredLists() { filteredLists() {
// Get a map of IDs of the user subsciptions. eg: {1: true, 2: true}; // Get a map of IDs of the user subscriptions. eg: {1: true, 2: true};
const subIDs = this.selectedItems.reduce((obj, item) => ({ ...obj, [item.id]: true }), {}); const subIDs = this.selectedItems.reduce((obj, item) => ({ ...obj, [item.id]: true }), {});
// Filter lists from the global lists whose IDs are not in the user's // Filter lists from the global lists whose IDs are not in the user's

View file

@ -350,7 +350,7 @@ export default Vue.extend({
}, },
// Stats returns the campaign object with stats (sent, toSend etc.) // Stats returns the campaign object with stats (sent, toSend etc.)
// if there's live stats availabe for running campaigns. Otherwise, // if there's live stats available for running campaigns. Otherwise,
// it returns the incoming campaign object that has the static stats // it returns the incoming campaign object that has the static stats
// values. // values.
getCampaignStats(c) { getCampaignStats(c) {

View file

@ -247,7 +247,7 @@ export default Vue.extend({
); );
}, },
// Returns true if an import has finished (failed or sucessful). // Returns true if an import has finished (failed or successful).
isDone() { isDone() {
if (this.status.status === 'finished' if (this.status.status === 'finished'
|| this.status.status === 'stopped' || this.status.status === 'stopped'

View file

@ -60,7 +60,7 @@ type Importer struct {
sync.RWMutex sync.RWMutex
} }
// Options represents inport options. // Options represents import options.
type Options struct { type Options struct {
UpsertStmt *sql.Stmt UpsertStmt *sql.Stmt
BlocklistStmt *sql.Stmt BlocklistStmt *sql.Stmt
@ -90,7 +90,7 @@ type SessionOpt struct {
ListIDs []int `json:"lists"` ListIDs []int `json:"lists"`
} }
// Status reporesents statistics from an ongoing import session. // Status represents statistics from an ongoing import session.
type Status struct { type Status struct {
Name string `json:"name"` Name string `json:"name"`
Total int `json:"total"` Total int `json:"total"`