Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Refactor ChatInviteDialog to be UserPickerDialog #1300

Merged
merged 9 commits into from
Aug 16, 2017
Merged

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented Aug 14, 2017

Now it's just a means of choosing users and all the actual inviting
functionality is moved out to Invite.js. This will allow us to
reuse it for inviting to groups.

Adds the ability to restrict what types of addresses may be chosen,
although this isn't used yet, it will be necessary for groups
because groups don't support 3pid invites.

Now it's just a means of choosing users and all the actual inviting
functionality is moved out to Invite.js. This will allow us to
reuse it for inviting to groups.

Adds the ability to restrict what types of addresses may be chosen,
although this isn;t used yet, it will be necessary for groups
because groups don't support 3pid invites.
The other changes I forgot to add
src/Invite.js Outdated
import MatrixClientPeg from './MatrixClientPeg';
import MultiInviter from './utils/MultiInviter';
import Modal from "./Modal";
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: consistent quotes pls

Copy link
Member Author

Choose a reason for hiding this comment

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

done

src/Invite.js Outdated
import MatrixClientPeg from './MatrixClientPeg';
import MultiInviter from './utils/MultiInviter';
import Modal from "./Modal";
import createRoom from './createRoom';
import sdk from "./";
Copy link
Contributor

Choose a reason for hiding this comment

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

and here

Copy link
Member Author

Choose a reason for hiding this comment

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

done

React.PropTypes.element,
React.PropTypes.string,
title: PropTypes.string.isRequired,
description: PropTypes.oneOfType([
Copy link
Contributor

Choose a reason for hiding this comment

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

could use PropTypes.node I think

Copy link
Member Author

Choose a reason for hiding this comment

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

done

};
},

getInitialState: function() {
return {
error: false,

// List of AddressTile.InviteAddressType objects representing
// List of InviteAddressType objects representing
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit odd having the word invite in variables, comments now that this component doesn't know about inviting

Copy link
Member Author

Choose a reason for hiding this comment

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

have made it UserAddressType throughout

@@ -311,7 +268,7 @@ module.exports = React.createClass({
// This is important, otherwise there's no way to invite
// a perfectly valid address if there are close matches.
const addrType = getAddressType(query);
if (addrType !== null) {
if (this.props.validAddressTypes.indexOf(addrType) !== -1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could use includes

Copy link
Member Author

Choose a reason for hiding this comment

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

I've been sticking to indexOf, but probably for no reason really, so I don't care, done

@@ -90,50 +89,7 @@ module.exports = React.createClass({
inviteList = this._addInputToList();
Copy link
Contributor

Choose a reason for hiding this comment

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

There are still things called invite and comments mentioning invites in this file

Copy link
Member Author

Choose a reason for hiding this comment

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

done

src/Invite.js Outdated
// could be a third party identifier or a matrix ID)
// along with some additional information about the
// address / target.
export const UserAddressType = PropTypes.shape({
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like a strange place for a general "user address" type that might no have anything to do with inviting. Putting it in AddressTile seems fine?

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to UserAddress as otherwise we'd end up importing view code from utility code which is definitely a pattern I'd like to avoid.

@lukebarnard1 lukebarnard1 assigned dbkr and unassigned lukebarnard1 Aug 15, 2017
@dbkr dbkr assigned lukebarnard1 and unassigned dbkr Aug 15, 2017
Copy link
Contributor

@lukebarnard1 lukebarnard1 left a comment

Choose a reason for hiding this comment

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

LGTM :)

@dbkr dbkr merged commit 252ab20 into develop Aug 16, 2017
dbkr added a commit that referenced this pull request Oct 27, 2017
I managed to lose this when refactoring ChatInviteDialog in
#1300

Fixes element-hq/element-web#5119
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants