diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-12 10:20:31 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-12 11:19:15 +0200 |
commit | 40a5242168a9f8cad4984c770673883a64e73569 (patch) | |
tree | 09fa9042ac8cceff80df2600f1654ab159ed9cc2 /client | |
parent | fe19f600dab0f6b00a7aa146ba4bd4bb96536155 (diff) | |
download | PeerTube-40a5242168a9f8cad4984c770673883a64e73569.tar.gz PeerTube-40a5242168a9f8cad4984c770673883a64e73569.tar.zst PeerTube-40a5242168a9f8cad4984c770673883a64e73569.zip |
Add alert modal in plugins on major upgrade
Diffstat (limited to 'client')
-rw-r--r-- | client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts index c78b19585..cbdc379a8 100644 --- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts +++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts | |||
@@ -128,6 +128,16 @@ export class PluginListInstalledComponent implements OnInit { | |||
128 | const updatingKey = this.getUpdatingKey(plugin) | 128 | const updatingKey = this.getUpdatingKey(plugin) |
129 | if (this.updating[updatingKey]) return | 129 | if (this.updating[updatingKey]) return |
130 | 130 | ||
131 | if (this.isMajorUpgrade(plugin)) { | ||
132 | const res = await this.confirmService.confirm( | ||
133 | $localize`This is a major plugin upgrade. Please go on the plugin homepage to check potential release notes.`, | ||
134 | $localize`Upgrade`, | ||
135 | $localize`Proceed upgrade` | ||
136 | ) | ||
137 | |||
138 | if (res === false) return | ||
139 | } | ||
140 | |||
131 | this.updating[updatingKey] = true | 141 | this.updating[updatingKey] = true |
132 | 142 | ||
133 | this.pluginApiService.update(plugin.name, plugin.type) | 143 | this.pluginApiService.update(plugin.name, plugin.type) |
@@ -156,4 +166,13 @@ export class PluginListInstalledComponent implements OnInit { | |||
156 | private getUpdatingKey (plugin: PeerTubePlugin) { | 166 | private getUpdatingKey (plugin: PeerTubePlugin) { |
157 | return plugin.name + plugin.type | 167 | return plugin.name + plugin.type |
158 | } | 168 | } |
169 | |||
170 | private isMajorUpgrade (plugin: PeerTubePlugin) { | ||
171 | if (!plugin.latestVersion) return false | ||
172 | |||
173 | const latestMajor = plugin.latestVersion.split('.')[0] | ||
174 | const currentMajor = plugin.version.split('.')[0] | ||
175 | |||
176 | return latestMajor > currentMajor | ||
177 | } | ||
159 | } | 178 | } |