From 50f3316088cdd833120650c78a003b0812144eae Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sun, 15 Sep 2024 19:40:49 +0300 Subject: [PATCH] Removed old models files that caused problems with login. Thanks to xet7 ! --- models/attachments_old.js | 101 -------------------------------------- models/avatars_old.js | 46 ----------------- 2 files changed, 147 deletions(-) delete mode 100644 models/attachments_old.js delete mode 100644 models/avatars_old.js diff --git a/models/attachments_old.js b/models/attachments_old.js deleted file mode 100644 index 7110b4a70..000000000 --- a/models/attachments_old.js +++ /dev/null @@ -1,101 +0,0 @@ -import { ReactiveCache } from '/imports/reactiveCache'; -import { Meteor } from 'meteor/meteor'; -import { FilesCollection } from 'meteor/ostrio:files'; -import { isFileValid } from './fileValidation'; -import { createBucket } from './lib/grid/createBucket'; -import fs from 'fs'; -import path from 'path'; - -if (Meteor.isServer) { - AttachmentsOld = createBucket('cfs_gridfs.attachments'); - -/* - - Meteor.startup(() => { - AttachmentsOld.files._ensureIndex({ cardId: 1 }); - }); - - AttachmentsOld.allow({ - insert(userId, doc) { - return allowIsBoardMember(userId, ReactiveCache.getBoard(doc.boardId)); - }, - update(userId, doc) { - return allowIsBoardMember(userId, ReactiveCache.getBoard(doc.boardId)); - }, - remove(userId, doc) { - return allowIsBoardMember(userId, ReactiveCache.getBoard(doc.boardId)); - }, - // We authorize the attachment download either: - // - if the board is public, everyone (even unconnected) can download it - // - if the board is private, only board members can download it - download(userId, doc) { - const board = ReactiveCache.getBoard(doc.boardId); - if (board.isPublic()) { - return true; - } else { - return board.hasMember(userId); - } - }, - - fetch: ['boardId'], - }); -} - -// XXX Enforce a schema for the AttachmentsOld CollectionFS - -if (Meteor.isServer) { - AttachmentsOld.files.after.insert((userId, doc) => { - // If the attachment doesn't have a source field - // or its source is different than import - if (!doc.source || doc.source !== 'import') { - // Add activity about adding the attachment - Activities.insert({ - userId, - type: 'card', - activityType: 'addAttachment', - attachmentId: doc._id, - // this preserves the name so that notifications can be meaningful after - // this file is removed - attachmentName: doc.original.name, - boardId: doc.boardId, - cardId: doc.cardId, - listId: doc.listId, - swimlaneId: doc.swimlaneId, - }); - } else { - // Don't add activity about adding the attachment as the activity - // be imported and delete source field - AttachmentsOld.update( - { - _id: doc._id, - }, - { - $unset: { - source: '', - }, - }, - ); - } - }); - - AttachmentsOld.files.before.remove((userId, doc) => { - Activities.insert({ - userId, - type: 'card', - activityType: 'deleteAttachment', - attachmentId: doc._id, - // this preserves the name so that notifications can be meaningful after - // this file is removed - attachmentName: doc.original.name, - boardId: doc.boardId, - cardId: doc.cardId, - listId: doc.listId, - swimlaneId: doc.swimlaneId, - }); - }); - -*/ - -} - -export default AttachmentsOld; diff --git a/models/avatars_old.js b/models/avatars_old.js deleted file mode 100644 index f7f561df7..000000000 --- a/models/avatars_old.js +++ /dev/null @@ -1,46 +0,0 @@ -import { ReactiveCache } from '/imports/reactiveCache'; -import { Meteor } from 'meteor/meteor'; -import { FilesCollection } from 'meteor/ostrio:files'; -import { isFileValid } from './fileValidation'; -import { createBucket } from './lib/grid/createBucket'; -import fs from 'fs'; -import path from 'path'; - -if (Meteor.isServer) { - AvatarsOld = createBucket('cfs_gridfs.avatars'); - -/* - -AvatarsOld = new FS.Collection('avatars', { - stores: [new FS.Store.GridFS('avatars')], - filter: { - maxSize: 72000, - allow: { - contentTypes: ['image/*'], - }, - }, -}); - -function isOwner(userId, file) { - return userId && userId === file.userId; -} - -AvatarsOld.allow({ - insert: isOwner, - update: isOwner, - remove: isOwner, - download() { - return true; - }, - fetch: ['userId'], -}); - -AvatarsOld.files.before.insert((userId, doc) => { - doc.userId = userId; -}); - -*/ - -}; - -export default AvatarsOld;