Skip to content
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

NT-1977: UX – Not logged in / not backer for Comment Card #1269

Merged
merged 15 commits into from Jun 2, 2021

Conversation

leighdouglas
Copy link
Contributor

πŸ“² What

We want to disable the reply/comment card action buttons in different user states i.e. logged in or out, backing or not backing, etc.
I also renamed a few variables to be clearer and extracted some functionality into individual methods, for readability and all that good stuff πŸ˜„

πŸ€” Why

  • The reply option should only show if the user is logged in and has backed the project, or if they are the project creator.
  • A user should not be able to reply to projects if they are not logged in, or if they are logged in but have not backed the project or they are not the creator.

πŸ›  How

  • Created a new CommentCardData model that holds the comment, the project the comment is from, and the state of the card (for future use when replying, errored, etc).
  • We then transform the list of comments returned in the network call to a list of CommentCardData, which is passed to the adapter and eventually the CommentsViewHolderViewModel
  • The CommentsViewHolderViewModel view model then performs a check when initialized that returns true or false depending on if the user should see the reply button. This boolean is passed to the CommentViewModel, which toggles the visibility of the action group on the comment card, which holds the reply button as well as the flag comment button.

πŸ‘€ See

No reply/action buttons: Logged out and logged in and NOT backing, respectively:
Screenshot_1622590680 Screenshot_1622591284

Reply/Action buttons visible: Logged in and backing
Screenshot_1622591300

πŸ“‹ QA

Make sure you have a project that you are not backing, a project that you are backing, and a project that you created, and all projects must have comments. Then test the different states listed below.

β›” = no reply or action buttons
βœ… = reply and action buttons visible

These are the different states to test:
Logged out = β›”
Logged in and not backing = β›”
Logged in and backing = βœ…
Logged in and creator = βœ…

Story πŸ“–

NT-1977: UX – Not logged in / not backer for Comment Card

leighdouglas and others added 8 commits June 1, 2021 20:05
# Conflicts:
#	app/src/main/java/com/kickstarter/ui/adapters/CommentsAdapter.kt
#	app/src/main/java/com/kickstarter/viewmodels/CommentsViewModel.kt
#	app/src/test/java/com/kickstarter/viewmodels/CommentsViewModelTest.kt
Copy link
Contributor

@Arkariang Arkariang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm!

@codecov
Copy link

codecov bot commented Jun 2, 2021

Codecov Report

Merging #1269 (57aaadd) into master (3ad9ab3) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1269   +/-   ##
=========================================
  Coverage     74.34%   74.34%           
  Complexity      739      739           
=========================================
  Files           221      221           
  Lines          6646     6646           
  Branches        405      405           
=========================================
  Hits           4941     4941           
  Misses         1569     1569           
  Partials        136      136           

Continue to review full report at Codecov.

Legend - Click here to learn more
Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data
Powered by Codecov. Last update 3ad9ab3...57aaadd. Read the comment docs.

@hadia hadia merged commit 1b95824 into master Jun 2, 2021
@hadia hadia deleted the leigh/nt-1977-comment-card-no-reply branch June 2, 2021 18:32
Arkariang added a commit that referenced this pull request Jun 2, 2021
…tin/NT-1984-feature-flags

* 'master' of github.com:kickstarter/android-oss:
  NT-1977: UX – Not logged in / not backer for Comment Card (#1269)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants