Merge pull request #1272 from bookwyrm-social/rss
Updates rss feed view
This commit is contained in:
@ -1,6 +1,9 @@
|
||||
""" serialize user's posts in rss feed """
|
||||
|
||||
from django.contrib.syndication.views import Feed
|
||||
from django.template.loader import get_template
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from .helpers import get_user_from_username, privacy_filter
|
||||
|
||||
# pylint: disable=no-self-use, unused-argument
|
||||
@ -8,7 +11,15 @@ class RssFeed(Feed):
|
||||
"""serialize user's posts in rss feed"""
|
||||
|
||||
description_template = "rss/content.html"
|
||||
title_template = "rss/title.html"
|
||||
|
||||
def item_title(self, item):
|
||||
"""render the item title"""
|
||||
if hasattr(item, "pure_name") and item.pure_name:
|
||||
return item.pure_name
|
||||
title_template = get_template("snippets/status/header_content.html")
|
||||
title = title_template.render({"status": item})
|
||||
template = get_template("rss/title.html")
|
||||
return template.render({"user": item.user, "item_title": title}).strip()
|
||||
|
||||
def get_object(self, request, username): # pylint: disable=arguments-differ
|
||||
"""the user who's posts get serialized"""
|
||||
@ -20,7 +31,7 @@ class RssFeed(Feed):
|
||||
|
||||
def title(self, obj):
|
||||
"""title of the rss feed entry"""
|
||||
return f"Status updates from {obj.display_name}"
|
||||
return _(f"Status updates from {obj.display_name}")
|
||||
|
||||
def items(self, obj):
|
||||
"""the user's activity feed"""
|
||||
|
Reference in New Issue
Block a user