Merge pull request #4007 from annando/archive-contact

Bugfix for unarchival and unarchival of the author
This commit is contained in:
Hypolite Petovan 2017-12-04 15:04:17 -05:00 committed by GitHub
commit 06d6d6c758
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -1151,6 +1151,11 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
* @param array $arr Contains the just posted item record
*/
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"])));

View file

@ -185,7 +185,7 @@ class Contact extends BaseObject
*/
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);
// We don't need to update, we never marked this contact for archival