diff options
author | aschaap <8865084+aschaap@users.noreply.github.com> | 2021-04-06 02:57:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 08:57:30 +0200 |
commit | 43a3d281fe562d5fe24feb53451b58630be3a288 (patch) | |
tree | 6a187e825a403a89b0f976eb20d7c19ed951041f | |
parent | 1bbc0270f6fa08a3f227552d0086617ae1802fd2 (diff) | |
download | PeerTube-43a3d281fe562d5fe24feb53451b58630be3a288.tar.gz PeerTube-43a3d281fe562d5fe24feb53451b58630be3a288.tar.zst PeerTube-43a3d281fe562d5fe24feb53451b58630be3a288.zip |
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
5 files changed, 23 insertions, 2 deletions
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index ed20d9c01..9b6b7cda5 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts | |||
@@ -10,6 +10,7 @@ import { LanguageChooserComponent } from '@app/menu/language-chooser.component' | |||
10 | import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' | 10 | import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' |
11 | import { ServerConfig, UserRight, VideoConstant } from '@shared/models' | 11 | import { ServerConfig, UserRight, VideoConstant } from '@shared/models' |
12 | import { NgbDropdown, NgbDropdownConfig } from '@ng-bootstrap/ng-bootstrap' | 12 | import { NgbDropdown, NgbDropdownConfig } from '@ng-bootstrap/ng-bootstrap' |
13 | import { PeertubeModalService } from '@app/shared/shared-main/peertube-modal/peertube-modal.service' | ||
13 | 14 | ||
14 | const logger = debug('peertube:menu:MenuComponent') | 15 | const logger = debug('peertube:menu:MenuComponent') |
15 | 16 | ||
@@ -54,6 +55,7 @@ export class MenuComponent implements OnInit { | |||
54 | private hotkeysService: HotkeysService, | 55 | private hotkeysService: HotkeysService, |
55 | private screenService: ScreenService, | 56 | private screenService: ScreenService, |
56 | private menuService: MenuService, | 57 | private menuService: MenuService, |
58 | private modalService: PeertubeModalService, | ||
57 | private dropdownConfig: NgbDropdownConfig, | 59 | private dropdownConfig: NgbDropdownConfig, |
58 | private router: Router | 60 | private router: Router |
59 | ) { | 61 | ) { |
@@ -130,6 +132,9 @@ export class MenuComponent implements OnInit { | |||
130 | this.authService.userInformationLoaded | 132 | this.authService.userInformationLoaded |
131 | .subscribe(() => this.buildUserLanguages()) | 133 | .subscribe(() => this.buildUserLanguages()) |
132 | }) | 134 | }) |
135 | |||
136 | this.modalService.openQuickSettingsSubject | ||
137 | .subscribe(() => this.openQuickSettings()) | ||
133 | } | 138 | } |
134 | 139 | ||
135 | isRegistrationAllowed () { | 140 | isRegistrationAllowed () { |
diff --git a/client/src/app/shared/shared-instance/instance-features-table.component.html b/client/src/app/shared/shared-instance/instance-features-table.component.html index ce2557147..d505b6739 100644 --- a/client/src/app/shared/shared-instance/instance-features-table.component.html +++ b/client/src/app/shared/shared-instance/instance-features-table.component.html | |||
@@ -11,7 +11,7 @@ | |||
11 | <tr> | 11 | <tr> |
12 | <th i18n class="label" scope="row"> | 12 | <th i18n class="label" scope="row"> |
13 | <div>Default NSFW/sensitive videos policy</div> | 13 | <div>Default NSFW/sensitive videos policy</div> |
14 | <div class="more-info">can be redefined by the users</div> | 14 | <div class="c-hand more-info" (click)="openQuickSettingsHighlight()">can be redefined by the users</div> |
15 | </th> | 15 | </th> |
16 | 16 | ||
17 | <td class="value">{{ buildNSFWLabel() }}</td> | 17 | <td class="value">{{ buildNSFWLabel() }}</td> |
diff --git a/client/src/app/shared/shared-instance/instance-features-table.component.ts b/client/src/app/shared/shared-instance/instance-features-table.component.ts index 0166157f9..c3b3dfdfd 100644 --- a/client/src/app/shared/shared-instance/instance-features-table.component.ts +++ b/client/src/app/shared/shared-instance/instance-features-table.component.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { ServerService } from '@app/core' | 2 | import { ServerService } from '@app/core' |
3 | import { ServerConfig } from '@shared/models' | 3 | import { ServerConfig } from '@shared/models' |
4 | import { PeertubeModalService } from '../shared-main/peertube-modal/peertube-modal.service' | ||
4 | 5 | ||
5 | @Component({ | 6 | @Component({ |
6 | selector: 'my-instance-features-table', | 7 | selector: 'my-instance-features-table', |
@@ -11,7 +12,10 @@ export class InstanceFeaturesTableComponent implements OnInit { | |||
11 | quotaHelpIndication = '' | 12 | quotaHelpIndication = '' |
12 | serverConfig: ServerConfig | 13 | serverConfig: ServerConfig |
13 | 14 | ||
14 | constructor (private serverService: ServerService) { } | 15 | constructor ( |
16 | private serverService: ServerService, | ||
17 | private modalService: PeertubeModalService | ||
18 | ) { } | ||
15 | 19 | ||
16 | get initialUserVideoQuota () { | 20 | get initialUserVideoQuota () { |
17 | return this.serverConfig.user.videoQuota | 21 | return this.serverConfig.user.videoQuota |
@@ -56,6 +60,10 @@ export class InstanceFeaturesTableComponent implements OnInit { | |||
56 | return this.serverService.getServerVersionAndCommit() | 60 | return this.serverService.getServerVersionAndCommit() |
57 | } | 61 | } |
58 | 62 | ||
63 | openQuickSettingsHighlight () { | ||
64 | this.modalService.openQuickSettingsSubject.next() | ||
65 | } | ||
66 | |||
59 | private getApproximateTime (seconds: number) { | 67 | private getApproximateTime (seconds: number) { |
60 | const hours = Math.floor(seconds / 3600) | 68 | const hours = Math.floor(seconds / 3600) |
61 | let pluralSuffix = '' | 69 | let pluralSuffix = '' |
diff --git a/client/src/app/shared/shared-main/peertube-modal/index.ts b/client/src/app/shared/shared-main/peertube-modal/index.ts new file mode 100644 index 000000000..d631522e4 --- /dev/null +++ b/client/src/app/shared/shared-main/peertube-modal/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './peertube-modal.service' | |||
diff --git a/client/src/app/shared/shared-main/peertube-modal/peertube-modal.service.ts b/client/src/app/shared/shared-main/peertube-modal/peertube-modal.service.ts new file mode 100644 index 000000000..79da08a5c --- /dev/null +++ b/client/src/app/shared/shared-main/peertube-modal/peertube-modal.service.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { Subject } from 'rxjs' | ||
3 | |||
4 | @Injectable({ providedIn: 'root' }) | ||
5 | export class PeertubeModalService { | ||
6 | openQuickSettingsSubject = new Subject<void>() | ||
7 | } | ||