Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
matrix-react-sdk
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Matrix.org
matrix-react-sdk
Commits
aeb9f437
Unverified
Commit
aeb9f437
authored
Dec 14, 2022
by
Kerry
Committed by
GitHub
Dec 14, 2022
Browse files
Options
Downloads
Patches
Plain Diff
Device manager - use deleteAccountData to prune device manager client information events (#9734)
parent
85d43fff
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/utils/device/clientInformation.ts
+2
-2
2 additions, 2 deletions
src/utils/device/clientInformation.ts
test/DeviceListener-test.ts
+3
-3
3 additions, 3 deletions
test/DeviceListener-test.ts
with
5 additions
and
5 deletions
src/utils/device/clientInformation.ts
+
2
−
2
View file @
aeb9f437
...
...
@@ -75,9 +75,9 @@ export const removeClientInformation = async (matrixClient: MatrixClient): Promi
const
type
=
getClientInformationEventType
(
deviceId
);
const
clientInformation
=
getDeviceClientInformation
(
matrixClient
,
deviceId
);
// if a non-empty client info event exists,
overwrite to remove the conten
t
// if a non-empty client info event exists,
remove i
t
if
(
clientInformation
.
name
||
clientInformation
.
version
||
clientInformation
.
url
)
{
await
matrixClient
.
s
etAccountData
(
type
,
{}
);
await
matrixClient
.
del
et
e
AccountData
(
type
);
}
};
...
...
This diff is collapsed.
Click to expand it.
test/DeviceListener-test.ts
+
3
−
3
View file @
aeb9f437
...
...
@@ -96,6 +96,7 @@ describe("DeviceListener", () => {
getDeviceId
:
jest
.
fn
().
mockReturnValue
(
deviceId
),
setAccountData
:
jest
.
fn
(),
getAccountData
:
jest
.
fn
(),
deleteAccountData
:
jest
.
fn
(),
checkDeviceTrust
:
jest
.
fn
().
mockReturnValue
(
new
DeviceTrustLevel
(
false
,
false
,
false
,
false
)),
});
jest
.
spyOn
(
MatrixClientPeg
,
"
get
"
).
mockReturnValue
(
mockClient
);
...
...
@@ -188,9 +189,8 @@ describe("DeviceListener", () => {
mockClient
!
.
getAccountData
.
mockReturnValue
(
clientInfoEvent
);
await
createAndStart
();
expect
(
mockClient
!
.
s
etAccountData
).
toHaveBeenCalledWith
(
expect
(
mockClient
!
.
del
et
e
AccountData
).
toHaveBeenCalledWith
(
`io.element.matrix_client_information.
${
deviceId
}
`
,
{},
);
});
...
...
@@ -198,7 +198,7 @@ describe("DeviceListener", () => {
mockClient
!
.
getAccountData
.
mockReturnValue
(
emptyClientInfoEvent
);
await
createAndStart
();
expect
(
mockClient
!
.
s
etAccountData
).
not
.
toHaveBeenCalled
();
expect
(
mockClient
!
.
del
et
e
AccountData
).
not
.
toHaveBeenCalled
();
});
it
(
"
does not save client information on logged in action
"
,
async
()
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment