Merge pull request #5648 from jaiwanth-v/add-invite-to-context-menu
Added invite option to room's context menu
This commit is contained in:
commit
16ae01aa43
4 changed files with 29 additions and 2 deletions
|
@ -189,6 +189,10 @@ limitations under the License.
|
||||||
mask-image: url('$(res)/img/element-icons/settings.svg');
|
mask-image: url('$(res)/img/element-icons/settings.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mx_RoomTile_iconInvite::before {
|
||||||
|
mask-image: url('$(res)/img/element-icons/room/invite.svg');
|
||||||
|
}
|
||||||
|
|
||||||
.mx_RoomTile_iconSignOut::before {
|
.mx_RoomTile_iconSignOut::before {
|
||||||
mask-image: url('$(res)/img/element-icons/leave.svg');
|
mask-image: url('$(res)/img/element-icons/leave.svg');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1256,7 +1256,9 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
? _t("Invite to %(spaceName)s", {
|
? _t("Invite to %(spaceName)s", {
|
||||||
spaceName: room.name || _t("Unnamed Space"),
|
spaceName: room.name || _t("Unnamed Space"),
|
||||||
})
|
})
|
||||||
: _t("Invite to this room");
|
: _t("Invite to %(roomName)s", {
|
||||||
|
roomName: room.name || _t("Unnamed Room"),
|
||||||
|
});
|
||||||
|
|
||||||
let helpTextUntranslated;
|
let helpTextUntranslated;
|
||||||
if (isSpace) {
|
if (isSpace) {
|
||||||
|
|
|
@ -333,6 +333,17 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
|
||||||
this.setState({generalMenuPosition: null}); // hide the menu
|
this.setState({generalMenuPosition: null}); // hide the menu
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private onInviteClick = (ev: ButtonEvent) => {
|
||||||
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'view_invite',
|
||||||
|
roomId: this.props.room.roomId,
|
||||||
|
});
|
||||||
|
this.setState({generalMenuPosition: null}); // hide the menu
|
||||||
|
};
|
||||||
|
|
||||||
private async saveNotifState(ev: ButtonEvent, newState: Volume) {
|
private async saveNotifState(ev: ButtonEvent, newState: Volume) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
|
@ -453,6 +464,8 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
|
||||||
const isLowPriority = roomTags.includes(DefaultTagID.LowPriority);
|
const isLowPriority = roomTags.includes(DefaultTagID.LowPriority);
|
||||||
const lowPriorityLabel = _t("Low Priority");
|
const lowPriorityLabel = _t("Low Priority");
|
||||||
|
|
||||||
|
const userId = MatrixClientPeg.get().getUserId();
|
||||||
|
const canInvite = this.props.room.canInvite(userId);
|
||||||
contextMenu = <IconizedContextMenu
|
contextMenu = <IconizedContextMenu
|
||||||
{...contextMenuBelow(this.state.generalMenuPosition)}
|
{...contextMenuBelow(this.state.generalMenuPosition)}
|
||||||
onFinished={this.onCloseGeneralMenu}
|
onFinished={this.onCloseGeneralMenu}
|
||||||
|
@ -472,7 +485,13 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
|
||||||
label={lowPriorityLabel}
|
label={lowPriorityLabel}
|
||||||
iconClassName="mx_RoomTile_iconArrowDown"
|
iconClassName="mx_RoomTile_iconArrowDown"
|
||||||
/>
|
/>
|
||||||
|
{canInvite ? (
|
||||||
|
<IconizedContextMenuOption
|
||||||
|
onClick={this.onInviteClick}
|
||||||
|
label={_t("Invite People")}
|
||||||
|
iconClassName="mx_RoomTile_iconInvite"
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
<IconizedContextMenuOption
|
<IconizedContextMenuOption
|
||||||
onClick={this.onOpenRoomSettings}
|
onClick={this.onOpenRoomSettings}
|
||||||
label={_t("Settings")}
|
label={_t("Settings")}
|
||||||
|
|
|
@ -1601,6 +1601,7 @@
|
||||||
"Favourited": "Favourited",
|
"Favourited": "Favourited",
|
||||||
"Favourite": "Favourite",
|
"Favourite": "Favourite",
|
||||||
"Low Priority": "Low Priority",
|
"Low Priority": "Low Priority",
|
||||||
|
"Invite People": "Invite People",
|
||||||
"Leave Room": "Leave Room",
|
"Leave Room": "Leave Room",
|
||||||
"Room options": "Room options",
|
"Room options": "Room options",
|
||||||
"%(count)s unread messages including mentions.|other": "%(count)s unread messages including mentions.",
|
"%(count)s unread messages including mentions.|other": "%(count)s unread messages including mentions.",
|
||||||
|
@ -2201,6 +2202,7 @@
|
||||||
"Go": "Go",
|
"Go": "Go",
|
||||||
"Invite to %(spaceName)s": "Invite to %(spaceName)s",
|
"Invite to %(spaceName)s": "Invite to %(spaceName)s",
|
||||||
"Unnamed Space": "Unnamed Space",
|
"Unnamed Space": "Unnamed Space",
|
||||||
|
"Invite to %(roomName)s": "Invite to %(roomName)s",
|
||||||
"Invite someone using their name, email address, username (like <userId/>) or <a>share this space</a>.": "Invite someone using their name, email address, username (like <userId/>) or <a>share this space</a>.",
|
"Invite someone using their name, email address, username (like <userId/>) or <a>share this space</a>.": "Invite someone using their name, email address, username (like <userId/>) or <a>share this space</a>.",
|
||||||
"Invite someone using their name, username (like <userId/>) or <a>share this space</a>.": "Invite someone using their name, username (like <userId/>) or <a>share this space</a>.",
|
"Invite someone using their name, username (like <userId/>) or <a>share this space</a>.": "Invite someone using their name, username (like <userId/>) or <a>share this space</a>.",
|
||||||
"Invite someone using their name, email address, username (like <userId/>) or <a>share this room</a>.": "Invite someone using their name, email address, username (like <userId/>) or <a>share this room</a>.",
|
"Invite someone using their name, email address, username (like <userId/>) or <a>share this room</a>.": "Invite someone using their name, email address, username (like <userId/>) or <a>share this room</a>.",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue