mirror of
https://github.com/SchildiChat/schildichat-desktop.git
synced 2025-03-31 21:24:27 +02:00
Update patches: disable sticky rooms, bring back unified room list
This commit is contained in:
parent
f67822feab
commit
eb706739a9
@ -1,14 +1,14 @@
|
|||||||
From 74eb328104004566b2fe99035e67e46e531135e4 Mon Sep 17 00:00:00 2001
|
From 1173e36ec0b5ae32efc3125da704693eba6d6ca9 Mon Sep 17 00:00:00 2001
|
||||||
From: SpiritCroc <dev@spiritcroc.de>
|
From: SpiritCroc <dev@spiritcroc.de>
|
||||||
Date: Sat, 2 Dec 2023 12:57:26 +0100
|
Date: Sat, 2 Dec 2023 12:57:26 +0100
|
||||||
Subject: [PATCH] Add back schildi fetch-package.ts modifications
|
Subject: Add back schildi fetch-package.ts modifications
|
||||||
|
|
||||||
---
|
---
|
||||||
scripts/fetch-package.ts | 14 ++++++++++----
|
scripts/fetch-package.ts | 14 ++++++++++----
|
||||||
1 file changed, 10 insertions(+), 4 deletions(-)
|
1 file changed, 10 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
diff --git a/scripts/fetch-package.ts b/scripts/fetch-package.ts
|
diff --git a/scripts/fetch-package.ts b/scripts/fetch-package.ts
|
||||||
index fc671c8..aa9c7ef 100644
|
index 051e53a..3446eb4 100644
|
||||||
--- a/scripts/fetch-package.ts
|
--- a/scripts/fetch-package.ts
|
||||||
+++ b/scripts/fetch-package.ts
|
+++ b/scripts/fetch-package.ts
|
||||||
@@ -55,6 +55,7 @@ async function main(): Promise<number | undefined> {
|
@@ -55,6 +55,7 @@ async function main(): Promise<number | undefined> {
|
||||||
|
29
patches/matrix-react-sdk/0001-Disable-sticky-rooms.patch
Normal file
29
patches/matrix-react-sdk/0001-Disable-sticky-rooms.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From a5fa3affdee6f104a6529d252f49b5f311bfc100 Mon Sep 17 00:00:00 2001
|
||||||
|
From: SpiritCroc <dev@spiritcroc.de>
|
||||||
|
Date: Tue, 18 Jan 2022 13:28:22 +0100
|
||||||
|
Subject: Disable sticky rooms
|
||||||
|
|
||||||
|
---
|
||||||
|
src/stores/room-list/algorithms/Algorithm.ts | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/stores/room-list/algorithms/Algorithm.ts b/src/stores/room-list/algorithms/Algorithm.ts
|
||||||
|
index 267b9bd742..635f7bbcf1 100644
|
||||||
|
--- a/src/stores/room-list/algorithms/Algorithm.ts
|
||||||
|
+++ b/src/stores/room-list/algorithms/Algorithm.ts
|
||||||
|
@@ -167,8 +167,10 @@ export class Algorithm extends EventEmitter {
|
||||||
|
this.recalculateActiveCallRooms(tagId);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private updateStickyRoom(val: Room | null): void {
|
||||||
|
- this.doUpdateStickyRoom(val);
|
||||||
|
+ private updateStickyRoom(val: Room) {
|
||||||
|
+ // Schildi: we don't want it sticky
|
||||||
|
+ this.doUpdateStickyRoom(null);
|
||||||
|
+ //this.doUpdateStickyRoom(val);
|
||||||
|
this._lastStickyRoom = null; // clear to indicate we're done changing
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.45.0
|
||||||
|
|
263
patches/matrix-react-sdk/0002-Bring-back-unified-room-list.patch
Normal file
263
patches/matrix-react-sdk/0002-Bring-back-unified-room-list.patch
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
From 0cdeef0334e79d41f02141f01f6391f3444ae920 Mon Sep 17 00:00:00 2001
|
||||||
|
From: SpiritCroc <dev@spiritcroc.de>
|
||||||
|
Date: Sun, 5 May 2024 10:12:17 +0200
|
||||||
|
Subject: Bring back unified room list
|
||||||
|
|
||||||
|
Remaining TODO:
|
||||||
|
- Hook up setting to UI again (better with own SC-specific screen?)
|
||||||
|
|
||||||
|
Co-authored-by: su-ex <codeworks@supercable.onl>
|
||||||
|
---
|
||||||
|
src/components/views/rooms/RoomList.tsx | 39 +++++++++++++++++++-
|
||||||
|
src/settings/Settings.tsx | 8 ++++
|
||||||
|
src/stores/room-list/RoomListStore.ts | 19 +++++++++-
|
||||||
|
src/stores/room-list/algorithms/Algorithm.ts | 20 ++++++++--
|
||||||
|
src/stores/room-list/models.ts | 2 +
|
||||||
|
5 files changed, 83 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/components/views/rooms/RoomList.tsx b/src/components/views/rooms/RoomList.tsx
|
||||||
|
index 073950e30f..7488ffd2c6 100644
|
||||||
|
--- a/src/components/views/rooms/RoomList.tsx
|
||||||
|
+++ b/src/components/views/rooms/RoomList.tsx
|
||||||
|
@@ -77,11 +77,13 @@ interface IState {
|
||||||
|
sublists: ITagMap;
|
||||||
|
currentRoomId?: string;
|
||||||
|
suggestedRooms: ISuggestedRoom[];
|
||||||
|
+ unifiedRoomList: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TAG_ORDER: TagID[] = [
|
||||||
|
DefaultTagID.Invite,
|
||||||
|
DefaultTagID.Favourite,
|
||||||
|
+ DefaultTagID.Unified,
|
||||||
|
DefaultTagID.DM,
|
||||||
|
DefaultTagID.Untagged,
|
||||||
|
DefaultTagID.Conference,
|
||||||
|
@@ -94,6 +96,7 @@ export const TAG_ORDER: TagID[] = [
|
||||||
|
// but we'd have to make sure that rooms you weren't in were hidden.
|
||||||
|
];
|
||||||
|
const ALWAYS_VISIBLE_TAGS: TagID[] = [DefaultTagID.DM, DefaultTagID.Untagged];
|
||||||
|
+const ALWAYS_VISIBLE_UNIFIED_TAGS: TagID[] = [DefaultTagID.Unified];
|
||||||
|
|
||||||
|
interface ITagAesthetics {
|
||||||
|
sectionLabel: TranslationKey;
|
||||||
|
@@ -371,6 +374,17 @@ const UntaggedAuxButton: React.FC<IAuxButtonProps> = ({ tabIndex }) => {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
+const UnifiedAuxButton: React.FC<IAuxButtonProps> = (iAuxButtonProps: IAuxButtonProps) => {
|
||||||
|
+ return (
|
||||||
|
+ <>
|
||||||
|
+ {/* eslint-disable-next-line new-cap */}
|
||||||
|
+ {DmAuxButton(iAuxButtonProps)}
|
||||||
|
+ {/* eslint-disable-next-line new-cap */}
|
||||||
|
+ {UntaggedAuxButton(iAuxButtonProps)}
|
||||||
|
+ </>
|
||||||
|
+ );
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
const TAG_AESTHETICS: TagAestheticsMap = {
|
||||||
|
[DefaultTagID.Invite]: {
|
||||||
|
sectionLabel: _td("action|invites_list"),
|
||||||
|
@@ -382,6 +396,12 @@ const TAG_AESTHETICS: TagAestheticsMap = {
|
||||||
|
isInvite: false,
|
||||||
|
defaultHidden: false,
|
||||||
|
},
|
||||||
|
+ [DefaultTagID.Unified]: {
|
||||||
|
+ sectionLabel: _td("Normal priority"),
|
||||||
|
+ isInvite: false,
|
||||||
|
+ defaultHidden: false,
|
||||||
|
+ AuxButtonComponent: UnifiedAuxButton,
|
||||||
|
+ },
|
||||||
|
[DefaultTagID.DM]: {
|
||||||
|
sectionLabel: _td("common|people"),
|
||||||
|
isInvite: false,
|
||||||
|
@@ -426,6 +446,7 @@ const TAG_AESTHETICS: TagAestheticsMap = {
|
||||||
|
|
||||||
|
export default class RoomList extends React.PureComponent<IProps, IState> {
|
||||||
|
private dispatcherRef?: string;
|
||||||
|
+ private readonly unifiedRoomListWatcherRef: string;
|
||||||
|
private treeRef = createRef<HTMLDivElement>();
|
||||||
|
|
||||||
|
public static contextType = MatrixClientContext;
|
||||||
|
@@ -437,7 +458,14 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
||||||
|
this.state = {
|
||||||
|
sublists: {},
|
||||||
|
suggestedRooms: SpaceStore.instance.suggestedRooms,
|
||||||
|
+ unifiedRoomList: SettingsStore.getValue("unifiedRoomList"),
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+ this.unifiedRoomListWatcherRef = SettingsStore.watchSetting(
|
||||||
|
+ "unifiedRoomList",
|
||||||
|
+ null,
|
||||||
|
+ this.onUnifiedRoomListChange,
|
||||||
|
+ );
|
||||||
|
}
|
||||||
|
|
||||||
|
public componentDidMount(): void {
|
||||||
|
@@ -452,9 +480,16 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
||||||
|
SpaceStore.instance.off(UPDATE_SUGGESTED_ROOMS, this.updateSuggestedRooms);
|
||||||
|
RoomListStore.instance.off(LISTS_UPDATE_EVENT, this.updateLists);
|
||||||
|
if (this.dispatcherRef) defaultDispatcher.unregister(this.dispatcherRef);
|
||||||
|
+ SettingsStore.unwatchSetting(this.unifiedRoomListWatcherRef);
|
||||||
|
SdkContextClass.instance.roomViewStore.off(UPDATE_EVENT, this.onRoomViewStoreUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private onUnifiedRoomListChange = (): void => {
|
||||||
|
+ this.setState({
|
||||||
|
+ unifiedRoomList: SettingsStore.getValue("unifiedRoomList"),
|
||||||
|
+ });
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
private onRoomViewStoreUpdate = (): void => {
|
||||||
|
this.setState({
|
||||||
|
currentRoomId: SdkContextClass.instance.roomViewStore.getRoomId() ?? undefined,
|
||||||
|
@@ -595,7 +630,9 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
||||||
|
const aesthetics = TAG_AESTHETICS[orderedTagId];
|
||||||
|
if (!aesthetics) throw new Error(`Tag ${orderedTagId} does not have aesthetics`);
|
||||||
|
|
||||||
|
- let alwaysVisible = ALWAYS_VISIBLE_TAGS.includes(orderedTagId);
|
||||||
|
+ let alwaysVisible = (
|
||||||
|
+ this.state.unifiedRoomList ? ALWAYS_VISIBLE_UNIFIED_TAGS : ALWAYS_VISIBLE_TAGS
|
||||||
|
+ ).includes(orderedTagId);
|
||||||
|
if (
|
||||||
|
(this.props.activeSpace === MetaSpace.Favourites && orderedTagId !== DefaultTagID.Favourite) ||
|
||||||
|
(this.props.activeSpace === MetaSpace.People && orderedTagId !== DefaultTagID.DM) ||
|
||||||
|
diff --git a/src/settings/Settings.tsx b/src/settings/Settings.tsx
|
||||||
|
index 6be0a6b46f..e96e29944a 100644
|
||||||
|
--- a/src/settings/Settings.tsx
|
||||||
|
+++ b/src/settings/Settings.tsx
|
||||||
|
@@ -206,6 +206,14 @@ export interface IFeature extends Omit<IBaseSetting<boolean>, "isFeature"> {
|
||||||
|
export type ISetting = IBaseSetting | IFeature;
|
||||||
|
|
||||||
|
export const SETTINGS: { [setting: string]: ISetting } = {
|
||||||
|
+ // SC settings start
|
||||||
|
+ "unifiedRoomList": {
|
||||||
|
+ supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||||
|
+ displayName: _td("Show people and rooms in a combined list"),
|
||||||
|
+ default: true,
|
||||||
|
+ controller: new ReloadOnChangeController(),
|
||||||
|
+ },
|
||||||
|
+ // SC settings end
|
||||||
|
"feature_video_rooms": {
|
||||||
|
isFeature: true,
|
||||||
|
labsGroup: LabGroup.VoiceAndVideo,
|
||||||
|
diff --git a/src/stores/room-list/RoomListStore.ts b/src/stores/room-list/RoomListStore.ts
|
||||||
|
index 16c4d3be5b..bf2bf2ff8a 100644
|
||||||
|
--- a/src/stores/room-list/RoomListStore.ts
|
||||||
|
+++ b/src/stores/room-list/RoomListStore.ts
|
||||||
|
@@ -508,6 +508,9 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> implements
|
||||||
|
this.setAndPersistListOrder(tag, listOrder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // SC: Unified list for DMs and groups
|
||||||
|
+ this.algorithm.setUnifiedRoomList(SettingsStore.getValue("unifiedRoomList"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private onAlgorithmListUpdated = (forceUpdate: boolean): void => {
|
||||||
|
@@ -621,7 +624,21 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> implements
|
||||||
|
*/
|
||||||
|
public getTagsForRoom(room: Room): TagID[] {
|
||||||
|
const algorithmTags = this.algorithm.getTagsForRoom(room);
|
||||||
|
- if (!algorithmTags) return [DefaultTagID.Untagged];
|
||||||
|
+ if (!algorithmTags) {
|
||||||
|
+ if (SettingsStore.getValue("unifiedRoomList")) {
|
||||||
|
+ return [DefaultTagID.Unified];
|
||||||
|
+ } else {
|
||||||
|
+ return [DefaultTagID.Untagged];
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ const dmTagIndex = algorithmTags.indexOf(DefaultTagID.DM);
|
||||||
|
+ if (dmTagIndex !== -1) {
|
||||||
|
+ algorithmTags[dmTagIndex] = DefaultTagID.Unified;
|
||||||
|
+ }
|
||||||
|
+ const untaggedTagIndex = algorithmTags.indexOf(DefaultTagID.Untagged);
|
||||||
|
+ if (untaggedTagIndex !== -1) {
|
||||||
|
+ algorithmTags[untaggedTagIndex] = DefaultTagID.Unified;
|
||||||
|
+ }
|
||||||
|
return algorithmTags;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/stores/room-list/algorithms/Algorithm.ts b/src/stores/room-list/algorithms/Algorithm.ts
|
||||||
|
index 635f7bbcf1..a837d02d22 100644
|
||||||
|
--- a/src/stores/room-list/algorithms/Algorithm.ts
|
||||||
|
+++ b/src/stores/room-list/algorithms/Algorithm.ts
|
||||||
|
@@ -83,6 +83,7 @@ export class Algorithm extends EventEmitter {
|
||||||
|
* Set to true to suspend emissions of algorithm updates.
|
||||||
|
*/
|
||||||
|
public updatesInhibited = false;
|
||||||
|
+ private unifiedRoomList: boolean = true;
|
||||||
|
|
||||||
|
public start(): void {
|
||||||
|
CallStore.instance.on(CallStoreEvent.ActiveCalls, this.onActiveCalls);
|
||||||
|
@@ -114,6 +115,10 @@ export class Algorithm extends EventEmitter {
|
||||||
|
return this._cachedRooms;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public setUnifiedRoomList(unifiedRoomList: boolean): void {
|
||||||
|
+ this.unifiedRoomList = unifiedRoomList;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Awaitable version of the sticky room setter.
|
||||||
|
* @param val The new room to sticky.
|
||||||
|
@@ -521,7 +526,10 @@ export class Algorithm extends EventEmitter {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inTag) {
|
||||||
|
- if (DMRoomMap.shared().getUserIdForRoomId(room.roomId)) {
|
||||||
|
+ if (this.unifiedRoomList) {
|
||||||
|
+ // SC: Unified room list for DMs and groups
|
||||||
|
+ newTags[DefaultTagID.Unified].push(room);
|
||||||
|
+ } else if (DMRoomMap.shared().getUserIdForRoomId(room.roomId)) {
|
||||||
|
newTags[DefaultTagID.DM].push(room);
|
||||||
|
} else {
|
||||||
|
newTags[DefaultTagID.Untagged].push(room);
|
||||||
|
@@ -565,7 +573,13 @@ export class Algorithm extends EventEmitter {
|
||||||
|
tags.push(...this.getTagsOfJoinedRoom(room));
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!tags.length) tags.push(DefaultTagID.Untagged);
|
||||||
|
+ if (!tags.length) {
|
||||||
|
+ if (this.unifiedRoomList) {
|
||||||
|
+ tags.push(DefaultTagID.Unified);
|
||||||
|
+ } else {
|
||||||
|
+ tags.push(DefaultTagID.Untagged);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
@@ -575,7 +589,7 @@ export class Algorithm extends EventEmitter {
|
||||||
|
|
||||||
|
if (tags.length === 0) {
|
||||||
|
// Check to see if it's a DM if it isn't anything else
|
||||||
|
- if (DMRoomMap.shared().getUserIdForRoomId(room.roomId)) {
|
||||||
|
+ if (DMRoomMap.shared().getUserIdForRoomId(room.roomId) && !this.unifiedRoomList) {
|
||||||
|
tags = [DefaultTagID.DM];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/stores/room-list/models.ts b/src/stores/room-list/models.ts
|
||||||
|
index d8b0488842..335097ccdb 100644
|
||||||
|
--- a/src/stores/room-list/models.ts
|
||||||
|
+++ b/src/stores/room-list/models.ts
|
||||||
|
@@ -21,6 +21,7 @@ export enum DefaultTagID {
|
||||||
|
LowPriority = "m.lowpriority",
|
||||||
|
Favourite = "m.favourite",
|
||||||
|
DM = "im.vector.fake.direct",
|
||||||
|
+ Unified = "chat.schildi.fake.unified",
|
||||||
|
Conference = "im.vector.fake.conferences",
|
||||||
|
ServerNotice = "m.server_notice",
|
||||||
|
Suggested = "im.vector.fake.suggested",
|
||||||
|
@@ -29,6 +30,7 @@ export enum DefaultTagID {
|
||||||
|
export const OrderedDefaultTagIDs = [
|
||||||
|
DefaultTagID.Invite,
|
||||||
|
DefaultTagID.Favourite,
|
||||||
|
+ DefaultTagID.Unified,
|
||||||
|
DefaultTagID.DM,
|
||||||
|
DefaultTagID.Conference,
|
||||||
|
DefaultTagID.Untagged,
|
||||||
|
--
|
||||||
|
2.45.0
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user