From 1b8fd893fab7ca7ba1885a1ee5bfb906e895047c Mon Sep 17 00:00:00 2001 From: John Henley Date: Wed, 6 Nov 2024 18:13:54 +0000 Subject: [PATCH 1/2] ENH: Use message subject when sending instant subscription messages --- .../Social/Messaging/Scheduler/CoreMessagingScheduler.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs b/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs index 22473f6e4e6..dd00093839e 100644 --- a/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs +++ b/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information @@ -695,7 +695,6 @@ private void SendMessage(MessageRecipient messageRecipient) var defaultLanguage = toUser.Profile.PreferredLocale; var portalSettings = new PortalSettings(message.PortalID); - var emailSubjectTemplate = GetEmailSubjectTemplate(portalSettings, defaultLanguage); var emailBodyTemplate = GetEmailBodyTemplate(portalSettings, defaultLanguage); var emailBodyItemTemplate = GetEmailBodyItemTemplate(portalSettings, defaultLanguage); @@ -708,8 +707,8 @@ private void SendMessage(MessageRecipient messageRecipient) { var senderName = GetSenderName(author.DisplayName, portalSettings.PortalName); var senderAddress = GetSenderAddress(senderName, portalSettings.Email); - var emailBodyItemContent = GetEmailItemContent(portalSettings, messageRecipient, emailBodyItemTemplate); - var subject = string.Format(emailSubjectTemplate, portalSettings.PortalName); + var emailBodyItemContent = GetEmailItemContent(portalSettings, messageRecipient, emailBodyItemTemplate); + var subject = InternalMessagingController.Instance.GetMessage(message.MessageID).Subject; var body = GetEmailBody(emailBodyTemplate, emailBodyItemContent, portalSettings, toUser); body = RemoveHttpUrlsIfSiteisSSLEnabled(body, portalSettings); From fc9d8af0efb38e43cd74861a48e2ab72e260471d Mon Sep 17 00:00:00 2001 From: John Henley Date: Wed, 6 Nov 2024 18:13:54 +0000 Subject: [PATCH 2/2] ENH: Use message subject when sending instant subscription messages --- .../Messaging/Scheduler/CoreMessagingScheduler.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs b/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs index 22473f6e4e6..01ee8f365d1 100644 --- a/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs +++ b/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information @@ -695,7 +695,6 @@ private void SendMessage(MessageRecipient messageRecipient) var defaultLanguage = toUser.Profile.PreferredLocale; var portalSettings = new PortalSettings(message.PortalID); - var emailSubjectTemplate = GetEmailSubjectTemplate(portalSettings, defaultLanguage); var emailBodyTemplate = GetEmailBodyTemplate(portalSettings, defaultLanguage); var emailBodyItemTemplate = GetEmailBodyItemTemplate(portalSettings, defaultLanguage); @@ -708,8 +707,13 @@ private void SendMessage(MessageRecipient messageRecipient) { var senderName = GetSenderName(author.DisplayName, portalSettings.PortalName); var senderAddress = GetSenderAddress(senderName, portalSettings.Email); - var emailBodyItemContent = GetEmailItemContent(portalSettings, messageRecipient, emailBodyItemTemplate); - var subject = string.Format(emailSubjectTemplate, portalSettings.PortalName); + var emailBodyItemContent = GetEmailItemContent(portalSettings, messageRecipient, emailBodyItemTemplate); + var subject = InternalMessagingController.Instance.GetMessage(message.MessageID).Subject; + if (string.IsNullOrEmpty(subject)) + { + subject = string.Format(GetEmailSubjectTemplate(portalSettings, defaultLanguage), portalSettings.PortalName); + } + var body = GetEmailBody(emailBodyTemplate, emailBodyItemContent, portalSettings, toUser); body = RemoveHttpUrlsIfSiteisSSLEnabled(body, portalSettings);