Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rm/1803 add verji custom search2 #5

Open
wants to merge 203 commits into
base: verji-develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
2f4fac0
Add leave room warning for last admin
Arnei Oct 19, 2022
b3e535a
Merge remote-tracking branch 'upstream/develop' into last-admin-leave…
Arnei Oct 21, 2022
0c0706d
Update src/components/structures/MatrixChat.tsx
Arnei Oct 28, 2022
93550dd
Merge branch 'develop' into last-admin-leave-room-warning
Arnei Oct 28, 2022
626f187
Update warning message for last_admin_warning
Arnei Feb 20, 2023
c71b8fd
Saner releases clean up (#12258)
t3chguy Feb 19, 2024
618462b
Fix Native OIDC for Element Desktop (#12253)
t3chguy Feb 19, 2024
300f30e
Update dependency oidc-client-ts to v3 (#12223)
renovate[bot] Feb 19, 2024
0e22413
Improvements to Playwright test infrastructure (#12260)
t3chguy Feb 19, 2024
3714057
Fix branding in "migrating crypto" message (#12265)
richvdh Feb 20, 2024
ac435c8
Revert "Refine menu, toast, and popover colors (#12247)" (#12263)
florianduros Feb 20, 2024
dd5b741
Remove hardcoded `Element` in tac labs description (#12266)
florianduros Feb 20, 2024
a9add45
Improvements around docker in Playwright (#12261)
t3chguy Feb 20, 2024
d20e9e4
Fix gradients spacings on the space panel (#12262)
dbkr Feb 20, 2024
96a33b8
Revert "Use Compound primary colors for most actions" (#12264)
florianduros Feb 20, 2024
6e73d65
[create-pull-request] automated change (#12268)
RiotRobot Feb 21, 2024
36a8d50
Add Playwright tests for OIDC-aware & OIDC-native (#12252)
t3chguy Feb 21, 2024
6d55ce0
Use browser's font size instead of hardcoded `16px` as root font size…
florianduros Feb 21, 2024
d9a20b0
Ignore activity in TAC (#12269)
florianduros Feb 21, 2024
ebd0a04
Fix the space panel getting bigger when gaining a scroll bar (#12267)
dbkr Feb 21, 2024
7646b89
Upgrade dependency to [email protected]
RiotRobot Feb 21, 2024
15e5130
v3.93.0-rc.0
RiotRobot Feb 21, 2024
2716e95
Update stylelint (#12220)
renovate[bot] Feb 21, 2024
0db6c6d
Update dependency axe-core to v4.8.4 (#12273)
renovate[bot] Feb 21, 2024
e51cd16
Update dependency @sentry/browser to v7.101.1 (#12274)
renovate[bot] Feb 21, 2024
37672f3
Update dependency @types/sanitize-html to v2.11.0 (#12275)
renovate[bot] Feb 21, 2024
5e71c36
Update dependency eslint-plugin-unicorn to v51 (#12276)
renovate[bot] Feb 21, 2024
ce36a67
Update typescript-eslint monorepo to v7 (#12278)
renovate[bot] Feb 21, 2024
bbbb0e3
Update all non-major dependencies (#12214)
renovate[bot] Feb 22, 2024
b9bdd18
Use green dot for activity notification in `LegacyRoomHeader` (#12270)
florianduros Feb 22, 2024
8a70260
ModuleAPI: `overwrite_login` action was not stopping the existing cli…
BillCarsonFr Feb 22, 2024
729eca4
[create-pull-request] automated change (#12282)
RiotRobot Feb 23, 2024
7b1e8e3
Update MSC2965 OIDC Discovery implementation (#12245)
t3chguy Feb 23, 2024
f2101c6
[create-pull-request] automated change (#12284)
RiotRobot Feb 26, 2024
1403cd8
Fix spurious session corruption error (#12280)
dbkr Feb 26, 2024
76da40c
Fix spurious session corruption error (#12280)
dbkr Feb 26, 2024
8f65fbf
Merge pull request #12287 from matrix-org/backport-12280-to-staging
dbkr Feb 26, 2024
179d2a7
Add theme data to EC widget Url (#12279)
toger5 Feb 26, 2024
28f7aac
Hide the archived section (#12286)
dbkr Feb 27, 2024
494d9de
Fix buttons of widget in a room (#12288)
florianduros Feb 27, 2024
bcb6696
Upgrade dependency to [email protected]
RiotRobot Feb 27, 2024
a7f8e82
v3.93.0
RiotRobot Feb 27, 2024
8f5bdf5
Merge branch 'master' into develop
RiotRobot Feb 27, 2024
0b16c93
Resetting package fields for development
RiotRobot Feb 27, 2024
db6f7da
Reset matrix-js-sdk back to develop branch
RiotRobot Feb 27, 2024
5ac222e
Fix alignment of user menu avatar (#12289)
dbkr Feb 27, 2024
222010f
[create-pull-request] automated change (#12293)
RiotRobot Feb 28, 2024
2402cd5
Allow screenshot update docker to run multiple test files (#12291)
dbkr Feb 28, 2024
86469bd
Add custom reporter to auto-report flaky Playwright tests (#12290)
t3chguy Feb 28, 2024
48c7543
PR template: reminder to document your stuff (#12294)
richvdh Feb 28, 2024
5bd0afc
Prevent "Element" hardcoded in i18n files (#12296)
t3chguy Feb 29, 2024
29b79ef
Fix TAC opening with keyboard (#12285)
florianduros Feb 29, 2024
71cece7
Feeds event with relation to unknown to the widget (#12283)
maheichyk Feb 29, 2024
dc5803f
Increase decryption failure grace period (#12298)
BillCarsonFr Feb 29, 2024
5a0537b
[create-pull-request] automated change (#12300)
RiotRobot Mar 1, 2024
65bfc92
fix automatic DM avatar with functional members (#12157)
HarHarLinks Mar 3, 2024
c9bea2d
Added local event search functionality
Mar 3, 2024
acb79af
VerjiLocalSearch test file
Mar 4, 2024
c3e0535
Update dependency sanitize-html to v2.12.1 [SECURITY] (#12302)
renovate[bot] Mar 4, 2024
5c8b14c
Fix requests for senders to submit auto-rageshakes (#12304)
richvdh Mar 4, 2024
6eafe0e
Refine styles of controls to match Compound (#12299)
robintown Mar 5, 2024
90bcce9
Upgrade dependency to [email protected]
RiotRobot Mar 5, 2024
9c8e572
v3.94.0-rc.0
RiotRobot Mar 5, 2024
0d76209
Update babel monorepo to v7.24.0 (#12311)
renovate[bot] Mar 5, 2024
2f6e967
Update dependency @sentry/browser to v7.104.0 (#12313)
renovate[bot] Mar 5, 2024
c334cd7
Update dependency @playwright/test to v1.42.1 (#12312)
renovate[bot] Mar 5, 2024
c7241e9
Update typescript-eslint monorepo to v7.1.0 (#12314)
renovate[bot] Mar 5, 2024
8f0e6aa
Update dependency @types/node to v18.19.21 (#12309)
renovate[bot] Mar 5, 2024
942fabc
Update all non-major dependencies (#12310)
renovate[bot] Mar 5, 2024
8bd74f5
Handle up/down as well as left/right for horizontal toolbars for impr…
t3chguy Mar 6, 2024
91020b3
Remove references to internal js-sdk type `CryptoBackend` (#12321)
richvdh Mar 6, 2024
2617611
Use `strong` element to semantically denote visually emphasised conte…
t3chguy Mar 6, 2024
60f3c2e
Remove unused slider component (#12303)
robintown Mar 7, 2024
ceba35c
Updated module-api reference
thoraj Mar 7, 2024
1b3df3c
Update matrix-org (#11966)
renovate[bot] Mar 7, 2024
ba6bc78
Update all non-major dependencies (#12322)
renovate[bot] Mar 7, 2024
148520c
Update dependency stylelint-scss to v6.2.0 (#12323)
renovate[bot] Mar 7, 2024
af51897
Update dependency @vector-im/compound-web to v3.1.3 (#12281)
renovate[bot] Mar 7, 2024
70365c8
Call guest access link creation to join calls as a non registered use…
toger5 Mar 7, 2024
ddbc643
Fix spotlight opening in TAC (#12315)
florianduros Mar 8, 2024
42ac873
Reset power selector on API failure to prevent state mismatch (#12319)
t3chguy Mar 8, 2024
e807457
Use correct push rule to evaluate room-wide mentions (#12318)
t3chguy Mar 8, 2024
8e68d5d
Improve Forward Dialog a11y by switching to roving tab index interact…
t3chguy Mar 8, 2024
89eb884
[create-pull-request] automated change (#12330)
RiotRobot Mar 11, 2024
431ae32
Reuse media content/info types from the js-sdk (#12308)
t3chguy Mar 11, 2024
753fc2d
TAC: Fix CSS & component typos (#12333)
florianduros Mar 11, 2024
396829e
Element Call: fix widget shown while its still loading (`waitForIfram…
toger5 Mar 12, 2024
181a317
Upgrade dependency to [email protected]
RiotRobot Mar 12, 2024
db532f1
v3.94.0
RiotRobot Mar 12, 2024
e0c7486
Merge branch 'master' into develop
RiotRobot Mar 12, 2024
1b793f7
Resetting package fields for development
RiotRobot Mar 12, 2024
0f251d8
Reset matrix-js-sdk back to develop branch
RiotRobot Mar 12, 2024
80c4c3c
Refine styles of menus, toasts, popovers, and modals (#12332)
robintown Mar 13, 2024
c42562e
Make EC widget theme reactive - Update widget url when the theme chan…
toger5 Mar 13, 2024
e3ba643
Update `@vector-im/compound-design-tokens` in package.json (#12339)
florianduros Mar 14, 2024
990b0fa
Converted VerjiLocalSearch to Typescript & documented it with JSDoc
Mar 14, 2024
bd6ebc9
Change 'type' prop on badges to 'forceDot' (#12327)
dbkr Mar 14, 2024
d139d66
[Backport staging] Update `@vector-im/compound-design-tokens` in pack…
RiotRobot Mar 14, 2024
49be30b
Fix the image view (#12341)
robintown Mar 14, 2024
e309410
TAC: Fix hover state when expanded (#12337)
florianduros Mar 14, 2024
f2bfc59
v3.95.0-rc.0
RiotRobot Mar 14, 2024
f96606a
v3.95.0
RiotRobot Mar 14, 2024
84f5bc7
Merge branch 'master' into develop
RiotRobot Mar 14, 2024
94bd798
Reset matrix-js-sdk back to develop branch
RiotRobot Mar 14, 2024
e247d31
TAC: Order rooms by most recent after notification level (#12329)
florianduros Mar 15, 2024
3c6fd58
Replace forceCount prop with hideIfDot (#12344)
dbkr Mar 15, 2024
54ff8b6
Converted VerjiLocalSearch-test to typescript. +minor fixes
Mar 15, 2024
062efda
Merge branch 'develop' of https://github.com/verji/matrix-react-sdk i…
Mar 15, 2024
75cadb4
Refactor searchAllEventsLocally function
Mar 18, 2024
f765a44
Fix incorrect check for private read receipt support (#12348)
tulir Mar 18, 2024
da99bad
Introduce Membership type
stas-demydiuk Mar 11, 2024
34559d2
Adapt Membership usage for the change to an enum KnownMembership
andybalaam Mar 12, 2024
d3c0435
Adept KnownMembership imports for new location in types
andybalaam Mar 18, 2024
26b4d47
Refine the colors of some more components (#12343)
robintown Mar 18, 2024
5cd7743
Remove use of KnownMembership from playwright tests
andybalaam Mar 18, 2024
7816d46
Update imports and fix error handling in VerjiLocalSearch
Mar 19, 2024
b1be9e7
Fix search functionality in VerjiLocalSearch.ts
Mar 19, 2024
ff971d5
Remove unused import and comment out duplicate import
Mar 19, 2024
a8341c0
Extract types for re-use in matrix-js-sdk.d.ts (#12350)
t3chguy Mar 19, 2024
a5ed97b
Mark as Unread (#12254)
dbkr Mar 19, 2024
ddd0ec4
Change user permission by using a new apply button (#12346)
florianduros Mar 19, 2024
ac08187
Refactor code to improve performance and readability
Mar 19, 2024
be8d30c
Merge branch 'develop' of https://github.com/verji/matrix-react-sdk i…
Mar 19, 2024
f8131e2
Upgrade dependency to [email protected]
RiotRobot Mar 19, 2024
ce8a2f3
v3.96.0-rc.0
RiotRobot Mar 19, 2024
99e32df
Update babel monorepo to v7.24.1 (#12352)
renovate[bot] Mar 19, 2024
e21b000
Update definitelyTyped (#12353)
renovate[bot] Mar 19, 2024
c9caf1b
Update typescript-eslint monorepo to v7.2.0 (#12355)
renovate[bot] Mar 19, 2024
7cbf7cc
Update dependency @sentry/browser to v7.107.0 (#12354)
renovate[bot] Mar 19, 2024
9c78b35
Update all non-major dependencies (#12351)
renovate[bot] Mar 19, 2024
665605b
Update dependency typescript to v5.4.2 (#12324)
renovate[bot] Mar 19, 2024
79c50db
Use data-mx-color for rainbows (#12325)
tulir Mar 19, 2024
4a05de4
Improve code-splitting of highlight.js and maplibre-gs libs (#12349)
t3chguy Mar 20, 2024
2cbf928
Improve types for `sendStateEvent` (#12331)
t3chguy Mar 20, 2024
d7bdbee
Merge branch 'develop' into andybalaam/stas-demydiuk-membership-type3
andybalaam Mar 20, 2024
0f118d7
Fix import statement in VerjiLocalSearch.ts and VerjiLocalSearch-test.ts
Mar 21, 2024
aa19cc9
Fix repeated imports
andybalaam Mar 21, 2024
0fdb300
Merge remote-tracking branch 'origin/develop' into last-admin-leave-r…
dbkr Mar 21, 2024
23bd96c
Copy from PR feedback + use strong tags
dbkr Mar 21, 2024
1a1699d
yarn i18n
dbkr Mar 21, 2024
ea3fff2
Fix some playwright flaky tests (#12357)
t3chguy Mar 21, 2024
a0795c7
Improve readability of badges and pills (#12360)
robintown Mar 22, 2024
79f9a13
[create-pull-request] automated change (#12361)
RiotRobot Mar 22, 2024
d36c1b3
Clean up some references to internal js-sdk classes (#12363)
richvdh Mar 22, 2024
4a182e8
VerificationExplorer: remove reference to internal class (#12362)
richvdh Mar 22, 2024
ac62ce3
Remove the Lazy Loading `InvalidStoreError` Dialogs (#12358)
langleyd Mar 22, 2024
8f22550
Merge pull request #12336 from matrix-org/andybalaam/stas-demydiuk-me…
dbkr Mar 22, 2024
64806d0
Use test helpers from js-sdk for encrypted events (#12364)
richvdh Mar 22, 2024
56d7911
Iterate styles around Link new device via QR (#12356)
t3chguy Mar 22, 2024
03dc48b
Merge pull request #9452 from Arnei/last-admin-leave-room-warning
dbkr Mar 22, 2024
11912a0
[create-pull-request] automated change (#12366)
RiotRobot Mar 25, 2024
4941327
Avoid using deprecated exports & methods from matrix-js-sdk (#12359)
t3chguy Mar 25, 2024
ef2bd7a
Improve types for `sendEvent` (#12335)
t3chguy Mar 25, 2024
157ca48
Remove references to `matrix-js-sdk/src/crypto/verification` (#12365)
richvdh Mar 25, 2024
10526c9
Remove the glass border from modal spinners (#12367)
robintown Mar 25, 2024
cd31447
[Backport staging] Remove the glass border from modal spinners (#12369)
RiotRobot Mar 25, 2024
a24aa7e
Video call meta space (#12297)
toger5 Mar 25, 2024
4702da8
Convert `DecryptionFailureTracker-test` to typescript (#12368)
richvdh Mar 25, 2024
53f837d
Update dependency katex to v0.16.10 [SECURITY] (#12371)
renovate[bot] Mar 25, 2024
7697c27
Update dependency express to v4.19.2 [SECURITY] (#12372)
renovate[bot] Mar 25, 2024
2e76687
Update dependency axe-core to v4.9.0 (#12373)
renovate[bot] Mar 26, 2024
69c23b5
Upgrade dependency to [email protected]
RiotRobot Mar 26, 2024
faf7b04
v3.96.0
RiotRobot Mar 26, 2024
c699c6b
Merge branch 'master' into develop
RiotRobot Mar 26, 2024
abd4caa
Resetting package fields for development
RiotRobot Mar 26, 2024
2119004
Reset matrix-js-sdk back to develop branch
RiotRobot Mar 26, 2024
ddadbf6
Allow popping out a Jitsi widget to respect Desktop `web_base_url` co…
t3chguy Mar 26, 2024
de154ff
Fix space topic jumping on hover/focus (#12377)
t3chguy Mar 26, 2024
ab7f5dc
change order between untagged or conference (#12375)
toger5 Mar 27, 2024
f23c992
add is video room or condition (#12374)
toger5 Mar 27, 2024
75a989e
Revert "Make EC widget theme reactive - Update widget url when the th…
Half-Shot Mar 28, 2024
09f0d11
Fix external guest access url for unencrypted rooms (#12345)
toger5 Mar 28, 2024
2603003
Revert "Make EC widget theme reactive - Update widget url when the th…
Half-Shot Mar 28, 2024
e314d3b
Merge pull request #12383 from matrix-org/backport-12382-to-staging
dbkr Mar 28, 2024
6f5591b
Upgrade dependency to [email protected]
RiotRobot Mar 28, 2024
3d0e7c6
v3.96.1
RiotRobot Mar 28, 2024
b3e96d0
Merge branch 'master' into develop
RiotRobot Mar 28, 2024
f8e210f
Reset matrix-js-sdk back to develop branch
RiotRobot Mar 28, 2024
4ae94ae
Mark all threads as read button (#12378)
dbkr Mar 28, 2024
d9c7bd1
Add `EventType.RoomEncryption` to the auto approve capabilities of El…
toger5 Apr 2, 2024
2abac6f
[create-pull-request] automated change (#12387)
RiotRobot Apr 3, 2024
9587cfa
playwright: Document some of the fixtures (#12388)
richvdh Apr 3, 2024
3de8de5
Remove redundant workaround in playwright test (#12390)
richvdh Apr 3, 2024
332b013
Update bobheadxi/deployments digest to 648679e (#12392)
renovate[bot] Apr 3, 2024
b4e1e0b
Update all non-major dependencies (#12393)
renovate[bot] Apr 3, 2024
784786d
Update babel monorepo to v7.24.3 (#12394)
renovate[bot] Apr 3, 2024
9e7500d
Update dependency @types/node to v18.19.28 (#12395)
renovate[bot] Apr 3, 2024
de9e7e3
Update dependency typescript to v5.4.3 (#12396)
renovate[bot] Apr 3, 2024
5e0068b
Update dependency @sentry/browser to v7.109.0 (#12397)
renovate[bot] Apr 3, 2024
64ac532
Update dependency stylelint to v16.3.1 (#12399)
renovate[bot] Apr 3, 2024
0ad769f
Update typescript-eslint monorepo to v7.4.0 (#12400)
renovate[bot] Apr 3, 2024
307d737
Add analytics for mark all threads unread (#12384)
dbkr Apr 4, 2024
015b938
change logic of when to show the call and share button. (#12385)
toger5 Apr 4, 2024
f37821d
Fix/disable failing playwright tests (#12402)
dbkr Apr 5, 2024
321350b
Merge branch 'develop' of https://github.com/verji/matrix-react-sdk i…
Apr 11, 2024
520238d
ran prettier on VerjiLocalSearch.ts
Apr 12, 2024
9702e0a
Fix promise type in RoomView.tsx
Apr 12, 2024
28a37f7
Ran prettier in in RoomView.tsx
Apr 12, 2024
7e59199
ran prettier on VerjiLocalSearch-test.ts
Apr 12, 2024
c756eb4
Fix import paths in VerjiLocalSearch.ts and VerjiLocalSearch-test.ts
Apr 15, 2024
139a44b
Fix import paths in VerjiLocalSearch.ts and VerjiLocalSearch-test.ts
Apr 15, 2024
a5c662d
Comment out eventSearch function in Searching.ts
Apr 15, 2024
ef7d687
Comment out eventSearch function in Searching.ts
Apr 15, 2024
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
Prev Previous commit
Next Next commit
Make EC widget theme reactive - Update widget url when the theme chan…
…ges (matrix-org#12295)

* update widget url when the theme changes

Signed-off-by: Timo K <[email protected]>

* quick "make it EC specific" workaround proposal.

Signed-off-by: Timo K <[email protected]>

* use `matches`

Signed-off-by: Timo K <[email protected]>

* test coverage

Signed-off-by: Timo K <[email protected]>

* more test coverage

Signed-off-by: Timo K <[email protected]>

* fix jest

Signed-off-by: Timo K <[email protected]>

* add tests for theme changes

Signed-off-by: Timo K <[email protected]>

* update snapshots

Signed-off-by: Timo K <[email protected]>

* test for theme update with non ec widget

Signed-off-by: Timo K <[email protected]>

* add dark custom theme widget url

Signed-off-by: Timo K <[email protected]>

* trigger conditions for theme cleanup

Signed-off-by: Timo K <[email protected]>

* update tests using testId

Signed-off-by: Timo K <[email protected]>

* use typed event emitter for theme watcher

Signed-off-by: Timo K <[email protected]>

* simplify condition

Signed-off-by: Timo K <[email protected]>

---------

Signed-off-by: Timo K <[email protected]>
toger5 authored Mar 13, 2024
commit c42562ef39672c7b665b91956df7a97fc7553f8d
38 changes: 31 additions & 7 deletions src/components/views/elements/AppTile.tsx
Original file line number Diff line number Diff line change
@@ -57,6 +57,7 @@ import { WidgetMessagingStore } from "../../../stores/widgets/WidgetMessagingSto
import { SdkContextClass } from "../../../contexts/SDKContext";
import { ModuleRunner } from "../../../modules/ModuleRunner";
import { parseUrl } from "../../../utils/UrlUtils";
import ThemeWatcher, { ThemeWatcherEvents } from "../../../settings/watchers/ThemeWatcher";

interface IProps {
app: IWidget | IApp;
@@ -115,6 +116,7 @@ interface IState {
menuDisplayed: boolean;
requiresClient: boolean;
hasContextMenuOptions: boolean;
widgetUrl?: string;
}

export default class AppTile extends React.Component<IProps, IState> {
@@ -140,7 +142,7 @@ export default class AppTile extends React.Component<IProps, IState> {
private sgWidget: StopGapWidget | null;
private dispatcherRef?: string;
private unmounted = false;

private themeWatcher = new ThemeWatcher();
public constructor(props: IProps, context: ContextType<typeof MatrixClientContext>) {
super(props);
this.context = context; // XXX: workaround for lack of `declare` support on `public context!:` definition
@@ -267,6 +269,7 @@ export default class AppTile extends React.Component<IProps, IState> {
!newProps.userWidget,
newProps.onDeleteClick,
),
widgetUrl: this.sgWidget?.embedUrl,
};
}

@@ -352,14 +355,18 @@ export default class AppTile extends React.Component<IProps, IState> {
}

private setupSgListeners(): void {
this.themeWatcher.on(ThemeWatcherEvents.ThemeChange, this.onThemeChanged);
this.themeWatcher.start();
this.sgWidget?.on("ready", this.onWidgetReady);
this.sgWidget?.on("error:preparing", this.updateRequiresClient);
// emits when the capabilities have been set up or changed
this.sgWidget?.on("capabilitiesNotified", this.updateRequiresClient);
}

private stopSgListeners(): void {
this.themeWatcher.stop();
if (!this.sgWidget) return;
this.themeWatcher.off(ThemeWatcherEvents.ThemeChange, this.onThemeChanged);
this.sgWidget?.off("ready", this.onWidgetReady);
this.sgWidget.off("error:preparing", this.updateRequiresClient);
this.sgWidget.off("capabilitiesNotified", this.updateRequiresClient);
@@ -382,6 +389,7 @@ export default class AppTile extends React.Component<IProps, IState> {
private startWidget(): void {
this.sgWidget?.prepare().then(() => {
if (this.unmounted) return;
if (!this.state.initialising) return;
this.setState({ initialising: false });
});
}
@@ -456,6 +464,17 @@ export default class AppTile extends React.Component<IProps, IState> {
});
};

private onThemeChanged = (): void => {
// Regenerate widget url when the theme changes
// this updates the url from e.g. `theme=light` to `theme=dark`
// We only do this with EC widgets where the theme prop is in the hash. If the widget puts the
// theme template variable outside the url hash this would cause a (IFrame) page reload on every theme change.
if (WidgetType.CALL.matches(this.props.app.type)) this.setState({ widgetUrl: this.sgWidget?.embedUrl });

// TODO: This is a stop gap solution to responsively update the theme of the widget.
// A new action should be introduced and the widget driver should be called here, so it informs the widget. (or connect to this by itself)
};

private onAction = (payload: ActionPayload): void => {
switch (payload.action) {
case "m.sticker":
@@ -548,9 +567,9 @@ export default class AppTile extends React.Component<IProps, IState> {
this.resetWidget(this.props);
this.startMessaging();

if (this.iframe && this.sgWidget) {
if (this.iframe && this.state.widgetUrl) {
// Reload iframe
this.iframe.src = this.sgWidget.embedUrl;
this.iframe.src = this.state.widgetUrl;
}
});
}
@@ -619,7 +638,7 @@ export default class AppTile extends React.Component<IProps, IState> {
"mx_AppTileBody--mini": this.props.miniMode,
"mx_AppTileBody--loading": this.state.loading,
// We don't want mx_AppTileBody (rounded corners) for call widgets
"mx_AppTileBody--call": this.props.app.type === WidgetType.CALL.preferred,
"mx_AppTileBody--call": WidgetType.CALL.matches(this.props.app.type),
});
const appTileBodyStyles: CSSProperties = {};
if (this.props.pointerEvents) {
@@ -648,7 +667,7 @@ export default class AppTile extends React.Component<IProps, IState> {
<AppPermission
roomId={this.props.room.roomId}
creatorUserId={this.props.creatorUserId}
url={this.sgWidget.embedUrl}
url={this.state.widgetUrl}
isRoomEncrypted={isEncrypted}
onPermissionGranted={this.grantWidgetPermission}
/>
@@ -676,7 +695,7 @@ export default class AppTile extends React.Component<IProps, IState> {
title={widgetTitle}
allow={iframeFeatures}
ref={this.iframeRefChange}
src={this.sgWidget.embedUrl}
src={this.state.widgetUrl}
allowFullScreen={true}
sandbox={sandboxFlags}
/>
@@ -699,7 +718,12 @@ export default class AppTile extends React.Component<IProps, IState> {
const zIndexAboveOtherPersistentElements = 101;

appTileBody = (
<div className="mx_AppTile_persistedWrapper">
<div
className="mx_AppTile_persistedWrapper"
// We store the widget url to make it possible to test the value of the widgetUrl. since the iframe itself wont be here. (PersistedElement are in a different dom tree)
data-test-widget-url={this.state.widgetUrl}
data-testid="widget-app-tile"
>
<PersistedElement
zIndex={this.props.miniMode ? zIndexAboveOtherPersistentElements : 9}
persistKey={this.persistKey}
13 changes: 12 additions & 1 deletion src/settings/watchers/ThemeWatcher.ts
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ limitations under the License.
*/

import { logger } from "matrix-js-sdk/src/logger";
import { TypedEventEmitter } from "matrix-js-sdk/src/matrix";

import SettingsStore from "../SettingsStore";
import dis from "../../dispatcher/dispatcher";
@@ -25,7 +26,15 @@ import { findHighContrastTheme, setTheme } from "../../theme";
import { ActionPayload } from "../../dispatcher/payloads";
import { SettingLevel } from "../SettingLevel";

export default class ThemeWatcher {
export enum ThemeWatcherEvents {
ThemeChange = "theme_change",
}

type EventHandlerMap = {
[ThemeWatcherEvents.ThemeChange]: (theme: string) => void;
};

export default class ThemeWatcher extends TypedEventEmitter<ThemeWatcherEvents, EventHandlerMap> {
private themeWatchRef: string | null;
private systemThemeWatchRef: string | null;
private dispatcherRef: string | null;
@@ -37,6 +46,7 @@ export default class ThemeWatcher {
private currentTheme: string;

public constructor() {
super();
this.themeWatchRef = null;
this.systemThemeWatchRef = null;
this.dispatcherRef = null;
@@ -86,6 +96,7 @@ export default class ThemeWatcher {
this.currentTheme = forceTheme === undefined ? this.getEffectiveTheme() : forceTheme;
if (oldTheme !== this.currentTheme) {
setTheme(this.currentTheme);
this.emit(ThemeWatcherEvents.ThemeChange, this.currentTheme);
}
}

10 changes: 8 additions & 2 deletions src/stores/widgets/StopGapWidget.ts
Original file line number Diff line number Diff line change
@@ -44,7 +44,6 @@ import { MatrixClientPeg } from "../../MatrixClientPeg";
import { OwnProfileStore } from "../OwnProfileStore";
import WidgetUtils from "../../utils/WidgetUtils";
import { IntegrationManagers } from "../../integrations/IntegrationManagers";
import SettingsStore from "../../settings/SettingsStore";
import { WidgetType } from "../../widgets/WidgetType";
import ActiveWidgetStore from "../ActiveWidgetStore";
import { objectShallowClone } from "../../utils/objects";
@@ -162,6 +161,7 @@ export class StopGapWidget extends EventEmitter {
private readonly virtual: boolean;
private readUpToMap: { [roomId: string]: string } = {}; // room ID to event ID
private stickyPromise?: () => Promise<void>; // This promise will be called and needs to resolve before the widget will actually become sticky.
private themeWatcher = new ThemeWatcher();

public constructor(private appTileProps: IAppTileProps) {
super();
@@ -212,13 +212,19 @@ export class StopGapWidget extends EventEmitter {

private runUrlTemplate(opts = { asPopout: false }): string {
const fromCustomisation = WidgetVariableCustomisations?.provideVariables?.() ?? {};
let theme = this.themeWatcher.getEffectiveTheme();
if (theme.startsWith("custom-")) {
// simplify custom theme to only light/dark
const customTheme = getCustomTheme(theme.slice(7));
theme = customTheme.is_dark ? "dark" : "light";
}
const defaults: ITemplateParams = {
widgetRoomId: this.roomId,
currentUserId: this.client.getUserId()!,
userDisplayName: OwnProfileStore.instance.displayName ?? undefined,
userHttpAvatarUrl: OwnProfileStore.instance.getHttpAvatarUrl() ?? undefined,
clientId: ELEMENT_CLIENT_ID,
clientTheme: SettingsStore.getValue("theme"),
clientTheme: theme,
clientLanguage: getUserLanguage(),
deviceId: this.client.getDeviceId() ?? undefined,
baseUrl: this.client.baseUrl,
2 changes: 1 addition & 1 deletion src/theme.ts
Original file line number Diff line number Diff line change
@@ -121,7 +121,7 @@ function clearCustomTheme(): void {
// remove all css variables, we assume these are there because of the custom theme
const inlineStyleProps = Object.values(document.body.style);
for (const prop of inlineStyleProps) {
if (prop.startsWith("--")) {
if (typeof prop === "string" && prop.startsWith("--")) {
document.body.style.removeProperty(prop);
}
}
79 changes: 77 additions & 2 deletions test/components/views/elements/AppTile-test.tsx
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import { jest } from "@jest/globals";
import { Room, MatrixClient } from "matrix-js-sdk/src/matrix";
import { ClientWidgetApi, IWidget, MatrixWidgetType } from "matrix-widget-api";
import { Optional } from "matrix-events-sdk";
import { act, render, RenderResult } from "@testing-library/react";
import { act, render, RenderResult, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { SpiedFunction } from "jest-mock";
import {
@@ -50,6 +50,8 @@ import { ElementWidget } from "../../../../src/stores/widgets/StopGapWidget";
import { WidgetMessagingStore } from "../../../../src/stores/widgets/WidgetMessagingStore";
import { ModuleRunner } from "../../../../src/modules/ModuleRunner";
import { RoomPermalinkCreator } from "../../../../src/utils/permalinks/Permalinks";
import { SettingLevel } from "../../../../src/settings/SettingLevel";
import { WidgetType } from "../../../../src/widgets/WidgetType";

jest.mock("../../../../src/stores/OwnProfileStore", () => ({
OwnProfileStore: {
@@ -68,6 +70,7 @@ describe("AppTile", () => {
const resizeNotifier = new ResizeNotifier();
let app1: IApp;
let app2: IApp;
let appElementCall: IApp;

const waitForRps = (roomId: string) =>
new Promise<void>((resolve) => {
@@ -120,6 +123,17 @@ describe("AppTile", () => {
creatorUserId: cli.getSafeUserId(),
avatar_url: undefined,
};
appElementCall = {
id: "1",
eventId: "2",
roomId: "r2",
type: WidgetType.CALL.preferred,
url: "https://example.com#theme=$org.matrix.msc2873.client_theme",
name: "Element Call",
creatorUserId: cli.getSafeUserId(),
avatar_url: undefined,
};

jest.spyOn(WidgetStore.instance, "getApps").mockImplementation((roomId: string): Array<IApp> => {
if (roomId === "r1") return [app1];
if (roomId === "r2") return [app2];
@@ -439,7 +453,6 @@ describe("AppTile", () => {
expect(moveToContainerSpy).toHaveBeenCalledWith(r1, app1, Container.Top);
});
});

describe("with an existing widgetApi with requiresClient = false", () => {
beforeEach(() => {
const api = {
@@ -466,6 +479,68 @@ describe("AppTile", () => {
});
});

describe("with an element call widget", () => {
beforeEach(() => {
document.body.style.setProperty("--custom-color", "red");
document.body.style.setProperty("normal-color", "blue");
});
it("should update the widget url on theme change", async () => {
const renderResult = render(
<MatrixClientContext.Provider value={cli}>
<a href="http://themeb" data-mx-theme="light">
A
</a>
<a href="http://themeA" data-mx-theme="dark">
B
</a>
<AppTile key={appElementCall.id} app={appElementCall} room={r1} />
</MatrixClientContext.Provider>,
);
await waitFor(() => {
expect(renderResult.getByTestId("widget-app-tile").dataset.testWidgetUrl).toEqual(
"https://example.com/?widgetId=1&parentUrl=http%3A%2F%2Flocalhost%2F#theme=light",
);
});
await SettingsStore.setValue("theme", null, SettingLevel.DEVICE, "dark");
await waitFor(() => {
expect(renderResult.getByTestId("widget-app-tile").dataset.testWidgetUrl).toEqual(
"https://example.com/?widgetId=1&parentUrl=http%3A%2F%2Flocalhost%2F#theme=dark",
);
});
await SettingsStore.setValue("theme", null, SettingLevel.DEVICE, "light");
await waitFor(() => {
expect(renderResult.getByTestId("widget-app-tile").dataset.testWidgetUrl).toEqual(
"https://example.com/?widgetId=1&parentUrl=http%3A%2F%2Flocalhost%2F#theme=light",
);
});
});
it("should not update the widget url for non Element Call widgets on theme change", async () => {
const appNonElementCall = { ...appElementCall, type: MatrixWidgetType.Custom };
const renderResult = render(
<MatrixClientContext.Provider value={cli}>
<a href="http://themeb" data-mx-theme="light">
A
</a>
<a href="http://themeA" data-mx-theme="dark">
B
</a>
<AppTile key={appNonElementCall.id} app={appNonElementCall} room={r1} />
</MatrixClientContext.Provider>,
);
await waitFor(() => {
expect(renderResult.getByTestId("widget-app-tile").dataset.testWidgetUrl).toEqual(
"https://example.com/?widgetId=1&parentUrl=http%3A%2F%2Flocalhost%2F#theme=light",
);
});
await SettingsStore.setValue("theme", null, SettingLevel.DEVICE, "dark");
await waitFor(() => {
expect(renderResult.getByTestId("widget-app-tile").dataset.testWidgetUrl).toEqual(
"https://example.com/?widgetId=1&parentUrl=http%3A%2F%2Flocalhost%2F#theme=light",
);
});
});
});

describe("for a persistent app", () => {
let renderResult: RenderResult;

Original file line number Diff line number Diff line change
@@ -85,6 +85,8 @@ exports[`AppTile for a persistent app should render 1`] = `
>
<div
class="mx_AppTile_persistedWrapper"
data-test-widget-url="https://example.com/?widgetId=1&parentUrl=http%3A%2F%2Flocalhost%2F"
data-testid="widget-app-tile"
>
<div />
</div>
@@ -172,6 +174,8 @@ exports[`AppTile for a pinned widget should render 1`] = `
</div>
<div
class="mx_AppTile_persistedWrapper"
data-test-widget-url="https://example.com/?widgetId=1&parentUrl=http%3A%2F%2Flocalhost%2F"
data-testid="widget-app-tile"
>
<div />
</div>
Loading

Unchanged files with check annotations Beta

await userEvent.keyboard("[ArrowDown]");
await waitFor(() =>
expect(container.querySelectorAll(".mx_ForwardList_entry")[2]).toHaveClass("mx_ForwardList_entry_active"),

Check warning on line 154 in test/components/views/dialogs/ForwardDialog-test.tsx

GitHub Actions / Jest (2)

RETRY 1: ForwardDialog › should be navigable using arrow keys

expect(received).toHaveClass() received value must be an HTMLElement or an SVGElement. Received has value: undefined Ignored nodes: comments, script, style <html> <head /> <body> <div> <div data-focus-guard="true" style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;" tabindex="0" /> <div aria-describedby="mx_ForwardList" aria-labelledby="mx_BaseDialog_title" class="mx_ForwardDialog" data-focus-lock-disabled="false" role="dialog" > <div class="mx_Dialog_header" > <h1 class="mx_Heading_h3 mx_Dialog_title" id="mx_BaseDialog_title" > Forward message </h1> </div> <div aria-label="Close dialog" class="mx_AccessibleButton mx_Dialog_cancelButton" role="button" tabindex="0" /> <h3> Message preview </h3> <div class="mx_ForwardDialog_preview" > <div aria-atomic="true" aria-live="off" class="mx_EventTile" data-event-id="$9999999999999999999999999999999999999999999" data-has-reply="false" data-layout="group" data-scroll-tokens="$9999999999999999999999999999999999999999999" data-self="true" tabindex="-1" > <div class="mx_DisambiguatedProfile" > <span class="mx_Username_color4 mx_DisambiguatedProfile_displayName" dir="auto" > Alice </span> </div> <div class="mx_EventTile_avatar" > <span class="_avatar_mcap2_17 mx_BaseAvatar _avatar-imageless_mcap2_61" data-color="4" data-testid="avatar-img" data-type="round" role="presentation" style="--cpd-avatar-size: 30px;" title="@bob:example.org" > A </span> </div> <div class="mx_EventTile_line" > <a aria-label="00:00" href="https://matrix.to/#/!111111111111111111:example.org/$9999999999999999999999999999999999999999999" /> <div class="mx_MTextBody mx_EventTile_content" > <span class="mx_EventTile_body" dir="auto" > Hello world! </span> </div> <div aria-label="Message Actions" aria-live="off" class="mx_MessageActionBar" role="toolbar" > <div aria-label="Edit" class="mx_AccessibleButton mx_MessageActionBar_iconButton" role="button" tabindex="0" > <div /> </div> <div aria-expanded="false" aria-haspopup="true" aria-label="Options" class="mx_AccessibleButton mx_MessageActionBar_iconButton mx_MessageActionBar_optionsButton" role="button" tabindex="-1" > <div /> </div> </div> </div> </div> </div> <hr /> <div class="mx_ForwardList" id="mx_ForwardList" > <div class="mx_SearchBox mx_textinput" > <input aria-activedescendant="mx_ForwardDialog_entry_a" aria-owns="mx_ForwardDialog_resultsList" autocomplete="off" class="mx_textinput_icon mx_textinput

Check warning on line 154 in test/components/views/dialogs/ForwardDialog-test.tsx

GitHub Actions / Jest (2)

RETRY 1: ForwardDialog › should be navigable using arrow keys

expect(received).toHaveClass() received value must be an HTMLElement or an SVGElement. Received has value: undefined Ignored nodes: comments, script, style <html> <head /> <body> <div> <div data-focus-guard="true" style="width: 1px; height: 0px; padding: 0px; overflow: hidden; position: fixed; top: 1px; left: 1px;" tabindex="0" /> <div aria-describedby="mx_ForwardList" aria-labelledby="mx_BaseDialog_title" class="mx_ForwardDialog" data-focus-lock-disabled="false" role="dialog" > <div class="mx_Dialog_header" > <h1 class="mx_Heading_h3 mx_Dialog_title" id="mx_BaseDialog_title" > Forward message </h1> </div> <div aria-label="Close dialog" class="mx_AccessibleButton mx_Dialog_cancelButton" role="button" tabindex="0" /> <h3> Message preview </h3> <div class="mx_ForwardDialog_preview" > <div aria-atomic="true" aria-live="off" class="mx_EventTile" data-event-id="$9999999999999999999999999999999999999999999" data-has-reply="false" data-layout="group" data-scroll-tokens="$9999999999999999999999999999999999999999999" data-self="true" tabindex="-1" > <div class="mx_DisambiguatedProfile" > <span class="mx_Username_color4 mx_DisambiguatedProfile_displayName" dir="auto" > Alice </span> </div> <div class="mx_EventTile_avatar" > <span class="_avatar_mcap2_17 mx_BaseAvatar _avatar-imageless_mcap2_61" data-color="4" data-testid="avatar-img" data-type="round" role="presentation" style="--cpd-avatar-size: 30px;" title="@bob:example.org" > A </span> </div> <div class="mx_EventTile_line" > <a aria-label="00:00" href="https://matrix.to/#/!111111111111111111:example.org/$9999999999999999999999999999999999999999999" /> <div class="mx_MTextBody mx_EventTile_content" > <span class="mx_EventTile_body" dir="auto" > Hello world! </span> </div> <div aria-label="Message Actions" aria-live="off" class="mx_MessageActionBar" role="toolbar" > <div aria-label="Edit" class="mx_AccessibleButton mx_MessageActionBar_iconButton" role="button" tabindex="0" > <div /> </div> <div aria-expanded="false" aria-haspopup="true" aria-label="Options" class="mx_AccessibleButton mx_MessageActionBar_iconButton mx_MessageActionBar_optionsButton" role="button" tabindex="-1" > <div /> </div> </div> </div> </div> </div> <hr /> <div class="mx_ForwardList" id="mx_ForwardList" > <div class="mx_SearchBox mx_textinput" > <input aria-activedescendant="mx_ForwardDialog_entry_a" aria-owns="mx_ForwardDialog_resultsList" autocomplete="off" class="mx_textinput_icon mx_textinput
);
await userEvent.keyboard("[ArrowUp]");