1 class NotesController < ApplicationController
4 before_action :check_api_readable
5 before_action :authorize_web
9 before_action :set_locale
10 around_action :api_call_handle_error, :api_call_timeout
13 # Display a list of notes by a specified user
15 if params[:display_name]
16 if @user = User.active.find_by(:display_name => params[:display_name])
17 @params = params.permit(:display_name)
18 @title = t ".title", :user => @user.display_name
19 @page = (params[:page] || 1).to_i
22 @notes = @notes.visible unless current_user&.moderator?
23 @notes = @notes.order("updated_at DESC, id").distinct.offset((@page - 1) * @page_size).limit(@page_size).preload(:comments => :author)
25 @title = t "users.no_such_user.title"
26 @not_found_user = params[:display_name]
28 render :template => "users/no_such_user", :status => :not_found