Remove dead code around the archived room sublist

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-11-25 17:42:02 +00:00
parent a2a066d8b4
commit 877f755114
No known key found for this signature in database
GPG key ID: A2B008A5F49F5D0D
7 changed files with 23 additions and 81 deletions

View file

@ -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>

View file

@ -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,

View file

@ -284,12 +284,7 @@ export class RoomTile extends React.PureComponent<ClassProps, 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;
}

View file

@ -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;

View file

@ -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));
}

View file

@ -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;

View file

@ -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();