-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MMI-3100 image tag email alert, migration 1.3.19 (#2404)
* MMI-3100 changes to Notification template to add image * MMI-3100 changes to basic notification template to include file reference when available. * MMI-3100 changes to DefaultRazorTemplate in Editor * MMI-3100 change to Where clause in Notification template * Updated defaultRazorTemplate sentiment --------- Co-authored-by: Dao Yu Lai <daoyu.lai@gov.bc.ca>
- Loading branch information
1 parent
9816cbc
commit 17bcf68
Showing
4 changed files
with
7,610 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
libs/net/dal/Migrations/1.3.19/Up/PostUp/00-Notification_Template.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
DO $$ | ||
BEGIN | ||
|
||
-- Update the basic alert template. | ||
UPDATE public."notification_template" SET | ||
"body" = '@inherits RazorEngineCore.RazorEngineTemplateBase<TNO.TemplateEngine.Models.Notifications.NotificationEngineContentModel> | ||
@using System | ||
@using System.Web | ||
@{ | ||
var subscriberAppUrl = @SubscriberAppUrl?.ToString(); | ||
var viewContentUrl = @ViewContentUrl?.ToString(); | ||
var requestTranscriptUrl = @RequestTranscriptUrl?.ToString(); | ||
var addToReportUrl = @AddToReportUrl?.ToString(); | ||
var isAV = @Content.ContentType == TNO.Entities.ContentType.AudioVideo; | ||
var isTranscriptAvailable = isAV && !string.IsNullOrWhiteSpace(@Content.Body) && @Content.IsApproved; | ||
var sourceCode = !string.IsNullOrEmpty(@Content.Source?.Code) ? @Content.Source.Code : @Content.OtherSource; | ||
var body = isTranscriptAvailable ? @Content.Body : (isAV ? @Content.Summary : @Content.Body); | ||
// body = System.Text.RegularExpressions.Regex.Replace(body, @"\r\n?|\n", "<br/>"); | ||
var replaceWith = "<br/>"; | ||
body = body.Replace("\r\n", replaceWith).Replace("\n", replaceWith).Replace("\r", replaceWith); | ||
var tz = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); | ||
var utcOffset = tz.GetUtcOffset(System.DateTime.Now).Hours; | ||
} | ||
@if (!string.IsNullOrWhiteSpace(@Content.Source?.Name)) | ||
{ | ||
<div>@Content.Source.Name</div> | ||
} | ||
@if (!string.IsNullOrEmpty(@Content.Series?.Name)) | ||
{ | ||
<div>@Content.Series.Name</div> | ||
} | ||
<div>@Content.PublishedOn?.AddHours(@utcOffset).ToString("dd-MMM-yyyy HH:mm")</div> | ||
@if (!string.IsNullOrEmpty(@Content.Byline)) | ||
{ | ||
<div>@Content.Byline</div> | ||
} | ||
@if (!string.IsNullOrEmpty(@Content.Page)) | ||
{ | ||
<div>Page #@Content.Page</div> | ||
} | ||
@if (!string.IsNullOrEmpty(@Content.ImageContent)) | ||
{ | ||
var src = $"data:{@Content.ContentType};base64," + Content.ImageContent; | ||
<div><img src="@src" alt="@Content.FileReferences.FirstOrDefault()?.FileName" /></div> | ||
} | ||
<br/> | ||
<div>@body</div> | ||
<br /> | ||
@if (!string.IsNullOrEmpty(subscriberAppUrl)) | ||
{ | ||
<div><a href="@subscriberAppUrl" target="">MMI</a> :: <a href="@viewContentUrl@Content.Id" target="_blank">View Article</a></div> | ||
<br /> | ||
} | ||
@if (isAV && !isTranscriptAvailable && !string.IsNullOrEmpty(requestTranscriptUrl) && Content.Source?.DisableTranscribe == false) | ||
{ | ||
<div><a href="@($"{requestTranscriptUrl}{Content.Id}")?uid=@(Content.OwnerId)&headline=@(HttpUtility.UrlEncode(Content.Headline))&source=@(HttpUtility.UrlEncode(Content.OtherSource))" target="_blank">Request Transcript...</a></div> | ||
<br /> | ||
} | ||
<br /> | ||
<div style="font-size: 10px;"> | ||
This e-mail is a service provided by Government Communications and Public Engagement and is only intended | ||
for the original addressee. All content is the copyrighted property of a third party creator of the material. | ||
Copying, retransmitting, redistributing, selling, licensing, or emailing the material to any third party or | ||
any employee of the Province who is not authorized to access the material is prohibited. | ||
</div>' | ||
WHERE "id" = cast((SELECT value FROM setting | ||
WHERE name = 'BasicAlertTemplateId') as integer); | ||
|
||
END $$; |
Oops, something went wrong.