-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Issue 15828 - Notification comment support in the new comment editor #15884
Issue 15828 - Notification comment support in the new comment editor #15884
Conversation
…ll CommentSource types (if feature flag is enabled)
…decide where to get the comment from
…tion-logic-to-new-editor
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
You can test the changes on this Pull Request by downloading the APKs: |
…edited notification comment
… Logic can be split among UseCases later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @RenanLukas ! Looks good and works well :) I left couple of small nitpicks in the code :)
As we discussed, let's keep this PR unmerged, until we can update the content of the comment in notification details (not list) after the edit.
} ?: showUpdateCommentError() | ||
} | ||
|
||
private suspend fun updateCommentEntityLocalDatabase( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the method name - updateEditComment
pushes the comment to sever as well, but I don't think that VM needs to know about what is happening there :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thank you! I had this decision in the VM before extracting it to the UseCase
and completely missed this name 😅
Changing it
@@ -80,7 +80,7 @@ public void onErrorResponse(VolleyError error) { | |||
} | |||
} | |||
|
|||
public static void downloadNoteAndUpdateDB(final String noteID, final RestRequest.Listener respoListener, | |||
public static void downloadNoteAndUpdateDB(final String noteID, final RestRequest.Listener requestListener, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch 👍
whenever(commentsStore.getCommentByLocalSiteAndRemoteId(siteModel.id, remoteCommentId)) | ||
.thenReturn(emptyList()) | ||
whenever(commentsStore.fetchComment(siteModel, remoteCommentId, null)) | ||
.thenReturn(CommentsActionPayload(CommentsActionData(emptyList(), 1))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NP: Doesn't affect the test, but the rowsAffected
in CommentsActionData
will probably be 0 in this case :)
} | ||
|
||
@Test | ||
fun `Should map CommentIdentifier to default CommentEssentials if CommentIdentifier comment not found`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NP: Wonder if this method signature should have = test {...}
instead of { test{...} }
} | ||
|
||
@Test | ||
fun `Should map CommentIdentifier to default CommentEssentials if CommentIdentifier not handled`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want the test to use runBlocking
(= test{...}
) or is it ok like this?
Thank you for the review @khaykov 🎉 I've addressed the comments.
Deal 👍 I'm on it |
…on comment in new editor
…CommentDetailFragment
…the CommentIdentifier
…put enabled settings based on comment identifier
This PR depends on #15918 |
…ication-comment-details-content-not-updated-after-editing Issue 15910 - Fix notification comment details content not updated after editing
…tion-logic-to-new-editor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the issues from the review, and fixing the issue with notification content not updating. Now everything works as expected :)
Fixes #15828
Currently only Site Comments are supported in the new comment editor. The goal of this PR is to also allow Notification Comments to be shown and editable in the new comment editor (instead of the legacy editor). It also tries to make it easier to support other Comment types in the future (e.g. Reader).
To test:
1 - Login with an user that has at least one notification of a comment;
2 - Select any site;
3 - Tap on "Notifications" bottom navigation icon to open Notifications screen;
4 - Tap on "Comments" tab inside Notifications screen;
5 - Tap on the comment you want to test;
6 - Tap on "More" button;
7 - Tap on "Edit" item. The notification comment edit should be opened in the new comment editor;
8 - Edit the comment text;
9 - Tap on "Done";
10 - The comment text should be updated.
Regression Notes
Potential unintended areas of impact
None
What I did to test those areas of impact (or what existing automated tests I relied on)
CommentEssentialsTest.kt
CommentSourceTest.kt
CommentEssentialsExtensionKtTest.kt
GetCommentUseCaseTest.kt
UnifiedCommentsEditViewModelTest.kt
PR submission checklist:
RELEASE-NOTES.txt
if necessary.