Merge branch 'element' into 'nadonomy/ui-tweaks-part-deux'

# Conflicts:
#   res/css/views/rooms/_RoomSublist2.scss
This commit is contained in:
Bruno Windels 2020-07-14 09:26:04 +00:00
commit 106c91aec0
42 changed files with 104 additions and 164 deletions

View file

@ -48,15 +48,15 @@ limitations under the License.
}
&.mx_NotificationBadge_2char {
width: 16px;
height: 16px;
border-radius: 16px;
width: $font-16px;
height: $font-16px;
border-radius: $font-16px;
}
&.mx_NotificationBadge_3char {
width: 26px;
height: 16px;
border-radius: 16px;
width: $font-26px;
height: $font-16px;
border-radius: $font-16px;
}
// The following is the floating badge

View file

@ -204,8 +204,11 @@ class Analytics {
this._setVisitVariable('Chosen Language', getCurrentLanguage());
if (window.location.hostname === 'riot.im') {
const hostname = window.location.hostname;
if (hostname === 'riot.im') {
this._setVisitVariable('Instance', window.location.pathname);
} else if (hostname.endsWith('.element.io')) {
this._setVisitVariable('Instance', hostname);
}
let installedPWA = "unknown";

View file

@ -35,17 +35,8 @@ import RoomListStore, { LISTS_UPDATE_EVENT } from "../../stores/room-list/RoomLi
import {Key} from "../../Keyboard";
import IndicatorScrollbar from "../structures/IndicatorScrollbar";
// TODO: Remove banner on launch: https://github.com/vector-im/riot-web/issues/14367
// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367
/*******************************************************************
* CAUTION *
*******************************************************************
* This is a work in progress implementation and isn't complete or *
* even useful as a component. Please avoid using it until this *
* warning disappears. *
*******************************************************************/
interface IProps {
isMinimized: boolean;
resizeNotifier: ResizeNotifier;
@ -111,6 +102,10 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
const newVal = BreadcrumbsStore.instance.visible;
if (newVal !== this.state.showBreadcrumbs) {
this.setState({showBreadcrumbs: newVal});
// Update the sticky headers too as the breadcrumbs will be popping in or out.
if (!this.listContainerRef.current) return; // ignore: no headers to sticky
this.handleStickyHeaders(this.listContainerRef.current);
}
};
@ -187,10 +182,23 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
if (header.style.top !== newTop) {
header.style.top = newTop;
}
} else if (style.stickyBottom) {
} else {
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyTop")) {
header.classList.remove("mx_RoomSublist2_headerContainer_stickyTop");
}
if (header.style.top) {
header.style.removeProperty('top');
}
}
if (style.stickyBottom) {
if (!header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) {
header.classList.add("mx_RoomSublist2_headerContainer_stickyBottom");
}
} else {
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) {
header.classList.remove("mx_RoomSublist2_headerContainer_stickyBottom");
}
}
if (style.stickyTop || style.stickyBottom) {
@ -209,21 +217,12 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
if (header.classList.contains("mx_RoomSublist2_headerContainer_sticky")) {
header.classList.remove("mx_RoomSublist2_headerContainer_sticky");
}
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyTop")) {
header.classList.remove("mx_RoomSublist2_headerContainer_stickyTop");
}
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) {
header.classList.remove("mx_RoomSublist2_headerContainer_stickyBottom");
}
if (headerContainer.classList.contains("mx_RoomSublist2_headerContainer_hasSticky")) {
headerContainer.classList.remove("mx_RoomSublist2_headerContainer_hasSticky");
}
if (header.style.width) {
header.style.removeProperty('width');
}
if (header.style.top) {
header.style.removeProperty('top');
}
}
}
@ -242,7 +241,6 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
}
}
// TODO: Improve header reliability: https://github.com/vector-im/riot-web/issues/14232
private onScroll = (ev: React.MouseEvent<HTMLDivElement>) => {
const list = ev.target as HTMLDivElement;
this.handleStickyHeaders(list);
@ -383,8 +381,6 @@ export default class LeftPanel2 extends React.Component<IProps, IState> {
onResize={this.onResize}
/>;
// TODO: Conference handling / calls: https://github.com/vector-im/riot-web/issues/14177
const containerClasses = classNames({
"mx_LeftPanel2": true,
"mx_LeftPanel2_hasTagPanel": !!tagPanel,

View file

@ -25,16 +25,6 @@ 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/14367
/*******************************************************************
* CAUTION *
*******************************************************************
* This is a work in progress implementation and isn't complete or *
* even useful as a component. Please avoid using it until this *
* warning disappears. *
*******************************************************************/
interface IProps {
onQueryUpdate: (newQuery: string) => void;
isMinimized: boolean;

View file

@ -170,6 +170,7 @@ export default class UserMenu extends React.Component<IProps, IState> {
ev.stopPropagation();
// TODO: Archived room view: https://github.com/vector-im/riot-web/issues/14038
// Note: You'll need to uncomment the button too.
console.log("TODO: Show archived rooms");
};

View file

@ -1,6 +1,6 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C.
Copyright 2019, 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.
@ -18,11 +18,13 @@ limitations under the License.
import React from 'react';
import createReactClass from 'create-react-class';
import { _t } from '../../../languageHandler';
import SdkConfig from '../../../SdkConfig';
export default createReactClass({
displayName: 'CustomServerDialog',
render: function() {
const brand = SdkConfig.get().brand;
return (
<div className="mx_ErrorDialog">
<div className="mx_Dialog_title">
@ -32,8 +34,9 @@ export default createReactClass({
<p>{_t(
"You can use the custom server options to sign into other " +
"Matrix servers by specifying a different homeserver URL. This " +
"allows you to use this app with an existing Matrix account on a " +
"allows you to use %(brand)s with an existing Matrix account on a " +
"different homeserver.",
{ brand },
)}</p>
</div>
<div className="mx_Dialog_buttons">

View file

@ -18,8 +18,6 @@ import React from "react";
import classNames from "classnames";
import { formatMinimalBadgeCount } from "../../../utils/FormattingUtils";
import SettingsStore from "../../../settings/SettingsStore";
import { DefaultTagID, TagID } from "../../../stores/room-list/models";
import { readReceiptChangeIsFor } from "../../../utils/read-receipts";
import AccessibleButton from "../elements/AccessibleButton";
import { XOR } from "../../../@types/common";
import { NOTIFICATION_STATE_UPDATE, NotificationState } from "../../../stores/notifications/NotificationState";

View file

@ -27,17 +27,8 @@ import RoomListStore from "../../../stores/room-list/RoomListStore2";
import { DefaultTagID } from "../../../stores/room-list/models";
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
// TODO: Remove banner on launch: https://github.com/vector-im/riot-web/issues/14367
// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367
/*******************************************************************
* CAUTION *
*******************************************************************
* This is a work in progress implementation and isn't complete or *
* even useful as a component. Please avoid using it until this *
* warning disappears. *
*******************************************************************/
interface IProps {
}

View file

@ -41,17 +41,8 @@ import { Action } from "../../../dispatcher/actions";
import { ViewRoomDeltaPayload } from "../../../dispatcher/payloads/ViewRoomDeltaPayload";
import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore";
// TODO: Remove banner on launch: https://github.com/vector-im/riot-web/issues/14367
// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367
/*******************************************************************
* CAUTION *
*******************************************************************
* This is a work in progress implementation and isn't complete or *
* even useful as a component. Please avoid using it until this *
* warning disappears. *
*******************************************************************/
interface IProps {
onKeyDown: (ev: React.KeyboardEvent) => void;
onFocus: (ev: React.FocusEvent) => void;
@ -231,6 +222,7 @@ export default class RoomList2 extends React.Component<IProps, IState> {
private renderCommunityInvites(): React.ReactElement[] {
// TODO: Put community invites in a more sensible place (not in the room list)
// See https://github.com/vector-im/riot-web/issues/14456
return MatrixClientPeg.get().getGroups().filter(g => {
if (g.myMembership !== 'invite') return false;
return !this.searchFilter || this.searchFilter.matches(g.name || "");

View file

@ -17,7 +17,7 @@ limitations under the License.
*/
import * as React from "react";
import {createRef, UIEventHandler} from "react";
import {createRef} from "react";
import { Room } from "matrix-js-sdk/src/models/room";
import classNames from 'classnames';
import { RovingAccessibleButton, RovingTabIndexWrapper } from "../../../accessibility/RovingTabIndex";
@ -48,17 +48,8 @@ import { polyfillTouchEvent } from "../../../@types/polyfill";
import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore";
import RoomListLayoutStore from "../../../stores/room-list/RoomListLayoutStore";
// TODO: Remove banner on launch: https://github.com/vector-im/riot-web/issues/14367
// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367
/*******************************************************************
* CAUTION *
*******************************************************************
* This is a work in progress implementation and isn't complete or *
* even useful as a component. Please avoid using it until this *
* warning disappears. *
*******************************************************************/
const SHOW_N_BUTTON_HEIGHT = 28; // As defined by CSS
const RESIZE_HANDLE_HEIGHT = 4; // As defined by CSS
export const HEADER_HEIGHT = 32; // As defined by CSS
@ -137,9 +128,10 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
let padding = RESIZE_HANDLE_HEIGHT;
// this is used for calculating the max height of the whole container,
// and takes into account whether there should be room reserved for the show less button
// when fully expanded. Note that the show more button might still be shown when not fully expanded,
// but in this case it will take the space of a tile and we don't need to reserve space for it.
if (this.numTiles > this.layout.defaultVisibleTiles) {
// when fully expanded. We cannot check against the layout's defaultVisible tile count
// because there are conditions in which we need to know that the 'show more' button
// is present while well under the default tile limit.
if (this.numTiles > this.numVisibleTiles) {
padding += SHOW_N_BUTTON_HEIGHT;
}
return padding;
@ -236,10 +228,13 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
};
private onShowAllClick = () => {
// read number of visible tiles before we mutate it
const numVisibleTiles = this.numVisibleTiles;
const newHeight = this.layout.tilesToPixelsWithPadding(this.numTiles, this.padding);
this.applyHeightChange(newHeight);
this.setState({height: newHeight}, () => {
this.focusRoomTile(this.numTiles - 1);
// focus the top-most new room
this.focusRoomTile(numVisibleTiles);
});
};
@ -606,8 +601,6 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
}
public render(): React.ReactElement {
// TODO: Error boundary: https://github.com/vector-im/riot-web/issues/14185
const visibleTiles = this.renderVisibleTiles();
const classes = classNames({
'mx_RoomSublist2': true,
@ -623,11 +616,15 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
const showMoreAtMinHeight = minTiles < this.numTiles;
const minHeightPadding = RESIZE_HANDLE_HEIGHT + (showMoreAtMinHeight ? SHOW_N_BUTTON_HEIGHT : 0);
const minTilesPx = layout.tilesToPixelsWithPadding(minTiles, minHeightPadding);
const maxTilesPx = layout.tilesToPixelsWithPadding(this.numTiles, this.padding);
let maxTilesPx = layout.tilesToPixelsWithPadding(this.numTiles, this.padding);
const showMoreBtnClasses = classNames({
'mx_RoomSublist2_showNButton': true,
});
if (this.numTiles > this.layout.defaultVisibleTiles) {
maxTilesPx += SHOW_N_BUTTON_HEIGHT;
}
// If we're hiding rooms, show a 'show more' button to the user. This button
// floats above the resize handle, if we have one present. If the user has all
// tiles visible, it becomes 'show less'.

View file

@ -55,17 +55,8 @@ import {ActionPayload} from "../../../dispatcher/payloads";
import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNotificationStateStore";
import { NotificationState } from "../../../stores/notifications/NotificationState";
// TODO: Remove banner on launch: https://github.com/vector-im/riot-web/issues/14367
// TODO: Rename on launch: https://github.com/vector-im/riot-web/issues/14367
/*******************************************************************
* CAUTION *
*******************************************************************
* This is a work in progress implementation and isn't complete or *
* even useful as a component. Please avoid using it until this *
* warning disappears. *
*******************************************************************/
interface IProps {
room: Room;
showMessagePreview: boolean;
@ -124,7 +115,6 @@ const NotifOption: React.FC<INotifOptionProps> = ({active, onClick, iconClassNam
export default class RoomTile2 extends React.Component<IProps, IState> {
private dispatcherRef: string;
private roomTileRef = createRef<HTMLDivElement>();
// TODO: a11y: https://github.com/vector-im/riot-web/issues/14180
constructor(props: IProps) {
super(props);
@ -310,7 +300,7 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
await setRoomNotifsState(this.props.room.roomId, newState);
} catch (error) {
// TODO: some form of error notification to the user to inform them that their state change failed.
// https://github.com/vector-im/riot-web/issues/14281
// See https://github.com/vector-im/riot-web/issues/14281
console.error(error);
}
@ -398,8 +388,6 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
private renderGeneralMenu(): React.ReactElement {
if (!this.showContextMenu) return null; // no menu to show
// TODO: We could do with a proper invite context menu, unlike what showContextMenu suggests
const roomTags = RoomListStore.instance.getTagsForRoom(this.props.room);
const isFavorite = roomTags.includes(DefaultTagID.Favourite);
@ -465,8 +453,6 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
}
public render(): React.ReactElement {
// TODO: Invites: https://github.com/vector-im/riot-web/issues/14198
const classes = classNames({
'mx_RoomTile2': true,
'mx_RoomTile2_selected': this.state.selected,
@ -495,7 +481,6 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
);
}
// TODO: the original RoomTile uses state for the room name. Do we need to?
let name = this.props.room.name;
if (typeof name !== 'string') name = '';
name = name.replace(":", ":\u200b"); // add a zero-width space to allow linewrapping after the colon

View file

@ -34,6 +34,7 @@ interface IState {
hover: boolean;
}
// TODO: Remove with community invites in the room list: https://github.com/vector-im/riot-web/issues/14456
export default class TemporaryTile extends React.Component<IProps, IState> {
constructor(props: IProps) {
super(props);

View file

@ -1056,7 +1056,6 @@
"Go back": "Върни се",
"Update status": "Обнови статуса",
"Set status": "Настрой статус",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Може да използвате настройките за собствен сървър за да влезете в друг Matrix сървър, чрез указване на адреса му. Това Ви позволява да използвате приложението със съществуващ Matrix акаунт принадлежащ към друг сървър.",
"Your Modular server": "Вашият Modular сървър",
"Enter the location of your Modular homeserver. It may use your own domain name or be a subdomain of <a>modular.im</a>.": "Въведете адреса на вашият Modular сървър. Той представлява или вашето собствено домейн име или поддомейн на <a>modular.im</a>.",
"Server Name": "Име на сървър",

View file

@ -1147,7 +1147,6 @@
"Set a new status...": "Nastavit status...",
"Hide": "Skrýt",
"This homeserver would like to make sure you are not a robot.": "Domovský server se potřebuje přesvědčit, že nejste robot.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Ve vlastním nastavení serveru můžete nastavit použití vlastního domovského serveru. To vám umožní používat tuto aplikaci s existujícím Matrix účtem na jiném serveru.",
"Please review and accept all of the homeserver's policies": "Pročtěte si a odsouhlaste prosím všechna pravidla domovského serveru",
"Please review and accept the policies of this homeserver:": "Pročtěte si a odsouhlaste prosím pravidla domovského serveru:",
"Enter the location of your Modular homeserver. It may use your own domain name or be a subdomain of <a>modular.im</a>.": "Zadejte adresu serveru Modular. Můžete použít svou vlastní doménu a nebo subdoménu <a>modular.im</a>.",

View file

@ -1185,7 +1185,6 @@
"Recovery Method Removed": "Wiederherstellungsmethode gelöscht",
"If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.": "Wenn du die Wiederherstellungsmethode nicht gelöscht hast, kann ein Angreifer versuchen Zugang zu deinem Konto zu bekommen. Ändere dein Passwort und richte sofort eine neue Wiederherstellungsmethode in den Einstellungen ein.",
"<b>Warning</b>: you should only set up key backup from a trusted computer.": "<b>Warnung</b>: Du solltest die Schlüsselsicherung nur auf einem vertrauenswürdigen Gerät einrichten.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Du kannst die angepassten Serveroptionen benutzen um dich an einem anderen Matrixserver anzumelden indem du eine andere Heimserver-Adresse angibst. Dies erlaubt dir diese Anwendung mit einem anderen Matrixkonto auf einem anderen Heimserver zu nutzen.",
"Enter the location of your Modular homeserver. It may use your own domain name or be a subdomain of <a>modular.im</a>.": "Gib die Adresse deines Modular-Heimservers an. Es kann deine eigene Domain oder eine Subdomain von <a>modular.im</a> sein.",
"Unable to query for supported registration methods.": "Konnte unterstützte Registrierungsmethoden nicht abrufen.",
"Bulk options": "Sammeloptionen",

View file

@ -1944,7 +1944,7 @@
"This homeserver would like to make sure you are not a robot.": "This homeserver would like to make sure you are not a robot.",
"Country Dropdown": "Country Dropdown",
"Custom Server Options": "Custom Server Options",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use %(brand)s with an existing Matrix account on a different homeserver.": "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use %(brand)s with an existing Matrix account on a different homeserver.",
"Confirm your identity by entering your account password below.": "Confirm your identity by entering your account password below.",
"Missing captcha public key in homeserver configuration. Please report this to your homeserver administrator.": "Missing captcha public key in homeserver configuration. Please report this to your homeserver administrator.",
"Please review and accept all of the homeserver's policies": "Please review and accept all of the homeserver's policies",

View file

@ -1184,7 +1184,6 @@
"Unable to load backup status": "Ne povas legi staton de savkopio",
"Collapse Reply Thread": "Maletendi respondan fadenon",
"This homeserver would like to make sure you are not a robot.": "Ĉi tiu hejmservilo volas certigi, ke vi ne estas roboto.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Vi povas uzi proprajn servilajn elektojn por saluti aliajn servilojn de Matrix per alia hejmservila URL. Tio ebligos uzi ĉi tiun aplikaĵon kun jama Matrix-konto en alia hejmservilo.",
"Please review and accept all of the homeserver's policies": "Bonvolu tralegi kaj akcepti ĉioman politikon de ĉi tiu hejmservilo",
"Please review and accept the policies of this homeserver:": "Bonvolu tralegi kaj akcepti la politikon de ĉi tiu hejmservilo:",
"Unable to validate homeserver/identity server": "Ne povas kontroli hejmservilon aŭ identigan servilon",

View file

@ -1941,7 +1941,6 @@
"User Status": "Estado de usuario",
"This homeserver would like to make sure you are not a robot.": "A este servidor le gustaría asegurarse de que no eres un robot.",
"Country Dropdown": "Seleccione país",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Puede utilizar las opciones del servidor personalizado para iniciar sesión en otros servidores de Matrix, especificando una URL de servidor doméstico diferente. Esto le permite usar esta aplicación con una cuenta existente de Matrix en un servidor doméstico diferente.",
"Confirm your identity by entering your account password below.": "Confirme su identidad introduciendo la contraseña de su cuenta.",
"Missing captcha public key in homeserver configuration. Please report this to your homeserver administrator.": "Falta la clave pública del captcha en la configuración del servidor doméstico. Por favor, informe de esto al administrador del servidor doméstico.",
"Please review and accept all of the homeserver's policies": "Por favor, revise y acepte todas las políticas del servidor doméstico",

View file

@ -1545,7 +1545,6 @@
"Failed to forget room %(errCode)s": "Jututoa unustamine ei õnnestunud %(errCode)s",
"This homeserver would like to make sure you are not a robot.": "See server soovib kindlaks teha, et sa ei ole robot.",
"Country Dropdown": "Riikide valik",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Sa võid kasutada serveri kohandatud valikuid selleks, et määrates teise aadressi logida sisse teise Matrix'i serverisse. See võimaldab sul kasutada seda rakendust teises koduserveris hallatava olemasoleva Matrix'i kontoga.",
"Confirm your identity by entering your account password below.": "Tuvasta oma isik sisestades salasõna alljärgnevalt.",
"Please review and accept all of the homeserver's policies": "Palun vaata üle kõik koduserveri kasutustingimused ja nõustu nendega",
"Please review and accept the policies of this homeserver:": "Palun vaata üle selle koduserveri kasutustingimused ja nõustu nendega:",

View file

@ -1188,7 +1188,6 @@
"Success!": "Ongi!",
"A new recovery passphrase and key for Secure Messages have been detected.": "Berreskuratze pasaesaldi eta mezu seguruen gako berriak antzeman dira.",
"If you didn't remove the recovery method, an attacker may be trying to access your account. Change your account password and set a new recovery method immediately in Settings.": "Ez baduzu berreskuratze metodoa kendu, agian erasotzaile bat zure mezuen historialera sarbidea lortu nahi du. Aldatu kontuaren pasahitza eta ezarri berreskuratze metodo berri bat berehala ezarpenetan.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Zerbitzari pertsonalizatuaren aukera erabili dezakezu beste Matrix zerbitzarietan saioa hasteko beste hasiera-zerbitzari batek URLa adieraziz. Honek aplikazio hau beste Matrix zerbitzari batean duzun Matrix kontua erabiltzea baimentzen dizu.",
"Changes your display nickname in the current room only": "Zure pantailako izena aldatzen du gela honetan bakarrik",
"Your Matrix account on %(serverName)s": "Zure %(serverName)s zerbitzariko Matrix kontua",
"Prepends ¯\\_(ツ)_/¯ to a plain-text message": "¯\\_(ツ)_/¯ jartzen du testu soileko mezu baten aurrean",

View file

@ -1159,7 +1159,6 @@
"Access your secure message history and set up secure messaging by entering your recovery key.": "Pääse turvattuun viestihistoriaasi ja ota käyttöön turvallinen viestintä syöttämällä palautusavaimesi.",
"Share Permalink": "Jaa ikilinkki",
"Collapse Reply Thread": "Supista vastaussäie",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Voit käyttää mukautettuja palvelinasetuksia kirjautuaksesi toiselle Matrix-palvelimelle. Tämä sallii tämän sovelluksen käytön toisella kotipalvelimella olevalla Matrix-tilillä.",
"Please review and accept all of the homeserver's policies": "Tarkistathan tämän kotipalvelimen käytännöt",
"Please review and accept the policies of this homeserver:": "Tarkistathan tämän kotipalvelimen käytännöt:",
"Code": "Koodi",

View file

@ -1056,7 +1056,6 @@
"Report bugs & give feedback": "Rapporter des anomalies & Donner son avis",
"Update status": "Mettre à jour le statut",
"Set status": "Définir le statut",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Vous pouvez utiliser les options de serveur personnalisé pour vous connecter à d'autres serveurs Matrix en renseignant un autre URL de serveur d'accueil. Cela vous permet d'utiliser cette application avec un compte Matrix existant sur un autre serveur d'accueil.",
"Your Modular server": "Votre serveur Modular",
"Enter the location of your Modular homeserver. It may use your own domain name or be a subdomain of <a>modular.im</a>.": "Saisissez l'emplacement de votre serveur d'accueil Modular. Il peut utiliser votre nom de domaine personnel ou être un sous-domaine de <a>modular.im</a>.",
"Server Name": "Nom du serveur",

View file

@ -2038,7 +2038,6 @@
"User Status": "Estado da usuaria",
"This homeserver would like to make sure you are not a robot.": "Este servidor quere asegurarse de que non es un robot.",
"Country Dropdown": "Despregable de países",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Podes usar as opcións dun servidor personalizado para conectarte a outros servidores Matrix indicando o URL do servidor. Así poderás usar esta app cunha conta Matrix dun servidor diferente.",
"Confirm your identity by entering your account password below.": "Confirma a túa identidade escribindo o contrasinal da conta embaixo.",
"Missing captcha public key in homeserver configuration. Please report this to your homeserver administrator.": "Falta a chave pública do captcha na configuración do servidor. Informa desto á administración do teu servidor.",
"Please review and accept all of the homeserver's policies": "Revisa e acepta todas as cláusulas do servidor",

View file

@ -1055,7 +1055,6 @@
"Go back": "Vissza",
"Update status": "Állapot frissítése",
"Set status": "Állapot beállítása",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Az egyedi szerver beállítással beléphetsz másik Matrix szerverbe ha megadod annak URL-jét. Ezzel használhatod az alkalmazást megy másik Matrix szerveren meglévő felhasználói fiókkal.",
"Your Modular server": "A te Modular servered",
"Enter the location of your Modular homeserver. It may use your own domain name or be a subdomain of <a>modular.im</a>.": "Add meg a Modular Matrix szerveredet. Ami vagy saját domaint használ vagy a <a>modular.im</a> aldomainját.",
"Server Name": "Szerver neve",

View file

@ -1188,7 +1188,6 @@
"Set status": "Imposta stato",
"Hide": "Nascondi",
"This homeserver would like to make sure you are not a robot.": "Questo homeserver vorrebbe assicurarsi che non sei un robot.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Puoi usare le opzioni server personalizzate per accedere ad altri server Matrix specificando un URL homeserver diverso. Ciò ti permette di usare questa app con un account Matrix esistente su un homeserver differente.",
"Your Modular server": "Il tuo server Modular",
"Enter the location of your Modular homeserver. It may use your own domain name or be a subdomain of <a>modular.im</a>.": "Inserisci l'indirizzo del tuo homeserver Modular. Potrebbe usare il tuo nome di dominio o essere un sottodominio di <a>modular.im</a>.",
"Server Name": "Nome server",

View file

@ -1338,7 +1338,6 @@
"Set a new status...": "새 상태를 설정...",
"Hide": "숨기기",
"This homeserver would like to make sure you are not a robot.": "이 홈서버는 당신이 로봇이 아닌지 확인하고 싶어합니다.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "맞춤 서버 설정을 사용해 다른 홈서버 URL을 지정함으로써 다른 Matrix 서버에 로그인할 수 있습니다. 이를 통해 다른 홈서버의 기존 Matrix 계정으로 이 앱을 사용할 수 있습니다.",
"Please review and accept all of the homeserver's policies": "모든 홈서버의 정책을 검토하고 수락해주세요",
"Please review and accept the policies of this homeserver:": "이 홈서버의 정책을 검토하고 수락해주세요:",
"Unable to validate homeserver/identity server": "홈서버/ID서버를 확인할 수 없음",

View file

@ -1031,7 +1031,6 @@
"Your email address hasn't been verified yet": "Jūsų el. pašto adresas dar nebuvo patvirtintas",
"We've sent you an email to verify your address. Please follow the instructions there and then click the button below.": "Išsiuntėme jums el. laišką, kad patvirtintumėme jūsų adresą. Sekite ten esančiais nurodymais ir tada paspauskite žemiau esantį mygtuką.",
"Email Address": "El. pašto adresas",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Jūs galite naudoti pasirinktinius serverio nustatymus, kad prisijungtumėte prie kitų Matrix serverių, nurodydami kito serverio URL. Tai leidžia jums naudotis šia programa su kitame serveryje esančia Matrix paskyra.",
"Enter your custom homeserver URL <a>What does this mean?</a>": "Įveskite pasirinktinio serverio URL <a>Ką tai reiškia?</a>",
"Homeserver URL": "Serverio URL",
"Homeserver URL does not appear to be a valid Matrix homeserver": "Serverio adresas neatrodo esantis tinkamas Matrix serveris",

View file

@ -1159,7 +1159,6 @@
"Set a new status...": "Stel een nieuwe status in…",
"Hide": "Verbergen",
"This homeserver would like to make sure you are not a robot.": "Deze thuisserver wil graag weten of u geen robot bent.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Middels de aangepaste serveropties kunt u zich aanmelden bij andere Matrix-servers, door een andere thuisserver-URL op te geven. Zo kunt u deze toepassing met een bestaande Matrix-account op een andere thuisserver gebruiken.",
"Please review and accept all of the homeserver's policies": "Gelieve het beleid van de thuisserver door te nemen en te aanvaarden",
"Please review and accept the policies of this homeserver:": "Gelieve het beleid van deze thuisserver door te nemen en te aanvaarden:",
"Your Modular server": "Uw Modular-server",

View file

@ -1277,7 +1277,6 @@
"Set a new status...": "Установка нового статуса...",
"Hide": "Скрыть",
"This homeserver would like to make sure you are not a robot.": "Этот сервер хотел бы убедиться, что вы не робот.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Пользовательские серверные параметры можно использовать для входа на другой сервер Matrix по его адресу. Таким образом, вы сможете использовать это приложение с существующим аккаунтом Matrix на другом домашнем сервере.",
"Please review and accept all of the homeserver's policies": "Пожалуйста, просмотрите и примите все правила сервера",
"Please review and accept the policies of this homeserver:": "Пожалуйста, просмотрите и примите политику этого сервера:",
"Unable to validate homeserver/identity server": "Невозможно проверить сервер/сервер идентификации",

View file

@ -1183,7 +1183,6 @@
"Set status": "Nastaviť stav",
"Hide": "Skryť",
"This homeserver would like to make sure you are not a robot.": "Tento domovský server by sa rád uistil, že nie ste robot.",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Vlastné nastavenia servera môžete použiť na pripojenie k inému domovskému serveru Matrix zadaním URL adresy. Umožní vám to prihlásiť sa cez túto aplikáciu k existujúcemu Matrix účtu na inom domovskom servery.",
"Your Modular server": "Váš server Modular",
"Enter the location of your Modular homeserver. It may use your own domain name or be a subdomain of <a>modular.im</a>.": "Zadajte umiestnenie vášho domovského servera modular. Môže to byť buď vaša doména alebo subdoména <a>modular.im</a>.",
"Server Name": "Názov servera",

View file

@ -1049,7 +1049,6 @@
"Go back": "Kthehu mbrapsht",
"Update status": "Përditëso gendjen",
"Set status": "Caktojini gjendjen",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Mund të përdorni mundësitë mbi shërbyes vetjak, për të bërë hyrjen në shërbyes të tjerë Matrix, duke dhënë URL-në e një tjetër shërbyesi Home. Kjo ju lejon ta përdorni këtë aplikacion në një tjetër shërbyes Home, me një llogari ekzistuese Matrix.",
"Your Modular server": "Shërbyesi juaj Modular",
"Enter the location of your Modular homeserver. It may use your own domain name or be a subdomain of <a>modular.im</a>.": "Jepni vendndodhjen e shërbyesit tuaj Home Modular. Mund të përdorë emrin e përkatësisë tuaj ose të jetë një nënpërkatësi e <a>modular.im</a>.",
"Server Name": "Emër Shërbyesi",

View file

@ -1082,7 +1082,6 @@
"powered by Matrix": "meuglik gemakt deur Matrix",
"This homeserver would like to make sure you are not a robot.": "Deze thuusserver wil geirn weetn of da je gy geen robot zyt.",
"Custom Server Options": "Angepaste serverinstelliengn",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "Je kut de angepaste serveropties gebruukn vo jen an te meldn by andere Matrix-servers, deur een andere thuusserver-URL in te geevn. Dit biedt je de meuglikheid vo deze toepassienge te gebruukn met een bestoande Matrix-account ip een andere thuusserver.",
"Please review and accept all of the homeserver's policies": "Gelieve t beleid van de thuusserver te leezn en anveirdn",
"Please review and accept the policies of this homeserver:": "Gelieve t beleid van deze thuusserver te leezn en tanveirdn:",
"An email has been sent to %(emailAddress)s": "t Is een e-mail noa %(emailAddress)s verstuurd gewist",

View file

@ -1138,7 +1138,6 @@
"Set a new status...": "设置新状态...",
"Hide": "隐藏",
"This homeserver would like to make sure you are not a robot.": "此主服务器想要确认您不是机器人。",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "您可以通过在自定义服务器选项中指定不同的主服务器网址来登入其他 Matrix 服务器。这让您可以通过不同的主服务器上已有的 Matrix 账号来使用此应用程序。",
"Please review and accept all of the homeserver's policies": "请阅读并接受该主服务器的所有政策",
"Please review and accept the policies of this homeserver:": "请阅读并接受此主服务器的政策:",
"Your Modular server": "您的模组服务器",

View file

@ -1054,7 +1054,6 @@
"Go back": "返回",
"Update status": "更新狀態",
"Set status": "設定狀態",
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use this app with an existing Matrix account on a different homeserver.": "您可以透過指定不同的家伺服器 URL 來使用自訂的伺服器選項來登入其他 Matrix 伺服器。這讓您可以與既有的在不同家伺服器上 Matrix 帳號一同使用此應用程式。",
"Your Modular server": "您的模組化伺服器",
"Enter the location of your Modular homeserver. It may use your own domain name or be a subdomain of <a>modular.im</a>.": "輸入您模組化伺服器的位置。它可能會使用您自己的域名或是 <a>modular.im</a> 的子網域。",
"Server Name": "伺服器名稱",

View file

@ -21,6 +21,7 @@ import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
import defaultDispatcher from "../dispatcher/dispatcher";
import { arrayHasDiff } from "../utils/arrays";
import { RoomListStoreTempProxy } from "./room-list/RoomListStoreTempProxy";
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
const MAX_ROOMS = 20; // arbitrary
const AUTOJOIN_WAIT_THRESHOLD_MS = 90000; // 90s, the time we wait for an autojoined room to show up
@ -51,7 +52,11 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
}
public get visible(): boolean {
return this.state.enabled && this.matrixClient.getVisibleRooms().length >= 20;
return this.state.enabled && this.meetsRoomRequirement;
}
private get meetsRoomRequirement(): boolean {
return this.matrixClient.getVisibleRooms().length >= 20;
}
protected async onAction(payload: ActionPayload) {
@ -99,8 +104,9 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
}
private onMyMembership = async (room: Room) => {
// We turn on breadcrumbs by default once the user has at least 1 room to show.
if (!this.state.enabled) {
// Only turn on breadcrumbs is the user hasn't explicitly turned it off again.
const settingValueRaw = SettingsStore.getValue("breadcrumbs", null, /*excludeDefault=*/true);
if (this.meetsRoomRequirement && isNullOrUndefined(settingValueRaw)) {
await SettingsStore.setValue("breadcrumbs", null, SettingLevel.ACCOUNT, true);
}
};

View file

@ -17,7 +17,7 @@ limitations under the License.
import { NotificationColor } from "./NotificationColor";
import { IDestroyable } from "../../utils/IDestroyable";
import { MatrixClientPeg } from "../../MatrixClientPeg";
import { EffectiveMembership, getEffectiveMembership } from "../room-list/membership";
import { EffectiveMembership, getEffectiveMembership } from "../../utils/membership";
import { readReceiptChangeIsFor } from "../../utils/read-receipts";
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { Room } from "matrix-js-sdk/src/models/room";

View file

@ -19,7 +19,6 @@ import { MatrixClient } from "matrix-js-sdk/src/client";
import SettingsStore from "../../settings/SettingsStore";
import { DefaultTagID, OrderedDefaultTagIDs, RoomUpdateCause, TagID } from "./models";
import TagOrderStore from "../TagOrderStore";
import { AsyncStore } from "../AsyncStore";
import { Room } from "matrix-js-sdk/src/models/room";
import { IListOrderingMap, ITagMap, ITagSortingMap, ListAlgorithm, SortAlgorithm } from "./algorithms/models";
import { ActionPayload } from "../../dispatcher/payloads";
@ -29,11 +28,11 @@ import { FILTER_CHANGED, IFilterCondition } from "./filters/IFilterCondition";
import { TagWatcher } from "./TagWatcher";
import RoomViewStore from "../RoomViewStore";
import { Algorithm, LIST_UPDATED_EVENT } from "./algorithms/Algorithm";
import { EffectiveMembership, getEffectiveMembership } from "./membership";
import { ListLayout } from "./ListLayout";
import { EffectiveMembership, getEffectiveMembership } from "../../utils/membership";
import { isNullOrUndefined } from "matrix-js-sdk/src/utils";
import RoomListLayoutStore from "./RoomListLayoutStore";
import { MarkedExecution } from "../../utils/MarkedExecution";
import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
interface IState {
tagsEnabled?: boolean;
@ -45,14 +44,13 @@ interface IState {
*/
export const LISTS_UPDATE_EVENT = "lists_update";
export class RoomListStore2 extends AsyncStore<ActionPayload> {
export class RoomListStore2 extends AsyncStoreWithClient<ActionPayload> {
/**
* Set to true if you're running tests on the store. Should not be touched in
* any other environment.
*/
public static TEST_MODE = false;
private _matrixClient: MatrixClient;
private initialListsGenerated = false;
private enabled = false;
private algorithm = new Algorithm();
@ -80,7 +78,7 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
}
public get matrixClient(): MatrixClient {
return this._matrixClient;
return super.matrixClient;
}
// Intended for test usage
@ -89,23 +87,28 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
this.tagWatcher = new TagWatcher(this);
this.filterConditions = [];
this.initialListsGenerated = false;
this._matrixClient = null;
this.algorithm.off(LIST_UPDATED_EVENT, this.onAlgorithmListUpdated);
this.algorithm.off(FILTER_CHANGED, this.onAlgorithmListUpdated);
this.algorithm = new Algorithm();
this.algorithm.on(LIST_UPDATED_EVENT, this.onAlgorithmListUpdated);
this.algorithm.on(FILTER_CHANGED, this.onAlgorithmListUpdated);
// Reset state without causing updates as the client will have been destroyed
// and downstream code will throw NPE errors.
await this.reset(null, true);
}
// Public for test usage. Do not call this.
public async makeReady(client: MatrixClient) {
public async makeReady(forcedClient?: MatrixClient) {
if (forcedClient) {
super.matrixClient = forcedClient;
}
// TODO: Remove with https://github.com/vector-im/riot-web/issues/14367
this.checkEnabled();
if (!this.enabled) return;
this._matrixClient = client;
// Update any settings here, as some may have happened before we were logically ready.
// Update any settings here, as some may have happened before we were logically ready.
console.log("Regenerating room lists: Startup");
@ -162,7 +165,15 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
if (trigger) this.updateFn.trigger();
}
protected async onDispatch(payload: ActionPayload) {
protected async onReady(): Promise<any> {
await this.makeReady();
}
protected async onNotReady(): Promise<any> {
await this.resetStore();
}
protected async onAction(payload: ActionPayload) {
// When we're running tests we can't reliably use setImmediate out of timing concerns.
// As such, we use a more synchronous model.
if (RoomListStore2.TEST_MODE) {
@ -176,29 +187,10 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
}
protected async onDispatchAsync(payload: ActionPayload) {
if (payload.action === 'MatrixActions.sync') {
// Filter out anything that isn't the first PREPARED sync.
if (!(payload.prevState === 'PREPARED' && payload.state !== 'PREPARED')) {
return;
}
await this.makeReady(payload.matrixClient);
return; // no point in running the next conditions - they won't match
}
// TODO: Remove this once the RoomListStore becomes default
if (!this.enabled) return;
if (payload.action === 'on_client_not_viable' || payload.action === 'on_logged_out') {
// Reset state without causing updates as the client will have been destroyed
// and downstream code will throw NPE errors.
await this.reset(null, true);
this._matrixClient = null;
this.initialListsGenerated = false; // we'll want to regenerate them
}
// Everything below here requires a MatrixClient or some sort of logical readiness.
// Everything here requires a MatrixClient or some sort of logical readiness.
const logicallyReady = this.matrixClient && this.initialListsGenerated;
if (!logicallyReady) return;
@ -425,7 +417,8 @@ export class RoomListStore2 extends AsyncStore<ActionPayload> {
// logic must match calculateListOrder
private calculateTagSorting(tagId: TagID): SortAlgorithm {
const defaultSort = SortAlgorithm.Alphabetic;
const isDefaultRecent = tagId === DefaultTagID.Invite || tagId === DefaultTagID.DM;
const defaultSort = isDefaultRecent ? SortAlgorithm.Recent : SortAlgorithm.Alphabetic;
const settingAlphabetical = SettingsStore.getValue("RoomList.orderAlphabetically", null, true);
const definedSort = this.getTagSorting(tagId);
const storedSort = this.getStoredTagSorting(tagId);

View file

@ -30,12 +30,10 @@ import {
SortAlgorithm
} from "./models";
import { FILTER_CHANGED, FilterPriority, IFilterCondition } from "../filters/IFilterCondition";
import { EffectiveMembership, getEffectiveMembership, splitRoomsByMembership } from "../membership";
import { EffectiveMembership, getEffectiveMembership, splitRoomsByMembership } from "../../../utils/membership";
import { OrderingAlgorithm } from "./list-ordering/OrderingAlgorithm";
import { getListAlgorithmInstance } from "./list-ordering";
// 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.
*/
@ -698,8 +696,8 @@ export class Algorithm extends EventEmitter {
}
}
let didTagChange = false;
if (cause === RoomUpdateCause.PossibleTagChange) {
let didTagChange = false;
const oldTags = this.roomIdsToTags[room.roomId] || [];
const newTags = this.getTagsForRoom(room);
const diff = arrayDiff(oldTags, newTags);
@ -713,6 +711,11 @@ export class Algorithm extends EventEmitter {
if (!algorithm) throw new Error(`No algorithm for ${rmTag}`);
await algorithm.handleRoomUpdate(room, RoomUpdateCause.RoomRemoved);
this.cachedRooms[rmTag] = algorithm.orderedRooms;
// Later on we won't update the filtered rooms or sticky room for removed
// tags, so do so now.
this.recalculateFilteredRoomsForTag(rmTag);
this.recalculateStickyRoom(rmTag);
}
for (const addTag of diff.added) {
if (!window.mx_QuietRoomListLogging) {
@ -812,7 +815,7 @@ export class Algorithm extends EventEmitter {
return false;
}
let changed = false;
let changed = didTagChange;
for (const tag of tags) {
const algorithm: OrderingAlgorithm = this.algorithms[tag];
if (!algorithm) throw new Error(`No algorithm for ${tag}`);

View file

@ -55,7 +55,7 @@ export class NaturalAlgorithm extends OrderingAlgorithm {
}
}
// TODO: Optimize this to avoid useless operations: https://github.com/vector-im/riot-web/issues/14035
// TODO: Optimize this to avoid useless operations: https://github.com/vector-im/riot-web/issues/14457
// For example, we can skip updates to alphabetic (sometimes) and manually ordered tags
this.cachedOrderedRooms = await sortRoomsWithAlgorithm(this.cachedOrderedRooms, this.tagId, this.sortingAlgorithm);

View file

@ -17,8 +17,6 @@ limitations under the License.
import { Room } from "matrix-js-sdk/src/models/room";
import { TagID } from "../../models";
import { IAlgorithm } from "./IAlgorithm";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
import * as Unread from "../../../../Unread";
/**
* Sorts rooms according to the browser's determination of alphabetic.

View file

@ -19,7 +19,7 @@ import { TagID } from "../../models";
import { IAlgorithm } from "./IAlgorithm";
import { MatrixClientPeg } from "../../../../MatrixClientPeg";
import * as Unread from "../../../../Unread";
import { EffectiveMembership, getEffectiveMembership } from "../../membership";
import { EffectiveMembership, getEffectiveMembership } from "../../../../utils/membership";
/**
* Sorts rooms according to the last event's timestamp in each room that seems
@ -33,12 +33,17 @@ 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
// See https://github.com/vector-im/riot-web/issues/14459
// 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.
const myUserId = MatrixClientPeg.get().getUserId();
// TODO: Don't assume we're using the same client as the peg
// See https://github.com/vector-im/riot-web/issues/14458
let myUserId = '';
if (MatrixClientPeg.get()) {
myUserId = MatrixClientPeg.get().getUserId();
}
const tsCache: { [roomId: string]: number } = {};
const getLastTs = (r: Room) => {
@ -68,7 +73,6 @@ export class RecentAlgorithm implements IAlgorithm {
const ev = r.timeline[i];
if (!ev.getTs()) continue; // skip events that don't have timestamps (tests only?)
// TODO: Don't assume we're using the same client as the peg
if (ev.getSender() === myUserId || Unread.eventTriggersUnreadCount(ev)) {
return ev.getTs();
}