Commit da17c8cc authored by Randall Leeds's avatar Randall Leeds

Merge pull request #1584 from hypothesis/public-replies

Make replies public by default 
parents 0f0e3c6f c23fcf7d
...@@ -159,7 +159,12 @@ AnnotationController = [ ...@@ -159,7 +159,12 @@ AnnotationController = [
# Construct the reply. # Construct the reply.
references = [references..., id] references = [references..., id]
reply = {references, uri}
# If replying to a public annotation make the response public.
if 'group:__world__' in model.permissions.read or []
permissions = {read: ['group:__world__']}
reply = {references, uri, permissions}
annotator.publish 'beforeAnnotationCreated', reply annotator.publish 'beforeAnnotationCreated', reply
###* ###*
......
// Generated by CoffeeScript 1.6.3 // Generated by CoffeeScript 1.6.3
/* /*
** Annotator 1.2.6-dev-9e0eff3 ** Annotator 1.2.6-dev-7c7b224
** https://github.com/okfn/annotator/ ** https://github.com/okfn/annotator/
** **
** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning. ** Copyright 2012 Aron Carroll, Rufus Pollock, and Nick Stenning.
** Dual licensed under the MIT and GPLv3 licenses. ** Dual licensed under the MIT and GPLv3 licenses.
** https://github.com/okfn/annotator/blob/master/LICENSE ** https://github.com/okfn/annotator/blob/master/LICENSE
** **
** Built at: 2014-09-25 22:40:57Z ** Built at: 2014-10-22 19:46:29Z
*/ */
...@@ -145,8 +145,18 @@ ...@@ -145,8 +145,18 @@
}; };
Permissions.prototype.addFieldsToAnnotation = function(annotation) { Permissions.prototype.addFieldsToAnnotation = function(annotation) {
var key, _i, _len, _ref;
if (annotation) { if (annotation) {
annotation.permissions = this.options.permissions; if (!annotation.permissions) {
annotation.permissions = {};
}
_ref = ['read', 'update', 'delete', 'admin'];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
if (!annotation.permissions.hasOwnProperty(key)) {
annotation.permissions[key] = this.options.permissions[key];
}
}
if (this.user) { if (this.user) {
return annotation.user = this.user; return annotation.user = this.user;
} }
...@@ -220,3 +230,6 @@ ...@@ -220,3 +230,6 @@
})(Annotator.Plugin); })(Annotator.Plugin);
}).call(this); }).call(this);
//
//# sourceMappingURL=annotator.permissions.map
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment