FIX: Clear drafts only when post is created by real user (#15720)

This commits adds a new advance_draft to PostCreator that controls if
the draft sequence will be advanced or not. If the draft sequence is
advanced then the old drafts will be cleared. This used to happen for
posts created by plugins or through the API and cleared user drafts
by mistake.
This commit is contained in:
Bianca Nenciu
2022-02-09 10:37:38 +02:00
committed by GitHub
parent c1ad9c3276
commit f704deca17
7 changed files with 37 additions and 8 deletions

View File

@ -182,6 +182,7 @@ class PostsController < ApplicationController
def create
@manager_params = create_params
@manager_params[:first_post_checks] = !is_api?
@manager_params[:advance_draft] = !is_api?
manager = NewPostManager.new(current_user, @manager_params)