From ec948dc6604ccfc4c9dacbf7277fd0ffbeeb15cf Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 19 Mar 2013 16:51:24 -0700 Subject: [PATCH] loading a user in a post_action is wasteful --- lib/guardian.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/guardian.rb b/lib/guardian.rb index ff8981f4a88..5ea4bb24a48 100644 --- a/lib/guardian.rb +++ b/lib/guardian.rb @@ -281,7 +281,8 @@ class Guardian def can_delete_post_action?(post_action) # You can only undo your own actions - return false unless post_action.user == @user + return false unless @user + return false unless post_action.user_id == @user.id # Make sure they want to delete it within the window return post_action.created_at > SiteSetting.post_undo_action_window_mins.minutes.ago