Skip to content

feat(jumpTo): implement lastMessage prop of chats and put add in JumpTo #18060

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jrainville
Copy link
Member

What does the PR do

Fixes #18031

Adds the lastMessage property to ChatDto and to the Chat Model and Item
Adds the lastMessage component to the JumpTo Screen
Updates the lastMessage in the Chat model when new messages are received

Affected areas

  • ChatDto
  • Chat Item
  • Chat Model
  • ChatSection module
  • ShellGridChatItem

Architecture compliance

Screenshot of functionality

  • I've checked the design and this PR matches it

Storybook:
image

Live:
lastMessage.webm

(yeah images don't seem to work, I'll fix 😄 )

Impact on end user

Shows the lastMessage of a chat in the JumpTo screen

How to test

  • use the ENV_SHELL_ENABLED=1
  • have chats

Risk

Tick one:

  • Low risk: 2 devs MUST perform testing as specified above and attach their results as comments to this PR before merging.
  • High risk: QA team MUST perform additional testing in the specified affected areas before merging.

@jrainville jrainville requested review from a team, micieslak, caybro, alexjba and noeliaSD as code owners June 4, 2025 19:29
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to create this file and update all the other ones because I now import message in the chat DTO file and it created a recursive import, because the link preview also imports community, which imports chat, which imports message, which imports link preview 💀

Using a Utils file like this avoids the issue and is just cleaner anyway.

