1
1
Fork 0

Merge pull request #9156 from annando/issue-9153

Issue 9153 Use "info" instead of "notice" on successful operations
This commit is contained in:
Tobias Diekershoff 2020-09-07 12:57:10 +02:00 committed by GitHub
commit 6728b518ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 17 deletions

View file

@ -44,7 +44,7 @@ class Contact extends BaseAdmin
$contact_id = Model\Contact::getIdForURL($contact_url); $contact_id = Model\Contact::getIdForURL($contact_url);
if ($contact_id) { if ($contact_id) {
Model\Contact::block($contact_id, $block_reason); Model\Contact::block($contact_id, $block_reason);
notice(DI::l10n()->t('The contact has been blocked from the node')); info(DI::l10n()->t('The contact has been blocked from the node'));
} else { } else {
notice(DI::l10n()->t('Could not find any contact entry for this URL (%s)', $contact_url)); notice(DI::l10n()->t('Could not find any contact entry for this URL (%s)', $contact_url));
} }
@ -54,7 +54,7 @@ class Contact extends BaseAdmin
foreach ($contacts as $uid) { foreach ($contacts as $uid) {
Model\Contact::unblock($uid); Model\Contact::unblock($uid);
} }
notice(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts))); info(DI::l10n()->tt('%s contact unblocked', '%s contacts unblocked', count($contacts)));
} }
DI::baseUrl()->redirect('admin/blocklist/contact'); DI::baseUrl()->redirect('admin/blocklist/contact');

View file

@ -58,14 +58,14 @@ class Users extends BaseAdmin
foreach ($users as $uid) { foreach ($users as $uid) {
User::block($uid); User::block($uid);
} }
notice(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users))); info(DI::l10n()->tt('%s user blocked', '%s users blocked', count($users)));
} }
if (!empty($_POST['page_users_unblock'])) { if (!empty($_POST['page_users_unblock'])) {
foreach ($users as $uid) { foreach ($users as $uid) {
User::block($uid, false); User::block($uid, false);
} }
notice(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users))); info(DI::l10n()->tt('%s user unblocked', '%s users unblocked', count($users)));
} }
if (!empty($_POST['page_users_delete'])) { if (!empty($_POST['page_users_delete'])) {
@ -77,21 +77,21 @@ class Users extends BaseAdmin
} }
} }
notice(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users))); info(DI::l10n()->tt('%s user deleted', '%s users deleted', count($users)));
} }
if (!empty($_POST['page_users_approve'])) { if (!empty($_POST['page_users_approve'])) {
foreach ($pending as $hash) { foreach ($pending as $hash) {
User::allow($hash); User::allow($hash);
} }
notice(DI::l10n()->tt('%s user approved', '%s users approved', count($pending))); info(DI::l10n()->tt('%s user approved', '%s users approved', count($pending)));
} }
if (!empty($_POST['page_users_deny'])) { if (!empty($_POST['page_users_deny'])) {
foreach ($pending as $hash) { foreach ($pending as $hash) {
User::deny($hash); User::deny($hash);
} }
notice(DI::l10n()->tt('%s registration revoked', '%s registrations revoked', count($pending))); info(DI::l10n()->tt('%s registration revoked', '%s registrations revoked', count($pending)));
} }
DI::baseUrl()->redirect('admin/users'); DI::baseUrl()->redirect('admin/users');

View file

@ -131,7 +131,7 @@ class Group extends BaseModule
throw new \Exception(DI::l10n()->t('Bad request.'), 400); throw new \Exception(DI::l10n()->t('Bad request.'), 400);
} }
notice($message); info($message);
System::jsonExit(['status' => 'OK', 'message' => $message]); System::jsonExit(['status' => 'OK', 'message' => $message]);
} catch (\Exception $e) { } catch (\Exception $e) {
notice($e->getMessage()); notice($e->getMessage());

View file

@ -119,7 +119,7 @@ class Invite extends BaseModule
} }
} }
notice(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total)); info(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total));
} }
public static function content(array $parameters = []) public static function content(array $parameters = [])

View file

@ -57,7 +57,7 @@ class Recovery extends BaseModule
if (RecoveryCode::existsForUser(local_user(), $recovery_code)) { if (RecoveryCode::existsForUser(local_user(), $recovery_code)) {
RecoveryCode::markUsedForUser(local_user(), $recovery_code); RecoveryCode::markUsedForUser(local_user(), $recovery_code);
Session::set('2fa', true); Session::set('2fa', true);
notice(DI::l10n()->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user()))); info(DI::l10n()->t('Remaining recovery codes: %d', RecoveryCode::countValidForUser(local_user())));
DI::auth()->setForUser($a, $a->user, true, true); DI::auth()->setForUser($a, $a->user, true, true);
} else { } else {

View file

@ -187,7 +187,7 @@ class Crop extends BaseSettings
Worker::add(PRIORITY_LOW, 'Directory', Session::get('my_url')); Worker::add(PRIORITY_LOW, 'Directory', Session::get('my_url'));
} }
notice(DI::l10n()->t('Profile picture successfully updated.')); info(DI::l10n()->t('Profile picture successfully updated.'));
DI::baseUrl()->redirect('profile/' . DI::app()->user['nickname']); DI::baseUrl()->redirect('profile/' . DI::app()->user['nickname']);
} }

View file

@ -74,13 +74,13 @@ class AppSpecific extends BaseSettings
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password')); DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
} else { } else {
self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? ''); self::$appSpecificPassword = AppSpecificPassword::generateForUser(local_user(), $_POST['description'] ?? '');
notice(DI::l10n()->t('New app-specific password generated.')); info(DI::l10n()->t('New app-specific password generated.'));
} }
break; break;
case 'revoke_all' : case 'revoke_all' :
AppSpecificPassword::deleteAllForUser(local_user()); AppSpecificPassword::deleteAllForUser(local_user());
notice(DI::l10n()->t('App-specific passwords successfully revoked.')); info(DI::l10n()->t('App-specific passwords successfully revoked.'));
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password')); DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));
break; break;
} }
@ -90,7 +90,7 @@ class AppSpecific extends BaseSettings
self::checkFormSecurityTokenRedirectOnError('settings/2fa/app_specific', 'settings_2fa_app_specific'); self::checkFormSecurityTokenRedirectOnError('settings/2fa/app_specific', 'settings_2fa_app_specific');
if (AppSpecificPassword::deleteForUser(local_user(), $_POST['revoke_id'])) { if (AppSpecificPassword::deleteForUser(local_user(), $_POST['revoke_id'])) {
notice(DI::l10n()->t('App-specific password successfully revoked.')); info(DI::l10n()->t('App-specific password successfully revoked.'));
} }
DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password')); DI::baseUrl()->redirect('settings/2fa/app_specific?t=' . self::getFormSecurityToken('settings_2fa_password'));

View file

@ -64,7 +64,7 @@ class Index extends BaseSettings
DI::pConfig()->delete(local_user(), '2fa', 'verified'); DI::pConfig()->delete(local_user(), '2fa', 'verified');
Session::remove('2fa'); Session::remove('2fa');
notice(DI::l10n()->t('Two-factor authentication successfully disabled.')); info(DI::l10n()->t('Two-factor authentication successfully disabled.'));
DI::baseUrl()->redirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');
} }
break; break;

View file

@ -63,7 +63,7 @@ class Recovery extends BaseSettings
if ($_POST['action'] == 'regenerate') { if ($_POST['action'] == 'regenerate') {
RecoveryCode::regenerateForUser(local_user()); RecoveryCode::regenerateForUser(local_user());
notice(DI::l10n()->t('New recovery codes successfully generated.')); info(DI::l10n()->t('New recovery codes successfully generated.'));
DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password')); DI::baseUrl()->redirect('settings/2fa/recovery?t=' . self::getFormSecurityToken('settings_2fa_password'));
} }
} }

View file

@ -75,7 +75,7 @@ class Verify extends BaseSettings
DI::pConfig()->set(local_user(), '2fa', 'verified', true); DI::pConfig()->set(local_user(), '2fa', 'verified', true);
Session::set('2fa', true); Session::set('2fa', true);
notice(DI::l10n()->t('Two-factor authentication successfully activated.')); info(DI::l10n()->t('Two-factor authentication successfully activated.'));
DI::baseUrl()->redirect('settings/2fa'); DI::baseUrl()->redirect('settings/2fa');
} else { } else {