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

Disable push notifications when logging out of instance #2311

Open
nolanlawson opened this issue Dec 10, 2022 · 0 comments
Open

Disable push notifications when logging out of instance #2311

nolanlawson opened this issue Dec 10, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@nolanlawson
Copy link
Owner

As far as I can tell, we don't unsubscribe from push notifications when you log out of an instance:

export async function logOutOfInstance (instanceName, message) {
message = message || formatIntl('intl.loggedOutOfInstance', { instance: instanceName })
const {
composeData,
currentInstance,
customEmoji,
instanceInfos,
instanceLists,
instanceThemes,
loggedInInstances,
loggedInInstancesInOrder,
verifyCredentials
} = store.get()
loggedInInstancesInOrder.splice(loggedInInstancesInOrder.indexOf(instanceName), 1)
const newInstance = instanceName === currentInstance ? loggedInInstancesInOrder[0] : currentInstance
const objectsToClear = [
composeData,
customEmoji,
instanceInfos,
instanceLists,
instanceThemes,
loggedInInstances,
verifyCredentials
]
for (const obj of objectsToClear) {
delete obj[instanceName]
}
store.set({
composeData,
currentInstance: newInstance,
customEmoji,
instanceInfos,
instanceLists,
instanceThemes,
loggedInInstances,
loggedInInstancesInOrder,
queryInSearch: '',
searchResults: null,
timelineInitialized: false,
timelinePreinitialized: false,
verifyCredentials
})
store.clearTimelineDataForInstance(instanceName)
store.clearAutosuggestDataForInstance(instanceName)
store.save()
const { virtualListStore } = await importVirtualListStore()
virtualListStore.clearRealmByPrefix(currentInstance + '/') // TODO: this is a hacky way to clear the vlist cache
toast.say(message)
const { enableGrayscale } = store.get()
switchToTheme(instanceThemes[newInstance], enableGrayscale)
/* no await */ database.clearDatabaseForInstance(instanceName)
goto('/settings/instances')
}

I'm surprised we haven't gotten a bug about this, though, so I could be wrong. Maybe it "just works" somehow already.

@nolanlawson nolanlawson added the bug Something isn't working label Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant