1 class DiaryCommentsController < ApplicationController
3 include PaginationMethods
7 before_action :authorize_web
8 before_action :set_locale
9 before_action :check_database_readable
13 before_action :lookup_user, :only => :index
14 before_action :check_database_writable, :only => [:hide, :unhide]
16 allow_thirdparty_images :only => :index
19 @title = t ".title", :user => @user.display_name
21 comments = DiaryComment.where(:user => @user)
22 comments = comments.visible unless can? :unhide, DiaryComment
24 @params = params.permit(:display_name, :before, :after)
26 @comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:user])
30 comment = DiaryComment.find(params[:comment])
31 comment.update(:visible => false)
32 redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry)
36 comment = DiaryComment.find(params[:comment])
37 comment.update(:visible => true)
38 redirect_to diary_entry_path(comment.diary_entry.user, comment.diary_entry)