Switched everything over to use can.* functions from telescope-lib instead of using can* functions from lib/permissions.js, deleted lib/permissions.js, added some tests for permissions, and some other random cleanup like deleting unused code.
Conflicts:
client/views/comments/comment_form.js
We're using a fork with a different definition of "isAdmin" (using
``meteor-roles`` rather than the boolean user.isAdmin). ``lib/user.js``
provides abstracted methods for reading admin state, which makes it very
easy to change our definition -- except that the abstractions weren't
used universally.
This commit finishes the job of using the abstractions, and adds a few
new parts to also allow abstracting setting and updating admin-ness:
- setAdmin: sets admin status directly on a user object.
- updateAdmin: executes a mongo update to set admin status.
- adminMongoQuery: the query parameter for admin-ness, for composing
user queries with other fields.
- notAdminMongoQuery: the query parameter for not-admin-ness.
Do not update up/downvotes counters server-side when up/downvoters have
been modified in the meantime. Ex: concurrent upvote and cancelUpvote
HTTP requests at once, when the user clicks button several times in a
row.
Using jshint and and fixmyjs I went through and removed 220 trivial
Javascript errors – mostly missing semicolons, and some properties that
weren’t written in dot notation. You can view the diff of jshint’s
output here:
https://gist.github.com/christianbundy/7b37c51bb6f7c8d739e7/revisions
Woops, turns out this.isSimulation is useful after all!
Also, I tried to simplify the code of vote.js. I especially tried to
get rid of the double inequalities, and took the voting validation code
out of the update call.