mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
FEATURE: RSS feed for user posts and topics
This commit is contained in:
@ -35,6 +35,8 @@ class ListController < ApplicationController
|
||||
Discourse.anonymous_filters.map { |f| :"parent_category_category_none_#{f}" },
|
||||
# category feeds
|
||||
:category_feed,
|
||||
# user topics feed
|
||||
:user_topics_feed,
|
||||
# top summaries
|
||||
:top,
|
||||
:category_top,
|
||||
@ -154,6 +156,19 @@ class ListController < ApplicationController
|
||||
render 'list', formats: [:rss]
|
||||
end
|
||||
|
||||
def user_topics_feed
|
||||
discourse_expires_in 1.minute
|
||||
target_user = fetch_user_from_params
|
||||
|
||||
@title = "#{SiteSetting.title} - #{I18n.t("rss_description.user_topics", username: target_user.username)}"
|
||||
@link = "#{Discourse.base_url}/users/#{target_user.username}/activity/topics"
|
||||
@atom_link = "#{Discourse.base_url}/users/#{target_user.username}/activity/topics.rss"
|
||||
@description = I18n.t("rss_description.user_topics", username: target_user.username)
|
||||
@topic_list = TopicQuery.new(nil, order: 'created').send("list_topics_by", target_user)
|
||||
|
||||
render 'list', formats: [:rss]
|
||||
end
|
||||
|
||||
def top(options=nil)
|
||||
options ||= {}
|
||||
period = ListController.best_period_for(current_user.try(:previous_visit_at), options[:category])
|
||||
|
Reference in New Issue
Block a user