Fix UserBookmarkSerializer topic references

Fix UserBookmarkSerializer topic references

diff --git a/plugin.rb b/plugin.rb
index bf31217..1c5e128 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -240,19 +240,19 @@ after_initialize do
 
   if defined? UserBookmarkSerializer
     add_to_class(:user_bookmark_serializer, :assigned_to_user_id) do
-      id = object.topic.custom_fields[TopicAssigner::ASSIGNED_TO_ID]
+      id = topic.custom_fields[TopicAssigner::ASSIGNED_TO_ID]
       # a bit messy but race conditions can give us an array here, avoid
       id && id.to_i rescue nil
     end
 
     add_to_serializer(:user_bookmark, :assigned_to_user, false) do
-      DiscourseAssign::Helpers.build_assigned_to_user(assigned_to_user_id, object.topic)
+      DiscourseAssign::Helpers.build_assigned_to_user(assigned_to_user_id, topic)
     end
 
     add_to_serializer(:user_bookmark, 'include_assigned_to_user?') do
       if SiteSetting.assigns_public || scope.can_assign?
         # subtle but need to catch cases where stuff is not assigned
-        object.topic.custom_fields.keys.include?(TopicAssigner::ASSIGNED_TO_ID)
+        topic.custom_fields.keys.include?(TopicAssigner::ASSIGNED_TO_ID)
       end
     end
   end

GitHub sha: baba785b