-
-
Notifications
You must be signed in to change notification settings - Fork 832
Look up email addresses in ChatInviteDialog #653
Conversation
So email addresses known to the IS get a display name & avatar
this._lookupThreepid(addrType, query).then((res) => { | ||
if (res !== null) { | ||
this.setState({ | ||
queryList: [res] |
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.
why not do this in _lookupThreepid
?
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.
done
@@ -435,6 +445,39 @@ module.exports = React.createClass({ | |||
return inviteList; | |||
}, | |||
|
|||
_lookupThreepid(medium, address) { |
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.
missing function
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.
oops, done
// wait a bit to let the user finish typing | ||
return q.delay(500).then(() => { | ||
// If the query has changed, forget it | ||
if (this.state.queryList[0] && this.state.queryList[0].address !== address) { |
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 sort-of wonder if it would be better to set a flag when we are changing the addresslist, rather than do this the whole time: basically rolling your own promise cancellation.
something like:
_lookupThreepid: function (medium, address) {
let cancelled = false;
this.cancelThreepidLookup = function() {
cancelled = true;
}
return q.delay(500).then(() => {
if (cancelled) { return null }
...
}) /* ... */ .finally(() => { this.cancelThreepidLookup = null })
}
then call cancelThreepidLookup
in onQueryChanged
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.
or, y'know, just use bluebird.
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.
Done, but note you can't remove cancelThreepidLookup
from this
in the finally because you don't know that it's the same one you added.
rather than checking queryList each time
ptal |
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
So email addresses known to the IS get a display name & avatar
Requires element-hq/element-web#3064