Verified Commit ae31b1e7 authored by Agate's avatar Agate 💬

See #170: display info that RSS feed is mirrored

parent ec99d529
Pipeline #9929 failed with stages
in 4 minutes and 42 seconds
......@@ -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
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment