Skip to content

Commit 4f21a20

Browse files
authoredJul 8, 2024
Merge pull request #972 from johnhenley/issues/topics-to-be-moderated-still-sending-notifications-971
FIX: Email notifications should not be sent until topic is moderated
2 parents 81fabd3 + d1b1419 commit 4f21a20

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed
 

‎Dnn.CommunityForums/controls/af_post.ascx.cs

+26-30
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected override void OnInit(EventArgs e)
9999
{
100100
if (!_canEdit && (Request.Params[ParamKeys.action].ToLowerInvariant() == PostActions.TopicEdit || Request.Params[ParamKeys.action].ToLowerInvariant() == PostActions.ReplyEdit))
101101
Response.Redirect(NavigateUrl(TabId));
102-
}
102+
}
103103

104104
if (CanCreate == false && CanReply == false)
105105
Response.Redirect(NavigateUrl(TabId, "", "ctl=login") + "?returnurl=" + Server.UrlEncode(Request.RawUrl));
@@ -819,28 +819,18 @@ private void SaveTopic()
819819
DataCache.CacheClearPrefix(ForumModuleId, string.Format(CacheKeys.TopicsViewPrefix, ForumModuleId));
820820
DataCache.CacheClearPrefix(ForumModuleId, string.Format(CacheKeys.ForumViewPrefix, ForumModuleId));
821821

