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

remove some dependencies from PinnedMessagePopup #16435

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

iurimatias
Copy link
Member

What does the PR do

Removes some of the dependencies on the store on PinnedMessagePopup, however some still remains because it requires refactoring the MessageView component.

Affected areas

Pinned Messages

Impact on end user

Functionality should stay the same

How to test

On Group Chats:

  • Pin a message
  • View Pinned Messages
  • Jump to messages
  • Unpin messages

Risk

Might affect community pinned messages also

@iurimatias iurimatias requested review from a team, jrainville, osmaczko and glitchminer and removed request for a team October 1, 2024 15:23
@status-im-auto
Copy link
Member

status-im-auto commented Oct 1, 2024

Jenkins Builds

Click to see older builds (7)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 985f482 #1 2024-10-01 15:30:19 ~6 min tests/nim 📄log
✔️ 985f482 #1 2024-10-01 15:32:18 ~8 min macos/aarch64 🍎dmg
✔️ 985f482 #1 2024-10-01 15:35:47 ~12 min tests/ui 📄log
✔️ 985f482 #1 2024-10-01 15:38:09 ~14 min linux-nix/x86_64 📦tgz
✔️ 985f482 #1 2024-10-01 15:39:37 ~15 min macos/x86_64 🍎dmg
✔️ 985f482 #1 2024-10-01 15:42:33 ~18 min linux/x86_64 📦tgz
✔️ 985f482 #1 2024-10-01 15:44:41 ~20 min windows/x86_64 💿exe
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ e73bcb5 #2 2024-10-04 15:10:39 ~6 min macos/aarch64 🍎dmg
✔️ e73bcb5 #2 2024-10-04 15:10:52 ~7 min tests/nim 📄log
✔️ e73bcb5 #2 2024-10-04 15:15:42 ~11 min macos/x86_64 🍎dmg
✔️ e73bcb5 #2 2024-10-04 15:15:58 ~12 min tests/ui 📄log
✔️ e73bcb5 #2 2024-10-04 15:19:48 ~16 min linux/x86_64 📦tgz
✔️ e73bcb5 #2 2024-10-04 15:21:13 ~17 min linux-nix/x86_64 📦tgz
✔️ e73bcb5 #2 2024-10-04 15:22:50 ~18 min windows/x86_64 💿exe
✔️ ec394ec #3 2024-10-10 13:50:24 ~6 min macos/aarch64 🍎dmg
✔️ ec394ec #3 2024-10-10 13:50:41 ~6 min tests/nim 📄log
✔️ ec394ec #3 2024-10-10 13:56:12 ~12 min tests/ui 📄log
✔️ ec394ec #3 2024-10-10 13:59:23 ~15 min linux-nix/x86_64 📦tgz
✔️ ec394ec #3 2024-10-10 14:00:00 ~16 min linux/x86_64 📦tgz
✔️ ec394ec #3 2024-10-10 14:00:27 ~16 min macos/x86_64 🍎dmg
✔️ ec394ec #3 2024-10-10 14:05:44 ~21 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.

LGTM

Modulo the typo (I know this is existing code though)

@@ -25,8 +25,11 @@ StatusDialog {
property string messageToUnpin
property string chatId

readonly property var contactDetails: store ? store.oneToOneChatContact : null
readonly property bool isPinActionAvaliable: contactDetails ? contactDetails.isContact : true
readonly property bool isPinActionAvaliable: true
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
readonly property bool isPinActionAvaliable: true
readonly property bool isPinActionAvailable: true

@@ -264,7 +264,8 @@ QtObject {
messageStore: messageStore,
pinnedMessagesModel: pinnedMessagesModel,
messageToPin: messageToPin,
chatId: chatId
chatId: chatId,
isPinActionAvaliable: store && store.oneToOneChatContact ? store.oneToOneChatContact.isContact : true
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
isPinActionAvaliable: store && store.oneToOneChatContact ? store.oneToOneChatContact.isContact : true
isPinActionAvailable: store && store.oneToOneChatContact ? store.oneToOneChatContact.isContact : true

Copy link
Member

@micieslak micieslak left a comment

Choose a reason for hiding this comment

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

Is the storybook working for you? It looks like that for me:

image

No content and many warning in logs.

Copy link
Member

@micieslak micieslak left a comment

Choose a reason for hiding this comment

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

The SB page seems to be kind of work in progress, many things are broken here and need adjustments.

After quick investigation I manged to display some content:

Screenshot from 2024-10-02 14-56-17

However there is still a lot of work to do to adjust everything correctly.


Logs { id: logs }

QtObject {
Copy link
Member

Choose a reason for hiding this comment

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

assigning this object results with:

storybook/pages/PinnedMessagesPopupPage.qml:177:17: Unable to assign QObject_QML_12084 to MessageStore_QMLTYPE_12017

It's necessary to use mechanism of stubs here. It means that store should be imported and used in it's typed form:

import AppLayouts.Chat.stores 1.0

MessageStore {
    id: mockMessageStore
    // mock stuff here
}

Similarly with RootStore below.

id: pinnedMessagesPopup
store: mockRootStore
messageStore: mockMessageStore
pinnedMessagesModel: mockMessageStore.messages
Copy link
Member

Choose a reason for hiding this comment

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

What is expected here is model, so it should be like:

    ListModel {
        id: messagesModel

        Component.onCompleted: {
            append(messages)
        }
    }

and messagesModel should be used in this binding here.

id: mockMessageStore
property var messages: [
{
messageId: "msg1",
Copy link
Member

Choose a reason for hiding this comment

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

Role names used here doesn't match what's expected in PinnedMessagesPopup, e.g.:

MessageView {
    id: messageItem

    messageId: model.id
    // ...
}

So messageId -> id. Some roles seem to be missing as well.

}

TextField {
id: messageToPinInput
Copy link
Member

Choose a reason for hiding this comment

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

not used?

@iurimatias iurimatias requested a review from alexjba as a code owner October 10, 2024 13:43
@iurimatias iurimatias requested a review from micieslak October 10, 2024 13:45
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.

5 participants