-
Notifications
You must be signed in to change notification settings - Fork 1.4k
CMM-1054 when opening an unauthorized post, the three dots menu icon is not working #22412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
|
|
| App Name | Jetpack | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22412-a94b641 | |
| Commit | a94b641 | |
| Direct Download | jetpack-prototype-build-pr22412-a94b641.apk |
|
| App Name | WordPress | |
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr22412-a94b641 | |
| Commit | a94b641 | |
| Direct Download | wordpress-prototype-build-pr22412-a94b641.apk |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #22412 +/- ##
=======================================
Coverage 39.09% 39.09%
=======================================
Files 2207 2207
Lines 106858 106860 +2
Branches 15159 15160 +1
=======================================
+ Hits 41776 41778 +2
Misses 61566 61566
Partials 3516 3516 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Claude finished @adalpari's task in 1m 40s —— View job Code Review Complete ✅I've reviewed the PR changes for fixing CMM-1054. This is a clean, well-implemented bug fix that addresses the issue where the three-dots menu was visible but non-functional in the error state. SummaryWhat Changed:
Files Changed:
Positive Observations
Code Quality ObservationsReaderPostDetailFragment.kt (1109-1114)The private fun hideMenu(menu: Menu) {
menu.findItem(R.id.menu_browse)?.isVisible = false
menu.findItem(R.id.menu_share)?.isVisible = false
menu.findItem(R.id.menu_reading_preferences)?.isVisible = false
menu.findItem(R.id.menu_more)?.isVisible = false
}Observation: This function manually hides each menu item individually. Consider adding a comment explaining why all items need to be hidden (they require a loaded post to function). ReaderPostDetailFragment.kt (503-511)The "Open in browser" button initialization: private fun initOpenInBrowserButton(view: View) {
view.findViewById<View>(R.id.open_in_browser_button).setOnClickListener {
viewModel.interceptedUri?.let { uri ->
readerTracker.trackUri(AnalyticsTracker.Stat.DEEP_LINKED_FALLBACK, uri)
ReaderActivityLauncher.openUrl(requireActivity(), uri, OpenUrlType.EXTERNAL)
requireActivity().finish()
}
}
}Good practices:
ReaderPostDetailViewModel.kt (711-719)The error state construction with proper visibility flags: private fun trackAndUpdateNotAuthorisedErrorState() {
trackNotAuthorisedState()
_uiState.value = ErrorUiState(
message = UiStringRes(getNotAuthorisedErrorMessageRes()),
signInButtonVisibility = shouldOfferSignIn,
openInBrowserButtonVisibility = interceptedUri != null
)
}Excellent: Clean logic - the browser button only shows when there's actually a URI to open. Layout Changes (reader_fragment_post_detail.xml:158-171)<org.wordpress.android.widgets.WPTextView
android:id="@+id/open_in_browser_button"
style="@style/WordPress.NUXPrimaryButton"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/margin_extra_large"
android:layout_below="@+id/text_error"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:text="@string/reader_open_in_browser"
android:visibility="gone"
android:layout_marginEnd="@dimen/reader_detail_margin"
android:layout_marginStart="@dimen/reader_detail_margin"
tools:visibility="visible"/>Concern: Both
Question: Can both conditions be true simultaneously? If yes, the layout would need adjustment to stack the buttons properly. Testing CoverageThe test coverage is comprehensive with 4 new tests covering all combinations: ReaderPostDetailViewModelTest.kt:582-608
Strong test coverage ensures the feature works correctly across all states. String ResourcesThe string changes appropriately remove misleading references to "top action button": - "You're not authorized to view this post. Use the top action button to try a browser instead."
+ "You're not authorized to view this post"
- "Try signing in to WordPress.com first or use the top action button to open a browser instead."
+ "Try signing in to WordPress.com first."New string added: <string name="reader_open_in_browser">Open in browser</string>Good: Clear, concise, and user-friendly. Minor Suggestions
Security Considerations✅ No security issues identified:
Performance Considerations✅ No performance concerns:
ConclusionThis is a well-implemented fix that addresses the reported issue effectively. The code follows Android best practices, maintains consistency with the existing codebase, and includes solid test coverage. The user experience improvement is clear - users now have a working alternative when they can't access a post via deeplink. Recommendation: ✅ Approve with the minor layout verification noted above. | |





Description
Problem
When opening a deeplink to a Reader post the user isn't authorized to view:
Solution
Testing instructions
Verify error message displays with "Open in browser" button (no toolbar menu icons), and it opens the browser
Open other posts form the reader or from deeplinks and verify the top menu is shown and works
Before:
After: