-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(updatenotification): Migrate legacy code
1. Remove hook usage and just provide an initial state 2. Replace jQuery code with modern non-deprecated frontend code Signed-off-by: Ferdinand Thiessen <[email protected]>
- Loading branch information
Showing
7 changed files
with
86 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import { showInfo } from '@nextcloud/dialogs' | ||
import { loadState } from '@nextcloud/initial-state' | ||
import { t } from '@nextcloud/l10n' | ||
|
||
interface IUpdateNotificationState { | ||
updateLink: string | ||
updateVersion: string | ||
} | ||
|
||
/** | ||
* This only gets loaded if an update is available and the notifications app is not enabled for the user. | ||
*/ | ||
window.addEventListener('DOMContentLoaded', function() { | ||
const { updateLink, updateVersion } = loadState<IUpdateNotificationState>('updatenotification', 'updateState') | ||
const text = t('core', '{version} is available. Get more information on how to update.', { version: updateVersion }) | ||
|
||
// On click open the update link in a new tab | ||
showInfo(text, { onClick: () => window.open(updateLink, '_blank') }) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters