Merge pull request #2538 from webzwo0i/check-author-attribution
Check author attribution and fix clearAuthorship test
This commit is contained in:
commit
e47992f5b7
|
@ -656,12 +656,17 @@ function handleUserChanges(data, cb)
|
||||||
, op
|
, op
|
||||||
while(iterator.hasNext()) {
|
while(iterator.hasNext()) {
|
||||||
op = iterator.next()
|
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) {
|
op.attribs.split('*').forEach(function(attr) {
|
||||||
if(!attr) return
|
if(!attr) return
|
||||||
attr = wireApool.getAttrib(attr)
|
attr = wireApool.getAttrib(attr)
|
||||||
if(!attr) return
|
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);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,11 @@ describe("clear authorship colors button", function(){
|
||||||
var hasAuthorClass = inner$("div").first().attr("class").indexOf("author") !== -1;
|
var hasAuthorClass = inner$("div").first().attr("class").indexOf("author") !== -1;
|
||||||
expect(hasAuthorClass).to.be(false);
|
expect(hasAuthorClass).to.be(false);
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
var disconnectVisible = chrome$("div.disconnected").attr("class").indexOf("visible") === -1
|
||||||
|
expect(disconnectVisible).to.be(true);
|
||||||
|
},1000);
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue