1
0
mirror of https://github.com/NicolasConstant/sengi synced 2025-02-08 07:58:47 +01:00

added privacy changes context-menu binding

This commit is contained in:
Nicolas Constant 2019-07-25 19:41:12 -04:00
parent a33a01289a
commit 893fb73363
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 14 additions and 6 deletions

View File

@ -34,23 +34,26 @@
<fa-icon [icon]="faPaperclip"></fa-icon> <fa-icon [icon]="faPaperclip"></fa-icon>
</a> </a>
<a href class="status-editor__footer--link" title="adjust status privacy" (click)="onContextMenu($event)"> <a href class="status-editor__footer--link" title="adjust status privacy" (click)="onContextMenu($event)">
<fa-icon [icon]="faGlobeAmericas"></fa-icon> <fa-icon [icon]="faGlobeAmericas" *ngIf="selectedPrivacy === 'Public'"></fa-icon>
<fa-icon [icon]="faLockOpen" *ngIf="selectedPrivacy === 'Unlisted'"></fa-icon>
<fa-icon [icon]="faLock" *ngIf="selectedPrivacy === 'Follows-only'"></fa-icon>
<fa-icon [icon]="faEnvelope" *ngIf="selectedPrivacy === 'DM'"></fa-icon>
</a> </a>
</div> </div>
<div class="status-form__mention-error" *ngIf="mentionTooFarAwayError">Error: mentions must be placed closer to the start in order to use multiposting.</div> <div class="status-form__mention-error" *ngIf="mentionTooFarAwayError">Error: mentions must be placed closer to the start in order to use multiposting.</div>
<context-menu #contextMenu> <context-menu #contextMenu>
<ng-template contextMenuItem (execute)="changePrivacy()"> <ng-template contextMenuItem (execute)="changePrivacy('Public')">
<fa-icon [icon]="faGlobeAmericas"></fa-icon> Public <fa-icon [icon]="faGlobeAmericas"></fa-icon> Public
</ng-template> </ng-template>
<ng-template contextMenuItem (execute)="changePrivacy()"> <ng-template contextMenuItem (execute)="changePrivacy('Unlisted')">
<fa-icon [icon]="faLockOpen"></fa-icon> Unlisted <fa-icon [icon]="faLockOpen"></fa-icon> Unlisted
</ng-template> </ng-template>
<ng-template contextMenuItem (execute)="changePrivacy()"> <ng-template contextMenuItem (execute)="changePrivacy('Follows-only')">
<fa-icon [icon]="faLock"></fa-icon> Followers-only <fa-icon [icon]="faLock"></fa-icon> Followers-only
</ng-template> </ng-template>
<ng-template contextMenuItem (execute)="changePrivacy()"> <ng-template contextMenuItem (execute)="changePrivacy('DM')">
<fa-icon [icon]="faEnvelope"></fa-icon> Direct <fa-icon [icon]="faEnvelope"></fa-icon> Direct
</ng-template> </ng-template>
</context-menu> </context-menu>

View File

@ -134,7 +134,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
private statusReplyingTo: Status; private statusReplyingTo: Status;
selectedPrivacy = 'Public'; selectedPrivacy = 'Public';
privacyList: string[] = ['Public', 'Unlisted', 'Follows-only', 'DM']; // privacyList: string[] = ['Public', 'Unlisted', 'Follows-only', 'DM'];
private accounts$: Observable<AccountInfo[]>; private accounts$: Observable<AccountInfo[]>;
private accountSub: Subscription; private accountSub: Subscription;
@ -185,6 +185,11 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
this.accountSub.unsubscribe(); this.accountSub.unsubscribe();
} }
changePrivacy(value: string): boolean {
this.selectedPrivacy = value;
return false;
}
private detectAutosuggestion(status: string) { private detectAutosuggestion(status: string) {
if (!this.loaded) return; if (!this.loaded) return;