-
Notifications
You must be signed in to change notification settings - Fork 81
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
base: master
Are you sure you want to change the base?
Conversation
Jenkins BuildsClick to see older builds (7)
|
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readonly property bool isPinActionAvaliable: true | |
readonly property bool isPinActionAvailable: true |
ui/app/mainui/Popups.qml
Outdated
@@ -264,7 +264,8 @@ QtObject { | |||
messageStore: messageStore, | |||
pinnedMessagesModel: pinnedMessagesModel, | |||
messageToPin: messageToPin, | |||
chatId: chatId | |||
chatId: chatId, | |||
isPinActionAvaliable: store && store.oneToOneChatContact ? store.oneToOneChatContact.isContact : true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isPinActionAvaliable: store && store.oneToOneChatContact ? store.oneToOneChatContact.isContact : true | |
isPinActionAvailable: store && store.oneToOneChatContact ? store.oneToOneChatContact.isContact : true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
Logs { id: logs } | ||
|
||
QtObject { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used?
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:
Risk
Might affect community pinned messages also