Show deleted diary entries to administrators, if the user isn't also deleted

This will allow administrators to review diary entry deletions from non-spam users.
This commit is contained in:
Andy Allan 2019-06-05 15:30:08 +02:00
parent f2f3fbb1f1
commit 49fc17c6b6
3 changed files with 30 additions and 2 deletions

View file

@ -157,7 +157,7 @@ class DiaryEntriesController < ApplicationController
@page = (params[:page] || 1).to_i
@page_size = 20
@entries = @entries.visible
@entries = @entries.visible unless current_user&.administrator?
@entries = @entries.order("created_at DESC")
@entries = @entries.offset((@page - 1) * @page_size)
@entries = @entries.limit(@page_size)