diff options
-rw-r--r-- | .meteor/packages | 2 | ||||
-rw-r--r-- | .meteor/versions | 3 | ||||
-rw-r--r-- | client/components/boards/boardHeader.js | 2 | ||||
-rw-r--r-- | models/export.js | 28 | ||||
-rw-r--r-- | server/lib/utils.js | 21 |
5 files changed, 19 insertions, 37 deletions
diff --git a/.meteor/packages b/.meteor/packages index 1756f8a8..f6e11fcf 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -68,7 +68,7 @@ mquandalle:jquery-textcomplete mquandalle:jquery-ui-drag-drop-sort mquandalle:mousetrap-bindglobal mquandalle:perfect-scrollbar -peerlibrary:blaze-components +peerlibrary:blaze-components@=0.15.1 perak:markdown seriousm:emoji-continued templates:tabs diff --git a/.meteor/versions b/.meteor/versions index f1a18b05..e4c0af1a 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -110,9 +110,8 @@ ongoworks:speakingurl@1.1.0 ordered-dict@1.0.4 peerlibrary:assert@0.2.5 peerlibrary:base-component@0.14.0 -peerlibrary:blaze-components@0.16.2 +peerlibrary:blaze-components@0.15.1 peerlibrary:computed-field@0.3.1 -peerlibrary:data-lookup@0.1.0 peerlibrary:reactive-field@0.1.0 perak:markdown@1.0.5 promise@0.5.2-faster-rebuild.0 diff --git a/client/components/boards/boardHeader.js b/client/components/boards/boardHeader.js index 567f14ac..055b6f27 100644 --- a/client/components/boards/boardHeader.js +++ b/client/components/boards/boardHeader.js @@ -19,7 +19,7 @@ Template.boardMenuPopup.helpers({ exportUrl() { const boardId = Session.get('currentBoard'); const loginToken = Accounts._storedLoginToken(); - return Meteor.absoluteUrl(`api/boards/${boardId}?authToken=${loginToken}`); + return FlowRouter.url(`api/boards/${boardId}?authToken=${loginToken}`); }, exportFilename() { const boardId = Session.get('currentBoard'); diff --git a/models/export.js b/models/export.js index 3d8ee99e..b774cf15 100644 --- a/models/export.js +++ b/models/export.js @@ -2,8 +2,10 @@ if(Meteor.isServer) { // todo XXX once we have a real API in place, move that route there // todo XXX also share the route definition between the client and the server - // so that we could use something like ApiRoutes.path('boards/export', boardId) - // on the client instead of copy/pasting the route path manually between the client and the server. + // so that we could use something like + // `ApiRoutes.path('boards/export', boardId)`` + // on the client instead of copy/pasting the route path manually between the + // client and the server. /* * This route is used to export the board FROM THE APPLICATION. * If user is already logged-in, pass loginToken as param "authToken": @@ -29,8 +31,8 @@ if(Meteor.isServer) { if(exporter.canExport(user)) { JsonRoutes.sendResult(res, 200, exporter.build()); } else { - // we could send an explicit error message, but on the other hand the only way to - // get there is by hacking the UI so let's keep it raw. + // we could send an explicit error message, but on the other hand the only + // way to get there is by hacking the UI so let's keep it raw. JsonRoutes.sendResult(res, 403); } }); @@ -54,14 +56,16 @@ class Exporter { result.comments = CardComments.find(byBoard, noBoardId).fetch(); result.activities = Activities.find(byBoard, noBoardId).fetch(); // for attachments we only export IDs and absolute url to original doc - result.attachments = Attachments.find(byBoard).fetch().map((attachment) => { return { - _id: attachment._id, - cardId: attachment.cardId, - url: Meteor.absoluteUrl(Utils.stripLeadingSlash(attachment.url())), - };}); + result.attachments = Attachments.find(byBoard).fetch().map((attachment) => { + return { + _id: attachment._id, + cardId: attachment.cardId, + url: FlowRouter.url(attachment.url()), + }; + }); - // we also have to export some user data - as the other elements only include id - // but we have to be careful: + // we also have to export some user data - as the other elements only + // include id but we have to be careful: // 1- only exports users that are linked somehow to that board // 2- do not export any sensitive information const users = {}; @@ -88,7 +92,7 @@ class Exporter { result.users = Users.find(byUserIds, userFields).fetch().map((user) => { // user avatar is stored as a relative url, we export absolute if(user.profile.avatarUrl) { - user.profile.avatarUrl = Meteor.absoluteUrl(Utils.stripLeadingSlash(user.profile.avatarUrl)); + user.profile.avatarUrl = FlowRouter.url(user.profile.avatarUrl); } return user; }); diff --git a/server/lib/utils.js b/server/lib/utils.js index a6a84f90..b59671fb 100644 --- a/server/lib/utils.js +++ b/server/lib/utils.js @@ -5,24 +5,3 @@ allowIsBoardAdmin = function(userId, board) { allowIsBoardMember = function(userId, board) { return board && board.hasMember(userId); }; - -// todo XXX not really server-specific, -// so move it to a common (client+server) lib? -Utils = { - /** - * If text starts with a / will remove it. - * @param text - */ - stripLeadingSlash(text) { - // we need an actual text string - if (!text) { - return text; - } - // if starting with slash - if (text[0] === '/') { - return text.slice(1); - } - // otherwise leave untouched - return text; - }, -}; |