From 530165f5ee750b56316f55a4a3a872793dde1d49 Mon Sep 17 00:00:00 2001 From: Yatish Mehta Date: Tue, 20 Jun 2023 11:10:34 -0700 Subject: [PATCH] Fix typos in comments (#1368) Co-authored-by: Yatish Mehta --- docs/docs/content/apis/campaigns.md | 54 +++++++++++++-------------- docs/docs/content/apis/import.md | 20 +++++----- docs/docs/content/apis/media.md | 52 +++++++++++++------------- docs/docs/content/apis/subscribers.md | 16 ++++---- docs/docs/content/apis/templates.md | 44 +++++++++++----------- internal/captcha/captcha.go | 2 +- internal/core/campaigns.go | 2 +- internal/core/subscribers.go | 2 +- internal/core/subscriptions.go | 6 +-- internal/subimporter/importer.go | 2 +- 10 files changed, 100 insertions(+), 100 deletions(-) diff --git a/docs/docs/content/apis/campaigns.md b/docs/docs/content/apis/campaigns.md index a83e482..817cc8d 100644 --- a/docs/docs/content/apis/campaigns.md +++ b/docs/docs/content/apis/campaigns.md @@ -1,16 +1,16 @@ # API / Campaigns -Method | Endpoint | Description --------|---------------------------------------------------------------------------|----------------------------- -`GET` | [/api/campaigns](#get-apicampaigns) | Gets all campaigns. -`GET` | [/api/campaigns/:`campaign_id`](#get-apicampaignscampaign_id) | Gets a single campaign. -`GET` | [/api/campaigns/:`campaign_id`/preview](#get-apicampaignscampaign_idpreview) | Gets the HTML preview of a campaign body. -`GET` | [/api/campaigns/running/stats](#get-apicampaignsrunningstats) | Gets the stats of a given set of campaigns. -`POST` | [/api/campaigns](#post-apicampaigns) | Creates a new campaign. -`POST` | /api/campaigns/:`campaign_id`/test | Posts campaign message to arbitrary subscribers for testing. -`PUT` | /api/campaigns/:`campaign_id` | Modifies a campaign. -`PUT` | [/api/campaigns/:`campaign_id`/status](#put-apicampaignscampaign_idstatus) | Start / pause / cancel / schedule a campaign. -`DELETE` | [/api/campaigns/:`campaign_id`](#delete-apicampaignscampaign_id) | Deletes a campaign. +Method | Endpoint | Description +---------|------------------------------------------------------------------------------|------------------------------------------------------------- +`GET` | [/api/campaigns](#get-apicampaigns) | Gets all campaigns. +`GET` | [/api/campaigns/:`campaign_id`](#get-apicampaignscampaign_id) | Gets a single campaign. +`GET` | [/api/campaigns/:`campaign_id`/preview](#get-apicampaignscampaign_idpreview) | Gets the HTML preview of a campaign body. +`GET` | [/api/campaigns/running/stats](#get-apicampaignsrunningstats) | Gets the stats of a given set of campaigns. +`POST` | [/api/campaigns](#post-apicampaigns) | Creates a new campaign. +`POST` | /api/campaigns/:`campaign_id`/test | Posts campaign message to arbitrary subscribers for testing. +`PUT` | /api/campaigns/:`campaign_id` | Modifies a campaign. +`PUT` | [/api/campaigns/:`campaign_id`/status](#put-apicampaignscampaign_idstatus) | Start / pause / cancel / schedule a campaign. +`DELETE` | [/api/campaigns/:`campaign_id`](#delete-apicampaignscampaign_id) | Deletes a campaign. #### ```GET``` /api/campaigns @@ -83,9 +83,9 @@ Name | Type | Required/Optional | Description Gets a single campaign. ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description -------------|-------------------|--------------|----------------------|----------------------------- -`campaign_id` | Path Parameter | Number | Required | The id value of the campaign you want to get. +Name | Parameter Type | Data Type | Required/Optional | Description +--------------|----------------|-----------|-------------------|----------------------------------------------- +`campaign_id` | Path Parameter | Number | Required | The id value of the campaign you want to get. ##### Example Request @@ -142,9 +142,9 @@ Gets the html preview of a campaign body. ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description -------------|-------------------|--------------|----------------------|----------------------------- -`campaign_id` | Path Parameter | Number | Required | The id value of the campaign to be previewed. +Name | Parameter Type | Data Type | Required/Optional | Description +--------------|----------------|-----------|-------------------|---------------------------------------------- +`campaign_id` | Path Parameter | Number | Required | The id value of the campaign to be previewed. ##### Example Request @@ -166,9 +166,9 @@ Gets the running stat of a given set of campaigns. ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description -------------|------------------|------------|---------------------|-------------------------------- -campaign_id | Query Parameters | Number | Required | The id values of the campaigns whose stat you want to get. +Name | Parameter Type | Data Type | Required/Optional | Description +------------|------------------|-----------|-------------------|----------------------------------------------------------- +campaign_id | Query Parameters | Number | Required | The id values of the campaigns whose stat you want to get. ##### Example Request @@ -259,10 +259,10 @@ Modifies a campaign status to start, pause, cancel, or schedule a campaign. ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description -------------------|-------------------------|---------------------------|----------------------|----------------------------- -`campaign_id` | Path Parameter | Number | Required | The id value of the campaign whose status is to be modified. -`status` | Request Body | String | Required | `scheduled`, `running`, `paused`, `cancelled`. +Name | Parameter Type | Data Type | Required/Optional | Description +--------------|----------------|-----------|-------------------|------------------------------------------------------------- +`campaign_id` | Path Parameter | Number | Required | The id value of the campaign whose status is to be modified. +`status` | Request Body | String | Required | `scheduled`, `running`, `paused`, `cancelled`. ###### Note: @@ -324,9 +324,9 @@ Deletes a campaign, only scheduled campaigns that have not yet been started can ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description ----------|--------------------|----------------|---------------------|------------------------------ -`campaign_id`| Path Parameter | Number | Required | The id value of the campaign you want to delete. +Name | Parameter Type | Data Type | Required/Optional | Description +--------------|----------------|-----------|-------------------|------------------------------------------------- +`campaign_id` | Path Parameter | Number | Required | The id value of the campaign you want to delete. ##### Example Request diff --git a/docs/docs/content/apis/import.md b/docs/docs/content/apis/import.md index 11bc5f8..82b27ad 100644 --- a/docs/docs/content/apis/import.md +++ b/docs/docs/content/apis/import.md @@ -1,11 +1,11 @@ # API / Import -Method | Endpoint | Description ------------|----------------------------------------------------------------------|-------------- -`GET` | [api/import/subscribers](#get-apiimportsubscribers) | Gets a import statistics. -`GET` | [api/import/subscribers/logs](#get-apiimportsubscriberslogs) | Get a import statistics . -`POST` | [api/import/subscribers](#post-apiimportsubscribers) | Upload a ZIP file or CSV file to bulk import subscribers. -`DELETE` | [api/import/subscribers](#delete-apiimportsubscribers) | Stops and deletes a import. +Method | Endpoint | Description +---------|--------------------------------------------------------------|---------------------------------------------------------- +`GET` | [api/import/subscribers](#get-apiimportsubscribers) | Gets a import statistics. +`GET` | [api/import/subscribers/logs](#get-apiimportsubscriberslogs) | Get a import statistics . +`POST` | [api/import/subscribers](#post-apiimportsubscribers) | Upload a ZIP file or CSV file to bulk import subscribers. +`DELETE` | [api/import/subscribers](#delete-apiimportsubscribers) | Stops and deletes a import. #### **`GET`** api/import/subscribers @@ -51,10 +51,10 @@ Post a CSV (optionally zipped) file to do a bulk import. The request should be a ##### Parameters -Name | Parameter type | Data type | Required/Optional | Description ----------|----------------|----------------|-------------------|----------------------- -`params` | Request body | String | Required | Stringified JSON with import params -`file` | Request body | File | Required | File to upload +Name | Parameter type | Data type | Required/Optional | Description +---------|----------------|-----------|-------------------|------------------------------------ +`params` | Request body | String | Required | Stringified JSON with import params +`file` | Request body | File | Required | File to upload ***params*** (JSON string) diff --git a/docs/docs/content/apis/media.md b/docs/docs/content/apis/media.md index 359522b..c633faa 100644 --- a/docs/docs/content/apis/media.md +++ b/docs/docs/content/apis/media.md @@ -1,9 +1,9 @@ # API / Media -Method | Endpoint | Description ---------------|--------------------------------------------------------------|---------------------------------------------- -`GET` | [/api/media](#get-apimedia) | Gets an uploaded media file. -`POST` | [/api/media](#post-apimedia) | Uploads a media file. -`DELETE` | [/api/media/:`media_id`](#delete-apimediamedia_id) | Deletes uploaded media files. +Method | Endpoint | Description +---------|----------------------------------------------------|------------------------------ +`GET` | [/api/media](#get-apimedia) | Gets an uploaded media file. +`POST` | [/api/media](#post-apimedia) | Uploads a media file. +`DELETE` | [/api/media/:`media_id`](#delete-apimediamedia_id) | Deletes uploaded media files. #### **`GET`** /api/media Gets an uploaded media file. @@ -33,23 +33,23 @@ curl -u "username:username" -X GET 'http://localhost:9000/api/media' \ Response definitions The following table describes each item in the response. -|Response item |Description |Data type | -|:---------------:|:------------|:----------:| -|data|Array of the media file objects, which contains an information about the uploaded media files|array| -|id|Media file object ID|number (int)| -|uuid|Media file uuuid|string (uuid)| -|filename|Name of the media file|string| -|created_at|Date and time, when the media file object was created|String (localDateTime)| -|thumb_uri|The thumbnail URI of the media file|string| -|uri|URI of the media file|string| +| Response item | Description | Data type | +|:-------------:|:----------------------------------------------------------------------------------------------|:----------------------:| +| data | Array of the media file objects, which contains an information about the uploaded media files | array | +| id | Media file object ID | number (int) | +| uuid | Media file uuid | string (uuid) | +| filename | Name of the media file | string | +| created_at | Date and time, when the media file object was created | String (localDateTime) | +| thumb_uri | The thumbnail URI of the media file | string | +| uri | URI of the media file | string | #### **`POST`** /api/media Uploads a media file. ##### Parameters -Nam | Parameter Type | Data Type | Required/Optional | Description ------------|-----------------------|-------------------|-------------------------|--------------------------------- -file | Request body | Media file | Required | The media file to be uploaded. +Name | Parameter Type | Data Type | Required/Optional | Description +-----|----------------|------------|-------------------|------------------------------- +file | Request body | Media file | Required | The media file to be uploaded. ##### Example Request @@ -74,17 +74,17 @@ curl -u "username:username" -X POST 'http://localhost:9000/api/media' \ ``` Response definitions -|Response item |Description |Data type | -|:---------------:|:------------:|:----------:| -|data|True means that the media file was successfully uploaded |boolean| +| Response item | Description | Data type | +|:-------------:|:--------------------------------------------------------:|:---------:| +| data | True means that the media file was successfully uploaded | boolean | #### **`DELETE`** /api/media/:`media_id` Deletes an uploaded media file. ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description -----------------|-------------------------|--------------------|-------------------------|-------------------------- -`Media_id` | Path Parameter | Number | Required | The id of the media file you want to delete. +Name | Parameter Type | Data Type | Required/Optional | Description +-----------|----------------|-----------|-------------------|--------------------------------------------- +`Media_id` | Path Parameter | Number | Required | The id of the media file you want to delete. ##### Example Request @@ -102,6 +102,6 @@ curl -u "username:username" -X DELETE 'http://localhost:9000/api/media/1' Response definitions -|Response item |Description |Data type | -|:---------------:|:------------:|:----------:| -|data|True means that the media file was successfully deleted |boolean| +| Response item | Description | Data type | +|:-------------:|:-------------------------------------------------------:|:---------:| +| data | True means that the media file was successfully deleted | boolean | diff --git a/docs/docs/content/apis/subscribers.md b/docs/docs/content/apis/subscribers.md index 40b50eb..b39ebd0 100644 --- a/docs/docs/content/apis/subscribers.md +++ b/docs/docs/content/apis/subscribers.md @@ -283,12 +283,12 @@ Creates a new subscriber. Name | Parameter type | Data type | Required/Optional | Description -------------------------|------------------|------------|-------------------|---------------------------- -email | Request body | String | Required | The email address of the new susbcriber. +email | Request body | String | Required | The email address of the new subscriber. name | Request body | String | Required | The name of the new subscriber. status | Request body | String | Required | The status of the new subscriber. Can be enabled, disabled or blocklisted. lists | Request body | Numbers | Optional | Array of list IDs to subscribe to (marked as `unconfirmed` by default). attribs | Request body | json | Optional | JSON list containing new subscriber's attributes. -preconfirm_subscriptions | Request body | Bool | Optional | If `true`, marks subscriptsions as `confirmed` and no-optin e-mails are sent for double opt-in lists. +preconfirm_subscriptions | Request body | Bool | Optional | If `true`, marks subscriptions as `confirmed` and no-optin e-mails are sent for double opt-in lists. ##### Example Request ```shell @@ -325,12 +325,12 @@ Modify subscribers list memberships. ##### Parameters -Name | Paramter type | Data type | Required/Optional | Description -------------------|---------------|-----------|--------------------|------------------------------------------------------- -`ids` | Request body | Numbers | Required | The ids of the subscribers to be modified. -`action` | Request body | String | Required | Wether to `add`, `remove`, or `unsubscribe` the users. -`target_list_ids` | Request body | Numbers | Required | The ids of the lists to be modified. -`status` | Request body | String | Required for `add` | `confirmed`, `unconfirmed`, or `unsubscribed` status. +Name | Parameter type | Data type | Required/Optional | Description +------------------|----------------|-----------|--------------------|------------------------------------------------------- +`ids` | Request body | Numbers | Required | The ids of the subscribers to be modified. +`action` | Request body | String | Required | Whether to `add`, `remove`, or `unsubscribe` the users. +`target_list_ids` | Request body | Numbers | Required | The ids of the lists to be modified. +`status` | Request body | String | Required for `add` | `confirmed`, `unconfirmed`, or `unsubscribed` status. ##### Example Request diff --git a/docs/docs/content/apis/templates.md b/docs/docs/content/apis/templates.md index 920eae7..9f35a44 100644 --- a/docs/docs/content/apis/templates.md +++ b/docs/docs/content/apis/templates.md @@ -1,15 +1,15 @@ # API / Templates -Method | Endpoint | Description ----------------------|-----------------------------------------|----------------------------------------------------- -`GET` | [/api/templates](#get-apitemplates) | Gets all templates. -`GET` | [/api/templates/:`template_id`](#get-apitemplatestemplate_id) | Gets a single template. -`GET` | [/api/templates/:`template_id`/preview](#get-apitemplatestemplate_idpreview) | Gets the HTML preview of a template. -`POST` | /api/templates/preview | -`POST` | /api/templates | Creates a template. -`PUT` | /api/templates/:`template_id` | Modifies a template. -`PUT` | [/api/templates/:`template_id`/default](#put-apitemplatestemplate_iddefault) | Sets a template to the default template. -`DELETE` | [/api/templates/:`template_id`](#delete-apitemplatestemplate_id) | Deletes a template. +Method | Endpoint | Description +---------|------------------------------------------------------------------------------|----------------------------------------- +`GET` | [/api/templates](#get-apitemplates) | Gets all templates. +`GET` | [/api/templates/:`template_id`](#get-apitemplatestemplate_id) | Gets a single template. +`GET` | [/api/templates/:`template_id`/preview](#get-apitemplatestemplate_idpreview) | Gets the HTML preview of a template. +`POST` | /api/templates/preview | +`POST` | /api/templates | Creates a template. +`PUT` | /api/templates/:`template_id` | Modifies a template. +`PUT` | [/api/templates/:`template_id`/default](#put-apitemplatestemplate_iddefault) | Sets a template to the default template. +`DELETE` | [/api/templates/:`template_id`](#delete-apitemplatestemplate_id) | Deletes a template. #### **`GET`** /api/templates Gets all templates. @@ -40,9 +40,9 @@ Gets all templates. Gets a single template. ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description -------------|------------------------|---------------------|-------------------------|------------------------------------------ -`template_id` | Path Parameter | Number | Required | The id value of the template you want to get. +Name | Parameter Type | Data Type | Required/Optional | Description +--------------|----------------|-----------|-------------------|---------------------------------------------- +`template_id` | Path Parameter | Number | Required | The id value of the template you want to get. ##### Example Request ``` shell @@ -68,9 +68,9 @@ curl -u "username:username" -X GET 'http://localhost:9000/api/templates/1' Gets the HTML preview of a template body. ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description -------------|----------------------|-----------------|------------------------|--------------------------------- -`template_id` | Path Parameter | Number | Required | The id value of the template whose html preview you want to get. +Name | Parameter Type | Data Type | Required/Optional | Description +--------------|----------------|------------|-------------------|----------------------------------------------------------------- +`template_id` | Path Parameter | Number | Required | The id value of the template whose html preview you want to get. ##### Example Request ``` shell @@ -97,9 +97,9 @@ curl -u "username:username" -X GET 'http://localhost:9000/api/templates/1/previe Sets a template to the default template. ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description -------------|------------------------|---------------------|-------------------------|------------------------------------------ -`template_id` | Path Parameter | Number | Required | The id value of the template you want to set to the default template. +Name | Parameter Type | Data Type | Required/Optional | Description +--------------|----------------|-----------|-------------------|---------------------------------------------------------------------- +`template_id` | Path Parameter | Number | Required | The id value of the template you want to set to the default template. ##### Example Request @@ -127,9 +127,9 @@ curl -u "username:username" -X PUT 'http://localhost:9000/api/templates/1/defaul Deletes a template. ##### Parameters -Name | Parameter Type | Data Type | Required/Optional | Description -------------|------------------------|---------------------|-------------------------|------------------------------------------ -`template_id` | Path Parameter | Number | Required | The id value of the template you want to delete. +Name | Parameter Type | Data Type | Required/Optional | Description +--------------|----------------|-----------|-------------------|------------------------------------------------- +`template_id` | Path Parameter | Number | Required | The id value of the template you want to delete. ##### Example Request diff --git a/internal/captcha/captcha.go b/internal/captcha/captcha.go index 92d7c9b..a6ab441 100644 --- a/internal/captcha/captcha.go +++ b/internal/captcha/captcha.go @@ -47,7 +47,7 @@ func New(o Opt) *Captcha { }} } -// Verify veries a CAPTCHA request. +// Verify verifies a CAPTCHA request. func (c *Captcha) Verify(token string) (error, bool) { resp, err := c.client.PostForm(rootURL, url.Values{ "secret": {c.o.CaptchaSecret}, diff --git a/internal/core/campaigns.go b/internal/core/campaigns.go index 1aba507..6194aa4 100644 --- a/internal/core/campaigns.go +++ b/internal/core/campaigns.go @@ -65,7 +65,7 @@ func (c *Core) GetCampaign(id int, uuid string) (models.Campaign, error) { return c.getCampaign(id, uuid, campaignTplDefault) } -// GetArchivedCampaign retreives a campaign with the archive template body. +// GetArchivedCampaign retrieves a campaign with the archive template body. func (c *Core) GetArchivedCampaign(id int, uuid string) (models.Campaign, error) { out, err := c.getCampaign(id, uuid, campaignTplArchive) if err != nil { diff --git a/internal/core/subscribers.go b/internal/core/subscribers.go index e91f441..072172e 100644 --- a/internal/core/subscribers.go +++ b/internal/core/subscribers.go @@ -439,7 +439,7 @@ func (c *Core) DeleteSubscribersByQuery(query string, listIDs []int) error { return err } -// UnsubscribeByCampaign unsubscibers a given subscriber from lists in a given campaign. +// UnsubscribeByCampaign unsubscribes a given subscriber from lists in a given campaign. func (c *Core) UnsubscribeByCampaign(subUUID, campUUID string, blocklist bool) error { if _, err := c.q.UnsubscribeByCampaign.Exec(campUUID, subUUID, blocklist); err != nil { c.log.Printf("error unsubscribing: %v", err) diff --git a/internal/core/subscriptions.go b/internal/core/subscriptions.go index 95046af..fa8f127 100644 --- a/internal/core/subscriptions.go +++ b/internal/core/subscriptions.go @@ -90,7 +90,7 @@ func (c *Core) UnsubscribeLists(subIDs, listIDs []int, listUUIDs []string) error return nil } -// UnsubscribeListsByQuery sets list subscriptions to 'ubsubscribed' by a given arbitrary query expression. +// UnsubscribeListsByQuery sets list subscriptions to 'unsubscribed' by a given arbitrary query expression. // sourceListIDs is the list of list IDs to filter the subscriber query with. func (c *Core) UnsubscribeListsByQuery(query string, sourceListIDs, targetListIDs []int) error { if sourceListIDs == nil { @@ -99,7 +99,7 @@ func (c *Core) UnsubscribeListsByQuery(query string, sourceListIDs, targetListID err := c.q.ExecSubQueryTpl(sanitizeSQLExp(query), c.q.UnsubscribeSubscribersFromListsByQuery, sourceListIDs, c.db, pq.Array(targetListIDs)) if err != nil { - c.log.Printf("error unsubscriging from lists by query: %v", err) + c.log.Printf("error unsubscribing from lists by query: %v", err) return echo.NewHTTPError(http.StatusInternalServerError, c.i18n.Ts("globals.messages.errorUpdating", "name", "{globals.terms.subscribers}", "error", pqErrMsg(err))) } @@ -107,7 +107,7 @@ func (c *Core) UnsubscribeListsByQuery(query string, sourceListIDs, targetListID return nil } -// DeleteUnconfirmedSubscriptions sets list subscriptions to 'ubsubscribed' by a given arbitrary query expression. +// DeleteUnconfirmedSubscriptions sets list subscriptions to 'unsubscribed' by a given arbitrary query expression. // sourceListIDs is the list of list IDs to filter the subscriber query with. func (c *Core) DeleteUnconfirmedSubscriptions(beforeDate time.Time) (int, error) { res, err := c.q.DeleteUnconfirmedSubscriptions.Exec(beforeDate) diff --git a/internal/subimporter/importer.go b/internal/subimporter/importer.go index c48f147..4c37cfe 100644 --- a/internal/subimporter/importer.go +++ b/internal/subimporter/importer.go @@ -145,7 +145,7 @@ func New(opt Options, db *sql.DB, i *i18n.I18n) *Importer { im.domainBlocklist[d] = true // Domains with *. as the subdomain prefix, strip that - // and add the full domain to the blocklist as welll. + // and add the full domain to the blocklist as well. // eg: *.example.com => example.com if strings.Contains(d, "*.") { im.hasBlocklistWildcards = true