Merge remote-tracking branch 'upstream/pull/5518'

This commit is contained in:
Tom Hughes 2025-01-21 18:44:31 +00:00
commit bd577d7c92
16 changed files with 233 additions and 98 deletions

View file

@ -1,7 +1,4 @@
class DiaryCommentsController < ApplicationController
include UserMethods
include PaginationMethods
layout "site"
before_action :authorize_web
@ -10,23 +7,9 @@ class DiaryCommentsController < ApplicationController
authorize_resource
before_action :lookup_user, :only => :index
before_action :check_database_writable, :only => [:create, :hide, :unhide]
before_action :check_database_writable
allow_thirdparty_images :only => [:index, :create]
def index
@title = t ".title", :user => @user.display_name
comments = DiaryComment.where(:user => @user)
comments = comments.visible unless can? :unhide, DiaryComment
@params = params.permit(:display_name, :before, :after)
@comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:user])
render :partial => "page" if turbo_frame_request_id == "pagination"
end
allow_thirdparty_images :only => :create
def create
@entry = DiaryEntry.find(params[:id])

View file

@ -0,0 +1,14 @@
module Users
class ChangesetCommentsController < CommentsController
def index
@title = t ".title", :user => @user.display_name
comments = ChangesetComment.where(:author => @user)
comments = comments.visible unless current_user&.moderator?
@params = params.permit(:display_name, :before, :after)
@comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:author])
end
end
end

View file

@ -0,0 +1,18 @@
module Users
class CommentsController < ApplicationController
include UserMethods
include PaginationMethods
layout "site"
before_action :authorize_web
before_action :set_locale
before_action :check_database_readable
authorize_resource
before_action :lookup_user
allow_thirdparty_images
end
end

View file

@ -0,0 +1,16 @@
module Users
class DiaryCommentsController < CommentsController
def index
@title = t ".title", :user => @user.display_name
comments = DiaryComment.where(:user => @user)
comments = comments.visible unless can? :unhide, DiaryComment
@params = params.permit(:display_name, :before, :after)
@comments, @newer_comments_id, @older_comments_id = get_page_items(comments, :includes => [:user])
render :partial => "page" if turbo_frame_request_id == "pagination"
end
end
end