CMM-1208 strange subscription notifications UI settings#22550
CMM-1208 strange subscription notifications UI settings#22550
Conversation
Generated by 🚫 Danger |
|
Claude finished @adalpari's task in 1m 40s —— View job Code Review Completed ✓
SummaryThe implementation correctly addresses the UI inconsistencies described in the PR. The fix properly updates the cached Detailed Review✅ Code Quality & Best PracticesStrengths:
Minor Observations:
✅ SecurityNo security concerns identified. The changes are UI-focused state management with no:
✅ PerformanceExcellent performance characteristics:
🟡 TestingConcern: Missing test coverage This file has no associated unit tests. The changes modify critical user-facing behavior (button visibility and state) but lack automated verification. Recommendation: While not blocking for this PR (fixing a bug is valuable), consider adding tests for:
Test file suggestion: Create Example test cases: @Test
fun `subscription settings button visible after successful follow`() {
// Given: blog info with isFollowing = false
// When: follow succeeds
// Then: button visibility = VISIBLE
}
@Test
fun `subscription settings button hidden after successful unfollow`() {
// Given: blog info with isFollowing = true
// When: unfollow succeeds
// Then: button visibility = GONE
}
@Test
fun `subscription settings button disabled during unsubscribe`() {
// Given: subscribed blog
// When: unsubscribe initiated
// Then: button.isEnabled = false
}
@Test
fun `subscription settings button re-enabled if unsubscribe fails`() {
// Given: subscribed blog
// When: unsubscribe fails
// Then: button.isEnabled = true
}✅ DocumentationThe PR description provides excellent documentation:
The code is self-explanatory with the inline comments added (lines 320, 345, 355). Edge Cases ConsideredThe implementation handles key edge cases:
Potential Future Improvements
Inline Code ReviewWordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java:320-323// Disable subscription settings button while unsubscribing
if (!isAskingToFollow && mSubscriptionSettingsButton != null) {
mSubscriptionSettingsButton.setEnabled(false);
}✅ Good: Prevents user interaction during async operation. Only disables during unsubscribe (when WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java:344-349if (succeeded) {
// Update cached blog info and subscription settings button visibility
if (mBlogInfo != null) {
mBlogInfo.isFollowing = isAskingToFollow;
updateSubscriptionSettingsButtonVisibility(mBlogInfo);
}✅ Excellent: This is the core fix. Updates the cached state and refreshes UI visibility. The null check is defensive and appropriate. Minor note: Direct field mutation ( WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java:355-358// Re-enable subscription settings button if unsubscribe failed
if (!isAskingToFollow && mSubscriptionSettingsButton != null) {
mSubscriptionSettingsButton.setEnabled(true);
}✅ Good: Properly handles failure case by restoring button interactability. Matches the disable logic at line 321-323. WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java:398mSubscriptionSettingsButton.setEnabled(showSettings);✅ Good for consistency: Ensures enabled state matches visibility state. This is defensive programming and prevents edge cases where visibility and enabled state could diverge. VerdictApprove ✅ This is a solid bug fix that correctly addresses the reported UI inconsistencies. The implementation is clean, handles edge cases appropriately, and introduces no security or performance concerns. The main gap is test coverage, which is a broader issue for this file rather than a problem introduced by this PR. The changes are safe to merge. I recommend adding tests in a follow-up task to prevent future regressions. |
|
WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java
Show resolved
Hide resolved
WordPress/src/main/java/org/wordpress/android/ui/reader/views/ReaderSiteHeaderView.java
Show resolved
Hide resolved
|
|
|
|





Description
Fixes UI inconsistencies in the Reader blog subscription settings button behavior.
Problems:
Root cause:
In
ReaderSiteHeaderView.java, after a successful follow/unfollow action, the cachedmBlogInfo.isFollowingwas never updated andupdateSubscriptionSettingsButtonVisibility()was never called, causing the button visibility to remain based on stale state.Fix:
mBlogInfo.isFollowingafter successful follow/unfollowupdateSubscriptionSettingsButtonVisibility()to refresh the button immediatelyTesting instructions
Test subscription settings button visibility:
Screen_recording_20260202_121059.mp4