bottomRowComponentFillsWidth: true
bottomRowComponent: Loader {
active: root.lastMessageText && root.lastMessageText.length > 0
clip: true // You can't elide RichText so we use clip instead
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if we can do something about that. It's not as pretty

Copy link
Member

Choose a reason for hiding this comment

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

We could just use a plain text here... and display sth like [Image] or [Sticker] in case the message is not text

Copy link
Member

Choose a reason for hiding this comment

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

Anyway, you could try converting the HTML to plain text and elide instead

Copy link
Member Author

@jrainville jrainville Jun 5, 2025

Choose a reason for hiding this comment

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

We have a couple options:

  • Use the raw text property from the MessageDto
    • Pro: It's the simplest and elides
    • Con: It contains the * and other Markdown elements, which are ugly
  • Use the raw `text but remove the markdown elements
    • Pro: would elide
    • Con: I don't think we have a function to remove markdown stuff yet
  • Use the parsedText property from the MessageDto
    • Pro: Also quite easy and does show what the user would see normally
    • Con: Doesn't elide
  • Use parsedText and remove the HTML
    • Pro: elides
    • Con: has the most parsing (though not enough to cause issues I think)

 @benjthayer the design doesn't have message markdown. What do you reckon would be the best? Do we want to show the rich text? Do we prefer eliding?

Copy link
Member

Choose a reason for hiding this comment

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

I think we want to show the plain text there, so I'd go with the easiest solution that will allow us to elide using some Text element

@status-im-auto
Copy link
Member

status-im-auto commented Jun 4, 2025

Jenkins Builds

Click to see older builds (13)
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ cd6b871 #1 2025-06-04 19:36:53 ~6 min tests/nim 📄log
✔️ cd6b871 #1 2025-06-04 19:39:54 ~9 min macos/aarch64 🍎dmg
✔️ cd6b871 #1 2025-06-04 19:40:24 ~10 min tests/ui 📄log
✔️ cd6b871 #1 2025-06-04 19:43:43 ~13 min linux/x86_64 📦tgz
✔️ cd6b871 #1 2025-06-04 19:51:46 ~21 min macos/x86_64 🍎dmg
✔️ cd6b871 #1 2025-06-04 19:56:48 ~26 min windows/x86_64 💿exe
✖️ 96fb531 #3 2025-06-06 17:51:07 ~6 min tests/nim 📄log
✔️ 96fb531 #3 2025-06-06 17:54:20 ~9 min tests/ui 📄log
✔️ 96fb531 #3 2025-06-06 17:59:25 ~15 min linux/x86_64 📦tgz
✔️ 96fb531 #3 2025-06-06 18:02:01 ~17 min macos/aarch64 🍎dmg
✔️ 96fb531 #3 2025-06-06 18:06:01 ~21 min macos/x86_64 🍎dmg
✔️ 96fb531 #3 2025-06-06 18:07:09 ~22 min windows/x86_64 💿exe
✖️ 96fb531 #4 2025-06-06 18:31:32 ~6 min tests/nim 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✖️ f73e740 #5 2025-06-09 15:06:36 ~6 min tests/nim 📄log
✔️ f73e740 #4 2025-06-09 15:07:54 ~7 min macos/aarch64 🍎dmg
✔️ f73e740 #4 2025-06-09 15:10:27 ~10 min tests/ui 📄log
✔️ f73e740 #4 2025-06-09 15:13:04 ~13 min linux/x86_64 📦tgz
✔️ f73e740 #4 2025-06-09 15:16:48 ~16 min macos/x86_64 🍎dmg
✔️ f73e740 #4 2025-06-09 15:30:50 ~30 min windows/x86_64 💿exe
✔️ 98149ad #6 2025-06-09 15:55:25 ~9 min tests/ui 📄log
✔️ 98149ad #6 2025-06-09 15:55:56 ~9 min macos/aarch64 🍎dmg
✔️ 98149ad #6 2025-06-09 15:59:45 ~13 min linux/x86_64 📦tgz
✔️ 98149ad #6 2025-06-09 16:03:54 ~17 min macos/x86_64 🍎dmg
✔️ 98149ad #6 2025-06-09 16:08:36 ~22 min windows/x86_64 💿exe

Copy link
Member

@caybro caybro 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! Just some minor details

@@ -71,9 +72,8 @@ type ChatDto* = object
readMessagesAtClockValue*: int64
unviewedMessagesCount*: int
unviewedMentionsCount*: int
#lastMessage*: Message ???? It's a question why do we need it here within this context ????
Copy link
Member

Choose a reason for hiding this comment

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

Now we know 😆

if chat.communityChannelUuid() != self.channelUuid:
continue

debug "setChannelInfo", communityId = $self.community.getCommunityId(), channelUuid = $self.channelUuid
Copy link
Member

Choose a reason for hiding this comment

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

leftover?

@@ -42,5 +44,16 @@ ShellGridItem {
}
}

// TODO bottomRowComponent -> last message in this chat
bottomRowComponentFillsWidth: true
bottomRowComponent: Loader {
Copy link
Member

Choose a reason for hiding this comment

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

A Loader inside a Component inside a Loader :)

bottomRowComponentFillsWidth: true
bottomRowComponent: Loader {
active: root.lastMessageText && root.lastMessageText.length > 0
clip: true // You can't elide RichText so we use clip instead
Copy link
Member

Choose a reason for hiding this comment

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

Anyway, you could try converting the HTML to plain text and elide instead

@@ -25,6 +25,7 @@ AbstractButton {
property bool hasNotification
property int notificationsCount
property alias bottomRowComponent: bottomRowLoader.sourceComponent
property bool bottomRowComponentFillsWidth: false
Copy link
Member

Choose a reason for hiding this comment

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

Not needed imo

@@ -42,5 +44,16 @@ ShellGridItem {
}
}

// TODO bottomRowComponent -> last message in this chat
bottomRowComponentFillsWidth: true
Copy link
Member

Choose a reason for hiding this comment

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

You can use sth like:

width: root.availableWidth

on the bottomRowComponent; see e.g. the ShellGridWalletItem

Copy link
Member Author

Choose a reason for hiding this comment

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

It makes the badge leave the Item. Since the bottomRowComponent is not alone on its row, I don't think using all the width makes sense?

image

Copy link
Member

Choose a reason for hiding this comment

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

Ah right yeah... I'll be doing some additional tweaks to the sizes of those grid items, so you can keep it as-is for now

@jrainville jrainville force-pushed the fix/shell-chat-section-load branch from ae50745 to 3f37f24 Compare June 6, 2025 16:48
@jrainville jrainville requested a review from a team as a code owner June 6, 2025 16:48
@jrainville jrainville requested review from Khushboo-dev-cpp and removed request for a team June 6, 2025 16:48
@jrainville jrainville force-pushed the feat/expose-last-message branch from cd6b871 to a381b4f Compare June 6, 2025 17:40
@jrainville
Copy link
Member Author

Fixed the eliding by using plainText

image

Now when an image or sticker is sent:
image

@jrainville jrainville force-pushed the feat/expose-last-message branch from a381b4f to 96fb531 Compare June 6, 2025 17:44
@jrainville jrainville requested a review from caybro June 6, 2025 17:44
@jrainville jrainville force-pushed the fix/shell-chat-section-load branch from 3f37f24 to ded14fc Compare June 9, 2025 14:44
@jrainville jrainville force-pushed the feat/expose-last-message branch from 96fb531 to f73e740 Compare June 9, 2025 14:59
Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

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

Nice!

Base automatically changed from fix/shell-chat-section-load to master June 9, 2025 15:44
Fixes #18031

Adds the `lastMessage` property to ChatDto and to the Chat Model and Item.
Adds the `lastMessage` component to the JumpTo Screen
Updates the `lastMessage` in the Chat model when new messages are received
@jrainville jrainville force-pushed the feat/expose-last-message branch from f73e740 to 98149ad Compare June 9, 2025 15:46
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.

[Qt6 shell] Expose the last message of a chat
3 participants