@@ -2,6 +2,11 @@ import Foundation
2
2
import UIKit
3
3
import WordPressShared
4
4
5
+ // Notification sent when a comment is moderated/edited to allow views that display Comments to update if necessary.
6
+ // Specifically, the Comments snippet on ReaderDetailViewController.
7
+ extension NSNotification . Name {
8
+ static let ReaderCommentModifiedNotification = NSNotification . Name ( rawValue: " ReaderCommentModifiedNotification " )
9
+ }
5
10
6
11
@objc public extension ReaderCommentsViewController {
7
12
func shouldShowSuggestions( for siteID: NSNumber ? ) -> Bool {
@@ -218,6 +223,8 @@ private extension ReaderCommentsViewController {
218
223
CommentAnalytics . trackCommentEdited ( comment: comment)
219
224
220
225
self ? . commentService. uploadComment ( comment, success: {
226
+ NotificationCenter . default. post ( name: . ReaderCommentModifiedNotification, object: nil )
227
+
221
228
// update the thread again in case the approval status changed.
222
229
tableView. reloadRows ( at: [ indexPath] , with: . automatic)
223
230
} , failure: { _ in
@@ -232,6 +239,8 @@ private extension ReaderCommentsViewController {
232
239
233
240
func moderateComment( _ comment: Comment , status: CommentStatusType , handler: WPTableViewHandler ) {
234
241
let successBlock : ( String ) -> Void = { [ weak self] noticeText in
242
+ NotificationCenter . default. post ( name: . ReaderCommentModifiedNotification, object: nil )
243
+
235
244
// Adjust the ReaderPost's comment count.
236
245
if let post = self ? . post, let commentCount = post. commentCount? . intValue {
237
246
let adjustment = ( status == . approved) ? 1 : - 1
0 commit comments