Added email notification when added to angeltype
This commit is contained in:
parent
1e3bd9aaad
commit
a79e1ebb5c
|
@ -216,6 +216,36 @@ function user_angeltype_confirm_email(User $user, array $angeltype): void
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param User $user
|
||||||
|
* @param array $angeltype
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function user_angeltype_add_email(User $user, array $angeltype): void
|
||||||
|
{
|
||||||
|
if (!$user->settings->email_shiftinfo || $user->id == auth()->user()->id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
/** @var EngelsystemMailer $mailer */
|
||||||
|
$mailer = app(EngelsystemMailer::class);
|
||||||
|
$mailer->sendViewTranslated(
|
||||||
|
$user,
|
||||||
|
'notification.angeltype.added',
|
||||||
|
'emails/angeltype-added',
|
||||||
|
['name' => $angeltype['name'], 'angeltype' => $angeltype, 'username' => $user->name]
|
||||||
|
);
|
||||||
|
} catch (SwiftException $e) {
|
||||||
|
/** @var LoggerInterface $logger */
|
||||||
|
$logger = app('logger');
|
||||||
|
$logger->error(
|
||||||
|
'Unable to send email "{title}" to user {user} with {exception}',
|
||||||
|
['title' => __('notification.angeltype.added'), 'user' => $user->name, 'exception' => $e]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a user from an Angeltype.
|
* Remove a user from an Angeltype.
|
||||||
*
|
*
|
||||||
|
@ -386,6 +416,8 @@ function user_angeltype_add_controller(): array
|
||||||
AngelType_name_render($angeltype, true)
|
AngelType_name_render($angeltype, true)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
user_angeltype_add_email($user_source, $angeltype);
|
||||||
|
|
||||||
throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
|
throw_redirect(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,5 +148,14 @@ msgstr "Du wurdest von einem Supporter als %1$s bestätigt."
|
||||||
msgid "notification.angeltype.confirmed.text"
|
msgid "notification.angeltype.confirmed.text"
|
||||||
msgstr "Eine Beschreibung findest du unter %2$s"
|
msgstr "Eine Beschreibung findest du unter %2$s"
|
||||||
|
|
||||||
|
msgid "notification.angeltype.added"
|
||||||
|
msgstr "Du wurdest als %s hinzugefügt"
|
||||||
|
|
||||||
|
msgid "notification.angeltype.added.introduction"
|
||||||
|
msgstr "Du wurdest von einem Supporter als %1$s hinzugefügt."
|
||||||
|
|
||||||
|
msgid "notification.angeltype.added.text"
|
||||||
|
msgstr "Eine Beschreibung findest du unter %2$s"
|
||||||
|
|
||||||
msgid "user.edit.success"
|
msgid "user.edit.success"
|
||||||
msgstr "Benutzer erfolgreich bearbeitet."
|
msgstr "Benutzer erfolgreich bearbeitet."
|
||||||
|
|
|
@ -144,5 +144,14 @@ msgstr "You have been confirmed as an %1$s by a supporter."
|
||||||
msgid "notification.angeltype.confirmed.text"
|
msgid "notification.angeltype.confirmed.text"
|
||||||
msgstr "You can find a description at %2$s"
|
msgstr "You can find a description at %2$s"
|
||||||
|
|
||||||
|
msgid "notification.angeltype.added"
|
||||||
|
msgstr "You have been added as an %s"
|
||||||
|
|
||||||
|
msgid "notification.angeltype.added.introduction"
|
||||||
|
msgstr "You have been added as an %1$s by a supporter."
|
||||||
|
|
||||||
|
msgid "notification.angeltype.added.text"
|
||||||
|
msgstr "You can find a description at %2$s"
|
||||||
|
|
||||||
msgid "user.edit.success"
|
msgid "user.edit.success"
|
||||||
msgstr "User edited successfully."
|
msgstr "User edited successfully."
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "emails/mail.twig" %}
|
||||||
|
|
||||||
|
{% set url=url('/angeltypes', {'action': 'view', 'angeltype_id': angeltype.id}) %}
|
||||||
|
|
||||||
|
{% block introduction %}
|
||||||
|
{{ __('notification.angeltype.added.introduction', [angeltype.name, url])|raw }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block message %}
|
||||||
|
{{ __('notification.angeltype.added.text', [angeltype.name, url])|raw }}
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue