Don't show the prompt to enable desktop notifications immediately after registration (#8274)
* Fix MatrixClientPeg.userRegisteredWithinLastHours so that it works * Try fixing end-to-end test + add case for New search beta * Remove end-to-end test case for Search beta toast as it only shows up after 5 minutes * Revert to localStorage based solution + non-inverted logic + test including time advancement
This commit is contained in:
parent
d151365fd7
commit
26b771bbf9
4 changed files with 74 additions and 14 deletions
|
@ -875,8 +875,9 @@ async function clearStorage(opts?: { deleteEverything?: boolean }): Promise<void
|
|||
Analytics.disable();
|
||||
|
||||
if (window.localStorage) {
|
||||
// try to save any 3pid invites from being obliterated
|
||||
// try to save any 3pid invites from being obliterated and registration time
|
||||
const pendingInvites = ThreepidInviteStore.instance.getWireInvites();
|
||||
const registrationTime = window.localStorage.getItem("mx_registration_time");
|
||||
|
||||
window.localStorage.clear();
|
||||
|
||||
|
@ -886,13 +887,17 @@ async function clearStorage(opts?: { deleteEverything?: boolean }): Promise<void
|
|||
logger.error("idbDelete failed for account:mx_access_token", e);
|
||||
}
|
||||
|
||||
// now restore those invites
|
||||
// now restore those invites and registration time
|
||||
if (!opts?.deleteEverything) {
|
||||
pendingInvites.forEach(i => {
|
||||
const roomId = i.roomId;
|
||||
delete i.roomId; // delete to avoid confusing the store
|
||||
ThreepidInviteStore.instance.storeInvite(roomId, i);
|
||||
});
|
||||
|
||||
if (registrationTime) {
|
||||
window.localStorage.setItem("mx_registration_time", registrationTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue