mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-17 04:01:29 -05:00
FIX: don't log user action if no user exists for topic
This commit is contained in:
parent
b1d6e2307f
commit
ad2a3ec5bc
1 changed files with 5 additions and 0 deletions
|
@ -79,6 +79,11 @@ class UserActionObserver < ActiveRecord::Observer
|
||||||
end
|
end
|
||||||
|
|
||||||
def log_topic(model)
|
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 = {
|
row = {
|
||||||
action_type: model.archetype == Archetype.private_message ? UserAction::NEW_PRIVATE_MESSAGE : UserAction::NEW_TOPIC,
|
action_type: model.archetype == Archetype.private_message ? UserAction::NEW_PRIVATE_MESSAGE : UserAction::NEW_TOPIC,
|
||||||
user_id: model.user_id,
|
user_id: model.user_id,
|
||||||
|
|
Loading…
Reference in a new issue