Browse Source

Code improvement

https://youtrack.weseek.co.jp/issue/GW-7759
- Remove all diffs in AdminCustomizeContainer
- Replace default value of attachmentType with required: true in attachment model
- Remove default value of attchmentType parameter from createAttachment method
mudana 3 years ago
parent
commit
4bd4156e2b

+ 2 - 0
packages/app/src/client/services/AdminCustomizeContainer.js

@@ -61,6 +61,7 @@ export default class AdminCustomizeContainer extends Container {
     this.switchPageListLimitationM = this.switchPageListLimitationM.bind(this);
     this.switchPageListLimitationL = this.switchPageListLimitationL.bind(this);
     this.switchPageListLimitationXL = this.switchPageListLimitationXL.bind(this);
+
   }
 
   /**
@@ -97,6 +98,7 @@ export default class AdminCustomizeContainer extends Container {
         currentCustomizeCss: customizeParams.customizeCss,
         currentCustomizeScript: customizeParams.customizeScript,
       });
+
       // search style name from object for display
       this.setState({ currentHighlightJsStyleName: this.state.highlightJsCssSelectorOptions[customizeParams.styleName].name });
     }

+ 1 - 1
packages/app/src/server/models/attachment.js

@@ -39,7 +39,7 @@ module.exports = function(crowi) {
     attachmentType: {
       type: String,
       enum: AttachmentType,
-      default: AttachmentType.WIKI_PAGE,
+      required: true,
     },
   }, {
     timestamps: { createdAt: true, updatedAt: false },

+ 1 - 3
packages/app/src/server/service/attachment.js

@@ -1,7 +1,5 @@
 import loggerFactory from '~/utils/logger';
 
-import { AttachmentType } from '../interfaces/attachment';
-
 const fs = require('fs');
 
 const mongoose = require('mongoose');
@@ -18,7 +16,7 @@ class AttachmentService {
     this.crowi = crowi;
   }
 
-  async createAttachment(file, user, pageId = null, attachmentType = AttachmentType.WIKI_PAGE) {
+  async createAttachment(file, user, pageId = null, attachmentType) {
     const { fileUploadService } = this.crowi;
 
     // check limit