Merge pull request #4459 from annando/unmark-contact

Bugfix and improvements for unmarking potentially archived contacts
This commit is contained in:
Hypolite Petovan 2018-02-14 17:01:17 -05:00 committed by GitHub
commit 41cd5af54f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 27 deletions

View file

@ -1084,17 +1084,15 @@ class Item extends BaseObject
private static function updateContact($arr)
{
// Unarchive the author
$contact = dba::selectFirst('contact', [], ['id' => $arr["author-link"]]);
if ($contact['term-date'] > NULL_DATE) {
Contact::unmarkForArchival($contact);
$contact = dba::selectFirst('contact', [], ['id' => $arr["author-id"]]);
if (DBM::is_result($contact)) {
Contact::unmarkForArchival($contact);
}
// Unarchive the contact if it is a toplevel posting
if ($arr["parent-uri"] === $arr["uri"]) {
$contact = dba::selectFirst('contact', [], ['id' => $arr["contact-id"]]);
if ($contact['term-date'] > NULL_DATE) {
Contact::unmarkForArchival($contact);
}
// Unarchive the contact if it's not our own contact
$contact = dba::selectFirst('contact', [], ['id' => $arr["contact-id"], 'self' => false]);
if (DBM::is_result($contact)) {
Contact::unmarkForArchival($contact);
}
$update = (!$arr['private'] && (($arr["author-link"] === $arr["owner-link"]) || ($arr["parent-uri"] === $arr["uri"])));