Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Rewrite the room list store #4253

Merged
merged 36 commits into from
May 21, 2020
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
82b55ff
Add temporary timing functions to old RoomListStore
turt2live Mar 12, 2020
08419d1
Initial breakout for room list rewrite
turt2live Mar 20, 2020
861268d
Invent an AsyncStore and use it for room lists
turt2live Apr 27, 2020
becadde
Categorize rooms by effective membership
turt2live Apr 28, 2020
00d400b
Possible framework for a proof of concept
turt2live Apr 29, 2020
9c04226
Add another thought
turt2live Apr 29, 2020
e7fffee
Remove the need for a tag manager
turt2live Apr 29, 2020
d244eeb
Break up algorithms and use the new layering
turt2live Apr 29, 2020
ecf8090
Handle DMs
turt2live Apr 30, 2020
09b7f39
Simple rendering of the room list for visual aid
turt2live Apr 30, 2020
5dda7f0
Early handling of dispatched events
turt2live May 4, 2020
ea34bb3
Make component index happy
turt2live May 4, 2020
e1fab9a
Work out the new category index for each room update
turt2live May 7, 2020
4a0d14e
Make missing rooms throw instead
turt2live May 7, 2020
e88788f
Handle event decryption too
turt2live May 8, 2020
cb3d17e
Bare minimum for rendering a room list
turt2live May 8, 2020
df3d5c4
Update i18n for room list
turt2live May 11, 2020
9f08102
Clean up imports and other minor lints
turt2live May 11, 2020
715dd7e
Prepare tooltip for collapsed support
turt2live May 11, 2020
6bdcbd0
Support switching rooms
turt2live May 11, 2020
e8c3316
Initial work on badges
turt2live May 12, 2020
c373526
Fix bold rooms not bolding
turt2live May 14, 2020
f8cbada
Clean up comments in skeleton components
turt2live May 14, 2020
aafbd7f
Update misc documentation and spell indices correctly
turt2live May 14, 2020
9fbd489
Update i18n
turt2live May 14, 2020
8e047c3
Update README for room list store
turt2live May 14, 2020
2b4c19e
Merge branch 'travis/dispatcher-types' into travis/room-list-2
turt2live May 14, 2020
6cb1efc
Use the new TS dispatcher
turt2live May 14, 2020
91a997d
Replace ChaoticAlgorithm for tag sorting with deterministic behaviour
turt2live May 14, 2020
b7ba9b3
Replace ChaoticAlgorithm with NaturalAlgorithm for list behaviour
turt2live May 14, 2020
5cfe29d
Update AsyncStore's docs to be slightly more clear
turt2live May 14, 2020
21e4713
Revert "Add temporary timing functions to old RoomListStore"
turt2live Mar 12, 2020
38920e7
Merge branch 'develop' into travis/room-list-2
turt2live May 19, 2020
559dd98
Fix comment style to be less bothersome
turt2live May 21, 2020
a11985f
Which component? The room list!
turt2live May 21, 2020
e3c0b47
Hyphenize algorithm directories
turt2live May 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
},
"dependencies": {
"@babel/runtime": "^7.8.3",
"await-lock": "^2.0.1",
"blueimp-canvas-to-blob": "^3.5.0",
"browser-encrypt-attachment": "^0.3.0",
"browser-request": "^0.3.3",
Expand Down Expand Up @@ -117,6 +118,7 @@
"@babel/register": "^7.7.4",
"@peculiar/webcrypto": "^1.0.22",
"@types/classnames": "^2.2.10",
"@types/flux": "^3.1.9",
"@types/modernizr": "^3.5.3",
"@types/qrcode": "^1.3.4",
"@types/react": "16.9",
Expand Down
2 changes: 1 addition & 1 deletion src/BasePlatform.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
*/

import {MatrixClient} from "matrix-js-sdk";
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import BaseEventIndexManager from './indexing/BaseEventIndexManager';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/CallHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import Modal from './Modal';
import * as sdk from './index';
import { _t } from './languageHandler';
import Matrix from 'matrix-js-sdk';
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import { showUnknownDeviceDialogForCalls } from './cryptodevices';
import WidgetUtils from './utils/WidgetUtils';
import WidgetEchoStore from './stores/WidgetEchoStore';
Expand Down
2 changes: 1 addition & 1 deletion src/ContentMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
'use strict';

import extend from './extend';
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import {MatrixClientPeg} from './MatrixClientPeg';
import * as sdk from './index';
import { _t } from './languageHandler';
Expand Down
2 changes: 1 addition & 1 deletion src/FromWidgetPostMessageApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
*/

import URL from 'url';
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import WidgetMessagingEndpoint from './WidgetMessagingEndpoint';
import ActiveWidgetStore from './stores/ActiveWidgetStore';
import {MatrixClientPeg} from "./MatrixClientPeg";
Expand Down
2 changes: 1 addition & 1 deletion src/Lifecycle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Analytics from './Analytics';
import Notifier from './Notifier';
import UserActivity from './UserActivity';
import Presence from './Presence';
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import DMRoomMap from './utils/DMRoomMap';
import Modal from './Modal';
import * as sdk from './index';
Expand Down
2 changes: 1 addition & 1 deletion src/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
import React from 'react';
import ReactDOM from 'react-dom';
import Analytics from './Analytics';
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import {defer} from './utils/promise';
import AsyncWrapper from './AsyncWrapper';

Expand Down
2 changes: 1 addition & 1 deletion src/Notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import PlatformPeg from './PlatformPeg';
import * as TextForEvent from './TextForEvent';
import Analytics from './Analytics';
import * as Avatar from './Avatar';
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import * as sdk from './index';
import { _t } from './languageHandler';
import Modal from './Modal';
Expand Down
2 changes: 1 addition & 1 deletion src/Presence.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
*/

import {MatrixClientPeg} from "./MatrixClientPeg";
import dis from "./dispatcher";
import dis from "./dispatcher/dispatcher";
import Timer from './utils/Timer';

// Time in ms after that a user is considered as unavailable/away
Expand Down
2 changes: 1 addition & 1 deletion src/Registration.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ limitations under the License.
* registration code.
*/

import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import * as sdk from './index';
import Modal from './Modal';
import { _t } from './languageHandler';
Expand Down
2 changes: 1 addition & 1 deletion src/Resend.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
*/

import {MatrixClientPeg} from './MatrixClientPeg';
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import { EventStatus } from 'matrix-js-sdk';

export default class Resend {
Expand Down
2 changes: 1 addition & 1 deletion src/ScalarMessaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Example:

import {MatrixClientPeg} from './MatrixClientPeg';
import { MatrixEvent } from 'matrix-js-sdk';
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import WidgetUtils from './utils/WidgetUtils';
import RoomViewStore from './stores/RoomViewStore';
import { _t } from './languageHandler';
Expand Down
10 changes: 7 additions & 3 deletions src/SlashCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ limitations under the License.
import * as React from 'react';

import {MatrixClientPeg} from './MatrixClientPeg';
import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import * as sdk from './index';
import {_t, _td} from './languageHandler';
import Modal from './Modal';
Expand All @@ -41,6 +41,8 @@ import { parseFragment as parseHtml } from "parse5";
import sendBugReport from "./rageshake/submit-rageshake";
import SdkConfig from "./SdkConfig";
import { ensureDMExists } from "./createRoom";
import { ViewUserPayload } from "./dispatcher/payloads/ViewUserPayload";
import { Action } from "./dispatcher/actions";

// XXX: workaround for https://github.com/microsoft/TypeScript/issues/31816
interface HTMLInputEvent extends Event {
Expand Down Expand Up @@ -943,8 +945,10 @@ export const Commands = [
}

const member = MatrixClientPeg.get().getRoom(roomId).getMember(userId);
dis.dispatch({
action: 'view_user',
dis.dispatch<ViewUserPayload>({
action: Action.ViewUser,
// XXX: We should be using a real member object and not assuming what the
// receiver wants.
member: member || {userId},
});
return success();
Expand Down
2 changes: 1 addition & 1 deletion src/UserActivity.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import dis from './dispatcher';
import dis from './dispatcher/dispatcher';
import Timer from './utils/Timer';

// important these are larger than the timeouts of timers
Expand Down
34 changes: 0 additions & 34 deletions src/actions/GroupActions.js

This file was deleted.

34 changes: 34 additions & 0 deletions src/actions/GroupActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
turt2live marked this conversation as resolved.
Show resolved Hide resolved
Copyright 2017 New Vector Ltd
Copyright 2020 The Matrix.org Foundation C.I.C.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { asyncAction } from './actionCreators';
import { AsyncActionPayload } from "../dispatcher/payloads";
import { MatrixClient } from "matrix-js-sdk/src/client";

export default class GroupActions {
/**
* Creates an action thunk that will do an asynchronous request to fetch
* the groups to which a user is joined.
*
* @param {MatrixClient} matrixClient the matrix client to query.
* @returns {AsyncActionPayload} An async action payload.
* @see asyncAction
*/
public static fetchJoinedGroups(matrixClient: MatrixClient): AsyncActionPayload {
return asyncAction('GroupActions.fetchJoinedGroups', () => matrixClient.getJoinedGroups(), null);
}
}
2 changes: 1 addition & 1 deletion src/actions/MatrixActionCreators.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import dis from '../dispatcher';
import dis from '../dispatcher/dispatcher';

// TODO: migrate from sync_state to MatrixActions.sync so that more js-sdk events
// become dispatches in the same place.
Expand Down
145 changes: 0 additions & 145 deletions src/actions/RoomListActions.js

This file was deleted.

Loading