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

chore: Unblock button is no longer visible when we block someone (WPB-2427) #2012

Merged

Conversation

ohassine
Copy link
Member

@ohassine ohassine commented Jul 26, 2023


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

In other profile screen, unblock button is no longer visible when block someone. We see "Open Conversation" instead

Causes (Optional)

Main Cause: The state in ConnectionActionButtonViewModelImpl is not being updating when the user is blocked.

The state is initialised on viewModel creation by getting passed params and then it will never be updated.
This happens because we already have an instance of the viewModel and the system won't create another one after recomposition. Therefore we will use the same state all the time.

Solutions

Since the connectionState is not something specific to ConnectionActionButtonViewModel, and it's already managed in OtherUserProfileScreenViewModel. I removed it from ConnectionActionButtonViewModel to be handled in one place.

Dependencies (Optional)

If there are some other pull requests related to this one (e.g. new releases of frameworks), specify them here.

Needs releases with:

  • GitHub link to other pull request

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.

Notes (Optional)

Specify here any other facts that you think are important for this issue.

Attachments (Optional)

Attachments like images, videos, etc. (drag and drop in the text box)


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Merging #2012 (07094be) into develop (35bc54c) will increase coverage by 0.09%.
Report is 2 commits behind head on develop.
The diff coverage is 68.75%.

@@              Coverage Diff              @@
##             develop    #2012      +/-   ##
=============================================
+ Coverage      38.54%   38.64%   +0.09%     
  Complexity       895      895              
=============================================
  Files            287      287              
  Lines          11347    11345       -2     
  Branches        1460     1460              
=============================================
+ Hits            4374     4384      +10     
+ Misses          6545     6536       -9     
+ Partials         428      425       -3     
Files Changed Coverage Δ
...d/ui/connection/ConnectionActionButtonViewModel.kt 74.00% <66.66%> (+11.62%) ⬆️
...n/kotlin/com/wire/android/model/ActionableState.kt 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35bc54c...07094be. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 26, 2023

Test Results

516 tests  +3   515 ✔️ +3   26s ⏱️ +5s
  74 suites ±0       1 💤 ±0 
  74 files   ±0       0 ±0 

Results for commit 07094be. ± Comparison against base commit 35bc54c.

This pull request removes 5 and adds 8 tests. Note that renamed tests count towards both.
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given a userId, when accepting a connection request, then returns a Success result and update view state()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given a userId, when canceling a connection request, then returns a Success result and update view state()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given a userId, when ignoring a connection request, then returns a Success result and update view state()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given a userId, when sending a connection request a fails, then returns a Failure result and show error message()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given a userId, when sending a connection request, then returns a Success result and update view state()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given a failure, when sending a connection request, then emit failure message()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given failure, when accepting a connection request, then emit failure message()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given failure, when canceling a connection request, then emit failure message()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given failure, when ignoring a connection request, then emit error message()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given success, when accepting a connection request, then emit success message()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given success, when canceling a connection request, then emit success message()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given success, when ignoring a connection request, then navigate back()
com.wire.android.ui.connection.ConnectionActionButtonViewModelTest ‑ given success, when sending a connection request, then emit success message()

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

@ohassine ohassine requested review from Garzas, a team, typfel, gongracr, MohamadJaara and vitorhugods and removed request for a team July 26, 2023 12:40
@AndroidBob
Copy link
Collaborator

Build 701 succeeded.

The build produced the following APK's:

Copy link
Contributor

@alexandreferris alexandreferris left a comment

Choose a reason for hiding this comment

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

Nice! Just have some tiny suggestions if they make sense 🤔

ohassine and others added 4 commits July 26, 2023 15:38
…ctionButtonViewModel.kt

Co-authored-by: Alexandre Ferris <[email protected]>
…ctionButtonViewModel.kt

Co-authored-by: Alexandre Ferris <[email protected]>
…ctionButtonViewModel.kt

Co-authored-by: Alexandre Ferris <[email protected]>
…ctionButtonViewModel.kt

Co-authored-by: Alexandre Ferris <[email protected]>
@github-actions
Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

@AndroidBob
Copy link
Collaborator

Build 707 succeeded.

The build produced the following APK's:

@MohamadJaara MohamadJaara added this pull request to the merge queue Jul 26, 2023
Merged via the queue into develop with commit 8232380 Jul 26, 2023
10 checks passed
@MohamadJaara MohamadJaara deleted the fix_unblock_button_not_visible_after_blocking_someone branch July 26, 2023 14:39
ohassine added a commit that referenced this pull request Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants