mirror of https://github.com/Chocobozzz/PeerTube
remove confirm modal for asset injection in edit-custom-config (#1219)
parent
302e7b19da
commit
211239ed94
|
@ -1,6 +1,5 @@
|
||||||
import { Component, OnInit } from '@angular/core'
|
import { Component, OnInit } from '@angular/core'
|
||||||
import { ConfigService } from '@app/+admin/config/shared/config.service'
|
import { ConfigService } from '@app/+admin/config/shared/config.service'
|
||||||
import { ConfirmService } from '@app/core'
|
|
||||||
import { ServerService } from '@app/core/server/server.service'
|
import { ServerService } from '@app/core/server/server.service'
|
||||||
import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared'
|
import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared'
|
||||||
import { NotificationsService } from 'angular2-notifications'
|
import { NotificationsService } from 'angular2-notifications'
|
||||||
|
@ -29,7 +28,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
private configService: ConfigService,
|
private configService: ConfigService,
|
||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private confirmService: ConfirmService,
|
|
||||||
private i18n: I18n
|
private i18n: I18n
|
||||||
) {
|
) {
|
||||||
super()
|
super()
|
||||||
|
@ -124,28 +122,6 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
async formValidated () {
|
async formValidated () {
|
||||||
const newCustomizationJavascript = this.form.value['customizationJavascript']
|
|
||||||
const newCustomizationCSS = this.form.value['customizationCSS']
|
|
||||||
|
|
||||||
const customizations = []
|
|
||||||
if (newCustomizationJavascript && newCustomizationJavascript !== this.oldCustomJavascript) customizations.push('JavaScript')
|
|
||||||
if (newCustomizationCSS && newCustomizationCSS !== this.oldCustomCSS) customizations.push('CSS')
|
|
||||||
|
|
||||||
if (customizations.length !== 0) {
|
|
||||||
const customizationsText = customizations.join('/')
|
|
||||||
|
|
||||||
// FIXME: i18n service does not support string concatenation
|
|
||||||
const message = this.i18n('You set custom {{customizationsText}}. ', { customizationsText }) +
|
|
||||||
this.i18n('This could lead to security issues or bugs if you do not understand it. ') +
|
|
||||||
this.i18n('Are you sure you want to update the configuration?')
|
|
||||||
|
|
||||||
const label = this.i18n('Please type') + ` "I understand the ${customizationsText} I set" ` + this.i18n('to confirm.')
|
|
||||||
const expectedInputValue = `I understand the ${customizationsText} I set`
|
|
||||||
|
|
||||||
const confirmRes = await this.confirmService.confirmWithInput(message, label, expectedInputValue)
|
|
||||||
if (confirmRes === false) return
|
|
||||||
}
|
|
||||||
|
|
||||||
const data: CustomConfig = {
|
const data: CustomConfig = {
|
||||||
instance: {
|
instance: {
|
||||||
name: this.form.value['instanceName'],
|
name: this.form.value['instanceName'],
|
||||||
|
|
Loading…
Reference in New Issue