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>
</a>
<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>
</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>
<ng-template contextMenuItem (execute)="changePrivacy()">
<ng-template contextMenuItem (execute)="changePrivacy('Public')">
<fa-icon [icon]="faGlobeAmericas"></fa-icon> Public
</ng-template>
<ng-template contextMenuItem (execute)="changePrivacy()">
<ng-template contextMenuItem (execute)="changePrivacy('Unlisted')">
<fa-icon [icon]="faLockOpen"></fa-icon> Unlisted
</ng-template>
<ng-template contextMenuItem (execute)="changePrivacy()">
<ng-template contextMenuItem (execute)="changePrivacy('Follows-only')">
<fa-icon [icon]="faLock"></fa-icon> Followers-only
</ng-template>
<ng-template contextMenuItem (execute)="changePrivacy()">
<ng-template contextMenuItem (execute)="changePrivacy('DM')">
<fa-icon [icon]="faEnvelope"></fa-icon> Direct
</ng-template>
</context-menu>

View File

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