Minimal PeertubeModalService to open settings from "can be redefined..." (#3923)
* Minimal PeertubeModalService to open settings from "can be redefined..." * Linter changes * Removed unused parameter, made Subject type reflect this, and formatting
This commit is contained in:
parent
1bbc0270f6
commit
43a3d281fe
|
@ -10,6 +10,7 @@ import { LanguageChooserComponent } from '@app/menu/language-chooser.component'
|
||||||
import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
|
import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
|
||||||
import { ServerConfig, UserRight, VideoConstant } from '@shared/models'
|
import { ServerConfig, UserRight, VideoConstant } from '@shared/models'
|
||||||
import { NgbDropdown, NgbDropdownConfig } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbDropdown, NgbDropdownConfig } from '@ng-bootstrap/ng-bootstrap'
|
||||||
|
import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service'
|
||||||
|
|
||||||
const logger = debug('peertube:menu:MenuComponent')
|
const logger = debug('peertube:menu:MenuComponent')
|
||||||
|
|
||||||
|
@ -54,6 +55,7 @@ export class MenuComponent implements OnInit {
|
||||||
private hotkeysService: HotkeysService,
|
private hotkeysService: HotkeysService,
|
||||||
private screenService: ScreenService,
|
private screenService: ScreenService,
|
||||||
private menuService: MenuService,
|
private menuService: MenuService,
|
||||||
|
private modalService: PeertubeModalService,
|
||||||
private dropdownConfig: NgbDropdownConfig,
|
private dropdownConfig: NgbDropdownConfig,
|
||||||
private router: Router
|
private router: Router
|
||||||
) {
|
) {
|
||||||
|
@ -130,6 +132,9 @@ export class MenuComponent implements OnInit {
|
||||||
this.authService.userInformationLoaded
|
this.authService.userInformationLoaded
|
||||||
.subscribe(() => this.buildUserLanguages())
|
.subscribe(() => this.buildUserLanguages())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.modalService.openQuickSettingsSubject
|
||||||
|
.subscribe(() => this.openQuickSettings())
|
||||||
}
|
}
|
||||||
|
|
||||||
isRegistrationAllowed () {
|
isRegistrationAllowed () {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th i18n class="label" scope="row">
|
<th i18n class="label" scope="row">
|
||||||
<div>Default NSFW/sensitive videos policy</div>
|
<div>Default NSFW/sensitive videos policy</div>
|
||||||
<div class="more-info">can be redefined by the users</div>
|
<div class="c-hand more-info" (click)="openQuickSettingsHighlight()">can be redefined by the users</div>
|
||||||
</th>
|
</th>
|
||||||
|
|
||||||
<td class="value">{{ buildNSFWLabel() }}</td>
|
<td class="value">{{ buildNSFWLabel() }}</td>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core'
|
import { Component, OnInit } from '@angular/core'
|
||||||
import { ServerService } from '@app/core'
|
import { ServerService } from '@app/core'
|
||||||
import { ServerConfig } from '@shared/models'
|
import { ServerConfig } from '@shared/models'
|
||||||
|
import { PeertubeModalService } from '../shared-main/peertube-modal/peertube-modal.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-instance-features-table',
|
selector: 'my-instance-features-table',
|
||||||
|
@ -11,7 +12,10 @@ export class InstanceFeaturesTableComponent implements OnInit {
|
||||||
quotaHelpIndication = ''
|
quotaHelpIndication = ''
|
||||||
serverConfig: ServerConfig
|
serverConfig: ServerConfig
|
||||||
|
|
||||||
constructor (private serverService: ServerService) { }
|
constructor (
|
||||||
|
private serverService: ServerService,
|
||||||
|
private modalService: PeertubeModalService
|
||||||
|
) { }
|
||||||
|
|
||||||
get initialUserVideoQuota () {
|
get initialUserVideoQuota () {
|
||||||
return this.serverConfig.user.videoQuota
|
return this.serverConfig.user.videoQuota
|
||||||
|
@ -56,6 +60,10 @@ export class InstanceFeaturesTableComponent implements OnInit {
|
||||||
return this.serverService.getServerVersionAndCommit()
|
return this.serverService.getServerVersionAndCommit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openQuickSettingsHighlight () {
|
||||||
|
this.modalService.openQuickSettingsSubject.next()
|
||||||
|
}
|
||||||
|
|
||||||
private getApproximateTime (seconds: number) {
|
private getApproximateTime (seconds: number) {
|
||||||
const hours = Math.floor(seconds / 3600)
|
const hours = Math.floor(seconds / 3600)
|
||||||
let pluralSuffix = ''
|
let pluralSuffix = ''
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export * from './peertube-modal.service'
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Injectable } from '@angular/core'
|
||||||
|
import { Subject } from 'rxjs'
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class PeertubeModalService {
|
||||||
|
openQuickSettingsSubject = new Subject<void>()
|
||||||
|
}
|
Loading…
Reference in New Issue