@@ -26,6 +26,7 @@ namespace DotNetNuke.Modules.ActiveForums.Controllers
2626 using System . Web ;
2727
2828 using DotNetNuke . Collections ;
29+ using DotNetNuke . Modules . ActiveForums . Data ;
2930 using DotNetNuke . Modules . ActiveForums . Enums ;
3031 using DotNetNuke . Modules . ActiveForums . Services . ProcessQueue ;
3132 using DotNetNuke . Modules . ActiveForums . ViewModels ;
@@ -203,45 +204,49 @@ public int Reply_QuickCreate(int portalId, int moduleId, int forumId, int topicI
203204 return replyId ;
204205 }
205206
206- public int Reply_Save ( int portalId , int moduleId , DotNetNuke . Modules . ActiveForums . Entities . ReplyInfo ri )
207+ public int Reply_Save ( int portalId , int moduleId , DotNetNuke . Modules . ActiveForums . Entities . ReplyInfo reply )
207208 {
208- ri . Content . DateUpdated = DateTime . UtcNow ;
209- if ( ri . ReplyId < 1 )
209+ reply . Content . DateUpdated = DateTime . UtcNow ;
210+ if ( reply . ReplyId < 1 )
210211 {
211- ri . Content . DateCreated = DateTime . UtcNow ;
212+ reply . Content . DateCreated = DateTime . UtcNow ;
212213 }
213214
214215 Utilities . UpdateModuleLastContentModifiedOnDate ( moduleId ) ;
215216
216217 // Clear profile Cache to make sure the LastPostDate is updated for Flood Control
217- DotNetNuke . Modules . ActiveForums . Controllers . ForumUserController . ClearCache ( portalId , ri . Content . AuthorId ) ;
218+ DotNetNuke . Modules . ActiveForums . Controllers . ForumUserController . ClearCache ( portalId , reply . Content . AuthorId ) ;
218219
219- DotNetNuke . Modules . ActiveForums . DataCache . ContentCacheClearForForum ( ri . ModuleId , ri . ForumId ) ;
220- DotNetNuke . Modules . ActiveForums . DataCache . ContentCacheClearForReply ( ri . ModuleId , ri . ReplyId ) ;
221- DotNetNuke . Modules . ActiveForums . DataCache . ContentCacheClearForTopic ( ri . ModuleId , ri . TopicId ) ;
222- DotNetNuke . Modules . ActiveForums . DataCache . ContentCacheClearForContent ( ri . ModuleId , ri . ContentId ) ;
223-
224- // if existing topic, update associated journal item
225- if ( ri . ReplyId > 0 )
220+ // if existing reply being edited, update associated journal item & tags
221+ if ( reply . ReplyId > 0 )
226222 {
227- string fullURL = new ControlUtils ( ) . BuildUrl ( portalId , ri . Forum . GetTabId ( ) , moduleId , ri . Forum . ForumGroup . PrefixURL , ri . Forum . PrefixURL , ri . Forum . ForumGroupId , ri . ForumId , ri . TopicId , ri . Topic . TopicUrl , - 1 , - 1 , string . Empty , 1 , ri . ReplyId , ri . Forum . SocialGroupId ) ;
223+ string fullURL = new ControlUtils ( ) . BuildUrl ( portalId , reply . Forum . GetTabId ( ) , moduleId , reply . Forum . ForumGroup . PrefixURL , reply . Forum . PrefixURL , reply . Forum . ForumGroupId , reply . ForumId , reply . TopicId , reply . Topic . TopicUrl , - 1 , - 1 , string . Empty , 1 , reply . ReplyId , reply . Forum . SocialGroupId ) ;
228224
229225 if ( fullURL . Contains ( "~/" ) )
230226 {
231- fullURL = Utilities . NavigateURL ( ri . Forum . GetTabId ( ) , string . Empty , new string [ ] { $ "{ ParamKeys . TopicId } ={ ri . TopicId } ", $ "{ ParamKeys . ContentJumpId } ={ ri . ReplyId } ", } ) ;
227+ fullURL = Utilities . NavigateURL ( reply . Forum . GetTabId ( ) , string . Empty , new string [ ] { $ "{ ParamKeys . TopicId } ={ reply . TopicId } ", $ "{ ParamKeys . ContentJumpId } ={ reply . ReplyId } ", } ) ;
232228 }
233229
234230 if ( fullURL . EndsWith ( "/" ) )
235231 {
236- fullURL += Utilities . UseFriendlyURLs ( moduleId ) ? $ "#{ ri . ReplyId } " : $ "{ ParamKeys . ContentJumpId } ={ ri . ReplyId } ";
232+ fullURL += Utilities . UseFriendlyURLs ( moduleId ) ? $ "#{ reply . ReplyId } " : $ "{ ParamKeys . ContentJumpId } ={ reply . ReplyId } ";
237233 }
238234
239- new Social ( ) . UpdateJournalItemForPost ( ri . PortalId , ri . ModuleId , ri . Forum . GetTabId ( ) , ri . ForumId , ri . TopicId , ri . ReplyId , ri . Author . AuthorId , fullURL , ri . Content . Subject , string . Empty , ri . Content . Body ) ;
235+ DotNetNuke . Modules . ActiveForums . Controllers . TagController . UpdateTopicTags ( reply ) ;
236+ new Social ( ) . UpdateJournalItemForPost ( reply . PortalId , reply . ModuleId , reply . Forum . GetTabId ( ) , reply . ForumId , reply . TopicId , reply . ReplyId , reply . Author . AuthorId , fullURL , reply . Content . Subject , string . Empty , reply . Content . Body ) ;
240237 }
241238
242- int replyId = Convert . ToInt32 ( DotNetNuke . Modules . ActiveForums . DataProvider . Instance ( ) . Reply_Save ( portalId , ri . TopicId , ri . ReplyId , ri . ReplyToId , ri . StatusId , ri . IsApproved , ri . IsDeleted , ri . Content . Subject . Trim ( ) , ri . Content . Body . Trim ( ) , ri . Content . DateCreated , ri . Content . DateUpdated , ri . Content . AuthorId , ri . Content . AuthorName , ri . Content . IPAddress ) ) ;
243- DotNetNuke . Modules . ActiveForums . Controllers . TopicController . SaveToForum ( moduleId , ri . ForumId , ri . TopicId ) ;
244- DotNetNuke . Modules . ActiveForums . Controllers . ForumController . UpdateForumLastUpdates ( ri . ForumId ) ;
239+ var forum = new DotNetNuke . Modules . ActiveForums . Controllers . ForumController ( ) . GetById ( forumId : reply . ForumId , moduleId : moduleId ) ;
240+ DotNetNuke . Modules . ActiveForums . Controllers . TagController . CleanUpTags ( reply , forum ) ;
241+ int replyId = Convert . ToInt32 ( DotNetNuke . Modules . ActiveForums . DataProvider . Instance ( ) . Reply_Save ( portalId , reply . TopicId , reply . ReplyId , reply . ReplyToId , reply . StatusId , reply . IsApproved , reply . IsDeleted , reply . Content . Subject . Trim ( ) , reply . Content . Body . Trim ( ) , reply . Content . DateCreated , reply . Content . DateUpdated , reply . Content . AuthorId , reply . Content . AuthorName , reply . Content . IPAddress ) ) ;
242+ DotNetNuke . Modules . ActiveForums . Controllers . TopicController . SaveToForum ( moduleId , reply . ForumId , reply . TopicId ) ;
243+ DotNetNuke . Modules . ActiveForums . Controllers . ForumController . UpdateForumLastUpdates ( reply . ForumId ) ;
244+
245+ DotNetNuke . Modules . ActiveForums . DataCache . ContentCacheClearForForum ( reply . ModuleId , reply . ForumId ) ;
246+ DotNetNuke . Modules . ActiveForums . DataCache . ContentCacheClearForReply ( reply . ModuleId , reply . ReplyId ) ;
247+ DotNetNuke . Modules . ActiveForums . DataCache . ContentCacheClearForTopic ( reply . ModuleId , reply . TopicId ) ;
248+ DotNetNuke . Modules . ActiveForums . DataCache . ContentCacheClearForContent ( reply . ModuleId , reply . ContentId ) ;
249+
245250 return replyId ;
246251 }
247252
@@ -321,12 +326,12 @@ internal static bool ProcessApprovedReplyAfterAction(int portalId, int tabId, in
321326
322327 Utilities . UpdateModuleLastContentModifiedOnDate ( moduleId ) ;
323328
324- if ( reply . IsApproved && reply . Content . AuthorId > 0 )
329+ if ( reply . Content . AuthorId > 0 )
325330 {
326331 DotNetNuke . Modules . ActiveForums . Controllers . ForumUserController . UpdateUserReplyCount ( portalId , reply . Content . AuthorId ) ;
327332 }
328333
329-
334+ DotNetNuke . Modules . ActiveForums . Controllers . TagController . UpdateTopicTags ( reply ) ;
330335 DotNetNuke . Modules . ActiveForums . Controllers . UserMentionController . ProcessUserMentions ( reply ) ;
331336
332337 return true ;
0 commit comments