Просмотр исходного кода

don't show SlackNotification if hasSlackConfig = false

sou 7 лет назад
Родитель
Сommit
ca3821746d
2 измененных файлов с 5 добавлено и 1 удалено
  1. 1 0
      lib/models/config.js
  2. 4 1
      resource/js/components/PageComment/CommentForm.js

+ 1 - 0
lib/models/config.js

@@ -564,6 +564,7 @@ module.exports = function(crowi) {
       attrWhiteList: Config.attrWhiteList(config),
       attrWhiteList: Config.attrWhiteList(config),
       highlightJsStyleBorder: Config.highlightJsStyleBorder(config),
       highlightJsStyleBorder: Config.highlightJsStyleBorder(config),
       isSavedStatesOfTabChanges: Config.isSavedStatesOfTabChanges(config),
       isSavedStatesOfTabChanges: Config.isSavedStatesOfTabChanges(config),
+      hasSlackConfig: Config.hasSlackConfig(config),
       env: {
       env: {
         PLANTUML_URI: env.PLANTUML_URI || null,
         PLANTUML_URI: env.PLANTUML_URI || null,
         BLOCKDIAG_URI: env.BLOCKDIAG_URI || null,
         BLOCKDIAG_URI: env.BLOCKDIAG_URI || null,

+ 4 - 1
resource/js/components/PageComment/CommentForm.js

@@ -40,6 +40,7 @@ export default class CommentForm extends React.Component {
       isUploadable,
       isUploadable,
       isUploadableFile,
       isUploadableFile,
       errorMessage: undefined,
       errorMessage: undefined,
+      hasSlackConfig: config.hasSlackConfig,
     };
     };
 
 
     this.growiRenderer = new GrowiRenderer(this.props.crowi, this.props.crowiOriginRenderer, {mode: 'comment'});
     this.growiRenderer = new GrowiRenderer(this.props.crowi, this.props.crowiOriginRenderer, {mode: 'comment'});
@@ -259,7 +260,9 @@ export default class CommentForm extends React.Component {
                   { this.state.errorMessage &&
                   { this.state.errorMessage &&
                     <span className="text-danger text-right mr-2">{this.state.errorMessage}</span>
                     <span className="text-danger text-right mr-2">{this.state.errorMessage}</span>
                   }
                   }
-                  <SlackNotification crowi={this.props.crowi} pageId={this.props.pageId} pagePath={this.props.pagePath} ref={(slackRef) => {this.slackRef = slackRef}} />
+                  { this.state.hasSlackConfig &&
+                    <SlackNotification crowi={this.props.crowi} pageId={this.props.pageId} pagePath={this.props.pagePath} ref={(slackRef) => {this.slackRef = slackRef}} />
+                  }
                   <Button type="submit" value="Submit" bsStyle="primary" className="fcbtn btn btn-sm btn-primary btn-outline btn-rounded btn-1b">
                   <Button type="submit" value="Submit" bsStyle="primary" className="fcbtn btn btn-sm btn-primary btn-outline btn-rounded btn-1b">
                     Comment
                     Comment
                   </Button>
                   </Button>