added thread analysis

This commit is contained in:
Nicolas Constant 2019-02-24 14:49:02 -05:00
parent 979e9c1caf
commit b4ac61662a
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 24 additions and 11 deletions

View File

@ -19,15 +19,19 @@
{{ status.created_at | timeAgo | async }} {{ status.created_at | timeAgo | async }}
</a> </a>
</div> </div>
<div class="status__automation-data"> <div class="status__labels">
<div class="status__automation-data--label status__automation-data--bot" title="bot" <div class="status__labels--label status__labels--bot" title="bot"
*ngIf="status.account.bot"> *ngIf="status.account.bot">
bot bot
</div> </div>
<div class="status__automation-data--label status__automation-data--xpost" title="cross-poster" <div class="status__labels--label status__labels--xpost" title="cross-poster"
*ngIf="isCrossPoster"> *ngIf="isCrossPoster">
x-post x-post
</div> </div>
<div class="status__labels--label status__labels--thread" title="thread"
*ngIf="isThread">
thread
</div>
</div> </div>
<!-- <div #content class="status__content" innerHTML="{{displayedStatus.content}}"></div> --> <!-- <div #content class="status__content" innerHTML="{{displayedStatus.content}}"></div> -->

View File

@ -47,7 +47,7 @@
border-radius: 2px; border-radius: 2px;
} }
} }
&__automation-data { &__labels {
position: absolute; position: absolute;
top: 65px; top: 65px;
left: 10px; left: 10px;
@ -71,6 +71,11 @@
background-color: rgb(189, 113, 0); background-color: rgb(189, 113, 0);
background-color: rgb(156, 94, 0); background-color: rgb(156, 94, 0);
} }
&--thread {
background-color: rgb(0, 187, 84);
background-color: rgb(0, 136, 61);
background-color: rgb(0, 114, 51);
}
} }
&__name { &__name {
display: inline-block; display: inline-block;

View File

@ -15,6 +15,7 @@ export class StatusComponent implements OnInit {
hasAttachments: boolean; hasAttachments: boolean;
replyingToStatus: boolean; replyingToStatus: boolean;
isCrossPoster: boolean; isCrossPoster: boolean;
isThread: boolean;
isContentWarned: boolean; isContentWarned: boolean;
contentWarningText: string; contentWarningText: string;
@ -29,7 +30,7 @@ export class StatusComponent implements OnInit {
this._statusWrapper = value; this._statusWrapper = value;
this.status = value.status; this.status = value.status;
this.checkCrossPosting(this.status); this.checkLabels(this.status);
this.checkContentWarning(this.status); this.checkContentWarning(this.status);
if (this.status.reblog) { if (this.status.reblog) {
@ -57,7 +58,7 @@ export class StatusComponent implements OnInit {
} }
private checkContentWarning(status: Status) { private checkContentWarning(status: Status) {
if(status.sensitive || status.spoiler_text){ if (status.sensitive || status.spoiler_text) {
this.isContentWarned = true; this.isContentWarned = true;
this.contentWarningText = status.spoiler_text; this.contentWarningText = status.spoiler_text;
} }
@ -68,18 +69,21 @@ export class StatusComponent implements OnInit {
return false; return false;
} }
private checkCrossPosting(status: Status) { private checkLabels(status: Status) {
//since API is limited with federated status... //since API is limited with federated status...
if(status.uri.includes('birdsite.link')){ if (status.uri.includes('birdsite.link')) {
this.isCrossPoster = true; this.isCrossPoster = true;
} }
else if (status.application) {
if (status.application) {
const usedApp = status.application.name.toLowerCase(); const usedApp = status.application.name.toLowerCase();
if (usedApp && (usedApp.includes('moa') || usedApp.includes('birdsite') || usedApp.includes('twitter'))) { if (usedApp && (usedApp.includes('moa') || usedApp.includes('birdsite') || usedApp.includes('twitter'))) {
this.isCrossPoster = true; this.isCrossPoster = true;
} }
} }
if (this.status.in_reply_to_account_id && this.status.in_reply_to_account_id === this.status.account.id) {
this.isThread = true;
}
} }
openAccount(account: Account): boolean { openAccount(account: Account): boolean {

View File

@ -127,7 +127,7 @@ export interface Status {
url: string; url: string;
account: Account; account: Account;
in_reply_to_id: string; in_reply_to_id: string;
in_reply_to_account_id: string; in_reply_to_account_id: number;
reblog: Status; reblog: Status;
content: string; content: string;
created_at: string; created_at: string;