Merge pull request #4007 from annando/archive-contact
Bugfix for unarchival and unarchival of the author
This commit is contained in:
commit
06d6d6c758
2 changed files with 6 additions and 1 deletions
|
@ -1151,6 +1151,11 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
|
||||||
* @param array $arr Contains the just posted item record
|
* @param array $arr Contains the just posted item record
|
||||||
*/
|
*/
|
||||||
function item_set_last_item($arr) {
|
function item_set_last_item($arr) {
|
||||||
|
// Unarchive the author
|
||||||
|
$contact = dba::select('contact', [], ['id' => $arr["author-link"]], ['limit' => 1]);
|
||||||
|
if ($contact['term-date'] > NULL_DATE) {
|
||||||
|
Contact::unmarkForArchival($contact);
|
||||||
|
}
|
||||||
|
|
||||||
$update = (!$arr['private'] && (($arr["author-link"] === $arr["owner-link"]) || ($arr["parent-uri"] === $arr["uri"])));
|
$update = (!$arr['private'] && (($arr["author-link"] === $arr["owner-link"]) || ($arr["parent-uri"] === $arr["uri"])));
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ class Contact extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function unmarkForArchival(array $contact)
|
public static function unmarkForArchival(array $contact)
|
||||||
{
|
{
|
||||||
$condition = array('`id` = ? AND (`term-date` > ? OR `archive`)', $contact[`id`], NULL_DATE);
|
$condition = array('`id` = ? AND (`term-date` > ? OR `archive`)', $contact['id'], NULL_DATE);
|
||||||
$exists = dba::exists('contact', $condition);
|
$exists = dba::exists('contact', $condition);
|
||||||
|
|
||||||
// We don't need to update, we never marked this contact for archival
|
// We don't need to update, we never marked this contact for archival
|
||||||
|
|
Loading…
Reference in a new issue