]> git.openstreetmap.org Git - rails.git/blob - app/controllers/users/diary_comments_controller.rb
Create diary_comments resources for users
[rails.git] / app / controllers / users / diary_comments_controller.rb
1 module Users
2   class DiaryCommentsController < ApplicationController
3     include UserMethods
4     include PaginationMethods
5
6     layout "site"
7
8     before_action :authorize_web
9     before_action :set_locale
10     before_action :check_database_readable
11
12     authorize_resource
13
14     before_action :lookup_user
15
16     allow_thirdparty_images
17
18     def index
19       @title = t ".title", :user => @user.display_name
20
21       comments = DiaryComment.where(:user => @user)
22       comments = comments.visible unless can? :unhide, DiaryComment
23
24       @params = params.permit(:display_name, :before, :after)
25
26       @comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:user])
27
28       render :partial => "page" if turbo_frame_request_id == "pagination"
29     end
30   end
31 end