Skip to content

Commit f1896ec

Browse files
authored
Fix an issue with P2 sites and follow conversation (#24135)
* Fix an issue with P2 sites and follow conversation * Update release notse
1 parent 4584dbc commit f1896ec

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

RELEASE-NOTES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* [*] Fix Reader Comments: Reply button is hidden when pasting long text (the ap now uses a sheet) [#17964]
2020
* [*] Fix Reader Comments: Cells could sometimes be displayed overlapping another cell [#17653]
2121
* [*] Fix Notifications: quote blocks in the Reply screen are not styled correctly [#13971]
22+
* [*] Fix an issue with "Follow Conversation" button not visible on some P2s [#24135]
23+
* [*] Fix an issue with "Enable Comments Notifications" button being visible and not working correctly on some P2s [#24135]
2224
* [*] Fix Notifications pointing to large threads sometimes break the app [#23993]
2325
* [*] Fix an issue with search results disappearing after returning from site details [#24121]
2426
* [*] Fix Reader: Opening comments is slow [#21887]

WordPress/Classes/Models/ReaderPost+Swift.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ import WordPressUI
33

44
extension ReaderPost {
55

6+
/// - note: this is a workaround for https://github.com/wordpress-mobile/WordPress-iOS/issues/18975 and
7+
/// https://github.com/wordpress-mobile/WordPress-iOS/issues/20953. This code
8+
/// makes sure that you see the "Follow Conversation" button on P2s
9+
/// but not if you have "Emails me all comments" option enabled, which
10+
/// matches the behavior on the web.
11+
var canActuallySubscribeToComments: Bool {
12+
if canSubscribeComments {
13+
return true
14+
}
15+
if isP2Type() {
16+
return !((topic as? ReaderSiteTopic)?.emailSubscription?.sendComments ?? false)
17+
}
18+
return false
19+
}
20+
621
func getSiteIconURL(size: Int) -> URL? {
722
SiteIconViewModel.makeReaderSiteIconURL(iconURL: siteIconURL, siteID: siteID?.intValue, size: CGSize(width: size, height: size))
823
}

WordPress/Classes/Services/FollowCommentsService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class FollowCommentsService: NSObject {
3535
/// Returns a Bool indicating whether or not the comments on the post can be followed.
3636
///
3737
@objc var canFollowConversation: Bool {
38-
return post.canSubscribeComments
38+
return post.canActuallySubscribeToComments
3939
}
4040

4141
/// Fetches the subscription status of the specified post for the current user.

WordPress/Classes/ViewRelated/Reader/Detail/Views/ReaderDetailCommentsHeader.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ReaderDetailCommentsHeader: UITableViewHeaderFooterView, NibReusable {
4646
) {
4747
self.post = post
4848
self.totalComments = totalComments
49-
self.followConversationEnabled = post.commentsOpen && post.canSubscribeComments
49+
self.followConversationEnabled = post.commentsOpen && post.canActuallySubscribeToComments
5050
self.followButtonTappedClosure = followButtonTappedClosure
5151

5252
configureTitle()

0 commit comments

Comments
 (0)