Skip to content

Commit

Permalink
Merge pull request #17557 from wordpress-mobile/issue/17476-overflow-…
Browse files Browse the repository at this point in the history
…menu-button

Reader Comments: Show ellipsis button when comment can be moderated
  • Loading branch information
dvdchr authored Nov 25, 2021
2 parents 7efda72 + b1e23eb commit ac6a682
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions WordPress/Classes/Models/Comment+CoreDataClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public class Comment: NSManagedObject {
/// Convenience method to check if the current user can actually moderate.
/// `canModerate` is only applicable when the site is dotcom-related (hosted or atomic). For self-hosted sites, default to true.
func allowsModeration() -> Bool {
if let _ = post as? ReaderPost {
return canModerate
}

guard let blog = blog,
(blog.isHostedAtWPcom || blog.isAtomic()) else {
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import UIKit

cell.indentationWidth = Constants.indentationWidth
cell.indentationLevel = min(Constants.maxIndentationLevel, Int(comment.depth))
cell.accessoryButtonType = comment.allowsModeration() ? .ellipsis : .share
cell.hidesModerationBar = true
cell.configure(with: comment) { _ in
tableView.performBatchUpdates({})
Expand Down

0 comments on commit ac6a682

Please sign in to comment.