Browse Source

Step 11.4: Update renderTasks to pass in showPrivateButton.

Frederic G. MARAND 8 years ago
parent
commit
04a4e9c1c6
1 changed files with 9 additions and 1 deletions
  1. 9 1
      App.jsx

+ 9 - 1
App.jsx

@@ -34,9 +34,17 @@ App = React.createClass({
   },
 
   renderTasks() {
+    // Get tasks from this.data.tasks.
     return this.data.tasks.map((task) => {
+      const currentUserId = this.data.currentUser && this.data.currentUser._id;
+      const showPrivateButton = task.owner === currentUserId;
+
       // Meteor._debug(task._id);
-      return <Task key={task._id} task={task} />;
+      return <Task
+        key={task._id}
+        task={task}
+        showPrivateButton={showPrivateButton}
+      />;
     });
   },