Prechádzať zdrojové kódy

W4.3: fixing 2 bugs with current doc and editing users.

Frederic G. MARAND 8 rokov pred
rodič
commit
9beeaf07f6
2 zmenil súbory, kde vykonal 4 pridanie a 4 odobranie
  1. 2 2
      client/main.js
  2. 2 2
      shared/main.js

+ 2 - 2
client/main.js

@@ -24,7 +24,7 @@ Template.editor.helpers({
         let $preview = $("#viewer_iframe");
         // Send the current code over to the iframe for rendering.
         $preview.contents().find("html").html(cmEditor.getValue());
-        Meteor.call("addEditingUser");
+        Meteor.call("addEditingUser", Session.get("docid"));
       });
     };
   }
@@ -33,7 +33,7 @@ Template.editor.helpers({
 Template.editingUsers.helpers({
   // Retrieve a list of users that are editing this document.
   users: function () {
-    let doc = Documents.findOne();
+    let doc = Documents.findOne({ _id: Session.get("docid") });
     if (!doc) {
       // Give up.
       return null;

+ 2 - 2
shared/main.js

@@ -33,8 +33,8 @@ Meteor.methods({
   },
 
   // Adding editors to a document.
-  addEditingUser: function () {
-    let doc = Documents.findOne();
+  addEditingUser: function (docid) {
+    let doc = Documents.findOne({ _id: docid });
     if (!doc) {
       // No doc: give up.
       return;