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; const leaveOption = (
if (roomTags.includes(DefaultTagID.Archived)) { <IconizedContextMenuOption
leaveOption = ( onClick={wrapHandler(
<IconizedContextMenuOption () =>
iconClassName="mx_RoomGeneralContextMenu_iconSignOut" dis.dispatch({
label={_t("room|context_menu|forget")} action: "leave_room",
className="mx_IconizedContextMenu_option_red" room_id: room.roomId,
onClick={wrapHandler( }),
() => onPostLeaveClick,
dis.dispatch({ )}
action: "forget_room", label={_t("action|leave")}
room_id: room.roomId, className="mx_IconizedContextMenu_option_red"
}), iconClassName="mx_RoomGeneralContextMenu_iconSignOut"
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 { level } = useUnreadNotifications(room); const { level } = useUnreadNotifications(room);
const markAsReadOption: JSX.Element | null = (() => { const markAsReadOption: JSX.Element | null = (() => {
@ -266,7 +247,7 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
iconClassName="mx_RoomGeneralContextMenu_iconMarkAsRead" iconClassName="mx_RoomGeneralContextMenu_iconMarkAsRead"
/> />
); );
} else if (!roomTags.includes(DefaultTagID.Archived)) { } else {
return ( return (
<IconizedContextMenuOption <IconizedContextMenuOption
onClick={wrapHandler(() => { onClick={wrapHandler(() => {
@ -277,8 +258,6 @@ export const RoomGeneralContextMenu: React.FC<RoomGeneralContextMenuProps> = ({
iconClassName="mx_RoomGeneralContextMenu_iconMarkAsUnread" 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> <IconizedContextMenu {...props} onFinished={onFinished} className="mx_RoomGeneralContextMenu" compact>
<IconizedContextMenuOptionList> <IconizedContextMenuOptionList>
{markAsReadOption} {markAsReadOption}
{!roomTags.includes(DefaultTagID.Archived) && ( {favoriteOption}
<> {lowPriorityOption}
{favoriteOption} {inviteOption}
{lowPriorityOption} {copyLinkOption}
{inviteOption} {settingsOption}
{copyLinkOption}
{settingsOption}
</>
)}
{developerToolsOption} {developerToolsOption}
</IconizedContextMenuOptionList> </IconizedContextMenuOptionList>
<IconizedContextMenuOptionList red>{leaveOption}</IconizedContextMenuOptionList> <IconizedContextMenuOptionList red>{leaveOption}</IconizedContextMenuOptionList>

View file

@ -83,10 +83,6 @@ export const TAG_ORDER: TagID[] = [
DefaultTagID.LowPriority, DefaultTagID.LowPriority,
DefaultTagID.ServerNotice, DefaultTagID.ServerNotice,
DefaultTagID.Suggested, 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]; const ALWAYS_VISIBLE_TAGS: TagID[] = [DefaultTagID.DM, DefaultTagID.Untagged];
@ -405,13 +401,6 @@ const TAG_AESTHETICS: TagAestheticsMap = {
defaultHidden: false, 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]: { [DefaultTagID.Suggested]: {
sectionLabel: _td("room_list|suggested_rooms_heading"), sectionLabel: _td("room_list|suggested_rooms_heading"),
isInvite: false, isInvite: false,

View file

@ -284,12 +284,7 @@ export class RoomTile extends React.PureComponent<ClassProps, State> {
}; };
private renderNotificationsMenu(isActive: boolean): React.ReactElement | null { private renderNotificationsMenu(isActive: boolean): React.ReactElement | null {
if ( if (MatrixClientPeg.safeGet().isGuest() || !this.showContextMenu || this.props.isMinimized) {
MatrixClientPeg.safeGet().isGuest() ||
this.props.tag === DefaultTagID.Archived ||
!this.showContextMenu ||
this.props.isMinimized
) {
// the menu makes no sense in these cases so do not show one // the menu makes no sense in these cases so do not show one
return null; return null;
} }

View file

@ -61,7 +61,6 @@ const filterConditions: Record<TagID, MSC3575Filter> = {
// TODO https://github.com/vector-im/element-web/issues/23207 // TODO https://github.com/vector-im/element-web/issues/23207
// DefaultTagID.ServerNotice, // DefaultTagID.ServerNotice,
// DefaultTagID.Suggested, // DefaultTagID.Suggested,
// DefaultTagID.Archived,
}; };
export const LISTS_UPDATE_EVENT = RoomListStoreEvent.ListsUpdate; 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]) { for (const room of memberships[EffectiveMembership.Invite]) {
newTags[DefaultTagID.Invite].push(room); 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 // Now process all the joined rooms. This is a bit more complicated
for (const room of memberships[EffectiveMembership.Join]) { for (const room of memberships[EffectiveMembership.Join]) {
@ -549,9 +544,7 @@ export class Algorithm extends EventEmitter {
if (membership === EffectiveMembership.Invite) { if (membership === EffectiveMembership.Invite) {
tags.push(DefaultTagID.Invite); tags.push(DefaultTagID.Invite);
} else if (membership === EffectiveMembership.Leave) { } else if (membership === EffectiveMembership.Join) {
tags.push(DefaultTagID.Archived);
} else {
tags.push(...this.getTagsOfJoinedRoom(room)); 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 { export enum DefaultTagID {
Invite = "im.vector.fake.invite", Invite = "im.vector.fake.invite",
Untagged = "im.vector.fake.recent", // legacy: used to just be 'recent rooms' but now it's all untagged rooms 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", LowPriority = "m.lowpriority",
Favourite = "m.favourite", Favourite = "m.favourite",
DM = "im.vector.fake.direct", DM = "im.vector.fake.direct",
@ -27,7 +26,6 @@ export const OrderedDefaultTagIDs = [
DefaultTagID.LowPriority, DefaultTagID.LowPriority,
DefaultTagID.ServerNotice, DefaultTagID.ServerNotice,
DefaultTagID.Suggested, DefaultTagID.Suggested,
DefaultTagID.Archived,
]; ];
export type TagID = string | DefaultTagID; export type TagID = string | DefaultTagID;

View file

@ -86,13 +86,6 @@ describe("RoomGeneralContextMenu", () => {
await clearAllModals(); 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 () => { it("renders the default context menu", async () => {
const { container } = getComponent({}); const { container } = getComponent({});
expect(container).toMatchSnapshot(); expect(container).toMatchSnapshot();