FIX: don't log user action if no user exists for topic

This commit is contained in:
Sam 2016-05-02 11:14:37 +10:00
parent b1d6e2307f
commit ad2a3ec5bc

View file

@ -79,6 +79,11 @@ class UserActionObserver < ActiveRecord::Observer
end
def log_topic(model)
# no action to log here, this can happen if a user is deleted
# then topic has no user_id
return unless model.user_id
row = {
action_type: model.archetype == Archetype.private_message ? UserAction::NEW_PRIVATE_MESSAGE : UserAction::NEW_TOPIC,
user_id: model.user_id,