forum: add /forum_topic_visits.{json,xml} endpoint.
For debugging purposes only.
This commit is contained in:
9
app/controllers/forum_topic_visits_controller.rb
Normal file
9
app/controllers/forum_topic_visits_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class ForumTopicVisitsController < ApplicationController
|
||||
respond_to :xml, :json
|
||||
before_action :member_only
|
||||
|
||||
def index
|
||||
@forum_topic_visits = ForumTopicVisit.where(user: CurrentUser.user).paginated_search(params)
|
||||
respond_with(@forum_topic_visits)
|
||||
end
|
||||
end
|
||||
@@ -5,4 +5,10 @@ class ForumTopicVisit < ApplicationRecord
|
||||
def self.prune!(user)
|
||||
where("user_id = ? and last_read_at < ?", user.id, user.last_forum_read_at).delete_all
|
||||
end
|
||||
|
||||
def self.search(params)
|
||||
q = super
|
||||
q = q.search_attributes(params, :user, :forum_topic_id, :last_read_at)
|
||||
q.apply_default_order(params)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user