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 }}
</a>
</div>
<div class="status__automation-data">
<div class="status__automation-data--label status__automation-data--bot" title="bot"
<div class="status__labels">
<div class="status__labels--label status__labels--bot" title="bot"
*ngIf="status.account.bot">
bot
</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">
x-post
</div>
<div class="status__labels--label status__labels--thread" title="thread"
*ngIf="isThread">
thread
</div>
</div>
<!-- <div #content class="status__content" innerHTML="{{displayedStatus.content}}"></div> -->

View File

@ -47,7 +47,7 @@
border-radius: 2px;
}
}
&__automation-data {
&__labels {
position: absolute;
top: 65px;
left: 10px;
@ -71,6 +71,11 @@
background-color: rgb(189, 113, 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 {
display: inline-block;

View File

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

View File

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