Browse Source

Merge pull request #2834 from Akuket/master

Issue #2688
Lauri Ojansivu 5 years ago
parent
commit
492ed2bdc2

+ 1 - 0
Dockerfile

@@ -111,6 +111,7 @@ ENV BUILD_DEPS="apt-utils libarchive-tools gnupg gosu wget curl bzip2 g++ build-
     CORS_ALLOW_HEADERS="" \
     CORS_EXPOSE_HEADERS="" \
     DEFAULT_AUTHENTICATION_METHOD=""
+    LINKED_CARDS_ENABLED=true
 
 # Copy the app to the image
 COPY ${SRC_PATH} /home/wekan/app

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

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

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

@@ -5,6 +5,17 @@ BlazeComponent.extendComponent({
   onCreated() {
     // for infinite scrolling
     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() {

+ 3 - 1
docker-compose.yml

@@ -559,7 +559,9 @@ services:
       # example : LOGOUT_ON_MINUTES=55
       #- LOGOUT_ON_MINUTES=
       #-------------------------------------------------------------------
-
+      # LINKED_CARDS_ENABLED : Enable or not the linked cards feature
+      # example : LINKED_CARDS_ENABLED=false
+      - LINKED_CARDS_ENABLED=true
     depends_on:
       - wekandb
 

+ 4 - 0
models/settings.js

@@ -334,6 +334,10 @@ if (Meteor.isServer) {
     getDefaultAuthenticationMethod() {
       return process.env.DEFAULT_AUTHENTICATION_METHOD;
     },
+
+    getLinkedCardsEnabled() {
+      return process.env.LINKED_CARDS_ENABLED === 'true';
+    }
   });
 }
 

+ 12 - 1
server/publications/cards.js

@@ -1,4 +1,15 @@
 Meteor.publish('card', cardId => {
   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,
+        ''
+      ]}
+    });
+  }
 });

File diff suppressed because it is too large
+ 0 - 0
snap-src/bin/config


+ 4 - 0
snap-src/bin/wekan-help

@@ -444,6 +444,10 @@ echo -e "Default authentication method."
 echo -e "The default authentication method used if a user does not exist to create and authenticate. Method can be password or ldap."
 echo -e "\t$ snap set $SNAP_NAME default-authentication-method='ldap'"
 echo -e "\n"
+echo -e "Linked cards enabled."
+echo -e "Enable or not the linked cards feature."
+echo -e "\t$ snap set $SNAP_NAME linked-cards-enabled='false'"
+echo -e "\n"
 # parse config file for supported settings keys
 echo -e "wekan supports settings keys"
 echo -e "values can be changed by calling\n$ snap set $SNAP_NAME <key name>='<key value>'"

Some files were not shown because too many files changed in this diff