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
pull/10670/head
Hypolite Petovan 2021-09-05 14:47:29 -04:00
parent 7ee88c3457
commit 6e358bfacf
4 changed files with 0 additions and 47 deletions

View File

@ -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',

View File

@ -21,7 +21,6 @@
<li class="divider"></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.ignore.title}}" onclick="window.location.href='{{$contact_actions.ignore.url}}'; return false;">{{$contact_actions.ignore.label}}</a></li>
{{if $contact_actions.archive.url}}<li role="menuitem"><a href="#" title="{{$contact_actions.archive.title}}" onclick="window.location.href='{{$contact_actions.archive.url}}'; return false;">{{$contact_actions.archive.label}}</a></li>{{/if}}
{{if $contact_actions.delete.url}}<li role="menuitem"><a href="{{$contact_actions.delete.url}}" title="{{$contact_actions.delete.title}}" onclick="return confirmDelete();">{{$contact_actions.delete.label}}</a></li> {{/if}}
</ul>
</div>

View File

@ -27,7 +27,6 @@
{{/if}}
<li role="presentation"><a role="menuitem" href="{{$contact_actions.block.url}}" title="{{$contact_actions.block.title}}">{{$contact_actions.block.label}}</a></li>
<li role="presentation"><a role="menuitem" href="{{$contact_actions.ignore.url}}" title="{{$contact_actions.ignore.title}}">{{$contact_actions.ignore.label}}</a></li>
{{if $contact_actions.archive.url}}<li role="presentation"><a role="menuitem" href="{{$contact_actions.archive.url}}" title="{{$contact_actions.archive.title}}">{{$contact_actions.archive.label}}</a></li>{{/if}}
{{if $contact_actions.delete.url}}<li role="presentation"><button role="menuitem" type="button" class="btn-link" title="{{$contact_actions.delete.title}}" onclick="addToModal('{{$contact_actions.delete.url}}?confirm=1');">{{$contact_actions.delete.label}}</button></li>{{/if}}
</ul>
</li>

View File

@ -22,7 +22,6 @@
<li class="divider"></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.ignore.title}}" onclick="window.location.href='{{$contact_actions.ignore.url}}'; return false;">{{$contact_actions.ignore.label}}</a></li>
{{if $contact_actions.archive.url}}<li role="menuitem"><a href="#" title="{{$contact_actions.archive.title}}" onclick="window.location.href='{{$contact_actions.archive.url}}'; return false;">{{$contact_actions.archive.label}}</a></li>{{/if}}
{{if $contact_actions.delete.url}}<li role="menuitem"><a href="{{$contact_actions.delete.url}}" title="{{$contact_actions.delete.title}}" onclick="return confirmDelete();">{{$contact_actions.delete.label}}</a></li>{{/if}}
</ul>
</div>