diff --git a/client/components/users/userHeader.jade b/client/components/users/userHeader.jade index e095e5d3b..75a80dd64 100644 --- a/client/components/users/userHeader.jade +++ b/client/components/users/userHeader.jade @@ -25,10 +25,6 @@ template(name="memberMenuPopup") a.js-global-search(href="{{pathFor 'global-search'}}") i.fa.fa-search | {{_ 'globalSearch-title'}} - li - a.js-broken-cards(href="{{pathFor 'broken-cards'}}") - i.fa.fa-chain-broken - | {{_ 'broken-cards'}} li a(href="{{pathFor 'home'}}") span.fa.fa-home diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index a1fc2c473..df81a24c2 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -992,7 +992,7 @@ "move-swimlane": "Move Swimlane", "moveSwimlanePopup-title": "Move Swimlane", "creator": "Creator", - "filesReportTitle": "Attachments Report", + "filesReportTitle": "Files Report", "orphanedFilesReportTitle": "Orphaned Files Report", "reports": "Reports" } diff --git a/server/publications/attachments.js b/server/publications/attachments.js new file mode 100644 index 000000000..80ef954cc --- /dev/null +++ b/server/publications/attachments.js @@ -0,0 +1,60 @@ +import Attachments, { AttachmentStorage } from '/models/attachments'; +import { ObjectID } from 'bson'; + +Meteor.publish('attachmentsList', function() { + // eslint-disable-next-line no-console + // console.log('attachments:', AttachmentStorage.find()); + const files = AttachmentStorage.find( + {}, + { + fields: { + _id: 1, + filename: 1, + md5: 1, + length: 1, + contentType: 1, + metadata: 1, + }, + sort: { + filename: 1, + }, + limit: 250, + }, + ); + const attIds = []; + files.forEach(file => { + attIds.push(file._id._str); + }); + + return [ + files, + Attachments.find({ 'copies.attachments.key': { $in: attIds } }), + ]; +}); + +Meteor.publish('orphanedAttachments', function() { + let keys = []; + Attachments.find({}, { fields: { copies: 1 } }).forEach(att => { + keys.push(new ObjectID(att.copies.attachments.key)); + }); + keys.sort(); + keys = _.uniq(keys, true); + + return AttachmentStorage.find( + { _id: { $nin: keys } }, + { + fields: { + _id: 1, + filename: 1, + md5: 1, + length: 1, + contentType: 1, + metadata: 1, + }, + sort: { + filename: 1, + }, + limit: 250, + }, + ); +}); diff --git a/server/publications/cards.js b/server/publications/cards.js index 38395851c..5f0d42dba 100644 --- a/server/publications/cards.js +++ b/server/publications/cards.js @@ -45,8 +45,8 @@ import { PREDICATE_PUBLIC, PREDICATE_START_AT, PREDICATE_SYSTEM, -} from '../../config/search-const'; -import { QueryErrors, QueryParams, Query } from '../../config/query-classes'; +} from '/config/search-const'; +import { QueryErrors, QueryParams, Query } from '/config/query-classes'; const escapeForRegex = require('escape-string-regexp'); @@ -598,10 +598,8 @@ function findCards(sessionId, query) { // console.log('selector.$and:', query.selector.$and); // eslint-disable-next-line no-console // console.log('projection:', projection); - let cards; - // if (!query.hasErrors()) { - cards = Cards.find(query.selector, query.projection); - // } + + const cards = Cards.find(query.selector, query.projection); // eslint-disable-next-line no-console // console.log('count:', cards.count());