mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
When purging drafts after a transaction edit, purge all drafts
Summary: Fixes T13071. See that task for discusison. I think this `<= version` constraint is needless in normal cases (it should match everything in the table anyway), and slightly harmful in bizarre cases where a draft somehow gets a much larger ID than it should have. Test Plan: - Gave a draft an unreasonably large ID. - Pre-patch, observed: submitting comments on the draft's object does not clear the draft. - Post-patch: submitting comments on the draft's object now clears the draft correctly. - Also added comments/actions, reloaded pages, saw drafts stick properly. Maniphest Tasks: T13071 Differential Revision: https://secure.phabricator.com/D19060
This commit is contained in:
parent
653bc0fa01
commit
5e6e9fcc56
2 changed files with 4 additions and 8 deletions
|
@ -80,20 +80,17 @@ final class PhabricatorVersionedDraft extends PhabricatorDraftDAO {
|
|||
|
||||
public static function purgeDrafts(
|
||||
$object_phid,
|
||||
$viewer_phid,
|
||||
$version) {
|
||||
$viewer_phid) {
|
||||
|
||||
$draft = new PhabricatorVersionedDraft();
|
||||
$conn_w = $draft->establishConnection('w');
|
||||
|
||||
queryfx(
|
||||
$conn_w,
|
||||
'DELETE FROM %T WHERE objectPHID = %s AND authorPHID = %s
|
||||
AND version <= %d',
|
||||
'DELETE FROM %T WHERE objectPHID = %s AND authorPHID = %s',
|
||||
$draft->getTableName(),
|
||||
$object_phid,
|
||||
$viewer_phid,
|
||||
$version);
|
||||
$viewer_phid);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1985,8 +1985,7 @@ abstract class PhabricatorEditEngine
|
|||
if (!$is_preview) {
|
||||
PhabricatorVersionedDraft::purgeDrafts(
|
||||
$object->getPHID(),
|
||||
$viewer->getPHID(),
|
||||
$this->loadDraftVersion($object));
|
||||
$viewer->getPHID());
|
||||
|
||||
$draft_engine = $this->newDraftEngine($object);
|
||||
if ($draft_engine) {
|
||||
|
|
Loading…
Reference in a new issue