Kaynağa Gözat

Add support for GMail go-to actions in the single CTA template.

Paulo Reis 9 yıl önce
ebeveyn
işleme
d6fcc21ab5

+ 15 - 0
services/web/app/coffee/Features/Email/Bodies/SingleCTAEmailBody.coffee

@@ -31,4 +31,19 @@ module.exports = _.template """
 	</th>
 	<th class="expander" style="Margin: 0; color: #0a0a0a; font-family: Helvetica, Arial, sans-serif; font-size: 16px; font-weight: normal; line-height: 1.3; margin: 0; padding: 0 !important; text-align: left; visibility: hidden; width: 0;"></th></tr></table></th>
 </tr></tbody></table>
+<% if (gmailGoToAction) { %>
+	<script type="application/ld+json">
+		{
+			"@context": "http://schema.org",
+			"@type": "EmailMessage",
+			"potentialAction": {
+				"@type": "ViewAction",
+				"target": "<%= gmailGoToAction.target %>",
+				"url": "<%= gmailGoToAction.target %>",
+				"name": "<%= gmailGoToAction.name %>"
+			},
+			"description": "<%= gmailGoToAction.description %>"
+		}
+	</script>
+<% } %>
 """

+ 6 - 0
services/web/app/coffee/Features/Email/EmailBuilder.coffee

@@ -92,6 +92,7 @@ Thank you
 			secondaryMessage: "If you ignore this message, your password won't be changed.<br>If you didn't request a password reset, let us know."
 			ctaText: "Reset password"
 			ctaURL: opts.setNewPasswordUrl
+			gmailGoToAction: null
 		})
 
 
@@ -116,6 +117,10 @@ Thank you
 			secondaryMessage: null
 			ctaText: "View project"
 			ctaURL: opts.inviteUrl
+			gmailGoToAction: 
+				target: opts.inviteUrl
+				name: "View project"
+				description: "Join #{ opts.project.name } at ShareLaTeX"
 		})
 
 
@@ -141,6 +146,7 @@ Thank You
 			secondaryMessage: null
 			ctaText: "Verify now"
 			ctaURL: opts.completeJoinUrl
+			gmailGoToAction: null
 		})
 
 module.exports =