@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Properly version Legalpad documents

Summary: Fixes T12933. This now creates a new DocumentBody when creating or editing a legalpad document.

Test Plan:
Create a new document, edit document. Check database that version is saved as new row, and timestamps are correct.

```mysql> select * from legalpad_documentbody;
+----+--------------------------------+--------------------------------+--------------------------------+---------+---------------+--------+-------------+--------------+
| id | phid | creatorPHID | documentPHID | version | title | text | dateCreated | dateModified |
+----+--------------------------------+--------------------------------+--------------------------------+---------+---------------+--------+-------------+--------------+
| 1 | PHID-LEGB-nsgzqklzfmjahlcgobm7 | PHID-USER-72xwu7eurrpsu2kxgrvw | PHID-LEGD-v7mc3xyithjvbiqeksbj | 2 | Legal Title 1 | Body 2 | 1501037011 | 1501037081 |
| 2 | PHID-LEGB-2kaytwmjusljib6pjycc | PHID-USER-72xwu7eurrpsu2kxgrvw | PHID-LEGD-v7mc3xyithjvbiqeksbj | 3 | Legal Title 1 | Body 3 | 1501037521 | 1501037521 |
| 3 | PHID-LEGB-h6q6bi42w4rgxrhk3qdb | PHID-USER-72xwu7eurrpsu2kxgrvw | PHID-LEGD-7gxuhafvkoy2izkv4gdd | 1 | New 2 | asdf | 1501037553 | 1501037553 |
+----+--------------------------------+--------------------------------+--------------------------------+---------+---------------+--------+-------------+--------------+
3 rows in set (0.00 sec)```

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: tmakarios, Korvin

Maniphest Tasks: T12933

Differential Revision: https://secure.phabricator.com/D18280

+10 -3
+2
resources/sql/autopatches/20170725.legalpad.date.01.sql
··· 1 + UPDATE {$NAMESPACE}_legalpad.legalpad_documentbody 2 + SET dateCreated = dateModified;
+8 -3
src/applications/legalpad/editor/LegalpadDocumentEditor.php
··· 45 45 } 46 46 47 47 if ($is_contribution) { 48 + $text = $object->getDocumentBody()->getText(); 49 + $title = $object->getDocumentBody()->getTitle(); 48 50 $object->setVersions($object->getVersions() + 1); 49 - $body = $object->getDocumentBody(); 51 + 52 + $body = new LegalpadDocumentBody(); 53 + $body->setCreatorPHID($this->getActingAsPHID()); 54 + $body->setText($text); 55 + $body->setTitle($title); 50 56 $body->setVersion($object->getVersions()); 51 57 $body->setDocumentPHID($object->getPHID()); 52 58 $body->save(); 53 59 54 60 $object->setDocumentBodyPHID($body->getPHID()); 55 61 56 - $actor = $this->getActor(); 57 62 $type = PhabricatorContributedToObjectEdgeType::EDGECONST; 58 63 id(new PhabricatorEdgeEditor()) 59 - ->addEdge($actor->getPHID(), $type, $object->getPHID()) 64 + ->addEdge($this->getActingAsPHID(), $type, $object->getPHID()) 60 65 ->save(); 61 66 62 67 $type = PhabricatorObjectHasContributorEdgeType::EDGECONST;