Compare commits
4 Commits
2c42e95265
...
t3chguy/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
525cc6facd | ||
|
|
85abde7545 | ||
|
|
f26225c30d | ||
|
|
877f755114 |
@@ -218,40 +218,21 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
|
||||
/>
|
||||
);
|
||||
|
||||
let leaveOption: JSX.Element;
|
||||
if (roomTags.includes(DefaultTagID.Archived)) {
|
||||
leaveOption = (
|
||||
<IconizedContextMenuOption
|
||||
iconClassName="mx_RoomGeneralContextMenu_iconSignOut"
|
||||
label={_t("room|context_menu|forget")}
|
||||
className="mx_IconizedContextMenu_option_red"
|
||||
onClick={wrapHandler(
|
||||
() =>
|
||||
dis.dispatch({
|
||||
action: "forget_room",
|
||||
room_id: room.roomId,
|
||||
}),
|
||||
onPostForgetClick,
|
||||
)}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
leaveOption = (
|
||||
<IconizedContextMenuOption
|
||||
onClick={wrapHandler(
|
||||
() =>
|
||||
dis.dispatch({
|
||||
action: "leave_room",
|
||||
room_id: room.roomId,
|
||||
}),
|
||||
onPostLeaveClick,
|
||||
)}
|
||||
label={_t("action|leave")}
|
||||
className="mx_IconizedContextMenu_option_red"
|
||||
iconClassName="mx_RoomGeneralContextMenu_iconSignOut"
|
||||
/>
|
||||
);
|
||||
}
|
||||
const leaveOption = (
|
||||
<IconizedContextMenuOption
|
||||
onClick={wrapHandler(
|
||||
() =>
|
||||
dis.dispatch({
|
||||
action: "leave_room",
|
||||
room_id: room.roomId,
|
||||
}),
|
||||
onPostLeaveClick,
|
||||
)}
|
||||
label={_t("action|leave")}
|
||||
className="mx_IconizedContextMenu_option_red"
|
||||
iconClassName="mx_RoomGeneralContextMenu_iconSignOut"
|
||||
/>
|
||||
);
|
||||
|
||||
const { level } = useUnreadNotifications(room);
|
||||
const markAsReadOption: JSX.Element | null = (() => {
|
||||
@@ -266,7 +247,7 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
|
||||
iconClassName="mx_RoomGeneralContextMenu_iconMarkAsRead"
|
||||
/>
|
||||
);
|
||||
} else if (!roomTags.includes(DefaultTagID.Archived)) {
|
||||
} else {
|
||||
return (
|
||||
<IconizedContextMenuOption
|
||||
onClick={wrapHandler(() => {
|
||||
@@ -277,8 +258,6 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
|
||||
iconClassName="mx_RoomGeneralContextMenu_iconMarkAsUnread"
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -291,15 +270,11 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
|
||||
<IconizedContextMenu {...props} onFinished={onFinished} className="mx_RoomGeneralContextMenu" compact>
|
||||
<IconizedContextMenuOptionList>
|
||||
{markAsReadOption}
|
||||
{!roomTags.includes(DefaultTagID.Archived) && (
|
||||
<>
|
||||
{favoriteOption}
|
||||
{lowPriorityOption}
|
||||
{inviteOption}
|
||||
{copyLinkOption}
|
||||
{settingsOption}
|
||||
</>
|
||||
)}
|
||||
{favoriteOption}
|
||||
{lowPriorityOption}
|
||||
{inviteOption}
|
||||
{copyLinkOption}
|
||||
{settingsOption}
|
||||
{developerToolsOption}
|
||||
</IconizedContextMenuOptionList>
|
||||
<IconizedContextMenuOptionList red>{leaveOption}</IconizedContextMenuOptionList>
|
||||
|
||||
@@ -83,10 +83,6 @@ export const TAG_ORDER: TagID[] = [
|
||||
DefaultTagID.LowPriority,
|
||||
DefaultTagID.ServerNotice,
|
||||
DefaultTagID.Suggested,
|
||||
// DefaultTagID.Archived isn't here any more: we don't show it at all.
|
||||
// The section still exists in the code as a place for rooms that we know
|
||||
// about but aren't joined. At some point it could be removed entirely
|
||||
// but we'd have to make sure that rooms you weren't in were hidden.
|
||||
];
|
||||
const ALWAYS_VISIBLE_TAGS: TagID[] = [DefaultTagID.DM, DefaultTagID.Untagged];
|
||||
|
||||
@@ -405,13 +401,6 @@ const TAG_AESTHETICS: TagAestheticsMap = {
|
||||
defaultHidden: false,
|
||||
},
|
||||
|
||||
// TODO: Replace with archived view: https://github.com/vector-im/element-web/issues/14038
|
||||
[DefaultTagID.Archived]: {
|
||||
sectionLabel: _td("common|historical"),
|
||||
isInvite: false,
|
||||
defaultHidden: true,
|
||||
},
|
||||
|
||||
[DefaultTagID.Suggested]: {
|
||||
sectionLabel: _td("room_list|suggested_rooms_heading"),
|
||||
isInvite: false,
|
||||
|
||||
@@ -279,12 +279,7 @@ class RoomTile extends React.PureComponent<Props, State> {
|
||||
};
|
||||
|
||||
private renderNotificationsMenu(isActive: boolean): React.ReactElement | null {
|
||||
if (
|
||||
MatrixClientPeg.safeGet().isGuest() ||
|
||||
this.props.tag === DefaultTagID.Archived ||
|
||||
!this.showContextMenu ||
|
||||
this.props.isMinimized
|
||||
) {
|
||||
if (MatrixClientPeg.safeGet().isGuest() || !this.showContextMenu || this.props.isMinimized) {
|
||||
// the menu makes no sense in these cases so do not show one
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -486,7 +486,6 @@
|
||||
"go_to_settings": "Go to Settings",
|
||||
"guest": "Guest",
|
||||
"help": "Help",
|
||||
"historical": "Historical",
|
||||
"home": "Home",
|
||||
"homeserver": "Homeserver",
|
||||
"identity_server": "Identity server",
|
||||
@@ -1904,7 +1903,6 @@
|
||||
"context_menu": {
|
||||
"copy_link": "Copy room link",
|
||||
"favourite": "Favourite",
|
||||
"forget": "Forget Room",
|
||||
"low_priority": "Low Priority",
|
||||
"mark_read": "Mark as read",
|
||||
"mark_unread": "Mark as unread",
|
||||
|
||||
@@ -61,7 +61,6 @@ const filterConditions: Record<TagID, MSC3575Filter> = {
|
||||
// TODO https://github.com/vector-im/element-web/issues/23207
|
||||
// DefaultTagID.ServerNotice,
|
||||
// DefaultTagID.Suggested,
|
||||
// DefaultTagID.Archived,
|
||||
};
|
||||
|
||||
export const LISTS_UPDATE_EVENT = RoomListStoreEvent.ListsUpdate;
|
||||
|
||||
@@ -490,11 +490,6 @@ export class Algorithm extends EventEmitter {
|
||||
for (const room of memberships[EffectiveMembership.Invite]) {
|
||||
newTags[DefaultTagID.Invite].push(room);
|
||||
}
|
||||
for (const room of memberships[EffectiveMembership.Leave]) {
|
||||
// We may not have had an archived section previously, so make sure its there.
|
||||
if (newTags[DefaultTagID.Archived] === undefined) newTags[DefaultTagID.Archived] = [];
|
||||
newTags[DefaultTagID.Archived].push(room);
|
||||
}
|
||||
|
||||
// Now process all the joined rooms. This is a bit more complicated
|
||||
for (const room of memberships[EffectiveMembership.Join]) {
|
||||
@@ -549,9 +544,7 @@ export class Algorithm extends EventEmitter {
|
||||
|
||||
if (membership === EffectiveMembership.Invite) {
|
||||
tags.push(DefaultTagID.Invite);
|
||||
} else if (membership === EffectiveMembership.Leave) {
|
||||
tags.push(DefaultTagID.Archived);
|
||||
} else {
|
||||
} else if (membership === EffectiveMembership.Join) {
|
||||
tags.push(...this.getTagsOfJoinedRoom(room));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ Please see LICENSE files in the repository root for full details.
|
||||
export enum DefaultTagID {
|
||||
Invite = "im.vector.fake.invite",
|
||||
Untagged = "im.vector.fake.recent", // legacy: used to just be 'recent rooms' but now it's all untagged rooms
|
||||
Archived = "im.vector.fake.archived",
|
||||
LowPriority = "m.lowpriority",
|
||||
Favourite = "m.favourite",
|
||||
DM = "im.vector.fake.direct",
|
||||
@@ -27,7 +26,6 @@ export const OrderedDefaultTagIDs = [
|
||||
DefaultTagID.LowPriority,
|
||||
DefaultTagID.ServerNotice,
|
||||
DefaultTagID.Suggested,
|
||||
DefaultTagID.Archived,
|
||||
];
|
||||
|
||||
export type TagID = string | DefaultTagID;
|
||||
|
||||
@@ -86,13 +86,6 @@ describe("RoomGeneralContextMenu", () => {
|
||||
await clearAllModals();
|
||||
});
|
||||
|
||||
it("renders an empty context menu for archived rooms", async () => {
|
||||
jest.spyOn(RoomListStore.instance, "getTagsForRoom").mockReturnValueOnce([DefaultTagID.Archived]);
|
||||
|
||||
const { container } = getComponent({});
|
||||
expect(container).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders the default context menu", async () => {
|
||||
const { container } = getComponent({});
|
||||
expect(container).toMatchSnapshot();
|
||||
|
||||
@@ -1,53 +1,5 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`RoomGeneralContextMenu renders an empty context menu for archived rooms 1`] = `
|
||||
<div>
|
||||
<div
|
||||
class="mx_ContextualMenu_wrapper"
|
||||
style="top: 1px; left: 1px;"
|
||||
>
|
||||
<div
|
||||
class="mx_ContextualMenu_background"
|
||||
/>
|
||||
<div
|
||||
class="mx_ContextualMenu mx_ContextualMenu_withChevron_left"
|
||||
role="menu"
|
||||
>
|
||||
<div
|
||||
class="mx_ContextualMenu_chevron_left"
|
||||
/>
|
||||
<ul
|
||||
class="mx_IconizedContextMenu mx_RoomGeneralContextMenu mx_IconizedContextMenu_compact"
|
||||
role="none"
|
||||
>
|
||||
<div
|
||||
class="mx_IconizedContextMenu_optionList mx_IconizedContextMenu_optionList_notFirst"
|
||||
/>
|
||||
<div
|
||||
class="mx_IconizedContextMenu_optionList mx_IconizedContextMenu_optionList_notFirst mx_IconizedContextMenu_optionList_red"
|
||||
>
|
||||
<li
|
||||
aria-label="Forget Room"
|
||||
class="mx_AccessibleButton mx_IconizedContextMenu_option_red mx_IconizedContextMenu_item"
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_icon mx_RoomGeneralContextMenu_iconSignOut"
|
||||
/>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_label"
|
||||
>
|
||||
Forget Room
|
||||
</span>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`RoomGeneralContextMenu renders the default context menu 1`] = `
|
||||
<div>
|
||||
<div
|
||||
@@ -70,12 +22,96 @@ exports[`RoomGeneralContextMenu renders the default context menu 1`] = `
|
||||
>
|
||||
<div
|
||||
class="mx_IconizedContextMenu_optionList mx_IconizedContextMenu_optionList_notFirst"
|
||||
/>
|
||||
>
|
||||
<li
|
||||
aria-label="Mark as unread"
|
||||
class="mx_AccessibleButton mx_IconizedContextMenu_item"
|
||||
role="menuitem"
|
||||
tabindex="0"
|
||||
>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_icon mx_RoomGeneralContextMenu_iconMarkAsUnread"
|
||||
/>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_label"
|
||||
>
|
||||
Mark as unread
|
||||
</span>
|
||||
</li>
|
||||
<div
|
||||
aria-checked="false"
|
||||
aria-label="Favourite"
|
||||
class="mx_AccessibleButton mx_IconizedContextMenu_item"
|
||||
role="menuitemcheckbox"
|
||||
tabindex="-1"
|
||||
>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_icon mx_RoomGeneralContextMenu_iconStar"
|
||||
/>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_label"
|
||||
>
|
||||
Favourite
|
||||
</span>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_icon mx_IconizedContextMenu_unchecked"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
aria-checked="false"
|
||||
aria-label="Low Priority"
|
||||
class="mx_AccessibleButton mx_IconizedContextMenu_item"
|
||||
role="menuitemcheckbox"
|
||||
tabindex="-1"
|
||||
>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_icon mx_RoomGeneralContextMenu_iconArrowDown"
|
||||
/>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_label"
|
||||
>
|
||||
Low Priority
|
||||
</span>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_icon mx_IconizedContextMenu_unchecked"
|
||||
/>
|
||||
</div>
|
||||
<li
|
||||
aria-label="Copy room link"
|
||||
class="mx_AccessibleButton mx_IconizedContextMenu_item"
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_icon mx_RoomGeneralContextMenu_iconCopyLink"
|
||||
/>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_label"
|
||||
>
|
||||
Copy room link
|
||||
</span>
|
||||
</li>
|
||||
<li
|
||||
aria-label="Settings"
|
||||
class="mx_AccessibleButton mx_IconizedContextMenu_item"
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_icon mx_RoomGeneralContextMenu_iconSettings"
|
||||
/>
|
||||
<span
|
||||
class="mx_IconizedContextMenu_label"
|
||||
>
|
||||
Settings
|
||||
</span>
|
||||
</li>
|
||||
</div>
|
||||
<div
|
||||
class="mx_IconizedContextMenu_optionList mx_IconizedContextMenu_optionList_notFirst mx_IconizedContextMenu_optionList_red"
|
||||
>
|
||||
<li
|
||||
aria-label="Forget Room"
|
||||
aria-label="Leave"
|
||||
class="mx_AccessibleButton mx_IconizedContextMenu_option_red mx_IconizedContextMenu_item"
|
||||
role="menuitem"
|
||||
tabindex="-1"
|
||||
@@ -86,7 +122,7 @@ exports[`RoomGeneralContextMenu renders the default context menu 1`] = `
|
||||
<span
|
||||
class="mx_IconizedContextMenu_label"
|
||||
>
|
||||
Forget Room
|
||||
Leave
|
||||
</span>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user