Browse Source

Fix comments

Kailash Nadh 5 years ago
parent
commit
c9fc83fb60
2 changed files with 21 additions and 13 deletions
  1. 1 2
      handlers.go
  2. 20 11
      public.go

+ 1 - 2
handlers.go

@@ -125,8 +125,7 @@ func registerHTTPHandlers(e *echo.Echo) {
 	e.GET("/campaigns/:campignID", handleIndexPage)
 }
 
-// handleIndex is the root handler that renders the login page if there's no
-// authenticated session, or redirects to the dashboard, if there's one.
+// handleIndex is the root handler that renders the Javascript frontend.
 func handleIndexPage(c echo.Context) error {
 	app := c.Get("app").(*App)
 

+ 20 - 11
public.go

@@ -86,6 +86,7 @@ func (t *tplRenderer) Render(w io.Writer, name string, data interface{}, c echo.
 }
 
 // handleViewCampaignMessage renders the HTML view of a campaign message.
+// This is the view the {{ MessageURL }} template tag links to in e-mail campaigns.
 func handleViewCampaignMessage(c echo.Context) error {
 	var (
 		app      = c.Get("app").(*App)
@@ -138,7 +139,8 @@ func handleViewCampaignMessage(c echo.Context) error {
 }
 
 // handleSubscriptionPage renders the subscription management page and
-// handles unsubscriptions.
+// handles unsubscriptions. This is the view that {{ UnsubscribeURL }} in
+// campaigns link to.
 func handleSubscriptionPage(c echo.Context) error {
 	var (
 		app          = c.Get("app").(*App)
@@ -176,7 +178,9 @@ func handleSubscriptionPage(c echo.Context) error {
 	return c.Render(http.StatusOK, "subscription", out)
 }
 
-// handleOptinPage handles a double opt-in confirmation from subscribers.
+// handleOptinPage renders the double opt-in confirmation page that subscribers
+// see when they click on the "Confirm subscription" button in double-optin
+// notifications.
 func handleOptinPage(c echo.Context) error {
 	var (
 		app        = c.Get("app").(*App)
@@ -235,7 +239,8 @@ func handleOptinPage(c echo.Context) error {
 	return c.Render(http.StatusOK, "optin", out)
 }
 
-// handleOptinPage handles a double opt-in confirmation from subscribers.
+// handleSubscriptionForm handles subscription requests coming from public
+// HTML subscription forms.
 func handleSubscriptionForm(c echo.Context) error {
 	var (
 		app = c.Get("app").(*App)
@@ -277,7 +282,9 @@ func handleSubscriptionForm(c echo.Context) error {
 		makeMsgTpl("Done", "", `Subscribed successfully.`))
 }
 
-// handleLinkRedirect handles link UUID to real link redirection.
+// handleLinkRedirect redirects a link UUID to its original underlying link
+// after recording the link click for a particular subscriber in the particular
+// campaign. These links are generated by {{ TrackLink }} tags in campaigns.
 func handleLinkRedirect(c echo.Context) error {
 	var (
 		app      = c.Get("app").(*App)
@@ -302,7 +309,8 @@ func handleLinkRedirect(c echo.Context) error {
 
 // handleRegisterCampaignView registers a campaign view which comes in
 // the form of an pixel image request. Regardless of errors, this handler
-// should always render the pixel image bytes.
+// should always render the pixel image bytes. The pixel URL is is generated by
+// the {{ TrackView }} template tag in campaigns.
 func handleRegisterCampaignView(c echo.Context) error {
 	var (
 		app      = c.Get("app").(*App)
@@ -321,10 +329,10 @@ func handleRegisterCampaignView(c echo.Context) error {
 	return c.Blob(http.StatusOK, "image/png", pixelPNG)
 }
 
-// handleSelfExportSubscriberData pulls the subscriber's profile,
-// list subscriptions, campaign views and clicks and produces
-// a JSON report. This is a privacy feature and depends on the
-// configuration in app.Constants.Privacy.
+// handleSelfExportSubscriberData pulls the subscriber's profile, list subscriptions,
+// campaign views and clicks and produces a JSON report that is then e-mailed
+// to the subscriber. This is a privacy feature and the data that's exported
+// is dependent on the configuration.
 func handleSelfExportSubscriberData(c echo.Context) error {
 	var (
 		app     = c.Get("app").(*App)
@@ -347,7 +355,7 @@ func handleSelfExportSubscriberData(c echo.Context) error {
 				"There was an error processing your request. Please try later."))
 	}
 
-	// Send the data out to the subscriber as an atachment.
+	// Prepare the attachment e-mail.
 	var msg bytes.Buffer
 	if err := app.notifTpls.ExecuteTemplate(&msg, notifSubscriberData, data); err != nil {
 		app.log.Printf("error compiling notification template '%s': %v",
@@ -357,6 +365,7 @@ func handleSelfExportSubscriberData(c echo.Context) error {
 				"There was an error preparing your data. Please try later."))
 	}
 
+	// Send the data as a JSON attachment to the subscriber.
 	const fname = "profile.json"
 	if err := app.messenger.Push(app.constants.FromEmail,
 		[]string{data.Email},
@@ -380,7 +389,7 @@ func handleSelfExportSubscriberData(c echo.Context) error {
 			`Your data has been e-mailed to you as an attachment.`))
 }
 
-// handleWipeSubscriberData allows a subscriber to self-delete their data. The
+// handleWipeSubscriberData allows a subscriber to delete their data. The
 // profile and subscriptions are deleted, while the campaign_views and link
 // clicks remain as orphan data unconnected to any subscriber.
 func handleWipeSubscriberData(c echo.Context) error {