emulating is_local for mastoapi

This commit is contained in:
Henry Jameson 2019-03-09 18:52:23 +02:00
parent 09736691ea
commit 710856ef99
3 changed files with 12 additions and 2 deletions

View File

@ -49,6 +49,16 @@ const Status = {
? this.$store.state.instance.collapseMessageWithSubject ? this.$store.state.instance.collapseMessageWithSubject
: this.$store.state.config.collapseMessageWithSubject : this.$store.state.config.collapseMessageWithSubject
}, },
isLocal () {
if (this.status.is_local !== null) {
return this.status.is_local
} else {
const server = this.$store.state.instance.server
const windowDomain = window.location.origin
return this.status.external_url.startsWith(server) ||
this.status.external_url.startsWith(windowDomain)
}
},
muteWords () { muteWords () {
return this.$store.state.config.muteWords return this.$store.state.config.muteWords
}, },

View File

@ -49,7 +49,7 @@
<div class="button-icon visibility-icon" v-if="status.visibility"> <div class="button-icon visibility-icon" v-if="status.visibility">
<i :class="visibilityIcon(status.visibility)" :title="status.visibility | capitalize"></i> <i :class="visibilityIcon(status.visibility)" :title="status.visibility | capitalize"></i>
</div> </div>
<a :href="status.external_url" target="_blank" v-if="!status.is_local && !isPreview" class="source_url" title="Source"> <a :href="status.external_url" target="_blank" v-if="!isLocal && !isPreview" class="source_url" title="Source">
<i class="button-icon icon-link-ext-alt"></i> <i class="button-icon icon-link-ext-alt"></i>
</a> </a>
<template v-if="expandable && !isPreview"> <template v-if="expandable && !isPreview">

View File

@ -180,7 +180,7 @@ export const parseStatus = (data) => {
output.external_url = data.url output.external_url = data.url
// FIXME missing!! // FIXME missing!!
output.is_local = false output.is_local = null
} else { } else {
output.favorited = data.favorited output.favorited = data.favorited
output.fave_num = data.fave_num output.fave_num = data.fave_num