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

support deletion for attachment which has no creator

Yuki Takei 5 лет назад
Родитель
Сommit
5915ecac90
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      src/server/routes/attachment.js

+ 5 - 0
src/server/routes/attachment.js

@@ -154,6 +154,11 @@ module.exports = function(crowi, app) {
    * @param {Attachment} attachment
    */
   async function isDeletableByUser(user, attachment) {
+    // deletable if creator is null
+    if (attachment.creator == null) {
+      return true;
+    }
+
     const ownerId = attachment.creator._id || attachment.creator;
     if (attachment.page == null) { // when profile image
       return user.id === ownerId.toString();