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

[CIS-1580] Fix "Only visible to you" shown when deleted messages visible for all users #1847

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Mar 14, 2022

🔗 Issue Link

CIS-1580

🎯 Goal

Fix the "Only visible to you" label being displayed when the ChatClientConfig is set to .alwaysVisible.

🛠 Implementation

Applied Solution:
The current implementation is done in the ChatMessageListVC. When the layout options are provided, we override them and remove the .onlyVisibleToYou label in case the config is not the .onlyVisibleToCurrentUser.

Alternative Solution:
It would make more sense to implement this directly in the ChatMessageLayoutOptionsResolver, but this would add a bit of complexity because we would need to inject the ChatClientConfig in the ChatMessageLayoutOptionsResolver. We can't inject it in the constructor, otherwise, we would break the API, and so it would be weird to have an optional chat client config in the resolver, causing it to be error-prone since a customer could easily forget to add the config as a property. For these reasons, the first implementation was the most simple one.

🧪 Testing

  1. Launch the Demo App
  2. Tap on the Configuration button and set the .alwaysVisible for deleted messages.
  3. Enter a channel and delete a message
  4. Deleted messages should not show the "Only Seen by You” label

☑️ Contributor Checklist

  • I have signed the Stream CLA (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • This change follows zero ⚠️ policy (required)
  • Comparison screenshots added for visual changes
  • Affected documentation updated (docusaurus, tutorial, CMS)

@nuno-vieira nuno-vieira requested a review from a team as a code owner March 14, 2022 20:46
@nuno-vieira nuno-vieira added 🐞 Bug An issue or PR related to a bug 🎨 SDK: StreamChatUI Tasks related to the StreamChatUI SDK labels Mar 14, 2022
@nuno-vieira nuno-vieira self-assigned this Mar 14, 2022
Copy link
Contributor

@adamrushy adamrushy 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 Mar 15, 2022

Codecov Report

Merging #1847 (0eb4339) into develop (35d3cc3) will increase coverage by 0.15%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1847      +/-   ##
===========================================
+ Coverage    85.45%   85.60%   +0.15%     
===========================================
  Files          245      245              
  Lines        11911    11911              
===========================================
+ Hits         10179    10197      +18     
+ Misses        1732     1714      -18     
Flag Coverage Δ
llc-tests 85.60% <ø> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Sources/StreamChat/Utils/Logger/Logger.swift 56.28% <0.00%> (+5.98%) ⬆️
...Chat/WebSocketClient/BackgroundTaskScheduler.swift 83.87% <0.00%> (+12.90%) ⬆️

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 35d3cc3...0eb4339. Read the comment docs.

@nuno-vieira nuno-vieira merged commit d53788f into develop Mar 15, 2022
@nuno-vieira nuno-vieira deleted the fix/CIS-1580-OnlyVisibleToYou-label-not-hidden-when-alwaysVisible branch March 15, 2022 16:02
@polqf polqf mentioned this pull request Mar 16, 2022
adamrushy pushed a commit that referenced this pull request Mar 23, 2022
…ble for all users (#1847)

* Fix "Only visible to you" shown when deleted messages visible for all users

* Add snapshot tests to make sure the fix is applied

* Update CHANGELOG.md

* Fix compilation in Tests

* Fix automated review

* Remove stress test plan from LLC Tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug An issue or PR related to a bug 🎨 SDK: StreamChatUI Tasks related to the StreamChatUI SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants