Shun Miyazawa 3 лет назад
Родитель
Сommit
45d78a6e14
1 измененных файлов с 3 добавлено и 13 удалено
  1. 3 13
      packages/app/src/server/middlewares/certify-brand-logo.ts

+ 3 - 13
packages/app/src/server/middlewares/certify-brand-logo.ts

@@ -1,23 +1,13 @@
-import loggerFactory from '~/utils/logger';
-
-
-const logger = loggerFactory('growi:middleware:certify-brand-logo-fire');
+import { AttachmentType } from '~/server/interfaces/attachment';
 
 module.exports = (crowi) => {
 
   return async(req, res, next) => {
 
-    const fileId = req.params.id || null;
-
     const Attachment = crowi.model('Attachment');
+    const attachment = await Attachment.findOne({ attachmentType: AttachmentType.BRAND_LOGO });
 
-    const attachment = await Attachment.findOne({ _id: fileId });
-
-    if (attachment == null) {
-      return next();
-    }
-
-    if (attachment.isBrandLogo()) {
+    if (attachment != null) {
       req.isBrandLogo = true;
     }