From ee2c216c4df97f6d8867cee7b58ee84ac93510f4 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sun, 28 Jun 2020 20:03:04 -0600 Subject: [PATCH] Clean up TODO comments for new room list All relevant TODOs should still be present, and reference an issue for easy finding. --- res/css/structures/_LeftPanel2.scss | 2 +- res/css/views/rooms/_RoomBreadcrumbs2.scss | 2 ++ res/css/views/rooms/_RoomSublist2.scss | 2 +- res/css/views/rooms/_RoomTile2.scss | 5 +-- src/components/structures/LeftPanel2.tsx | 25 +++++---------- src/components/structures/RoomSearch.tsx | 2 ++ src/components/structures/UserMenu.tsx | 2 +- .../views/rooms/NotificationBadge.tsx | 5 ++- .../views/rooms/RoomBreadcrumbs2.tsx | 9 ++++-- src/components/views/rooms/RoomList2.tsx | 9 ++++-- src/components/views/rooms/RoomSublist2.tsx | 31 ++++++------------- src/components/views/rooms/RoomTile2.tsx | 29 +++++------------ src/stores/BreadcrumbsStore.ts | 6 ++-- src/stores/room-list/ListLayout.ts | 3 +- src/stores/room-list/MessagePreviewStore.ts | 2 +- src/stores/room-list/RoomListStore2.ts | 31 +++++++++++++++---- .../room-list/RoomListStoreTempProxy.ts | 2 +- src/stores/room-list/TagWatcher.ts | 5 +-- src/stores/room-list/algorithms/Algorithm.ts | 23 +++++++++++--- .../list-ordering/ImportanceAlgorithm.ts | 4 ++- .../list-ordering/NaturalAlgorithm.ts | 4 ++- .../algorithms/tag-sorting/RecentAlgorithm.ts | 1 + .../filters/CommunityFilterCondition.ts | 1 + .../room-list/filters/NameFilterCondition.ts | 3 +- src/stores/room-list/membership.ts | 2 +- 25 files changed, 117 insertions(+), 93 deletions(-) diff --git a/res/css/structures/_LeftPanel2.scss b/res/css/structures/_LeftPanel2.scss index 67fa9ba557d..40babaa9ca4 100644 --- a/res/css/structures/_LeftPanel2.scss +++ b/res/css/structures/_LeftPanel2.scss @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// TODO: Rename to mx_LeftPanel during replacement of old component +// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14231 $tagPanelWidth: 70px; // only applies in this file, used for calculations diff --git a/res/css/views/rooms/_RoomBreadcrumbs2.scss b/res/css/views/rooms/_RoomBreadcrumbs2.scss index ac5a9fc34ee..dd9581069c5 100644 --- a/res/css/views/rooms/_RoomBreadcrumbs2.scss +++ b/res/css/views/rooms/_RoomBreadcrumbs2.scss @@ -14,6 +14,8 @@ See the License for the specific language governing permissions and limitations under the License. */ +// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14231 + .mx_RoomBreadcrumbs2 { width: 100%; diff --git a/res/css/views/rooms/_RoomSublist2.scss b/res/css/views/rooms/_RoomSublist2.scss index f859aba6235..ffb96cf6002 100644 --- a/res/css/views/rooms/_RoomSublist2.scss +++ b/res/css/views/rooms/_RoomSublist2.scss @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// TODO: Rename to mx_RoomSublist during replacement of old component +// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14231 .mx_RoomSublist2 { // The sublist is a column of rows, essentially diff --git a/res/css/views/rooms/_RoomTile2.scss b/res/css/views/rooms/_RoomTile2.scss index a97d1fd5b98..ffefd86c955 100644 --- a/res/css/views/rooms/_RoomTile2.scss +++ b/res/css/views/rooms/_RoomTile2.scss @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// TODO: Rename to mx_RoomTile during replacement of old component +// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14231 // Note: the room tile expects to be in a flexbox column container .mx_RoomTile2 { @@ -96,7 +96,8 @@ limitations under the License. // TODO: [Notifications] Use mx_RoomTile2_notificationsButton, similar to the following approach: // https://github.com/matrix-org/matrix-react-sdk/blob/2180a56074f3698fc0241c309a72ba6cad802d1c/res/css/views/rooms/_RoomSublist2.scss#L48-L76 // You'll need to do the same down below on the &:hover selector for the tile. - // ... also remove this 4 line TODO comment. + // See https://github.com/vector-im/riot-web/issues/13961. + // ... also remove this 5 line TODO comment. .mx_RoomTile2_menuButton, .mx_RoomTile2_notificationsButton { width: 0; diff --git a/src/components/structures/LeftPanel2.tsx b/src/components/structures/LeftPanel2.tsx index 6e0faff57f2..0f614435e59 100644 --- a/src/components/structures/LeftPanel2.tsx +++ b/src/components/structures/LeftPanel2.tsx @@ -31,6 +31,9 @@ import { UPDATE_EVENT } from "../../stores/AsyncStore"; import ResizeNotifier from "../../utils/ResizeNotifier"; import SettingsStore from "../../settings/SettingsStore"; +// TODO: Remove banner on launch: https://github.com/vector-im/riot-web/issues/14231 +// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14231 + /******************************************************************* * CAUTION * ******************************************************************* @@ -45,7 +48,7 @@ interface IProps { } interface IState { - searchFilter: string; // TODO: Move search into room list? + searchFilter: string; showBreadcrumbs: boolean; showTagPanel: boolean; } @@ -54,12 +57,7 @@ export default class LeftPanel2 extends React.Component { private listContainerRef: React.RefObject = createRef(); private tagPanelWatcherRef: string; - // TODO: Properly support TagPanel - // TODO: Properly support searching/filtering - // TODO: Properly support breadcrumbs - // TODO: a11y - // TODO: actually make this useful in general (match design proposals) - // TODO: Fadable support (is this still needed?) + // TODO: a11y: https://github.com/vector-im/riot-web/issues/14180 constructor(props: IProps) { super(props); @@ -138,7 +136,7 @@ export default class LeftPanel2 extends React.Component { } } - // TODO: Apply this on resize, init, etc for reliability + // TODO: Improve header reliability: https://github.com/vector-im/riot-web/issues/14232 private onScroll = (ev: React.MouseEvent) => { const list = ev.target as HTMLDivElement; this.handleStickyHeaders(list); @@ -150,11 +148,6 @@ export default class LeftPanel2 extends React.Component { }; private renderHeader(): React.ReactNode { - // TODO: Update when profile info changes - // TODO: Presence - // TODO: Breadcrumbs toggle - // TODO: Menu button - let breadcrumbs; if (this.state.showBreadcrumbs) { breadcrumbs = ( @@ -173,8 +166,6 @@ export default class LeftPanel2 extends React.Component { } private renderSearchExplore(): React.ReactNode { - // TODO: Collapsed support - return (
@@ -195,7 +186,7 @@ export default class LeftPanel2 extends React.Component {
); - // TODO: Improve props for RoomList2 + // TODO: Determine what these onWhatever handlers do: https://github.com/vector-im/riot-web/issues/14180 const roomList = {/*TODO*/}} resizeNotifier={null} @@ -206,7 +197,7 @@ export default class LeftPanel2 extends React.Component { isMinimized={this.props.isMinimized} />; - // TODO: Conference handling / calls + // TODO: Conference handling / calls: https://github.com/vector-im/riot-web/issues/14177 const containerClasses = classNames({ "mx_LeftPanel2": true, diff --git a/src/components/structures/RoomSearch.tsx b/src/components/structures/RoomSearch.tsx index 345cf83d316..8e643539547 100644 --- a/src/components/structures/RoomSearch.tsx +++ b/src/components/structures/RoomSearch.tsx @@ -25,6 +25,8 @@ import { Key } from "../../Keyboard"; import AccessibleButton from "../views/elements/AccessibleButton"; import { Action } from "../../dispatcher/actions"; +// TODO: Remove banner on launch: https://github.com/vector-im/riot-web/issues/14231 + /******************************************************************* * CAUTION * ******************************************************************* diff --git a/src/components/structures/UserMenu.tsx b/src/components/structures/UserMenu.tsx index 19e57ac51b8..8c06a068528 100644 --- a/src/components/structures/UserMenu.tsx +++ b/src/components/structures/UserMenu.tsx @@ -136,7 +136,7 @@ export default class UserMenu extends React.Component { ev.preventDefault(); ev.stopPropagation(); - // TODO: Archived room view (deferred) + // TODO: Archived room view: https://github.com/vector-im/riot-web/issues/14038 console.log("TODO: Show archived rooms"); }; diff --git a/src/components/views/rooms/NotificationBadge.tsx b/src/components/views/rooms/NotificationBadge.tsx index 6929341845c..2111310555b 100644 --- a/src/components/views/rooms/NotificationBadge.tsx +++ b/src/components/views/rooms/NotificationBadge.tsx @@ -35,7 +35,8 @@ export const NOTIFICATION_STATE_UPDATE = "update"; export enum NotificationColor { // Inverted (None -> Red) because we do integer comparisons on this None, // nothing special - Bold, // no badge, show as unread // TODO: This goes away with new notification structures + // TODO: Remove bold with notifications: https://github.com/vector-im/riot-web/issues/14227 + Bold, // no badge, show as unread Grey, // unread notified messages Red, // unread pings } @@ -141,6 +142,8 @@ export default class NotificationBadge extends React.PureComponent { return ( { for (const orderedTagId of TAG_ORDER) { if (COMMUNITY_TAGS_BEFORE_TAG === orderedTagId) { // Populate community invites if we have the chance - // TODO + // TODO: Community invites: https://github.com/vector-im/riot-web/issues/14179 } if (CUSTOM_TAGS_BEFORE_TAG === orderedTagId) { // Populate custom tags if needed - // TODO + // TODO: Custom tags: https://github.com/vector-im/riot-web/issues/14091 } const orderedRooms = this.state.sublists[orderedTagId] || []; diff --git a/src/components/views/rooms/RoomSublist2.tsx b/src/components/views/rooms/RoomSublist2.tsx index d34ddf090d5..58ebf54bf79 100644 --- a/src/components/views/rooms/RoomSublist2.tsx +++ b/src/components/views/rooms/RoomSublist2.tsx @@ -34,6 +34,9 @@ import RoomListStore from "../../../stores/room-list/RoomListStore2"; import { ListAlgorithm, SortAlgorithm } from "../../../stores/room-list/algorithms/models"; import { TagID } from "../../../stores/room-list/models"; +// TODO: Remove banner on launch: https://github.com/vector-im/riot-web/issues/14231 +// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14231 + /******************************************************************* * CAUTION * ******************************************************************* @@ -59,12 +62,7 @@ interface IProps { isMinimized: boolean; tagId: TagID; - // TODO: Collapsed state - // TODO: Group invites - // TODO: Calls - // TODO: forceExpand? - // TODO: Header clicking - // TODO: Spinner support for historical + // TODO: Account for https://github.com/vector-im/riot-web/issues/14179 } interface IState { @@ -89,7 +87,7 @@ export default class RoomSublist2 extends React.Component { } private get numTiles(): number { - // TODO: Account for group invites + // TODO: Account for group invites: https://github.com/vector-im/riot-web/issues/14179 return (this.props.rooms || []).length; } @@ -268,17 +266,12 @@ export default class RoomSublist2 extends React.Component { } private renderHeader(): React.ReactElement { - // TODO: Title on collapsed - // TODO: Incoming call box - return ( {({onFocus, isActive, ref}) => { - // TODO: Use onFocus + // TODO: Use onFocus: https://github.com/vector-im/riot-web/issues/14180 const tabIndex = isActive ? 0 : -1; - // TODO: Collapsed state - const badge = ; let addRoomButton = null; @@ -309,7 +302,7 @@ export default class RoomSublist2 extends React.Component { ); - // TODO: a11y (see old component) + // TODO: a11y (see old component): https://github.com/vector-im/riot-web/issues/14180 // Note: the addRoomButton conditionally gets moved around // the DOM depending on whether or not the list is minimized. // If we're minimized, we want it below the header so it @@ -343,15 +336,12 @@ export default class RoomSublist2 extends React.Component { } public render(): React.ReactElement { - // TODO: Proper rendering - // TODO: Error boundary + // TODO: Error boundary: https://github.com/vector-im/riot-web/issues/14185 const tiles = this.renderTiles(); const classes = classNames({ - // TODO: Proper collapse support 'mx_RoomSublist2': true, - 'mx_RoomSublist2_collapsed': false, // len && isCollapsed 'mx_RoomSublist2_hasMenuOpen': this.state.menuDisplayed, 'mx_RoomSublist2_minimized': this.props.isMinimized, }); @@ -360,9 +350,6 @@ export default class RoomSublist2 extends React.Component { if (tiles.length > 0) { const layout = this.props.layout; // to shorten calls - // TODO: Lazy list rendering - // TODO: Whatever scrolling magic needs to happen here - const nVisible = Math.floor(layout.visibleTiles); const visibleTiles = tiles.slice(0, nVisible); @@ -457,7 +444,7 @@ export default class RoomSublist2 extends React.Component { ); } - // TODO: onKeyDown support + // TODO: onKeyDown support: https://github.com/vector-im/riot-web/issues/14180 return (
{ private roomTileRef: React.RefObject = createRef(); private generalMenuButtonRef: React.RefObject = createRef(); - // TODO: Custom status - // TODO: Lock icon - // TODO: Presence indicator - // TODO: e2e shields - // TODO: Handle changes to room aesthetics (name, join rules, etc) - // TODO: scrollIntoView? - // TODO: hover, badge, etc - // TODO: isSelected for hover effects - // TODO: Context menu - // TODO: a11y + // TODO: a11y: https://github.com/vector-im/riot-web/issues/14180 constructor(props: IProps) { super(props); @@ -108,7 +100,7 @@ export default class RoomTile2 extends React.Component { private onTileClick = (ev: React.KeyboardEvent) => { dis.dispatch({ action: 'view_room', - // TODO: Support show_room_tile in new room list + // TODO: Support show_room_tile in new room list: https://github.com/vector-im/riot-web/issues/14233 show_room_tile: true, // make sure the room is visible in the list room_id: this.props.room.roomId, clear_search: (ev && (ev.key === Key.ENTER || ev.key === Key.SPACE)), @@ -240,10 +232,8 @@ export default class RoomTile2 extends React.Component { } public render(): React.ReactElement { - // TODO: Collapsed state - // TODO: Invites - // TODO: a11y proper - // TODO: Render more than bare minimum + // TODO: Invites: https://github.com/vector-im/riot-web/issues/14198 + // TODO: a11y proper: https://github.com/vector-im/riot-web/issues/14180 const classes = classNames({ 'mx_RoomTile2': true, @@ -265,9 +255,6 @@ export default class RoomTile2 extends React.Component { if (typeof name !== 'string') name = ''; name = name.replace(":", ":\u200b"); // add a zero-width space to allow linewrapping after the colon - // TODO: Support collapsed state properly - // TODO: Tooltip? - let messagePreview = null; if (this.props.showMessagePreview && !this.props.isMinimized) { // The preview store heavily caches this info, so should be safe to hammer. diff --git a/src/stores/BreadcrumbsStore.ts b/src/stores/BreadcrumbsStore.ts index 332fa7fe2ec..1c47075cbb4 100644 --- a/src/stores/BreadcrumbsStore.ts +++ b/src/stores/BreadcrumbsStore.ts @@ -57,7 +57,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient { protected async onAction(payload: ActionPayload) { if (!this.matrixClient) return; - // TODO: Remove when new room list is made the default + // TODO: Remove when new room list is made the default: https://github.com/vector-im/riot-web/issues/14231 if (!RoomListStoreTempProxy.isUsingNewStore()) return; if (payload.action === 'setting_updated') { @@ -80,7 +80,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient { } protected async onReady() { - // TODO: Remove when new room list is made the default + // TODO: Remove when new room list is made the default: https://github.com/vector-im/riot-web/issues/14231 if (!RoomListStoreTempProxy.isUsingNewStore()) return; await this.updateRooms(); @@ -91,7 +91,7 @@ export class BreadcrumbsStore extends AsyncStoreWithClient { } protected async onNotReady() { - // TODO: Remove when new room list is made the default + // TODO: Remove when new room list is made the default: https://github.com/vector-im/riot-web/issues/14231 if (!RoomListStoreTempProxy.isUsingNewStore()) return; this.matrixClient.removeListener("Room.myMembership", this.onMyMembership); diff --git a/src/stores/room-list/ListLayout.ts b/src/stores/room-list/ListLayout.ts index 8ca8ad637b6..56f94ccd9a7 100644 --- a/src/stores/room-list/ListLayout.ts +++ b/src/stores/room-list/ListLayout.ts @@ -85,7 +85,8 @@ export class ListLayout { } public get defaultVisibleTiles(): number { - // TODO: Remove dogfood flag + // TODO: Remove dogfood flag: https://github.com/vector-im/riot-web/issues/14231 + // TODO: Resolve dogfooding: https://github.com/vector-im/riot-web/issues/14137 const val = Number(localStorage.getItem("mx_dogfood_rl_defTiles") || 4); return val + RESIZER_BOX_FACTOR; } diff --git a/src/stores/room-list/MessagePreviewStore.ts b/src/stores/room-list/MessagePreviewStore.ts index b727069f9f0..01ddde2e17a 100644 --- a/src/stores/room-list/MessagePreviewStore.ts +++ b/src/stores/room-list/MessagePreviewStore.ts @@ -192,7 +192,7 @@ export class MessagePreviewStore extends AsyncStoreWithClient { protected async onAction(payload: ActionPayload) { if (!this.matrixClient) return; - // TODO: Remove when new room list is made the default + // TODO: Remove when new room list is made the default: https://github.com/vector-im/riot-web/issues/14231 if (!RoomListStoreTempProxy.isUsingNewStore()) return; if (payload.action === 'MatrixActions.Room.timeline' || payload.action === 'MatrixActions.Event.decrypted') { diff --git a/src/stores/room-list/RoomListStore2.ts b/src/stores/room-list/RoomListStore2.ts index 99eee82d4ea..58a78f4dd8a 100644 --- a/src/stores/room-list/RoomListStore2.ts +++ b/src/stores/room-list/RoomListStore2.ts @@ -72,7 +72,7 @@ export class RoomListStore2 extends AsyncStore { return this._matrixClient; } - // TODO: Remove enabled flag when the old RoomListStore goes away + // TODO: Remove enabled flag with the old RoomListStore: https://github.com/vector-im/riot-web/issues/14231 private checkEnabled() { this.enabled = SettingsStore.isFeatureEnabled("feature_new_room_list"); if (this.enabled) { @@ -89,7 +89,7 @@ export class RoomListStore2 extends AsyncStore { } private onRVSUpdate = () => { - if (!this.enabled) return; // TODO: Remove enabled flag when RoomListStore2 takes over + if (!this.enabled) return; // TODO: Remove with https://github.com/vector-im/riot-web/issues/14231 if (!this.matrixClient) return; // We assume there won't be RVS updates without a client const activeRoomId = RoomViewStore.getRoomId(); @@ -99,6 +99,7 @@ export class RoomListStore2 extends AsyncStore { const activeRoom = this.matrixClient.getRoom(activeRoomId); if (!activeRoom) throw new Error(`${activeRoomId} is current in RVS but missing from client`); if (activeRoom !== this.algorithm.stickyRoom) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`Changing sticky room to ${activeRoomId}`); this.algorithm.stickyRoom = activeRoom; } @@ -112,7 +113,7 @@ export class RoomListStore2 extends AsyncStore { return; } - // TODO: Remove this once the RoomListStore becomes default + // TODO: Remove with https://github.com/vector-im/riot-web/issues/14231 this.checkEnabled(); if (!this.enabled) return; @@ -163,12 +164,14 @@ export class RoomListStore2 extends AsyncStore { console.warn(`Own read receipt was in unknown room ${room.roomId}`); return; } + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Got own read receipt in ${room.roomId}`); await this.handleRoomUpdate(room, RoomUpdateCause.ReadReceipt); return; } } else if (payload.action === 'MatrixActions.Room.tags') { const roomPayload = (payload); // TODO: Type out the dispatcher types + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Got tag change in ${roomPayload.room.roomId}`); await this.handleRoomUpdate(roomPayload.room, RoomUpdateCause.PossibleTagChange); } else if (payload.action === 'MatrixActions.Room.timeline') { @@ -180,10 +183,12 @@ export class RoomListStore2 extends AsyncStore { const roomId = eventPayload.event.getRoomId(); const room = this.matrixClient.getRoom(roomId); const tryUpdate = async (updatedRoom: Room) => { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Live timeline event ${eventPayload.event.getId()} in ${updatedRoom.roomId}`); if (eventPayload.event.getType() === 'm.room.tombstone' && eventPayload.event.getStateKey() === '') { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Got tombstone event - regenerating room list`); - // TODO: We could probably be smarter about this + // TODO: We could probably be smarter about this: https://github.com/vector-im/riot-web/issues/14035 await this.regenerateAllLists(); return; // don't pass the update down - we will have already handled it in the regen } @@ -208,13 +213,15 @@ export class RoomListStore2 extends AsyncStore { console.warn(`Event ${eventPayload.event.getId()} was decrypted in an unknown room ${roomId}`); return; } + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Decrypted timeline event ${eventPayload.event.getId()} in ${roomId}`); - // TODO: Check that e2e rooms are calculated correctly on initial load. + // TODO: Verify that e2e rooms are handled on init: https://github.com/vector-im/riot-web/issues/14238 // It seems like when viewing the room the timeline is decrypted, rather than at startup. This could // cause inaccuracies with the list ordering. We may have to decrypt the last N messages of every room :( await this.handleRoomUpdate(room, RoomUpdateCause.Timeline); } else if (payload.action === 'MatrixActions.accountData' && payload.event_type === 'm.direct') { const eventPayload = (payload); // TODO: Type out the dispatcher types + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Received updated DM map`); const dmMap = eventPayload.event.getContent(); for (const userId of Object.keys(dmMap)) { @@ -236,6 +243,7 @@ export class RoomListStore2 extends AsyncStore { } else if (payload.action === 'MatrixActions.Room.myMembership') { const membershipPayload = (payload); // TODO: Type out the dispatcher types if (membershipPayload.oldMembership !== "join" && membershipPayload.membership === "join") { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Handling new room ${membershipPayload.room.roomId}`); await this.algorithm.handleRoomUpdate(membershipPayload.room, RoomUpdateCause.NewRoom); return; @@ -243,6 +251,7 @@ export class RoomListStore2 extends AsyncStore { // If it's not a join, it's transitioning into a different list (possibly historical) if (membershipPayload.oldMembership !== membershipPayload.membership) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Handling membership change in ${membershipPayload.room.roomId}`); await this.algorithm.handleRoomUpdate(membershipPayload.room, RoomUpdateCause.PossibleTagChange); return; @@ -253,6 +262,7 @@ export class RoomListStore2 extends AsyncStore { private async handleRoomUpdate(room: Room, cause: RoomUpdateCause): Promise { const shouldUpdate = await this.algorithm.handleRoomUpdate(room, cause); if (shouldUpdate) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[DEBUG] Room "${room.name}" (${room.roomId}) triggered by ${cause} requires list update`); this.emit(LISTS_UPDATE_EVENT, this); } @@ -260,6 +270,7 @@ export class RoomListStore2 extends AsyncStore { public async setTagSorting(tagId: TagID, sort: SortAlgorithm) { await this.algorithm.setTagSorting(tagId, sort); + // TODO: Per-account? https://github.com/vector-im/riot-web/issues/14114 localStorage.setItem(`mx_tagSort_${tagId}`, sort); } @@ -269,11 +280,13 @@ export class RoomListStore2 extends AsyncStore { // noinspection JSMethodCanBeStatic private getStoredTagSorting(tagId: TagID): SortAlgorithm { + // TODO: Per-account? https://github.com/vector-im/riot-web/issues/14114 return localStorage.getItem(`mx_tagSort_${tagId}`); } public async setListOrder(tagId: TagID, order: ListAlgorithm) { await this.algorithm.setListOrdering(tagId, order); + // TODO: Per-account? https://github.com/vector-im/riot-web/issues/14114 localStorage.setItem(`mx_listOrder_${tagId}`, order); } @@ -283,6 +296,7 @@ export class RoomListStore2 extends AsyncStore { // noinspection JSMethodCanBeStatic private getStoredListOrder(tagId: TagID): ListAlgorithm { + // TODO: Per-account? https://github.com/vector-im/riot-web/issues/14114 return localStorage.getItem(`mx_listOrder_${tagId}`); } @@ -319,6 +333,7 @@ export class RoomListStore2 extends AsyncStore { } private onAlgorithmListUpdated = () => { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log("Underlying algorithm has triggered a list update - refiring"); this.emit(LISTS_UPDATE_EVENT, this); }; @@ -334,8 +349,10 @@ export class RoomListStore2 extends AsyncStore { } if (this.state.tagsEnabled) { - // TODO: Find a more reliable way to get tags (this doesn't work) + // TODO: Fix custom tags: https://github.com/vector-im/riot-web/issues/14091 const roomTags = TagOrderStore.getOrderedTags() || []; + + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log("rtags", roomTags); } @@ -348,6 +365,7 @@ export class RoomListStore2 extends AsyncStore { } public addFilter(filter: IFilterCondition): void { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log("Adding filter condition:", filter); this.filterConditions.push(filter); if (this.algorithm) { @@ -356,6 +374,7 @@ export class RoomListStore2 extends AsyncStore { } public removeFilter(filter: IFilterCondition): void { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log("Removing filter condition:", filter); const idx = this.filterConditions.indexOf(filter); if (idx >= 0) { diff --git a/src/stores/room-list/RoomListStoreTempProxy.ts b/src/stores/room-list/RoomListStoreTempProxy.ts index 0a173d53a9c..86aff178eeb 100644 --- a/src/stores/room-list/RoomListStoreTempProxy.ts +++ b/src/stores/room-list/RoomListStoreTempProxy.ts @@ -24,7 +24,7 @@ import { ITagMap } from "./algorithms/models"; * Temporary RoomListStore proxy. Should be replaced with RoomListStore2 when * it is available to everyone. * - * TODO: Remove this when RoomListStore gets fully replaced. + * TODO: Delete this: https://github.com/vector-im/riot-web/issues/14231 */ export class RoomListStoreTempProxy { public static isUsingNewStore(): boolean { diff --git a/src/stores/room-list/TagWatcher.ts b/src/stores/room-list/TagWatcher.ts index 22302b695d6..56b64375244 100644 --- a/src/stores/room-list/TagWatcher.ts +++ b/src/stores/room-list/TagWatcher.ts @@ -23,7 +23,7 @@ import { arrayDiff, arrayHasDiff } from "../../utils/arrays"; * Watches for changes in tags/groups to manage filters on the provided RoomListStore */ export class TagWatcher { - // TODO: Support custom tags, somehow (deferred to later work - need support elsewhere) + // TODO: Support custom tags, somehow: https://github.com/vector-im/riot-web/issues/14091 private filters = new Map(); constructor(private store: RoomListStore2) { @@ -44,7 +44,7 @@ export class TagWatcher { const newFilters = new Map(); - // TODO: Support custom tags properly + // TODO: Support custom tags, somehow: https://github.com/vector-im/riot-web/issues/14091 const filterableTags = newTags.filter(t => t.startsWith("+")); for (const tag of filterableTags) { @@ -61,6 +61,7 @@ export class TagWatcher { const diff = arrayDiff(lastTags, newTags); for (const tag of diff.added) { // TODO: Remove this check when custom tags are supported (as we shouldn't be losing filters) + // Ref https://github.com/vector-im/riot-web/issues/14091 const filter = newFilters.get(tag); if (!filter) continue; diff --git a/src/stores/room-list/algorithms/Algorithm.ts b/src/stores/room-list/algorithms/Algorithm.ts index 5f7a7bd2efe..37ce7e4ba70 100644 --- a/src/stores/room-list/algorithms/Algorithm.ts +++ b/src/stores/room-list/algorithms/Algorithm.ts @@ -34,7 +34,7 @@ import { EffectiveMembership, splitRoomsByMembership } from "../membership"; import { OrderingAlgorithm } from "./list-ordering/OrderingAlgorithm"; import { getListAlgorithmInstance } from "./list-ordering"; -// TODO: Add locking support to avoid concurrent writes? +// TODO: Add locking support to avoid concurrent writes? https://github.com/vector-im/riot-web/issues/14235 /** * Fired when the Algorithm has determined a list has been updated. @@ -185,7 +185,6 @@ export class Algorithm extends EventEmitter { // the same thing it no-ops. After we're done calling the algorithm, we'll issue // a new update for ourselves. const lastStickyRoom = this._stickyRoom; - console.log(`Last sticky room:`, lastStickyRoom); this._stickyRoom = null; this.recalculateStickyRoom(); @@ -262,6 +261,8 @@ export class Algorithm extends EventEmitter { } } newMap[tagId] = allowedRoomsInThisTag; + + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[DEBUG] ${newMap[tagId].length}/${rooms.length} rooms filtered into ${tagId}`); } @@ -296,6 +297,8 @@ export class Algorithm extends EventEmitter { if (filteredRooms.length > 0) { this.filteredRooms[tagId] = filteredRooms; } + + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[DEBUG] ${filteredRooms.length}/${rooms.length} rooms filtered into ${tagId}`); } @@ -335,6 +338,7 @@ export class Algorithm extends EventEmitter { } if (!this._cachedStickyRooms || !updatedTag) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`Generating clone of cached rooms for sticky room handling`); const stickiedTagMap: ITagMap = {}; for (const tagId of Object.keys(this.cachedRooms)) { @@ -346,6 +350,7 @@ export class Algorithm extends EventEmitter { if (updatedTag) { // Update the tag indicated by the caller, if possible. This is mostly to ensure // our cache is up to date. + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`Replacing cached sticky rooms for ${updatedTag}`); this._cachedStickyRooms[updatedTag] = this.cachedRooms[updatedTag].map(r => r); // shallow clone } @@ -355,6 +360,7 @@ export class Algorithm extends EventEmitter { // we might have updated from the cache is also our sticky room. const sticky = this._stickyRoom; if (!updatedTag || updatedTag === sticky.tag) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`Inserting sticky room ${sticky.room.roomId} at position ${sticky.position} in ${sticky.tag}`); this._cachedStickyRooms[sticky.tag].splice(sticky.position, 0, sticky.room); } @@ -440,10 +446,12 @@ export class Algorithm extends EventEmitter { // Split out the easy rooms first (leave and invite) const memberships = splitRoomsByMembership(rooms); for (const room of memberships[EffectiveMembership.Invite]) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[DEBUG] "${room.name}" (${room.roomId}) is an Invite`); newTags[DefaultTagID.Invite].push(room); } for (const room of memberships[EffectiveMembership.Leave]) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[DEBUG] "${room.name}" (${room.roomId}) is Historical`); newTags[DefaultTagID.Archived].push(room); } @@ -462,8 +470,10 @@ export class Algorithm extends EventEmitter { let inTag = false; if (tags.length > 0) { for (const tag of tags) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[DEBUG] "${room.name}" (${room.roomId}) is tagged as ${tag}`); if (!isNullOrUndefined(newTags[tag])) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[DEBUG] "${room.name}" (${room.roomId}) is tagged with VALID tag ${tag}`); newTags[tag].push(room); inTag = true; @@ -472,8 +482,10 @@ export class Algorithm extends EventEmitter { } if (!inTag) { - // TODO: Determine if DM and push there instead + // TODO: Determine if DM and push there instead: https://github.com/vector-im/riot-web/issues/14236 newTags[DefaultTagID.Untagged].push(room); + + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[DEBUG] "${room.name}" (${room.roomId}) is Untagged`); } } @@ -537,8 +549,8 @@ export class Algorithm extends EventEmitter { if (!this.algorithms) throw new Error("Not ready: no algorithms to determine tags from"); if (cause === RoomUpdateCause.PossibleTagChange) { - // TODO: Be smarter and splice rather than regen the planet. - // TODO: No-op if no change. + // TODO: Be smarter and splice rather than regen the planet. https://github.com/vector-im/riot-web/issues/14035 + // TODO: No-op if no change. https://github.com/vector-im/riot-web/issues/14035 await this.setKnownRooms(this.rooms); return true; } @@ -548,6 +560,7 @@ export class Algorithm extends EventEmitter { // as the sticky room relies on this. if (cause !== RoomUpdateCause.NewRoom && cause !== RoomUpdateCause.RoomRemoved) { if (this.stickyRoom === room) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.warn(`[RoomListDebug] Received ${cause} update for sticky room ${room.roomId} - ignoring`); return false; } diff --git a/src/stores/room-list/algorithms/list-ordering/ImportanceAlgorithm.ts b/src/stores/room-list/algorithms/list-ordering/ImportanceAlgorithm.ts index 15fa00c302a..e2a9fc19526 100644 --- a/src/stores/room-list/algorithms/list-ordering/ImportanceAlgorithm.ts +++ b/src/stores/room-list/algorithms/list-ordering/ImportanceAlgorithm.ts @@ -87,6 +87,8 @@ export class ImportanceAlgorithm extends OrderingAlgorithm { public constructor(tagId: TagID, initialSortingAlgorithm: SortAlgorithm) { super(tagId, initialSortingAlgorithm); + + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Constructed an ImportanceAlgorithm for ${tagId}`); } @@ -292,7 +294,7 @@ export class ImportanceAlgorithm extends OrderingAlgorithm { // "should never happen" disclaimer goes here console.warn(`!! Room list index corruption: ${lastCat} (i:${indices[lastCat]}) is greater than ${thisCat} (i:${indices[thisCat]}) - category indices are likely desynced from reality`); - // TODO: Regenerate index when this happens + // TODO: Regenerate index when this happens: https://github.com/vector-im/riot-web/issues/14234 } } } diff --git a/src/stores/room-list/algorithms/list-ordering/NaturalAlgorithm.ts b/src/stores/room-list/algorithms/list-ordering/NaturalAlgorithm.ts index 96a3f58d2c8..79fa2ed6046 100644 --- a/src/stores/room-list/algorithms/list-ordering/NaturalAlgorithm.ts +++ b/src/stores/room-list/algorithms/list-ordering/NaturalAlgorithm.ts @@ -28,6 +28,8 @@ export class NaturalAlgorithm extends OrderingAlgorithm { public constructor(tagId: TagID, initialSortingAlgorithm: SortAlgorithm) { super(tagId, initialSortingAlgorithm); + + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log(`[RoomListDebug] Constructed a NaturalAlgorithm for ${tagId}`); } @@ -49,7 +51,7 @@ export class NaturalAlgorithm extends OrderingAlgorithm { if (idx >= 0) this.cachedOrderedRooms.splice(idx, 1); } - // TODO: Optimize this to avoid useless operations + // TODO: Optimize this to avoid useless operations: https://github.com/vector-im/riot-web/issues/14035 // For example, we can skip updates to alphabetic (sometimes) and manually ordered tags this.cachedOrderedRooms = await sortRoomsWithAlgorithm(this.cachedOrderedRooms, this.tagId, this.sortingAlgorithm); diff --git a/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts b/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts index 4e4df6c9d67..a122ee3ae68 100644 --- a/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts +++ b/src/stores/room-list/algorithms/tag-sorting/RecentAlgorithm.ts @@ -32,6 +32,7 @@ export class RecentAlgorithm implements IAlgorithm { // of the rooms to each other. // TODO: We could probably improve the sorting algorithm here by finding changes. + // See https://github.com/vector-im/riot-web/issues/14035 // For example, if we spent a little bit of time to determine which elements have // actually changed (probably needs to be done higher up?) then we could do an // insertion sort or similar on the limited set of changes. diff --git a/src/stores/room-list/filters/CommunityFilterCondition.ts b/src/stores/room-list/filters/CommunityFilterCondition.ts index b7ff8e686dd..9f7d8daaa38 100644 --- a/src/stores/room-list/filters/CommunityFilterCondition.ts +++ b/src/stores/room-list/filters/CommunityFilterCondition.ts @@ -52,6 +52,7 @@ export class CommunityFilterCondition extends EventEmitter implements IFilterCon const beforeRoomIds = this.roomIds; this.roomIds = (await GroupStore.getGroupRooms(this.community.groupId)).map(r => r.roomId); if (arrayHasDiff(beforeRoomIds, this.roomIds)) { + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log("Updating filter for group: ", this.community.groupId); this.emit(FILTER_CHANGED); } diff --git a/src/stores/room-list/filters/NameFilterCondition.ts b/src/stores/room-list/filters/NameFilterCondition.ts index 4ac5b685960..8625cd932c2 100644 --- a/src/stores/room-list/filters/NameFilterCondition.ts +++ b/src/stores/room-list/filters/NameFilterCondition.ts @@ -41,6 +41,7 @@ export class NameFilterCondition extends EventEmitter implements IFilterConditio public set search(val: string) { this._search = val; + // TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14035 console.log("Updating filter for room name search:", this._search); this.emit(FILTER_CHANGED); } @@ -57,7 +58,7 @@ export class NameFilterCondition extends EventEmitter implements IFilterConditio } } - if (!room.name) return false; // should realisitically not happen: the js-sdk always calculates a name + if (!room.name) return false; // should realistically not happen: the js-sdk always calculates a name // Note: we have to match the filter with the removeHiddenChars() room name because the // function strips spaces and other characters (M becomes RN for example, in lowercase). diff --git a/src/stores/room-list/membership.ts b/src/stores/room-list/membership.ts index 3cb4bf146c9..9f1c5b7b414 100644 --- a/src/stores/room-list/membership.ts +++ b/src/stores/room-list/membership.ts @@ -63,7 +63,7 @@ export function getEffectiveMembership(membership: string): EffectiveMembership if (membership === 'invite') { return EffectiveMembership.Invite; } else if (membership === 'join') { - // TODO: Do the same for knock? Update docs as needed in the enum. + // TODO: Include knocks? Update docs as needed in the enum. https://github.com/vector-im/riot-web/issues/14237 return EffectiveMembership.Join; } else { // Probably a leave, kick, or ban