Only update m.accepted_terms if there were changes
Fixes https://github.com/vector-im/riot-web/issues/10744
This commit is contained in:
parent
096dff4b54
commit
312143315b
1 changed files with 6 additions and 2 deletions
|
@ -116,6 +116,7 @@ export async function startTermsFlow(
|
|||
}
|
||||
|
||||
// if there's anything left to agree to, prompt the user
|
||||
let numAcceptedBeforeAgreement = agreedUrlSet.size;
|
||||
if (unagreedPoliciesAndServicePairs.length > 0) {
|
||||
const newlyAgreedUrls = await interactionCallback(unagreedPoliciesAndServicePairs, [...agreedUrlSet]);
|
||||
console.log("User has agreed to URLs", newlyAgreedUrls);
|
||||
|
@ -125,8 +126,11 @@ export async function startTermsFlow(
|
|||
console.log("User has already agreed to all required policies");
|
||||
}
|
||||
|
||||
// We only ever add to the set of URLs, so if anything has changed then we'd see a different length
|
||||
if (agreedUrlSet.size !== numAcceptedBeforeAgreement) {
|
||||
const newAcceptedTerms = {accepted: Array.from(agreedUrlSet)};
|
||||
await MatrixClientPeg.get().setAccountData('m.accepted_terms', newAcceptedTerms);
|
||||
}
|
||||
|
||||
const agreePromises = policiesAndServicePairs.map((policiesAndService) => {
|
||||
// filter the agreed URL list for ones that are actually for this service
|
||||
|
|
Loading…
Reference in a new issue