Skip to content
Snippets Groups Projects
Commit 3a81b307 authored by Taico Aerts's avatar Taico Aerts
Browse files

Actually support nil users

parent ee955011
No related branches found
No related tags found
2 merge requests!51Upgrade to latest qpixel,!50Update to latest codidact changes
...@@ -16,7 +16,7 @@ class PostHistory < ApplicationRecord ...@@ -16,7 +16,7 @@ class PostHistory < ApplicationRecord
# @param user [User] # @param user [User]
# @return [Boolean] whether the given user is allowed to see the details of this history item # @return [Boolean] whether the given user is allowed to see the details of this history item
def allowed_to_see_details?(user) def allowed_to_see_details?(user)
!hidden || user.is_admin || user_id == user.id || post.user_id == user.id !hidden || user&.is_admin || user_id == user&.id || post.user_id == user&.id
end end
def self.method_missing(name, *args, **opts) def self.method_missing(name, *args, **opts)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment