Skip to content

Commit

Permalink
Merge pull request #787 from bcgov/yj
Browse files Browse the repository at this point in the history
Yj
  • Loading branch information
ychung-mot authored Nov 18, 2024
2 parents 535543b + 2682d95 commit 48a4f68
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 43 deletions.
36 changes: 1 addition & 35 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,6 @@ on:
types: [published]

jobs:
# deploy-silver:
# runs-on: ubuntu-22.04
# timeout-minutes: 5
# permissions:
# contents: read
# environment:
# name: prod
# url: https://prod-strdata.apps.silver.devops.gov.bc.ca/

# steps:
# - uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a
# - uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5
# with:
# ref: main # one source of truth for CI/CD pipeline

# - name: Authenticate and set context
# uses: redhat-actions/oc-login@9b79eb6d8ec51bce42cb4e77f0a174fc80cf3cb9
# with:
# openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }}
# openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}
# namespace: f4a30d-prod
# insecure_skip_tls_verify: true

# - name: Deploy apps with Helm chart
# run: |
# vtag=${{ github.ref_name }}
# make upgrade \
# NAMESPACE=f4a30d-prod \
# NAME=strdss-prod \
# ENV_NAME=prod \
# IMAGE_TAG_FRONTEND=${vtag//v} \
# IMAGE_TAG_BACKEND=${vtag//v} \
# IMAGE_TAG_HANGFIRE=${vtag//v} \
# working-directory: ./helm/main

deploy-emerald:
runs-on: ubuntu-22.04
Expand All @@ -50,7 +16,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: bcgov-c/tenant-gitops-b0471a
ref: main
ref: prod
token: ${{ secrets.GITOPS }} # `GITOPS` is a secret that contains your PAT
- name: Update Helm Values and Commit
id: helm
Expand Down
2 changes: 0 additions & 2 deletions server/StrDss.Api/Controllers/BizLicencesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using StrDss.Common;
using StrDss.Model;
using StrDss.Service;
using System.Security.Cryptography;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace StrDss.Api.Controllers
{
Expand Down
12 changes: 11 additions & 1 deletion server/StrDss.Service/DelistingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,13 @@ private async Task ProcessComplianceOrderListings(ComplianceOrderDto[] listings,
{
var emailRegex = RegexDefs.GetRegexInfo(RegexDefs.Email);
var commentError = false;
var cc = Environment.GetEnvironmentVariable("STR_CEU_EMAIL");

if (!Regex.IsMatch(_currentUser.EmailAddress, emailRegex.Regex))
{
errors.AddItem("email", $"Your email address ({_currentUser.EmailAddress}) is invalid");
return;
}

foreach (var listing in listings)
{
Expand All @@ -1112,6 +1119,8 @@ private async Task ProcessComplianceOrderListings(ComplianceOrderDto[] listings,

var template = CreateComplianceOrderTemplate(listing, rentalListing);

listing.BccList.Add(_currentUser.EmailAddress);

ValidateEmails(listing.BccList, emailRegex, "bccList", errors);

listing.HostEmails = GetValidHostEmails(rentalListing.Hosts.ToArray(), emailRegex);
Expand All @@ -1123,6 +1132,7 @@ private async Task ProcessComplianceOrderListings(ComplianceOrderDto[] listings,
template.RentalListingId = rentalListing.RentalListingId ?? 0;
template.To = listing.HostEmails;
template.Bcc = listing.BccList;
template.Cc = cc == "" ? [] : new string[] { cc! };
template.Comment = listing.Comment;
templates.Add(template);
}
Expand Down Expand Up @@ -1194,7 +1204,7 @@ private async Task SendComplianceOrderEmailFromListingAsync(ComplianceOrderDto[]
EmailMessageType = template.EmailMessageType,
MessageDeliveryDtm = DateTime.UtcNow,
MessageTemplateDsc = template.GetContent(),
IsSubmitterCcRequired = true, //todo:
IsSubmitterCcRequired = true,
UnreportedListingNo = template.ListingId,
HostEmailAddressDsc = listing.HostEmails.FirstOrDefault(),
LgEmailAddressDsc = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public ComplianceOrderFromListing(IEmailMessageService emailService)
: base(emailService)
{
EmailMessageType = EmailMessageTypes.ComplianceOrder;
From = Environment.GetEnvironmentVariable("STR_CEU_EMAIL") ?? From;
Subject = "New mail from the Short-term Rental Compliance and Enforcement Unit";
//From = Environment.GetEnvironmentVariable("STR_CEU_EMAIL") ?? From;
Subject = "New mail regarding your short-term rental listing";
}

public long RentalListingId { get; set; }
Expand All @@ -22,9 +22,8 @@ public override string GetContent()
{
return (Preview ? GetPreviewHeader() : "") + $@"
Dear Host,<br/><br/>
This message has been sent to you by B.C.'s Short-Term Rental Compliance Unit regarding your short-term rental<br/>
listing: <b>{Url}</b><br/><br/>
{Comment}<br/>
<b>This message has been sent to you by B.C.'s Short-term Rental Compliance Unit regarding your short-term rental listing:</b><br/><b>{Url}</b><br/><br/>
<b>{Comment}</b><br/>
";
}

Expand Down

0 comments on commit 48a4f68

Please sign in to comment.