itizawa 6 лет назад
Родитель
Сommit
13b8ceb611

+ 3 - 3
src/client/js/components/Admin/Notification/SlackAppConfiguration.jsx

@@ -72,7 +72,7 @@ class SlackAppConfiguration extends React.Component {
                 <input
                   className="form-control"
                   type="text"
-                  defaultValue={adminNotificationContainer.state.webhookUrl}
+                  defaultValue={adminNotificationContainer.state.webhookUrl || ''}
                   onChange={e => adminNotificationContainer.changeWebhookUrl(e.target.value)}
                 />
               </div>
@@ -84,7 +84,7 @@ class SlackAppConfiguration extends React.Component {
                   <input
                     id="cbPrioritizeIWH"
                     type="checkbox"
-                    checked={adminNotificationContainer.state.isIncomingWebhookPrioritized}
+                    checked={adminNotificationContainer.state.isIncomingWebhookPrioritized || false}
                     onChange={() => { adminNotificationContainer.switchIsIncomingWebhookPrioritized() }}
                   />
                   <label htmlFor="cbPrioritizeIWH">
@@ -123,7 +123,7 @@ class SlackAppConfiguration extends React.Component {
                   <input
                     className="form-control"
                     type="text"
-                    defaultValue={adminNotificationContainer.state.slackToken}
+                    defaultValue={adminNotificationContainer.state.slackToken || ''}
                     onChange={e => adminNotificationContainer.changeSlackToken(e.target.value)}
                   />
                 </div>

+ 2 - 1
src/client/js/components/Admin/Notification/UserTriggerNotification.jsx

@@ -78,6 +78,7 @@ class UserTriggerNotification extends React.Component {
 
   render() {
     const { t, adminNotificationContainer } = this.props;
+    const userNotifications = adminNotificationContainer.state.userNotifications || [];
 
     return (
       <React.Fragment>
@@ -123,7 +124,7 @@ class UserTriggerNotification extends React.Component {
                 <button type="button" className="btn btn-primary" disabled={!this.validateForm()} onClick={this.onClickSubmit}>{t('add')}</button>
               </td>
             </tr>
-            {adminNotificationContainer.state.userNotifications.map((notification) => {
+            {userNotifications.map((notification) => {
               return <UserNotificationRow notification={notification} onClickDeleteBtn={this.onClickDeleteBtn} key={notification._id} />;
             })
             }

+ 5 - 5
src/client/js/services/AdminNotificationContainer.js

@@ -47,13 +47,13 @@ export default class AdminNotificationContainer extends Container {
       const { notificationParams } = response.data;
 
       this.setState({
-        webhookUrl: notificationParams.webhookUrl || '',
-        isIncomingWebhookPrioritized: notificationParams.isIncomingWebhookPrioritized || false,
-        slackToken: notificationParams.slackToken || '',
-        userNotifications: notificationParams.userNotifications || [],
+        webhookUrl: notificationParams.webhookUrl,
+        isIncomingWebhookPrioritized: notificationParams.isIncomingWebhookPrioritized,
+        slackToken: notificationParams.slackToken,
+        userNotifications: notificationParams.userNotifications,
         isNotificationOwnerPageEnabled: notificationParams.isNotificationOwnerPageEnabled,
         isNotificationGroupPageEnabled: notificationParams.isNotificationGroupPageEnabled,
-        globalNotifications: notificationParams.globalNotifications || [],
+        globalNotifications: notificationParams.globalNotifications,
       });
 
     }