diff --git a/res/css/views/rooms/_RoomTile.scss b/res/css/views/rooms/_RoomTile.scss index 9afbd44b20..f22228602d 100644 --- a/res/css/views/rooms/_RoomTile.scss +++ b/res/css/views/rooms/_RoomTile.scss @@ -221,10 +221,6 @@ limitations under the License. mask-image: url('$(res)/img/element-icons/roomlist/favorite.svg'); } - .mx_RoomTile_iconFavorite::before { - mask-image: url('$(res)/img/feather-customised/favourites.svg'); - } - .mx_RoomTile_iconArrowDown::before { mask-image: url('$(res)/img/element-icons/roomlist/low-priority.svg'); } diff --git a/src/components/views/rooms/RoomTile.tsx b/src/components/views/rooms/RoomTile.tsx index 1a7643aeb4..59dc4d1321 100644 --- a/src/components/views/rooms/RoomTile.tsx +++ b/src/components/views/rooms/RoomTile.tsx @@ -231,11 +231,12 @@ export default class RoomTile extends React.Component { ev.preventDefault(); ev.stopPropagation(); - if (tagId === DefaultTagID.Favourite) { + if (tagId === DefaultTagID.Favourite || tagId === DefaultTagID.LowPriority) { + const inverseTag = tagId === DefaultTagID.Favourite ? DefaultTagID.LowPriority : DefaultTagID.Favourite; const roomTags = RoomListStore.instance.getTagsForRoom(this.props.room); - const isFavourite = roomTags.includes(DefaultTagID.Favourite); - const removeTag = isFavourite ? DefaultTagID.Favourite : DefaultTagID.LowPriority; - const addTag = isFavourite ? null : DefaultTagID.Favourite; + const isFavourite = roomTags.includes(tagId); + const removeTag = isFavourite ? tagId : inverseTag; + const addTag = isFavourite ? null : tagId; dis.dispatch(RoomListActions.tagRoom( MatrixClientPeg.get(), this.props.room, @@ -387,13 +388,6 @@ export default class RoomTile extends React.Component { private renderGeneralMenu(): React.ReactElement { if (!this.showContextMenu) return null; // no menu to show - const roomTags = RoomListStore.instance.getTagsForRoom(this.props.room); - - const isFavorite = roomTags.includes(DefaultTagID.Favourite); - const favouriteIconClassName = isFavorite ? "mx_RoomTile_iconFavorite" : "mx_RoomTile_iconStar"; - const favouriteLabelClassName = isFavorite ? "mx_RoomTile_contextMenu_activeRow" : ""; - const favouriteLabel = isFavorite ? _t("Favourited") : _t("Favourite"); - let contextMenu = null; if (this.state.generalMenuPosition && this.props.tag === DefaultTagID.Archived) { contextMenu = ( @@ -409,19 +403,36 @@ export default class RoomTile extends React.Component { ); } else if (this.state.generalMenuPosition) { + const roomTags = RoomListStore.instance.getTagsForRoom(this.props.room); + + const isFavorite = roomTags.includes(DefaultTagID.Favourite); + const favouriteLabel = isFavorite ? _t("Favourited") : _t("Favourite"); + + const isLowPriority = roomTags.includes(DefaultTagID.LowPriority); + const lowPriorityLabel = _t("Low Priority"); + contextMenu = (
this.onTagRoom(e, DefaultTagID.Favourite)} active={isFavorite} label={favouriteLabel} > - + {favouriteLabel} + this.onTagRoom(e, DefaultTagID.LowPriority)} + active={isLowPriority} + label={lowPriorityLabel} + > + + {lowPriorityLabel} + {_t("Settings")} diff --git a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js index 391f4f7845..2fa61a0ee6 100644 --- a/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/AdvancedRoomSettingsTab.js @@ -22,10 +22,6 @@ import * as sdk from "../../../../.."; import AccessibleButton from "../../../elements/AccessibleButton"; import Modal from "../../../../../Modal"; import dis from "../../../../../dispatcher/dispatcher"; -import RoomListStore from "../../../../../stores/room-list/RoomListStore"; -import RoomListActions from "../../../../../actions/RoomListActions"; -import { DefaultTagID } from '../../../../../stores/room-list/models'; -import LabelledToggleSwitch from '../../../elements/LabelledToggleSwitch'; export default class AdvancedRoomSettingsTab extends React.Component { static propTypes = { @@ -36,13 +32,9 @@ export default class AdvancedRoomSettingsTab extends React.Component { constructor(props) { super(props); - const room = MatrixClientPeg.get().getRoom(props.roomId); - const roomTags = RoomListStore.instance.getTagsForRoom(room); - this.state = { // This is eventually set to the value of room.getRecommendedVersion() upgradeRecommendation: null, - isLowPriorityRoom: roomTags.includes(DefaultTagID.LowPriority), }; } @@ -94,25 +86,6 @@ export default class AdvancedRoomSettingsTab extends React.Component { this.props.closeSettingsFn(); }; - _onToggleLowPriorityTag = (e) => { - this.setState({ - isLowPriorityRoom: !this.state.isLowPriorityRoom, - }); - - const removeTag = this.state.isLowPriorityRoom ? DefaultTagID.LowPriority : DefaultTagID.Favourite; - const addTag = this.state.isLowPriorityRoom ? null : DefaultTagID.LowPriority; - const client = MatrixClientPeg.get(); - - dis.dispatch(RoomListActions.tagRoom( - client, - client.getRoom(this.props.roomId), - removeTag, - addTag, - undefined, - 0, - )); - } - render() { const client = MatrixClientPeg.get(); const room = client.getRoom(this.props.roomId); @@ -183,17 +156,6 @@ export default class AdvancedRoomSettingsTab extends React.Component { {_t("Open Devtools")}
-
- {_t('Make this room low priority')} - -
); } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 998d582853..f7acedd7a6 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -967,8 +967,6 @@ "Room version:": "Room version:", "Developer options": "Developer options", "Open Devtools": "Open Devtools", - "Make this room low priority": "Make this room low priority", - "Low priority rooms show up at the bottom of your room list in a dedicated section at the bottom of your room list": "Low priority rooms show up at the bottom of your room list in a dedicated section at the bottom of your room list", "This room is bridging messages to the following platforms. Learn more.": "This room is bridging messages to the following platforms. Learn more.", "This room isn’t bridging messages to any platforms. Learn more.": "This room isn’t bridging messages to any platforms. Learn more.", "Bridges": "Bridges", @@ -1217,6 +1215,7 @@ "Notification options": "Notification options", "Favourited": "Favourited", "Favourite": "Favourite", + "Low Priority": "Low Priority", "Leave Room": "Leave Room", "Forget Room": "Forget Room", "Room options": "Room options", @@ -1911,7 +1910,6 @@ "Mentions only": "Mentions only", "Leave": "Leave", "Forget": "Forget", - "Low Priority": "Low Priority", "Direct Chat": "Direct Chat", "Clear status": "Clear status", "Update status": "Update status",