-
Notifications
You must be signed in to change notification settings - Fork 452
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
Rework scroll into view of conversation after post #4531
Conversation
f8ba7e8
to
f8fdf33
Compare
@danxuliu thanks for the addition, indeed I forgot to |
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.
Tested and works as described. But I do not know why before the scrolling was done only if it was not the first item in the list*, so I can not approve :-) In any case, code looks good 👍
*Note that as conversationIsFirstInList
was updated only on mount and on token change if the conversation moved to the top once the list continued scrolling to the top whenever the current user posted a new message (until the conversation was changed). That was probably unintended, though.
Note: I don't understand when a conversation moves to the top and when not, it seemed to be random in my tests... could be another bug.
For me it always moves to the top when the current user postes a message; I have not dug into the code, though.
// Check whether the current conversation is the first in the conversations | ||
// list and stores the value in the component's data. | ||
isCurrentConversationIsFirstInList() { | ||
this.conversationIsFirstInList = this.$store.getters.conversationsList.map(conversation => conversation.token).indexOf(this.token) === 0 |
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.
This didn't work when you had a favorite and posted in a normal conversation?
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.
I just tested in this PR and having a favorite or normal conversation makes no difference.
It just makes sure that whatever room you posted in becomes visible in the left panel.
And when posting in a room that is invisible below the scroll panel, the room gets moved to the top, below favorites, highlighted, and it scrolls to that.
@ma12-co do you know why there was a check for "first room" ?
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.
Don't remember honestly :/
src/components/LeftSidebar/ConversationsList/ConversationsList.vue
Outdated
Show resolved
Hide resolved
Fixes an issue where a chat in the files sidebar would trigger a warning because the conversation list element don't exist there. When posting a message, an event is now triggered so other components could react on it. The conversation list will now take the responsibility of scrolling the current conversation into view after posting, instead of the NewMessageForm. The behavior is also adjusted to always scroll regardless where the conversation is located in the list. Signed-off-by: Vincent Petry <vincent@nextcloud.com> Co-Authored-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
71d7678
to
e3e430e
Compare
adjusted scrollIntoView to "top" instead of "center", rebased, squashed |
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.
tested and works
// Check whether the current conversation is the first in the conversations | ||
// list and stores the value in the component's data. | ||
isCurrentConversationIsFirstInList() { | ||
this.conversationIsFirstInList = this.$store.getters.conversationsList.map(conversation => conversation.token).indexOf(this.token) === 0 |
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.
Don't remember honestly :/
Fixes an issue where a chat in the files sidebar would trigger a warning
because the conversation list element don't exist there. See #4291 (comment)
When posting a message, an event is now triggered so other components
could react on it.
The conversation list will now take the responsibility of scrolling the
current conversation into view after posting, instead of the
NewMessageForm.
The behavior is also adjusted to always scroll regardless where the
conversation is located in the list.
@ma12-co not sure why this was limited to only when it moves to the top.
I tested also by clicking on a conversation at the bottom of list, then scrolling up, then posting: it will now scroll down to highlight the conversation even when at the bottom.
Note: I don't understand when a conversation moves to the top and when not, it seemed to be random in my tests... could be another bug.