Fix all test channels for user and owner.

This commit is contained in:
James Cole
2024-12-14 06:30:27 +01:00
parent 7d8d773f8f
commit b976239580
23 changed files with 720 additions and 95 deletions

View File

@@ -1290,6 +1290,7 @@ return [
'create_recurring_from_transaction' => 'Create recurring transaction based on transaction',
// preferences
'test_notifications_buttons' => 'To test your configuration, use the buttons below. Please note that the buttons have no spam control.',
'dark_mode_option_browser' => 'Let your browser decide',
'dark_mode_option_light' => 'Always light',
'dark_mode_option_dark' => 'Always dark',
@@ -1388,7 +1389,7 @@ return [
'pref_notifications' => 'Notifications',
'pref_notifications_help' => 'Indicate if these are notifications you would like to get. Some notifications may contain sensitive financial information.',
'pref_notifications_settings' => 'Notifications settings',
'pref_notifications_settings_help' => 'Use these settings to configure your notification channels. Please note that notifications will be sent to ALL channels.',
'pref_notifications_settings_help' => 'Use these settings to configure your notification channels. Please note that notifications will be sent to ALL channels. Please save your settings FIRST.',
'slack_url_label' => 'Slack "incoming webhook" URL',
'discord_url_label' => 'Discord webhook URL',
@@ -2481,7 +2482,7 @@ return [
'delete_user' => 'Delete user :email',
'user_deleted' => 'The user has been deleted',
'send_test_email' => 'Send test email message',
'send_test_email_text' => 'To see if your installation is capable of sending email or posting Slack messages, please press this button. You will not see an error here (if any), <strong>the log files will reflect any errors</strong>. You can press this button as many times as you like. There is no spam control. The message will be sent to <code>:email</code> and should arrive shortly.',
'send_test_email_text' => 'To see if your installation is capable of sending a notification, please press this button. You will not see an error here (if any), <strong>the log files will reflect any errors</strong>. You can press this button as many times as you like. There is no spam control. The message will be sent to <code>:email</code> and should arrive shortly.',
'send_message' => 'Send message',
'send_test_triggered' => 'Test was triggered. Check your inbox and the log files.',
'give_admin_careful' => 'Users who are given admin rights can take away yours. Be careful.',
@@ -2514,7 +2515,7 @@ return [
'notification_channel_name_pushover' => 'Pushover',
'notification_channel_name_gotify' => 'Gotify',
'notification_channel_name_pushbullet' => 'Pushbullet',
'channel_not_available' => 'not available yet',
'channel_not_available' => 'not available',
'configure_channel_in_env' => 'needs environment variables',
'test_notification_channel_name_email' => 'Test email',
'test_notification_channel_name_slack' => 'Test Slack',

View File

@@ -307,13 +307,33 @@
{# view range #}
<div class="preferences-box">
<h3>{{ 'pref_notifications'|_ }}</h3>
<p class="text-info">{{ 'pref_notifications_help'|_ }}</p>
<p>
{{ 'available_channels_expl'|_ }}
</p>
<ul>
{% for name,info in channels %}
<li>
{% if true == info.enabled and true == forcedAvailability[name] %}
☑️ {{ trans('firefly.notification_channel_name_'~name) }}
{% if 0 == info.ui_configurable %}({{ 'configure_channel_in_env'|_ }}) {% endif %}
{% endif %}
{% if false == info.enabled or false == forcedAvailability[name] %}
⚠️ {{ trans('firefly.notification_channel_name_'~name) }} ({{ 'channel_not_available'|_ }})
{% endif %}
</li>
{% endfor %}
</ul>
<p>{{ 'pref_notifications_help'|_ }}</p>
{% for id, info in notifications %}
<div class="form-group">
<div class="col-sm-10">
<div class="checkbox">
<label>
<input {% if not info.configurable %}disabled{% endif %} type="checkbox" name="notification_{{ id }}" {{ info.enabled == true ? 'checked' : '' }} value="1">
{% if info.configurable %}
<input {% if not info.configurable %}readonly{% endif %} type="checkbox" name="notification_{{ id }}" {{ info.enabled == true ? 'checked' : '' }} value="1">
{% else %}
<input readonly disabled type="checkbox" checked value="1">
{% endif %}
{{ trans('firefly.pref_notification_' ~ id) }}
</label>
</div>
@@ -325,8 +345,8 @@
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="preferences-box">
<h3>{{ 'pref_notifications_settings'|_ }}</h3>
<p class="text-info">{{ 'pref_notifications_settings_help'|_ }}</p>
{{ ExpandedForm.text('slackUrl',slackUrl,{'label' : 'slack_url_label'|_, helpText: 'slack_discord_double'|_}) }}
<p>{{ 'pref_notifications_settings_help'|_ }}</p>
{{ ExpandedForm.text('slack_webhook_url',slackUrl,{'label' : 'slack_url_label'|_, helpText: 'slack_discord_double'|_}) }}
{{ ExpandedForm.text('pushover_app_token', pushoverAppToken, {}) }}
{{ ExpandedForm.text('pushover_user_token', pushoverUserToken, {}) }}
@@ -336,7 +356,18 @@
{{ ExpandedForm.checkbox('ntfy_auth','1', ntfyAuth, {}) }}
{{ ExpandedForm.text('ntfy_user', ntfyUser, {}) }}
{{ ExpandedForm.passwordWithValue('ntfy_pass', ntfyPass, {}) }}
<p>
{{ 'pref_notifications_settings_help'|_ }}
</p>
<div class="btn-group">
{% for name,info in channels %}
{% if true == info.enabled and true == forcedAvailability[name] %}
<a href="#" data-channel="{{ name }}" class="btn btn-default submit-test">
{{ trans('firefly.test_notification_channel_name_'~name) }}
</a>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
@@ -349,7 +380,7 @@
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="form-group">
<div class="col-sm-12">
<button type="submit" class="btn btn-success btn-lg">{{ 'pref_save_settings'|_ }}</button>
<button type="submit" name="form_submit" value="form_submit" class="btn btn-success btn-lg">{{ 'pref_save_settings'|_ }}</button>
</div>
</div>
</div>
@@ -357,6 +388,9 @@
</form>
{% endblock %}
{% block scripts %}
<script type="text/javascript" nonce="{{ JS_NONCE }}">
var postUrl = "{{ route('preferences.test-notification') }}";
</script>
<script type="text/javascript" src="v1/js/lib/modernizr-custom.js?v={{ FF_VERSION }}"
nonce="{{ JS_NONCE }}"></script>
<script type="text/javascript" src="v1/js/lib/jquery-ui.min.js?v={{ FF_VERSION }}" nonce="{{ JS_NONCE }}"></script>