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

Fix messages failing to be deleted when pending updates to the server #2949

Merged
merged 8 commits into from Dec 21, 2023

Conversation

nuno-vieira
Copy link
Member

@nuno-vieira nuno-vieira commented Dec 21, 2023

🔗 Issue Links

Resolves https://github.com/GetStream/ios-issues-tracking/issues/685

🎯 Goal

Fix messages failing to be deleted when pending updates to the server.

📝 Summary

  • Fix messages failing to be deleted when pending updates to the server
  • Makes sure message actions always show at least Edit and Delete action
  • Fixes actions not appearing for local-only messages with BG Mapping enabled

🛠 Implementation

The root cause of the problem is that we were incorrectly calculating the logic for isWaitingToBeSentToTheServer, which has now been renamed to isLocalOnly to better describe the goal of the property. Before, if a message was being edited, but not yet published, we would assume it was local only. This is incorrect since the message is already in the server, since it was published once, even tho it does not have the most updated data.

While debugging this issue, I also fixed a issue that was happening with background mapping. The issue is similar to this one: #2922. Because the ChatMessageController.message is not available on the main thread with background mapping, sometimes it was returning nil.

🧪 Manual Testing Notes

Fix messages failing to be deleted when pending updates to the server:
N/A
Right now this not manually testable in our Demo app, since we do not allow doing any message action while the message is being edited.

Fixes actions not appearing for local-only messages with BG Mapping enabled

  1. Turn off Wi-Fi
  2. Send a message
  3. Long press the message
  4. Message Actions should appear

☑️ Contributor Checklist

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

@nuno-vieira nuno-vieira added 🐞 Bug An issue or PR related to a bug 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK labels Dec 21, 2023
@nuno-vieira nuno-vieira requested a review from a team as a code owner December 21, 2023 00:50
Copy link
Contributor

@martinmitrevski martinmitrevski left a comment

Choose a reason for hiding this comment

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

LGTM ✅ Just added one question.

@nuno-vieira nuno-vieira enabled auto-merge (squash) December 21, 2023 10:26
@nuno-vieira nuno-vieira merged commit 804b42a into develop Dec 21, 2023
7 checks passed
@nuno-vieira nuno-vieira deleted the fix/message-is-local-only-logic branch December 21, 2023 10:34
@nuno-vieira nuno-vieira mentioned this pull request Dec 21, 2023
Copy link

sonarcloud bot commented Dec 21, 2023

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

47 New issues
0 Security Hotspots
91.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

This was referenced Dec 21, 2023
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: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants