Fix translations when removing users from angeltype

This commit is contained in:
Igor Scheller 2024-03-10 12:38:49 +01:00 committed by xuwhite
parent 0642bff804
commit ba908bf849
3 changed files with 22 additions and 14 deletions

View File

@ -231,8 +231,9 @@ function user_angeltype_delete_controller(): array
$user_angeltype = UserAngelType::findOrFail($request->input('user_angeltype_id'));
$angeltype = $user_angeltype->angelType;
$user_source = $user_angeltype->user;
$isOwnAngelType = $user->id == $user_source->id;
if (
$user->id != $user_angeltype->user_id
!$isOwnAngelType
&& !$user->isAngelTypeSupporter($angeltype)
&& !auth()->can('admin_user_angeltypes')
) {
@ -243,15 +244,15 @@ function user_angeltype_delete_controller(): array
if ($request->hasPostData('delete')) {
$user_angeltype->delete();
engelsystem_log(sprintf('User %s removed from %s.', User_Nick_render($user_source, true), $angeltype->name));
success(sprintf(__('User %s removed from %s.'), $user_source->displayName, $angeltype->name));
engelsystem_log(sprintf('User "%s" removed from "%s".', User_Nick_render($user_source, true), $angeltype->name));
success(sprintf($isOwnAngelType ? __('You successfully left "%2$s".') : __('User "%s" removed from "%s".'), $user_source->displayName, $angeltype->name));
throw_redirect(url('/angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype->id]));
}
return [
__('Remove angeltype'),
UserAngelType_delete_view($user_angeltype, $user_source, $angeltype),
__('Leave angeltype'),
UserAngelType_delete_view($user_angeltype, $user_source, $angeltype, $isOwnAngelType),
];
}

View File

@ -108,14 +108,15 @@ function UserAngelType_confirm_view(UserAngelType $user_angeltype, User $user, A
* @param UserAngelType $user_angeltype
* @param User $user
* @param AngelType $angeltype
* @param bool $isOwnAngelType
* @return string
*/
function UserAngelType_delete_view(UserAngelType $user_angeltype, User $user, AngelType $angeltype)
function UserAngelType_delete_view(UserAngelType $user_angeltype, User $user, AngelType $angeltype, bool $isOwnAngelType)
{
return page_with_title(__('Remove angeltype'), [
return page_with_title(__('Leave angeltype'), [
msg(),
info(sprintf(
__('Do you really want to delete %s from %s?'),
$isOwnAngelType ? __('Do you really want to leave "%2$s"?') : __('Do you really want to remove "%s" from "%s"?'),
$user->displayName,
$angeltype->name
), true),

View File

@ -365,14 +365,17 @@ msgstr "Engeltyp für Benutzer bestätigen"
msgid "You are not allowed to delete this users angeltype."
msgstr "Du darfst diesen Benutzer nicht von diesem Engeltyp entfernen."
msgid "User %s removed from %s."
msgstr "Benutzer %s von %s entfernt."
msgid "User \"%s\" removed from \"%s\"."
msgstr "Benutzer \"%s\" von \"%s\" entfernt."
msgid "Edit certificates"
msgstr "Zertifikate bearbeiten"
msgid "Remove angeltype"
msgstr "Engeltyp löschen"
msgid "You successfully left \"%2$s\"."
msgstr "Du hast erfolgreich \"%2$s\" verlassen."
msgid "Leave angeltype"
msgstr "Engeltyp verlassen"
msgid "You are not allowed to set supporter rights."
msgstr "Du darfst keine Supporterrechte bearbeiten."
@ -1129,8 +1132,11 @@ msgstr "Möchtest Du wirklich alle Benutzer als %s bestätigen?"
msgid "Do you really want to confirm %s for %s?"
msgstr "Möchtest Du wirklich %s für %s bestätigen?"
msgid "Do you really want to delete %s from %s?"
msgstr "Möchtest Du wirklich %s von %s entfernen?"
msgid "Do you really want to remove \"%s\" from \"%s\"?"
msgstr "Möchtest Du wirklich \"%s\" von \"%s\" entfernen?"
msgid "Do you really want to leave \"%2$s\"?"
msgstr "Möchtest Du \"%2$s\" wirklich verlassen?"
msgid "Do you really want to add %s to %s?"
msgstr "Möchtest Du wirklich %s zu %s hinzufügen?"