diff options
author | John McLear <john@mclear.co.uk> | 2015-03-31 23:14:22 +0100 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2015-03-31 23:14:22 +0100 |
commit | e47992f5b7ec89b5798b9715643f768355dbc463 (patch) | |
tree | 7447014ba09c67b94c37af1558c991c70a4ab63d | |
parent | 64a89a3ec0b3eeb5f813ce6655b8175fc3d72767 (diff) | |
parent | 547046830e0808b86dcde94b4e8f6da9206ddb89 (diff) | |
download | etherpad-lite-e47992f5b7ec89b5798b9715643f768355dbc463.zip |
Merge pull request #2538 from webzwo0i/check-author-attribution
Check author attribution and fix clearAuthorship test
-rw-r--r-- | src/node/handler/PadMessageHandler.js | 9 | ||||
-rw-r--r-- | tests/frontend/specs/clear_authorship_colors.js | 5 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 7ea5039d..ef8e32b0 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -656,12 +656,17 @@ function handleUserChanges(data, cb) , op while(iterator.hasNext()) { op = iterator.next() - if(op.opcode != '+') continue; + + //+ can add text with attribs + //= can change or add attribs + //- can have attribs, but they are discarded and don't show up in the attribs - but do show up in the pool + op.attribs.split('*').forEach(function(attr) { if(!attr) return attr = wireApool.getAttrib(attr) if(!attr) return - if('author' == attr[0] && attr[1] != thisSession.author) throw new Error("Trying to submit changes as another author in changeset "+changeset); + //the empty author is used in the clearAuthorship functionality so this should be the only exception + if('author' == attr[0] && (attr[1] != thisSession.author && attr[1] != '')) throw new Error("Trying to submit changes as another author in changeset "+changeset); }) } diff --git a/tests/frontend/specs/clear_authorship_colors.js b/tests/frontend/specs/clear_authorship_colors.js index 5db35612..1417f63c 100644 --- a/tests/frontend/specs/clear_authorship_colors.js +++ b/tests/frontend/specs/clear_authorship_colors.js @@ -47,6 +47,11 @@ describe("clear authorship colors button", function(){ var hasAuthorClass = inner$("div").first().attr("class").indexOf("author") !== -1; expect(hasAuthorClass).to.be(false); + setTimeout(function(){ + var disconnectVisible = chrome$("div.disconnected").attr("class").indexOf("visible") === -1 + expect(disconnectVisible).to.be(true); + },1000); + done(); }); |