From 4bc4292ceba42605d7e60a022072f29defe128fd Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 23 Jun 2016 11:12:25 +0100 Subject: [PATCH] Rooms may not have aliases --- src/components/structures/RoomDirectory.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/structures/RoomDirectory.js b/src/components/structures/RoomDirectory.js index f71b61aed2..81429a0e48 100644 --- a/src/components/structures/RoomDirectory.js +++ b/src/components/structures/RoomDirectory.js @@ -98,9 +98,16 @@ module.exports = React.createClass({ var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); + var desc; + if (alias) { + desc = `Delete the room alias '${alias}' and remove '${name}' from the directory?`; + } else { + desc = `Remove '${name}' from the directory?`; + } + Modal.createDialog(QuestionDialog, { title: "Remove from Directory", - description: `Delete the room alias '${alias}' and remove '${name}' from the directory?`, + description: desc, onFinished: (should_delete) => { if (!should_delete) return; @@ -109,6 +116,7 @@ module.exports = React.createClass({ var step = `remove '${name}' from the directory.`; MatrixClientPeg.get().setRoomDirectoryVisibility(room.room_id, 'private').then(() => { + if (!alias) return; step = 'delete the alias.'; return MatrixClientPeg.get().deleteAlias(alias); }).done(() => {