822-
if (ti.IsApproved == false)
822+
if (!ti.IsApproved)
823823
{
824824
DotNetNuke.Modules.ActiveForums.Controllers.TopicController.QueueUnapprovedTopicAfterAction(PortalId, TabId, ForumModuleId, _fi.ForumGroupId, ForumId, TopicId, 0, ti.Content.AuthorId);
825-
826825
string[] @params = { ParamKeys.ForumId + "=" + ForumId, ParamKeys.ViewType + "=confirmaction", ParamKeys.ConfirmActionId + "=" + ConfirmActions.MessagePending };
827826
Response.Redirect(NavigateUrl(ForumTabId, "", @params), false);
828-
}
829-
if (!_isEdit)
830-
{
831-
DotNetNuke.Modules.ActiveForums.Controllers.TopicController.QueueApprovedTopicAfterAction(PortalId, TabId, ModuleId, ForumInfo.ForumGroupId, ForumId, TopicId, 0, ti.Content.AuthorId);
832-
}
833-
834-
if (ti.IsApproved == false)
835-
{
836-
string[] @params = { ParamKeys.ForumId + "=" + ForumId, ParamKeys.ViewType + "=confirmaction", ParamKeys.ConfirmActionId + "=" + ConfirmActions.MessagePending };
837-
Response.Redirect(NavigateUrl(TabId, "", @params), false);
827+
Context.ApplicationInstance.CompleteRequest();
838828
}
839829
else
840830
{
841-
if (ti != null)
831+
if (!_isEdit)
842832
{
843-
ti.TopicId = TopicId;
833+
DotNetNuke.Modules.ActiveForums.Controllers.TopicController.QueueApprovedTopicAfterAction(PortalId, TabId, ModuleId, ForumInfo.ForumGroupId, ForumId, TopicId, 0, ti.Content.AuthorId);
844834
}
845835
ControlUtils ctlUtils = new ControlUtils();
846836
string sUrl = ctlUtils.BuildUrl(TabId, ForumModuleId, ForumInfo.ForumGroup.PrefixURL, ForumInfo.PrefixURL, ForumInfo.ForumGroupId, ForumInfo.ForumID, TopicId, ti.TopicUrl, -1, -1, string.Empty, 1, -1, SocialGroupId);
@@ -849,6 +839,7 @@ private void SaveTopic()
849839
sUrl = Utilities.NavigateURL(ForumTabId, "", ParamKeys.TopicId + "=" + TopicId);
850840
}
851841
Response.Redirect(sUrl, false);
842+
Context.ApplicationInstance.CompleteRequest();
852843
}
853844
}
854845
catch (Exception ex)
@@ -972,27 +963,32 @@ private void SaveReply()
972963
new SubscriptionController().Subscription_Update(PortalId, ForumModuleId, ForumId, TopicId, 1, authorId, ForumUser.UserRoles);
973964
}
974965
}
975-
if (ri.IsApproved == false)
966+
if (!ri.IsApproved)
976967
{
977968
DotNetNuke.Modules.ActiveForums.Controllers.ReplyController.QueueUnapprovedReplyAfterAction(PortalId, TabId, ForumModuleId, _fi.ForumGroupId, ForumId, TopicId, tmpReplyId, ri.Content.AuthorId);
978969

979970
string[] @params = { ParamKeys.ForumId + "=" + ForumId, ParamKeys.TopicId + "=" + TopicId, ParamKeys.ViewType + "=confirmaction", ParamKeys.ConfirmActionId + "=" + ConfirmActions.MessagePending };
980971
Response.Redirect(Utilities.NavigateURL(TabId, "", @params), false);
972+
Context.ApplicationInstance.CompleteRequest();
981973
}
982-
if (!_isEdit)
983-
{
984-
DotNetNuke.Modules.ActiveForums.Controllers.ReplyController.QueueApprovedReplyAfterAction(PortalId, TabId, ModuleId, _fi.ForumGroupId, ForumId, TopicId, tmpReplyId, ri.Content.AuthorId);
985-
}
986-
var fullURL = new ControlUtils().BuildUrl(TabId, ForumModuleId, ForumInfo.ForumGroup.PrefixURL, ForumInfo.PrefixURL, ForumInfo.ForumGroupId, ForumInfo.ForumID, TopicId, ri.Topic.TopicUrl, -1, -1, string.Empty, 1, tmpReplyId, SocialGroupId);
987-
if (fullURL.Contains("~/"))
988-
{
989-
fullURL = Utilities.NavigateURL(TabId, "", new[] { ParamKeys.TopicId + "=" + TopicId, ParamKeys.ContentJumpId + "=" + tmpReplyId });
990-
}
991-
if (fullURL.EndsWith("/"))
992-
{
993-
fullURL += Utilities.UseFriendlyURLs(ForumModuleId) ? String.Concat("#", tmpReplyId) : String.Concat("?", ParamKeys.ContentJumpId, "=", tmpReplyId);
994-
}
995-
Response.Redirect(fullURL);
974+
else
975+
{
976+
if (!_isEdit)
977+
{
978+
DotNetNuke.Modules.ActiveForums.Controllers.ReplyController.QueueApprovedReplyAfterAction(PortalId, TabId, ModuleId, _fi.ForumGroupId, ForumId, TopicId, tmpReplyId, ri.Content.AuthorId);
979+
}
980+
var fullURL = new ControlUtils().BuildUrl(TabId, ForumModuleId, ForumInfo.ForumGroup.PrefixURL, ForumInfo.PrefixURL, ForumInfo.ForumGroupId, ForumInfo.ForumID, TopicId, ri.Topic.TopicUrl, -1, -1, string.Empty, 1, tmpReplyId, SocialGroupId);
981+
if (fullURL.Contains("~/"))
982+
{
983+
fullURL = Utilities.NavigateURL(TabId, "", new[] { ParamKeys.TopicId + "=" + TopicId, ParamKeys.ContentJumpId + "=" + tmpReplyId });
984+
}
985+
if (fullURL.EndsWith("/"))
986+
{
987+
fullURL += Utilities.UseFriendlyURLs(ForumModuleId) ? String.Concat("#", tmpReplyId) : String.Concat("?", ParamKeys.ContentJumpId, "=", tmpReplyId);
988+
}
989+
Response.Redirect(fullURL, false);
990+
Context.ApplicationInstance.CompleteRequest();
991+
}
996992
}
997993
catch (Exception)
998994
{

0 commit comments

Comments
 (0)