Explorar el Código

Using LINKED_CARDS_ENABLED

Guillaume hace 5 años
padre
commit
0a1e7006b3

+ 4 - 3
client/components/lists/listBody.jade

@@ -49,9 +49,10 @@ template(name="addCardForm")
     button.primary.confirm(type="submit") {{_ 'add'}}
     button.primary.confirm(type="submit") {{_ 'add'}}
     unless currentBoard.isTemplatesBoard
     unless currentBoard.isTemplatesBoard
       unless currentBoard.isTemplateBoard
       unless currentBoard.isTemplateBoard
-        span.quiet
-          | {{_ 'or'}}
-          a.js-link {{_ 'link'}}
+        if linkCardsEnabled
+          span.quiet
+            | {{_ 'or'}}
+            a.js-link {{_ 'link'}}
         span.quiet
         span.quiet
           |  
           |  
           | /
           | /

+ 11 - 0
client/components/lists/listBody.js

@@ -5,6 +5,17 @@ BlazeComponent.extendComponent({
   onCreated() {
   onCreated() {
     // for infinite scrolling
     // for infinite scrolling
     this.cardlimit = new ReactiveVar(InfiniteScrollIter);
     this.cardlimit = new ReactiveVar(InfiniteScrollIter);
+    this.linkCardsEnabled = new ReactiveVar(true);
+
+    Meteor.call('getLinkedCardsEnabled', (error, ret) => {
+      if (!error && ret) {
+        this.linkCardsEnabled.set(ret);
+      }
+    });
+  },
+
+  linkCardsEnabled() {
+    return this.linkCardsEnabled.get();
   },
   },
 
 
   mixins() {
   mixins() {

+ 12 - 1
server/publications/cards.js

@@ -1,4 +1,15 @@
 Meteor.publish('card', cardId => {
 Meteor.publish('card', cardId => {
   check(cardId, String);
   check(cardId, String);
-  return Cards.find({ _id: cardId });
+  if (process.env.LINKED_CARDS_ENABLED === 'true') {
+    return Cards.find({ _id: cardId });
+  } else {
+    // TODO: test
+    return Cards.find({
+      _id: cardId,
+      linkedId: {$ne: [
+        null,
+        ''
+      ]}
+    });
+  }
 });
 });