From 6e358bfacf0c1a0c4c857371b3c7b478f4a1f32c Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 5 Sep 2021 14:47:29 -0400 Subject: [PATCH] Remove user-controlled contact archival feature - Archival is managed at the system level for failed probing and doesn't make sense for a user to decide on it --- src/Module/Contact.php | 44 ---------------------- view/templates/contact_edit.tpl | 1 - view/theme/frio/templates/contact_edit.tpl | 1 - view/theme/vier/templates/contact_edit.tpl | 1 - 4 files changed, 47 deletions(-) diff --git a/src/Module/Contact.php b/src/Module/Contact.php index ae7c77d992..4233be4625 100644 --- a/src/Module/Contact.php +++ b/src/Module/Contact.php @@ -79,11 +79,6 @@ class Contact extends BaseModule self::ignoreContact($contact_id); $count_actions++; } - if (!empty($_POST['contacts_batch_archive']) - && self::archiveContact($contact_id, $orig_record) - ) { - $count_actions++; - } if (!empty($_POST['contacts_batch_drop'])) { self::dropContact($orig_record); $count_actions++; @@ -98,8 +93,6 @@ class Contact extends BaseModule public static function post(array $parameters = []) { - $a = DI::app(); - if (!local_user()) { return; } @@ -216,23 +209,6 @@ class Contact extends BaseModule Model\Contact\User::setIgnored($contact_id, local_user(), $ignored); } - /** - * Toggles the archived status of a contact identified by id. - * If the current status isn't provided, this will always archive the contact. - * - * @param $contact_id - * @param $orig_record - * @return bool - * @throws \Exception - */ - private static function archiveContact($contact_id, $orig_record) - { - $archived = empty($orig_record['archive']); - $r = DBA::update('contact', ['archive' => $archived], ['id' => $contact_id, 'uid' => local_user()]); - - return DBA::isResult($r); - } - private static function dropContact($orig_record) { $owner = Model\User::getOwnerDataById(local_user()); @@ -395,17 +371,6 @@ class Contact extends BaseModule // NOTREACHED } - if ($cmd === 'archive' && ($orig_record['uid'] != 0)) { - $r = self::archiveContact($contact_id, $orig_record); - if ($r) { - $archived = (($orig_record['archive']) ? 0 : 1); - info((($archived) ? DI::l10n()->t('Contact has been archived') : DI::l10n()->t('Contact has been unarchived'))); - } - - DI::baseUrl()->redirect('contact/' . $contact_id); - // NOTREACHED - } - if ($cmd === 'drop' && ($orig_record['uid'] != 0)) { // Check if we should do HTML-based delete confirmation if (!empty($_REQUEST['confirm'])) { @@ -845,7 +810,6 @@ class Contact extends BaseModule 'contacts_batch_update' => DI::l10n()->t('Update'), 'contacts_batch_block' => DI::l10n()->t('Block') . '/' . DI::l10n()->t('Unblock'), 'contacts_batch_ignore' => DI::l10n()->t('Ignore') . '/' . DI::l10n()->t('Unignore'), - 'contacts_batch_archive' => DI::l10n()->t('Archive') . '/' . DI::l10n()->t('Unarchive'), 'contacts_batch_drop' => DI::l10n()->t('Delete'), ], '$h_batch_actions' => DI::l10n()->t('Batch Actions'), @@ -1128,14 +1092,6 @@ class Contact extends BaseModule ]; if ($contact['uid'] != 0) { - $contact_actions['archive'] = [ - 'label' => (intval($contact['archive']) ? DI::l10n()->t('Unarchive') : DI::l10n()->t('Archive')), - 'url' => 'contact/' . $contact['id'] . '/archive', - 'title' => DI::l10n()->t('Toggle Archive status'), - 'sel' => (intval($contact['archive']) ? 'active' : ''), - 'id' => 'toggle-archive', - ]; - $contact_actions['delete'] = [ 'label' => DI::l10n()->t('Delete'), 'url' => 'contact/' . $contact['id'] . '/drop', diff --git a/view/templates/contact_edit.tpl b/view/templates/contact_edit.tpl index 9a5fc6172c..f597877826 100644 --- a/view/templates/contact_edit.tpl +++ b/view/templates/contact_edit.tpl @@ -21,7 +21,6 @@
  • {{$contact_actions.block.label}}
  • {{$contact_actions.ignore.label}}
  • - {{if $contact_actions.archive.url}}
  • {{$contact_actions.archive.label}}
  • {{/if}} {{if $contact_actions.delete.url}}
  • {{$contact_actions.delete.label}}
  • {{/if}} diff --git a/view/theme/frio/templates/contact_edit.tpl b/view/theme/frio/templates/contact_edit.tpl index 4fcfc1fb7a..91c6d26f43 100644 --- a/view/theme/frio/templates/contact_edit.tpl +++ b/view/theme/frio/templates/contact_edit.tpl @@ -27,7 +27,6 @@ {{/if}}
  • {{$contact_actions.block.label}}
  • {{$contact_actions.ignore.label}}
  • - {{if $contact_actions.archive.url}}
  • {{$contact_actions.archive.label}}
  • {{/if}} {{if $contact_actions.delete.url}}
  • {{/if}} diff --git a/view/theme/vier/templates/contact_edit.tpl b/view/theme/vier/templates/contact_edit.tpl index 94c753c7d4..2693012bff 100644 --- a/view/theme/vier/templates/contact_edit.tpl +++ b/view/theme/vier/templates/contact_edit.tpl @@ -22,7 +22,6 @@
  • {{$contact_actions.block.label}}
  • {{$contact_actions.ignore.label}}
  • - {{if $contact_actions.archive.url}}
  • {{$contact_actions.archive.label}}
  • {{/if}} {{if $contact_actions.delete.url}}
  • {{$contact_actions.delete.label}}
  • {{/if}}