FIX: Improve checks for non-human users.

This commit is contained in:
Guo Xiang Tan
2017-03-14 14:33:06 +08:00
parent aeb169bd0e
commit 5943543ec3
8 changed files with 15 additions and 12 deletions

View File

@ -3,7 +3,7 @@ class DraftSequence < ActiveRecord::Base
user_id = user
user_id = user.id unless user.class == Fixnum
return 0 if user_id == Discourse::SYSTEM_USER_ID
return 0 if user_id < 0
h = { user_id: user_id, draft_key: key }
c = DraftSequence.find_by(h)