mirror of https://github.com/Chocobozzz/PeerTube
Add alert modal in plugins on major upgrade
parent
fe19f600da
commit
40a5242168
|
@ -128,6 +128,16 @@ export class PluginListInstalledComponent implements OnInit {
|
||||||
const updatingKey = this.getUpdatingKey(plugin)
|
const updatingKey = this.getUpdatingKey(plugin)
|
||||||
if (this.updating[updatingKey]) return
|
if (this.updating[updatingKey]) return
|
||||||
|
|
||||||
|
if (this.isMajorUpgrade(plugin)) {
|
||||||
|
const res = await this.confirmService.confirm(
|
||||||
|
$localize`This is a major plugin upgrade. Please go on the plugin homepage to check potential release notes.`,
|
||||||
|
$localize`Upgrade`,
|
||||||
|
$localize`Proceed upgrade`
|
||||||
|
)
|
||||||
|
|
||||||
|
if (res === false) return
|
||||||
|
}
|
||||||
|
|
||||||
this.updating[updatingKey] = true
|
this.updating[updatingKey] = true
|
||||||
|
|
||||||
this.pluginApiService.update(plugin.name, plugin.type)
|
this.pluginApiService.update(plugin.name, plugin.type)
|
||||||
|
@ -156,4 +166,13 @@ export class PluginListInstalledComponent implements OnInit {
|
||||||
private getUpdatingKey (plugin: PeerTubePlugin) {
|
private getUpdatingKey (plugin: PeerTubePlugin) {
|
||||||
return plugin.name + plugin.type
|
return plugin.name + plugin.type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private isMajorUpgrade (plugin: PeerTubePlugin) {
|
||||||
|
if (!plugin.latestVersion) return false
|
||||||
|
|
||||||
|
const latestMajor = plugin.latestVersion.split('.')[0]
|
||||||
|
const currentMajor = plugin.version.split('.')[0]
|
||||||
|
|
||||||
|
return latestMajor > currentMajor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue