1 class NotesController < ApplicationController
6 before_action :check_api_readable
7 before_action :authorize_web
8 before_action :require_oauth
12 before_action :lookup_user, :only => [:index]
13 before_action :set_locale
14 around_action :web_timeout
17 # Display a list of notes by a specified user
19 @params = params.permit(:display_name)
20 @title = t ".title", :user => @user.display_name
21 @page = (params[:page] || 1).to_i
24 @notes = @notes.visible unless current_user&.moderator?
25 @notes = @notes.order("updated_at DESC, id").distinct.offset((@page - 1) * @page_size).limit(@page_size).preload(:comments => :author)
27 render :layout => "site"
33 if current_user&.moderator?
34 @note = Note.find(params[:id])
35 @note_comments = @note.comments.unscope(:where => :visible)
37 @note = Note.visible.find(params[:id])
38 @note_comments = @note.comments
40 rescue ActiveRecord::RecordNotFound
41 render :template => "browse/not_found", :status => :not_found