From 5f9bbd0666026253beb4eb6e8f95d54fcbc573d0 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 21 Jan 2015 00:03:39 +0000 Subject: [PATCH 1/3] restrict expor4t to only expose this pad ID --- src/node/utils/ExportEtherpad.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node/utils/ExportEtherpad.js b/src/node/utils/ExportEtherpad.js index 36df452da..4f91e4e39 100644 --- a/src/node/utils/ExportEtherpad.js +++ b/src/node/utils/ExportEtherpad.js @@ -48,6 +48,7 @@ exports.getPadRaw = function(padId, callback){ // Get the author info db.get("globalAuthor:"+authorId, function(e, authorEntry){ + authorEntry.padIDs = padId; if(!e) data["globalAuthor:"+authorId] = authorEntry; }); From cb6522499734afe156d1e5b660858d93645fb8c6 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 21 Jan 2015 00:28:00 +0000 Subject: [PATCH 2/3] better logic for author handling --- src/node/utils/ImportEtherpad.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/node/utils/ImportEtherpad.js b/src/node/utils/ImportEtherpad.js index 8daeb5363..1574a3a9d 100644 --- a/src/node/utils/ImportEtherpad.js +++ b/src/node/utils/ImportEtherpad.js @@ -24,12 +24,25 @@ exports.setPadRaw = function(padId, records, callback){ async.eachSeries(Object.keys(records), function(key, cb){ var value = records[key] - // we know its an author + // Author data if(value.padIDs){ // rewrite author pad ids value.padIDs[padId] = 1; var newKey = key; + // Does this author already exist? + db.get(key, function(err, author){ + if(author){ + // Yes, add the padID to the author.. + author.padIDs.push(padId); + value = author; + }else{ + // No, create a new array with the author info in + value.padIDs = [padId]; + } + }); + + // Not author data, probably pad data }else{ // we can split it to look to see if its pad data var oldPadId = key.split(":"); From cbeb464358c231b204751e580184365e0a1467f1 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 21 Jan 2015 01:16:12 +0000 Subject: [PATCH 3/3] ie now uses keydown --- tests/frontend/specs/bold.js | 3 +-- tests/frontend/specs/caret.js | 2 +- tests/frontend/specs/indentation.js | 2 +- tests/frontend/specs/italic.js | 2 +- tests/frontend/specs/redo.js | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/frontend/specs/bold.js b/tests/frontend/specs/bold.js index 703d0815a..bffb281b5 100644 --- a/tests/frontend/specs/bold.js +++ b/tests/frontend/specs/bold.js @@ -43,9 +43,8 @@ describe("bold button", function(){ //select this text element $firstTextElement.sendkeys('{selectall}'); - console.log(inner$(window)[0].bowser); - if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser + if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE var evtType = "keypress"; }else{ var evtType = "keydown"; diff --git a/tests/frontend/specs/caret.js b/tests/frontend/specs/caret.js index 48dd94a66..6e68b6f52 100644 --- a/tests/frontend/specs/caret.js +++ b/tests/frontend/specs/caret.js @@ -297,7 +297,7 @@ function prepareDocument(n, target){ // generates a random document with random } function keyEvent(target, charCode, ctrl, shift){ // sends a charCode to the window - if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser + if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE var evtType = "keypress"; }else{ var evtType = "keydown"; diff --git a/tests/frontend/specs/indentation.js b/tests/frontend/specs/indentation.js index 3730f6bf5..c8f2cee81 100644 --- a/tests/frontend/specs/indentation.js +++ b/tests/frontend/specs/indentation.js @@ -15,7 +15,7 @@ describe("indentation button", function(){ //select this text element $firstTextElement.sendkeys('{selectall}'); - if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser + if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE var evtType = "keypress"; }else{ var evtType = "keydown"; diff --git a/tests/frontend/specs/italic.js b/tests/frontend/specs/italic.js index 955cec0fd..4ef4b4085 100644 --- a/tests/frontend/specs/italic.js +++ b/tests/frontend/specs/italic.js @@ -44,7 +44,7 @@ describe("italic some text", function(){ //select this text element $firstTextElement.sendkeys('{selectall}'); - if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser + if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE var evtType = "keypress"; }else{ var evtType = "keydown"; diff --git a/tests/frontend/specs/redo.js b/tests/frontend/specs/redo.js index 99056fb75..00873d14a 100644 --- a/tests/frontend/specs/redo.js +++ b/tests/frontend/specs/redo.js @@ -47,7 +47,7 @@ describe("undo button then redo button", function(){ var modifiedValue = $firstTextElement.text(); // get the modified value expect(modifiedValue).not.to.be(originalValue); // expect the value to change - if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser + if(inner$(window)[0].bowser.firefox || inner$(window)[0].bowser.msie){ // if it's a mozilla or IE var evtType = "keypress"; }else{ var evtType = "keydown";