|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
class MemosController < ApplicationController
|
|
|
|
|
before_action :require_login, except: [:show, :index]
|
|
|
|
|
before_action :set_memo, only: [:show, :edit, :update, :destroy, :sticky_or_cancel, :hidden]
|
|
|
|
|
before_action :set_memo, only: [:show, :edit, :update, :destroy, :sticky_or_cancel, :hidden, :more_reply]
|
|
|
|
|
before_action :validate_memo_params, only: [:create, :update]
|
|
|
|
|
before_action :owner_or_admin, only: [:edit, :update, :destroy]
|
|
|
|
|
before_action :is_admin, only: [:sticky_or_cancel, :hidden]
|
|
|
|
@ -164,7 +164,14 @@ class MemosController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def more_reply
|
|
|
|
|
@user = current_user
|
|
|
|
|
page = params[:page] || 2
|
|
|
|
|
limit = params[:limit] || 10
|
|
|
|
|
offset = (page.to_i - 1) * limit
|
|
|
|
|
@memos_count = Memo.where(parent_id: @memo.id).count
|
|
|
|
|
@memos = Memo.limit(limit).where(parent_id: @memo.id).includes(:author, :praise_treads).order("created_at desc").offset(offset)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
|
|
|