mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
BUGFIX: eliminate drafts for system user
This commit is contained in:
parent
48790368a0
commit
7e1bd88c33
3 changed files with 5 additions and 2 deletions
|
@ -2,6 +2,9 @@ class DraftSequence < ActiveRecord::Base
|
|||
def self.next!(user,key)
|
||||
user_id = user
|
||||
user_id = user.id unless user.class == Fixnum
|
||||
|
||||
return 0 if user_id == Discourse::SYSTEM_USER_ID
|
||||
|
||||
h = { user_id: user_id, draft_key: key }
|
||||
c = DraftSequence.find_by(h)
|
||||
c ||= DraftSequence.new(h)
|
||||
|
|
|
@ -201,7 +201,7 @@ module Discourse
|
|||
user ||= User.admins.real.order(:id).first
|
||||
end
|
||||
|
||||
SYSTEM_USER_ID = -1
|
||||
SYSTEM_USER_ID = -1 unless defined? SYSTEM_USER_ID
|
||||
|
||||
def self.system_user
|
||||
User.find_by(id: SYSTEM_USER_ID)
|
||||
|
|
|
@ -25,7 +25,7 @@ class PostRevisor
|
|||
update_topic_excerpt
|
||||
post_process_post
|
||||
update_topic_word_counts
|
||||
@post.advance_draft_sequence unless editor.id == Discourse::SYSTEM_USER_ID
|
||||
@post.advance_draft_sequence
|
||||
PostAlerter.new.after_save_post(@post)
|
||||
publish_revision
|
||||
|
||||
|
|
Loading…
Reference in a new issue