kopia lustrzana https://dev.funkwhale.audio/funkwhale/funkwhale
See #170: display info that RSS feed is mirrored
rodzic
ec99d52919
commit
ae31b1e720
|
@ -239,6 +239,7 @@ class ChannelSerializer(serializers.ModelSerializer):
|
|||
actor = serializers.SerializerMethodField()
|
||||
attributed_to = federation_serializers.APIActorSerializer()
|
||||
rss_url = serializers.CharField(source="get_rss_url")
|
||||
url = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = models.Channel
|
||||
|
@ -250,6 +251,7 @@ class ChannelSerializer(serializers.ModelSerializer):
|
|||
"creation_date",
|
||||
"metadata",
|
||||
"rss_url",
|
||||
"url",
|
||||
]
|
||||
|
||||
def get_artist(self, obj):
|
||||
|
@ -269,6 +271,9 @@ class ChannelSerializer(serializers.ModelSerializer):
|
|||
return None
|
||||
return federation_serializers.APIActorSerializer(obj.actor).data
|
||||
|
||||
def get_url(self, obj):
|
||||
return obj.actor.url
|
||||
|
||||
|
||||
class SubscriptionSerializer(serializers.Serializer):
|
||||
approved = serializers.BooleanField(read_only=True)
|
||||
|
|
|
@ -227,6 +227,7 @@ def test_channel_serializer_representation(factories, to_api_date):
|
|||
).data,
|
||||
"metadata": {},
|
||||
"rss_url": channel.get_rss_url(),
|
||||
"url": channel.actor.url,
|
||||
}
|
||||
expected["artist"]["description"] = common_serializers.ContentSerializer(
|
||||
content
|
||||
|
@ -249,6 +250,7 @@ def test_channel_serializer_external_representation(factories, to_api_date):
|
|||
).data,
|
||||
"metadata": {},
|
||||
"rss_url": channel.get_rss_url(),
|
||||
"url": channel.actor.url,
|
||||
}
|
||||
expected["artist"]["description"] = common_serializers.ContentSerializer(
|
||||
content
|
||||
|
|
|
@ -128,6 +128,12 @@
|
|||
<div class="sub header ellipsis" v-if="object.actor ":title="object.actor.full_username">
|
||||
{{ object.actor.full_username }}
|
||||
</div>
|
||||
<div v-else class="sub header ellipsis">
|
||||
<a :href="object.url || object.rss_url" rel="noopener noreferrer" target="_blank">
|
||||
<i class="external link icon"></i>
|
||||
<translate :translate-params="{domain: externalDomain}" translate-context="Content/Channel/Paragraph">Mirrored from %{ domain }</translate>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</h1>
|
||||
<div class="header-buttons">
|
||||
|
@ -298,6 +304,12 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
externalDomain () {
|
||||
let parser = document.createElement('a')
|
||||
parser.href = this.object.url || this.object.rss_url
|
||||
return parser.hostname
|
||||
},
|
||||
|
||||
isOwner () {
|
||||
return this.$store.state.auth.authenticated && this.object.attributed_to.full_username === this.$store.state.auth.fullUsername
|
||||
},
|
||||
|
|
Ładowanie…
Reference in New Issue