This commit is contained in:
Harshil Sharma 2023-06-16 16:02:53 +05:30
parent 81dd44ae09
commit 0b591264b2
7 changed files with 20 additions and 7 deletions

View file

@ -9,7 +9,7 @@ import {MM_TABLES} from '@constants/database';
import {queryGroupsByNames} from './group';
import {querySavedPostsPreferences} from './preference';
import {getConfigValue, observeConfigBooleanValue} from './system';
import {getConfigValue, observeConfigBooleanValue, observeConfigIntValue, observeConfigValue} from './system';
import {queryUsersByUsername, observeUser, observeCurrentUser} from './user';
import type PostModel from '@typings/database/models/servers/post';

View file

@ -6,14 +6,19 @@ import withObservables from '@nozbe/with-observables';
import {observeIsPostAcknowledgementsEnabled, observePersistentNotificationsEnabled} from '@queries/servers/post';
import {observeConfigIntValue} from '../../queries/servers/system';
import PostPriorityPicker from './post_priority_picker';
import type {Database} from '@nozbe/watermelondb';
const enhanced = withObservables([], ({database}: {database: Database}) => {
const persistentNotificationInterval = observeConfigIntValue(database, 'PersistentNotificationIntervalMinutes');
return {
isPostAcknowledgementEnabled: observeIsPostAcknowledgementsEnabled(database),
isPersistenNotificationsEnabled: observePersistentNotificationsEnabled(database),
persistentNotificationInterval,
};
});

View file

@ -35,6 +35,7 @@ type Props = {
postPriority: PostPriority;
updatePostPriority: (data: PostPriority) => void;
closeButtonId: string;
persistentNotificationInterval: number;
};
const TITLE_HEIGHT = 30; // typography 600 line height
@ -83,6 +84,7 @@ const PostPriorityPicker = ({
componentId,
isPostAcknowledgementEnabled,
isPersistenNotificationsEnabled,
persistentNotificationInterval,
postPriority,
updatePostPriority,
closeButtonId,
@ -201,7 +203,12 @@ const PostPriorityPicker = ({
<PickerOption
action={handleUpdatePersistentNotifications}
label={intl.formatMessage(labels.persistentNotifications.label)}
description={intl.formatMessage(labels.persistentNotifications.description)}
description={intl.formatMessage(
labels.persistentNotifications.description,
{
interval: persistentNotificationInterval,
},
)}
icon='bell-ring-outline'
type='toggle'
selected={data.persistent_notifications}

View file

@ -29,7 +29,7 @@ export const labels = {
},
description: {
id: t('post_priority.picker.label.request_ack.description'),
defaultMessage: 'An acknowledgement button appears with your message.',
defaultMessage: 'An acknowledgement button will appear with your message',
},
},
persistentNotifications: {
@ -39,7 +39,7 @@ export const labels = {
},
description: {
id: t('post_priority.picker.label.persistent_notifications.description'),
defaultMessage: 'Recipients are notified every five minutes until they acknowledge or reply.',
defaultMessage: 'Recipients are notified every {interval, plural, one {minute} other {{interval} minutes}} minutes until they acknowledge or reply.',
},
},
};

View file

@ -844,9 +844,9 @@
"post_priority.picker.cancel": "Cancel",
"post_priority.picker.label.important": "Important",
"post_priority.picker.label.persistent_notifications": "Send persistent notifications",
"post_priority.picker.label.persistent_notifications.description": "Recipients are notified every five minutes until they acknowledge or reply.",
"post_priority.picker.label.persistent_notifications.description": "Recipients are notified every {interval, plural, one {minute} other {{interval} minutes}} until they acknowledge or reply.",
"post_priority.picker.label.request_ack": "Request acknowledgement",
"post_priority.picker.label.request_ack.description": "Recipients are notified every five minutes until they acknowledge or reply.",
"post_priority.picker.label.request_ack.description": "An acknowledgement button will appear with your message",
"post_priority.picker.label.standard": "Standard",
"post_priority.picker.label.urgent": "Urgent",
"post_priority.picker.title": "Message priority",

2
package-lock.json generated
View file

@ -26182,7 +26182,7 @@
"resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
"integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==",
"requires": {
"@types/react": "^18.0.35",
"@types/react": "*",
"hoist-non-react-statics": "^3.3.0"
}
},

View file

@ -159,6 +159,7 @@ interface ClientConfig {
PersistentNotificationMaxRecipients: string;
PersistentNotificationInterval: string;
AllowPersistentNotificationsForGuests: string;
PersistentNotificationIntervalMinutes: string;
PrivacyPolicyLink: string;
ReportAProblemLink: string;
RequireEmailVerification: string;