fix CW not being inherited corretly in responses

This commit is contained in:
Nicolas Constant 2019-03-06 00:02:16 -05:00
parent 933bfa9acd
commit 74bd942407
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 13 additions and 12 deletions

View File

@ -3,9 +3,10 @@
<app-waiting-animation class="waiting-icon status-form__sending--waiting"></app-waiting-animation> <app-waiting-animation class="waiting-icon status-form__sending--waiting"></app-waiting-animation>
</div> </div>
<input [(ngModel)]="title" type="text" class="form-control form-control-sm" name="title" autocomplete="off" placeholder="Title, Content Warning (optional)" /> <input [(ngModel)]="title" type="text" class="form-control form-control-sm" name="title" autocomplete="off" placeholder="Title, Content Warning (optional)" title="title, content warning (optional)"/>
<textarea #reply [(ngModel)]="status" name="status" class="form-control form-control-sm" rows="5" required <textarea #reply [(ngModel)]="status" name="status" class="form-control form-control-sm"
rows="5" required title="content"
placeholder="What's in your mind?" (keydown.control.enter)="onCtrlEnter()"></textarea> placeholder="What's in your mind?" (keydown.control.enter)="onCtrlEnter()"></textarea>
<select class="form-control form-control-sm form-control--privacy" id="privacy" name="privacy" <select class="form-control form-control-sm form-control--privacy" id="privacy" name="privacy"

View File

@ -41,11 +41,13 @@ export class CreateStatusComponent implements OnInit {
} else { } else {
this.statusReplyingTo = this.statusReplyingToWrapper.status; this.statusReplyingTo = this.statusReplyingToWrapper.status;
} }
const uniqueMentions = this.getMentions(this.statusReplyingTo, this.statusReplyingToWrapper.provider); const uniqueMentions = this.getMentions(this.statusReplyingTo, this.statusReplyingToWrapper.provider);
for (const mention of uniqueMentions) { for (const mention of uniqueMentions) {
this.status += `@${mention} `; this.status += `@${mention} `;
} }
this.title = this.statusReplyingTo.spoiler_text;
} }
setTimeout(() => { setTimeout(() => {
@ -53,19 +55,19 @@ export class CreateStatusComponent implements OnInit {
}, 0); }, 0);
} }
private getMentions(status: Status, providerInfo: AccountInfo): string[]{ private getMentions(status: Status, providerInfo: AccountInfo): string[] {
const mentions = [...status.mentions.map(x => x.acct), status.account.acct]; const mentions = [...status.mentions.map(x => x.acct), status.account.acct];
let uniqueMentions = []; let uniqueMentions = [];
for(let mention of mentions){ for (let mention of mentions) {
if(!uniqueMentions.includes(mention)){ if (!uniqueMentions.includes(mention)) {
uniqueMentions.push(mention); uniqueMentions.push(mention);
} }
} }
let globalUniqueMentions = []; let globalUniqueMentions = [];
for(let mention of uniqueMentions){ for (let mention of uniqueMentions) {
if(!mention.includes('@')){ if (!mention.includes('@')) {
mention += `@${providerInfo.instance}`; mention += `@${providerInfo.instance}`;
} }
globalUniqueMentions.push(mention); globalUniqueMentions.push(mention);
@ -75,7 +77,7 @@ export class CreateStatusComponent implements OnInit {
} }
onSubmit(): boolean { onSubmit(): boolean {
if(this.isSending) return false; if (this.isSending) return false;
this.isSending = true; this.isSending = true;
@ -96,9 +98,7 @@ export class CreateStatusComponent implements OnInit {
} }
let spoiler = this.title; let spoiler = this.title;
if (this.statusReplyingToWrapper) {
spoiler = this.statusReplyingTo.spoiler_text;
}
const acc = this.toolsService.getSelectedAccounts()[0]; const acc = this.toolsService.getSelectedAccounts()[0];