-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Conversation
26d8c47
to
f3cd349
Compare
f3cd349
to
be4eae5
Compare
@lieut-data Should I test this PR after the redux one is merged, or before? Should I also test the Redux PR separately? |
@jasonblais, this PR has the Redux commit baked into it, so it's worth testing together. I've added you as reviewer to mattermost/mattermost-redux#693 explicitly to get your feedback on that part of the change. |
Thanks Jesse, just saw the note in the redux PR. Will review both 👍 |
Heads up that there is an issue with the with the RHS throwing an exception for which I'll push up a commit for, but I won't bother recreating the test server right away. |
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.
Observations (Mac Sierra; Chrome):
1 - Join a channel with previous posts; Type @
in the message box.
Observed: User autocomplete doesn't open. Clearing the at-symbol and re-typing it opens the user autocomplete.
This also reproduces for channels I've joined but haven't yet viewed in my session. Also reproduces after posting an at-mention, and re-typing @
in the message box.
- Every at-mention results in
user not in channel
even if they still were
- In the attached screenshot,
brandon.ford
has left the channel but appears in channel member lists, and thein channel
list in user autocomplete. It persists after a page reload.
If the user is removed from the channel, the above doesn't reproduce. Not reproducing on the master
branch.
<I only did some smoke testing so there may be other issues in addition to above; I'll queue this for more complete QA testing after we've discussed point 4 below>
4 - I want to pause testing and fully understand the consequences of the Redux PR mattermost/mattermost-redux#693
I assume what we see in point 3 would be a consequence, since the user sees a post from Brandon in the channel and the app wouldn't know if they have left or not.
If so, I worry about that consequence. We have received reports in the past from customers where they saw a user leave a channel (or a user was removed from the channel), yet they still appeared to be a member of the channel. They were concerned if they still had access to the private conversations.
Previously those reports were caused by actual bugs, but I worry the results in 3 will be perceived as such.
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.
Based on above
Thanks for the feedback, @jasonblais!
|
4 - There might certainly be UX changes we could consider - some competitors don't separate users in the autocomplete at all. To confirm:
Is the above correct? 5 - Question: Do we need to make any changes on mobile? |
Thanks all! @lieut-data I moved this to dev review, please help queue it for the appropriate devs :) |
@@ -444,7 +444,9 @@ export default class CreateComment extends React.PureComponent { | |||
|
|||
if (allowSending) { | |||
e.persist(); | |||
this.refs.textbox.blur(); | |||
if (this.refs.textbox) { | |||
this.refs.textbox.getWrappedInstance().blur(); |
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'd love feedback on connecting Textbox
and updating the world to poke through the wrapped instance like this. An alternative was to push up the the store access to all components that used the Textbox
, but that seems like a violation of concerns. Alternatively, I could have accessed the store globally from within the suggestion provider, but there's currently no way to "trigger" the user of the provider to try a pretext match.
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'm not sure I understand. Do you mean to avoid the mess of getWrappedInstance
?
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.
Yeah, that :/
@@ -52,7 +58,12 @@ export default class Textbox extends React.Component { | |||
this.state = {}; | |||
|
|||
this.suggestionProviders = [ | |||
new AtMentionProvider(this.props.channelId), | |||
new AtMentionProvider({ |
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.
Ideally, AtMentionProvider
would be connected itself, but while this is technically possible, it still leaves us without a way to back-propagate pretext changes on props-only changes unless Textbox
is in on the loop.
} | ||
|
||
// setProps gives the provider additional context for matching pretexts. Ideally this would | ||
// just be something akin to a connected component with access to the store itself. |
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 is something I've wanted to look at as well. We could either:
- Change the Provider classes to components that just render nothing so that we can render something like
<SuggestionBox><AtMentionProvider/></SuggestionBox>
- Hook into the context when instantiating the
Textbox
to pass the store directly to the Provider
The first method is a bit hacky since the provider is not really a component, but it is cleaner than the second one since that requires us to breach the encapsulation provided by react-redux
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.
The first also naturally moves us towards triggering a "render" (i.e. prefix match) on any change, while the latter has the difficulty of still needing to notify the renderer that the provider has changed, perhaps outside of an explicit pretext match. Complicated either way, I suppose!
@@ -65,6 +65,10 @@ export default class SuggestionList extends React.PureComponent { | |||
const contentBottomPadding = parseInt(content.css('padding-top'), 10); | |||
|
|||
const item = $(ReactDOM.findDOMNode(this.refs[term])); | |||
if (!item[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.
Minor nit, but could this be item.length === 0
? It might just be a bit clearer
components/textbox/index.js
Outdated
|
||
import Textbox from './textbox.jsx'; | ||
|
||
const autocompleteUsersInChannel = (prefix) => (dispatch, getState) => { |
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 should probably live in actions/views
@@ -1269,6 +1269,7 @@ export const Constants = { | |||
MENTION_MORE_CHANNELS: 'mention.morechannels', | |||
MENTION_UNREAD_CHANNELS: 'mention.unread.channels', | |||
MENTION_MEMBERS: 'mention.members', | |||
MENTION_MORE_MEMBERS: 'mention.moremembers', |
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.
Does this need to be wrapped in the t
function somewhere?
@@ -2567,6 +2567,7 @@ | |||
"suggestion.mention.channels": "My Channels", | |||
"suggestion.mention.here": "Notifies everyone in the channel and online", | |||
"suggestion.mention.members": "Channel Members", | |||
"suggestion.mention.moremembers": "Other Members", |
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.
Should this be "Other Users"? Without "Channel" or "Team" for context, "Members" looks weird to be
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.
Where/when does this string occur?
I feel it was discussed, but I forget now, and didn't spot it on the latest spinmint below.
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.
Got it. I think Members
referring to channel members is quite clear in this context.
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.
Are those users channel members though? I thought this was for loading people who aren't in the channel
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.
@hmhealey Some are channel members, some are not.
We are first loading users locally, so the query returns immediate results. We then load everyone else, most of which are not in the channel but a few that could be.
Once the loading has finished, there will be three sections: Channel Members, Special Mentions, and Not In Channel
(Jesse is more equipped to go into more of the technical details if needed)
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.
The gist of these changes is to:
- Source results from the local redux cache immediately (if available)
- Make a network request to fetch more details
The Other Members
will never be shown except with the loading indicator, as the results of the network request will be merged into the appropriate Channel Members
or Not In Channel
. Other Members
is somewhat inaccurate, in that it suggests its just loading other channel members, when in fact it will return non-channel members as well. We could say, Other Users
if it would help clarify. 0/5
|
Spinmint test server created at: https://i-08a63d874aaf7e2bc.test.spinmint.com Test Admin Account: Username: Test User Account: Username: Instance ID: i-08a63d874aaf7e2bc |
@crspeller @hmhealey this one is ready for re-review |
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.
Looks good!
Spinmint test server destroyed |
Spinmint test running for more than 7 days. This test server was terminated. |
1 similar comment
Spinmint test running for more than 7 days. This test server was terminated. |
Summary
Leverage existing data in the Redux store to present local at mentions even before the server responds with results. This is not strictly dependent on mattermost/mattermost-redux#693, but that PR pre-fills the data using knowledge from the posts.
Ticket Link
https://mattermost.atlassian.net/browse/MM-12233
Checklist
make check-style
to check for style errors (required for all pull requests)make test
to ensure unit and component tests passed