link actions to related status fix #121

This commit is contained in:
Nicolas Constant 2019-06-23 15:12:43 -04:00
parent 0e214f1204
commit 1327860c07
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 13 additions and 10 deletions

View File

@ -53,8 +53,8 @@ export class PollComponent implements OnInit {
return this._poll;
}
@Input() provider: AccountInfo;
@Input() status: Status;
// @Input() provider: AccountInfo;
@Input() statusWrapper: StatusWrapper;
private accounts$: Observable<AccountInfo[]>;
private accountSub: Subscription;
@ -71,8 +71,8 @@ export class PollComponent implements OnInit {
}
ngOnInit() {
this.pollPerAccountId[this.provider.id] = Promise.resolve(this.poll);
this.selectedAccount = this.provider;
this.pollPerAccountId[this.statusWrapper.provider.id] = Promise.resolve(this.poll);
this.selectedAccount = this.statusWrapper.provider;
this.accountSub = this.accounts$.subscribe((accounts: AccountInfo[]) => {
this.checkStatus(accounts);
@ -84,10 +84,10 @@ export class PollComponent implements OnInit {
var newSelectedAccount = accounts.find(x => x.isSelected);
const accountChanged = this.selectedAccount.id !== newSelectedAccount.id;
if (accountChanged && !this.pollPerAccountId[newSelectedAccount.id] && (this.status.visibility === 'public' || this.status.visibility === 'unlisted')) {
if (accountChanged && !this.pollPerAccountId[newSelectedAccount.id] && (this.statusWrapper.status.visibility === 'public' || this.statusWrapper.status.visibility === 'unlisted')) {
this.setStatsAtZero();
this.pollPerAccountId[newSelectedAccount.id] = this.toolsService.getStatusUsableByAccount(newSelectedAccount, new StatusWrapper(this.status, this.provider))
this.pollPerAccountId[newSelectedAccount.id] = this.toolsService.getStatusUsableByAccount(newSelectedAccount, new StatusWrapper(this.statusWrapper.status, this.statusWrapper.provider))
.then((status: Status) => {
return this.mastodonService.getPoll(newSelectedAccount, status.poll.id);
})
@ -99,7 +99,7 @@ export class PollComponent implements OnInit {
this.notificationService.notifyHttpError(err);
return null;
});
} else if (this.status.visibility !== 'public' && this.status.visibility !== 'unlisted' && this.provider.id !== newSelectedAccount.id) {
} else if (this.statusWrapper.status.visibility !== 'public' && this.statusWrapper.status.visibility !== 'unlisted' && this.statusWrapper.provider.id !== newSelectedAccount.id) {
this.pollLocked = true;
} else {
this.pollPerAccountId[newSelectedAccount.id]

View File

@ -79,7 +79,7 @@
(textSelected)="textSelected()"></app-databinded-text>
<app-poll class="status__poll" *ngIf="!isContentWarned && displayedStatus.poll"
[poll]="displayedStatus.poll" [status]="displayedStatus" [provider]="statusWrapper.provider"></app-poll>
[poll]="displayedStatus.poll" [statusWrapper]="displayedStatusWrapper"></app-poll>
<app-card class="status__card" *ngIf="!isContentWarned && displayedStatus.card && !hasAttachments" [card]="displayedStatus.card"></app-card>
@ -87,9 +87,9 @@
[attachments]="displayedStatus.media_attachments">
</app-attachements>
<app-action-bar #appActionBar [statusWrapper]="statusWrapper" (cwIsActiveEvent)="changeCw($event)"
<app-action-bar #appActionBar [statusWrapper]="displayedStatusWrapper" (cwIsActiveEvent)="changeCw($event)"
(replyEvent)="openReply()"></app-action-bar>
</div>
<app-create-status *ngIf="replyingToStatus" [statusReplyingToWrapper]="statusWrapper" (onClose)="closeReply()">
<app-create-status *ngIf="replyingToStatus" [statusReplyingToWrapper]="displayedStatusWrapper" (onClose)="closeReply()">
</app-create-status>
</div>

View File

@ -21,6 +21,7 @@ export class StatusComponent implements OnInit {
faList = faList;
displayedStatus: Status;
displayedStatusWrapper: StatusWrapper;
// statusAccountName: string;
statusContent: string;
@ -60,6 +61,8 @@ export class StatusComponent implements OnInit {
this.displayedStatus = this.status;
}
this.displayedStatusWrapper = new StatusWrapper(this.displayedStatus, value.provider);
this.checkLabels(this.displayedStatus);
this.checkContentWarning(this.displayedStatus);