From ed37c5bcc76c20ad04bd57b98b51883c48ed8296 Mon Sep 17 00:00:00 2001 From: jjaffeux Date: Tue, 4 Aug 2020 21:06:02 +0200 Subject: [PATCH] FIX: directly check on post if we have an event This is cleaner and also avoids a 404 when no event is found --- plugin.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/plugin.rb b/plugin.rb index ca87b60a..67638fa8 100644 --- a/plugin.rb +++ b/plugin.rb @@ -509,11 +509,8 @@ after_initialize do ids = [] post = post_revision.post - if post && post.is_first_post? - event = DiscoursePostEvent::Event.find(post.id) - if event - ids.concat(event.currently_attending_invitees.pluck(:user_id)) - end + if post && post.is_first_post? && post.event + ids.concat(post.event.currently_attending_invitees.pluck(:user_id)) end ids