diff --git a/res/css/views/rooms/_RoomPreviewBar.scss b/res/css/views/rooms/_RoomPreviewBar.scss index c7d03e3523..85b6916226 100644 --- a/res/css/views/rooms/_RoomPreviewBar.scss +++ b/res/css/views/rooms/_RoomPreviewBar.scss @@ -117,12 +117,17 @@ limitations under the License. .mx_RoomPreviewBar_actions { flex-direction: column-reverse; .mx_AccessibleButton { - padding: 7px 50px;//extra wide + padding: 7px 50px; //extra wide } & > * { margin-top: 12px; } + .mx_AccessibleButton.mx_AccessibleButton_kind_primary { + // to account for the padding of the primary button which causes inconsistent look between + // subsequent secondary (text) buttons + margin-bottom: 7px; + } } } diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 9b02f6d503..3f438ea909 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -1367,6 +1367,41 @@ export default createReactClass({ }); }, + onRejectAndIgnoreClick: async function() { + this.setState({ + rejecting: true, + }); + + const cli = MatrixClientPeg.get(); + try { + const myMember = this.state.room.getMember(cli.getUserId()); + const inviteEvent = myMember.events.member; + const ignoredUsers = MatrixClientPeg.get().getIgnoredUsers(); + ignoredUsers.push(inviteEvent.getSender()); // de-duped internally in the js-sdk + await cli.setIgnoredUsers(ignoredUsers); + + await cli.leave(this.state.roomId); + dis.dispatch({ action: 'view_next_room' }); + this.setState({ + rejecting: false, + }); + } catch (error) { + console.error("Failed to reject invite: %s", error); + + const msg = error.message ? error.message : JSON.stringify(error); + const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + Modal.createTrackedDialog('Failed to reject invite', '', ErrorDialog, { + title: _t("Failed to reject invite"), + description: msg, + }); + + self.setState({ + rejecting: false, + rejectError: error, + }); + } + }, + onRejectThreepidInviteButtonClicked: function(ev) { // We can reject 3pid invites in the same way that we accept them, // using /leave rather than /join. In the short term though, we @@ -1671,9 +1706,11 @@ export default createReactClass({ return (
- + { _t("Reject & Ignore user") } + , + ); + } break; } case MessageCase.ViewingRoom: { @@ -505,8 +516,6 @@ export default createReactClass({ } } - const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); - let subTitleElements; if (subTitle) { if (!Array.isArray(subTitle)) { @@ -554,6 +563,7 @@ export default createReactClass({
{ secondaryButton } + { extraComponents } { primaryButton }
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 62373e8092..9060279e54 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1046,6 +1046,7 @@ "Do you want to join %(roomName)s?": "Do you want to join %(roomName)s?", " invited you": " invited you", "Reject": "Reject", + "Reject & Ignore user": "Reject & Ignore user", "You're previewing %(roomName)s. Want to join it?": "You're previewing %(roomName)s. Want to join it?", "%(roomName)s can't be previewed. Do you want to join it?": "%(roomName)s can't be previewed. Do you want to join it?", "%(roomName)s does not exist.": "%(roomName)s does not exist.",