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(@message) Album of images disappears from reply after reloading t… #12806

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

kounkou
Copy link
Contributor

@kounkou kounkou commented Nov 21, 2023

Fix(@message) Album of images disappears from reply after reloading the application

Fixes #10986

This PR contains 2 changes :

1- Adding of properties for the quotedMessage
2- Update of the view with the properties with Qml binding

Design decisions :

The reason why the before reload everything works perfectly is because inside MessageView.qml

replyDetails: StatusMessageDetails {

On onResponseMessageChanged signal, we call the messageStore.getMessageByIdAsJson(responseToMessageWithId) to obtain the images of the quotedMessage.

But the model is not made aware of this change at any time. Therefore, when reloading the application, the message doesn't contain the necessary quoted Images to be displayed.
However, the quotedMessage text already exists in the model.

In this PR they were 3 ways to accomplish the goal of fixing the disappearing of images after reloading the application :

[preferred]

  • Add Qml properties in Nim modules to be able to read them directly in the UI

[performance Impactful change as more payload to process]

  • Use the signal from Qml to trigger the finding of the quoted message

[slow and unreliable method]

  • Pass the image in the message going to status-go to be able to read the image on reload

What does the PR do

The PR adds 2 Qml properties and bind them to the View. The 2 properties are the quotedMessageAlbumMessageImages and the quotedMessageAlbumImagesCount that are necessary to display the quoted images (thumbnails) in replies along with how many of the images need to be displayed.

Affected areas

Chat screen is affected. There are only additions to the code.

Screenshot of functionality (including design for comparison)

output

Cheers!

@status-im-auto
Copy link
Member

status-im-auto commented Nov 21, 2023

Jenkins Builds

Click to see older builds (5)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ c263054 #1 2023-11-21 01:39:29 ~5 min tests/nim 📄log
✔️ c263054 #1 2023-11-21 01:42:08 ~7 min macos/aarch64 🍎dmg
✔️ c263054 #1 2023-11-21 01:44:31 ~10 min macos/x86_64 🍎dmg
✔️ c263054 #1 2023-11-21 01:44:56 ~10 min tests/ui 📄log
✔️ c263054 #1 2023-11-21 01:50:17 ~16 min linux/x86_64 📦tgz
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 74ae23e #2 2023-11-21 01:58:36 ~4 min macos/aarch64 🍎dmg
✔️ 74ae23e #2 2023-11-21 01:59:09 ~5 min tests/nim 📄log
✔️ 74ae23e #2 2023-11-21 02:01:03 ~7 min macos/x86_64 🍎dmg
✔️ 74ae23e #2 2023-11-21 02:04:37 ~10 min tests/ui 📄log
✔️ 74ae23e #2 2023-11-21 02:07:57 ~14 min linux/x86_64 📦tgz
✔️ 74ae23e #2 2023-11-21 02:26:31 ~32 min tests/e2e 📄log
✔️ 74ae23e #2 2023-11-21 02:31:20 ~37 min windows/x86_64 💿exe
✔️ 9a59d35 #3 2023-11-22 06:10:38 ~5 min tests/nim 📄log
✔️ 9a59d35 #3 2023-11-22 06:10:42 ~5 min macos/aarch64 🍎dmg
✔️ 9a59d35 #3 2023-11-22 06:13:21 ~8 min macos/x86_64 🍎dmg
✔️ 9a59d35 #3 2023-11-22 06:15:40 ~10 min tests/ui 📄log
✔️ 9a59d35 #3 2023-11-22 06:18:41 ~13 min linux/x86_64 📦tgz
✔️ 9a59d35 #3 2023-11-22 06:27:37 ~22 min windows/x86_64 💿exe
✔️ 9a59d35 #3 2023-11-22 06:36:07 ~31 min tests/e2e 📄log

@kounkou
Copy link
Contributor Author

kounkou commented Nov 21, 2023

I am missing some nim tests, Adding them.

@kounkou kounkou force-pushed the album-disappearing-from-reply branch from c263054 to 74ae23e Compare November 21, 2023 01:53
ui/imports/shared/views/chat/MessageView.qml Show resolved Hide resolved


proc setQuotedMessageImages(self: Module, messages: seq[MessageDto], items: var seq[Item], albumIdToImagesMap: Table[string, seq[string]]) =
for message in messages:
Copy link
Contributor

Choose a reason for hiding this comment

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

This look quite suspicious to me that we have ffor message in messages here while setQuotedMessageImages is already called in the same message loop. You sure everything's ok here? 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Good eye. We can probably move setQuotedMessageImages out of the loop in newMessagesLoaded

Copy link
Contributor Author

@kounkou kounkou Nov 21, 2023

Choose a reason for hiding this comment

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

Let me have a second look on it. Good catch. Updating this.

Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

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

Nice work!

I left a couple of suggestions and also, sadly, we'll need some more work on it in another issue to move it to status-go, since just using Nim is not good enough, since Nim doesn't have all the data.



proc setQuotedMessageImages(self: Module, messages: seq[MessageDto], items: var seq[Item], albumIdToImagesMap: Table[string, seq[string]]) =
for message in messages:
Copy link
Member

Choose a reason for hiding this comment

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

Good eye. We can probably move setQuotedMessageImages out of the loop in newMessagesLoaded

ui/imports/shared/views/chat/MessageView.qml Show resolved Hide resolved
…he application

Fixes #10986

This PR contains 2 changes :

1- Adding of properties for the quotedMessage
2- Update of the view with the properties with Qml binding
@kounkou kounkou force-pushed the album-disappearing-from-reply branch from 74ae23e to 9a59d35 Compare November 22, 2023 06:04
@kounkou
Copy link
Contributor Author

kounkou commented Nov 22, 2023

I have added a ticket : #12821 which I believe would solve more consistently the missing image in reply problem exposed here.
Although the current ticket is a progress because :
1/ we understand better the problem (core question is how to efficiently retrieve the quoted Message images album at any time?)
2/ System design decisions are taken in this PR that would help for the ultimate solution. Essentially, we should probably not increase the payload of a message during the sendMessage to avoid increase latency for processing the images, nor rely on asynchronous call to fetch the images directly from the View.
However, it seems that the solution will end up being asynchronous as we should rely on status-go backend which has RPC calls (depending if we use blocking or non-blocking RPC here) to fetch the images of the corresponding message from the database.

From all the above, I believe it might not make more sense to dive deep further into the current implementation/PR. Please let me know if any thoughts.

Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

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

Looks good. Like discussed, this will need some work on the status-go side to make sure it works in all cases, but for now, this PR still helps mitigate the issue so I'm fine with merging it.

Copy link
Contributor

@igor-sirotin igor-sirotin left a comment

Choose a reason for hiding this comment

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

Nice job! 👍

@kounkou kounkou merged commit aaa759f into master Nov 22, 2023
8 of 9 checks passed
@kounkou kounkou deleted the album-disappearing-from-reply branch November 22, 2023 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Album of images disappears from reply after reloading the app
4 participants