DEV: Avoid repeating draft key logic in multiple places.
This commit is contained in:
parent
a009ec597d
commit
3c423faafd
|
@ -303,7 +303,7 @@ class PostCreator
|
||||||
|
|
||||||
def draft_key
|
def draft_key
|
||||||
@draft_key ||= @opts[:draft_key]
|
@draft_key ||= @opts[:draft_key]
|
||||||
@draft_key ||= @topic ? "topic_#{@topic.id}" : "new_topic"
|
@draft_key ||= @topic ? @topic.draft_key : Draft::NEW_TOPIC
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_post_stats
|
def build_post_stats
|
||||||
|
|
|
@ -301,9 +301,8 @@ describe PostCreator do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates post stats' do
|
it 'creates post stats' do
|
||||||
|
Draft.set(user, Draft::NEW_TOPIC, 0, "test")
|
||||||
Draft.set(user, 'new_topic', 0, "test")
|
Draft.set(user, Draft::NEW_TOPIC, 0, "test1")
|
||||||
Draft.set(user, 'new_topic', 0, "test1")
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
PostCreator.track_post_stats = true
|
PostCreator.track_post_stats = true
|
||||||
|
|
Loading…
Reference in New Issue