feat(notif): Notification improvements (#914)

This commit is contained in:
TheCatLady
2021-02-12 08:27:11 -05:00
committed by GitHub
parent 7d3da1a1d2
commit 2768155bba
14 changed files with 252 additions and 205 deletions

View File

@@ -204,12 +204,10 @@ const NotificationsEmail: React.FC = () => {
</div>
<div className="form-row">
<label htmlFor="secure" className="checkbox-label">
<div className="flex flex-col">
<span>{intl.formatMessage(messages.enableSsl)}</span>
<span className="text-gray-500">
{intl.formatMessage(messages.ssldisabletip)}
</span>
</div>
<span>{intl.formatMessage(messages.enableSsl)}</span>
<span className="label-tip">
{intl.formatMessage(messages.ssldisabletip)}
</span>
</label>
<div className="form-input">
<Field type="checkbox" id="secure" name="secure" />

View File

@@ -28,6 +28,8 @@ const messages = defineMessages({
Additionally, you need the chat ID for the chat you want the bot to send notifications to.\
You can do this by adding <GetIdBotLink>@get_id_bot</GetIdBotLink> to the chat or group chat.',
notificationtypes: 'Notification Types',
sendSilently: 'Send Silently',
sendSilentlyTip: 'Send notifications with no sound',
});
const NotificationsTelegram: React.FC = () => {
@@ -57,6 +59,7 @@ const NotificationsTelegram: React.FC = () => {
types: data?.types,
botAPI: data?.options.botAPI,
chatId: data?.options.chatId,
sendSilently: data?.options.sendSilently,
}}
validationSchema={NotificationsTelegramSchema}
onSubmit={async (values) => {
@@ -67,6 +70,7 @@ const NotificationsTelegram: React.FC = () => {
options: {
botAPI: values.botAPI,
chatId: values.chatId,
sendSilently: values.sendSilently,
},
});
addToast(intl.formatMessage(messages.telegramsettingssaved), {
@@ -91,6 +95,7 @@ const NotificationsTelegram: React.FC = () => {
options: {
botAPI: values.botAPI,
chatId: values.chatId,
sendSilently: values.sendSilently,
},
});
@@ -178,6 +183,21 @@ const NotificationsTelegram: React.FC = () => {
)}
</div>
</div>
<div className="form-row">
<label htmlFor="sendSilently" className="checkbox-label">
<span>{intl.formatMessage(messages.sendSilently)}</span>
<span className="label-tip">
{intl.formatMessage(messages.sendSilentlyTip)}
</span>
</label>
<div className="form-input">
<Field
type="checkbox"
id="sendSilently"
name="sendSilently"
/>
</div>
</div>
<div
role="group"
aria-labelledby="group-label"

View File

@@ -29,6 +29,9 @@ const defaultPayload = {
status4k: '{{media_status4k}}',
},
'{{extra}}': [],
'{{request}}': {
request_id: '{{request_id}}',
},
};
const messages = defineMessages({

View File

@@ -287,6 +287,8 @@
"components.Settings.Notifications.notificationtypes": "Notification Types",
"components.Settings.Notifications.save": "Save Changes",
"components.Settings.Notifications.saving": "Saving…",
"components.Settings.Notifications.sendSilently": "Send Silently",
"components.Settings.Notifications.sendSilentlyTip": "Send notifications with no sound",
"components.Settings.Notifications.senderName": "Sender Name",
"components.Settings.Notifications.settinguptelegram": "Setting Up Telegram Notifications",
"components.Settings.Notifications.settinguptelegramDescription": "To set up Telegram, you need to <CreateBotLink>create a bot</CreateBotLink> and get the bot API key. Additionally, you need the chat ID for the chat you want the bot to send notifications to. You can do this by adding <GetIdBotLink>@get_id_bot</GetIdBotLink> to the chat or group chat.",