Commit graph

59 commits

Author SHA1 Message Date
Juaanma
9e4b152ec7 Correct base score calculation in vote.js
When we downvote an item or cancel one of its upvotes, we should decrese, not increase, the base score.
2015-03-13 23:53:26 -03:00
Sacha Greif
eb0a792dc7 vote power tweaks 2015-03-11 17:49:42 +09:00
Bandersnatch
a8ba82eeaf Moved the method callbacks to operate before the vote is applied. 2015-03-10 21:05:29 -06:00
Bandersnatch
81b7c4e3fb Change votePowerEq to getVotePower. getVotePower can now be a function, or a number. 2015-03-10 20:31:31 -06:00
Bandersnatch
8e5af099d5 Added the ability to modify vote power from packages. Set votePowerEq to a function in a package and that function will be how vote power is determined. Makes sure to re-export votePowerEq from you function! 2015-03-07 23:30:20 -07:00
Bandersnatch
69f10079ce Added Synchronous Method callbacks for each vote callback. 2015-03-07 22:19:00 -07:00
Bandersnatch
8e42994483 Added hooks for canceling up voting and down voting. 2015-03-07 21:54:32 -07:00
Sacha Greif
201af43cf9 adding upvote and down vote callbacks 2015-01-21 10:38:59 +09:00
Anthony Mayer
f197b930e6 Cleaning up vote click handling functions and adding tests.
Also combining can.upvote and can.downvote and deleting unused permissions function and random cleanup.
2015-01-19 00:04:41 -08:00
Anthony Mayer
f9d9891fba Getting rid of redundant permissions functions
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
2015-01-07 08:22:46 +01:00
Sacha Greif
51fd6fe975 temporarily remove feed item quickform 2014-12-27 17:56:10 +09:00
Sacha Greif
4858e178fa fix voting code typo 2014-12-27 12:20:09 +09:00
Sacha Greif
24a0f9b830 refactor voting code to accept function calls from server 2014-12-20 17:34:15 +09:00
Mark Lee
c5284ce625 Minor tweaks 2014-12-15 18:02:24 -08:00
Charlie DeTar
ed09d0ea7c Fully abstract isAdmin
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.
2014-10-03 16:21:06 -06:00
Fabrice Delhoste
9bd8517e8a Prevent invalid up/downvotes when concurrent requests
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.
2014-09-19 21:47:58 +02:00
Mitchell Wulfman
6fc6b9eb78 cleanup while getting familiar with the codebase 2014-09-16 15:18:27 -04:00
Sacha Greif
735f0645db move votes to their own object on user object 2014-08-23 11:53:37 +09:00
Sacha Greif
509972f18a Now keeping track of upvoted/downvoted posts & comments. 2014-08-11 10:14:53 +09:00
Sacha Greif
77d572345b removing a few console.logs 2014-06-25 14:33:41 +09:00
Sacha Greif
d29e613f7d Get rid of superfluous check 2014-06-22 11:32:35 +09:00
Sacha Greif
738857a51e Merge branch 'master' into autoform
Conflicts:
	client/views/posts/post_page.js
2014-06-22 08:58:18 +09:00
Sadi
80a482e505 fixed - upvote/downvote
The issue was that the cancelDownvote() had was checking if there were any upvotes!

Now its working like a charm.
2014-06-17 14:34:07 +03:00
Sacha Greif
e0ff3f71fc Counting up votes and down votes with two separate properties instead of a single "votes" property 2014-05-15 15:56:23 +09:00
Mike Carson
2237994555 fix for downvoting comments 2014-05-08 19:35:24 -04:00
Christian Bundy
86ec3ede93 Solve trivial JS errors
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
2014-05-06 20:15:48 -07:00
Ankur Patel
81ced52a99 Best practice to pass object than to check for optional parameter value 2014-01-25 14:11:26 -05:00
Sacha Greif
1b6072e114 fixing updateScore syntax 2013-11-12 08:23:15 +09:00
Tarang Patel
b38c6cda3f Fix downvoting, cancelling upvoting & cancelling downvoting
Additionally removed the `(function() {})();` encapsulation since Meteor already adds this in since they started scoping files
2013-11-11 23:06:12 +02:00
Sacha Greif
c164e67572 enable karma redistribution 2013-11-08 10:12:00 +09:00
Sacha Greif
1253f1563e extending post item to calculate score 2013-10-29 18:02:10 +09:00
Sacha Greif
b7f4fb38e8 add _id property to post object 2013-10-29 17:54:45 +09:00
Sacha Greif
5c3aee060c reworking animations 2013-10-29 15:47:20 +09:00
Sacha Greif
3edfb38032 clean up upvoting/downvoting/scoring code 2013-10-29 15:06:50 +09:00
Sacha Greif
c97e7ea443 fixed karma 2013-10-29 13:39:28 +09:00
Sacha Greif
9b441c1048 make scoring client-side too for latency compensation 2013-10-29 13:30:35 +09:00
Peter Coles
1e2750bb28 make upvote cleanup prior downvote and vice-versa 2013-05-19 16:26:42 -04:00
Sacha Greif
59e1304c72 still cleaning up files 2013-04-13 15:10:07 +09:00
Sacha Greif
3f180f027b added rate limiting to posts and comments posting 2012-10-06 13:15:55 +09:00
Sacha Greif
1c2056d2f8 perfected permission and redirection system 2012-10-05 22:46:20 +09:00
Sacha Greif
7419ff2cb0 adding canView to permissions 2012-10-05 14:08:46 +09:00
Tom Coleman
4edc7513c5 Best to test things before pushing. 2012-10-04 12:33:15 +10:00
Tom Coleman
973b17cb09 Updated vote.js to use approved (and some minor clean up) 2012-10-04 12:31:02 +10:00
Sacha Greif
d974d26ece using $addToSet instead of $push 2012-09-29 17:23:13 +09:00
Sacha Greif
a467225da1 refactoring vote.js and put this.isSimulation back in
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.
2012-09-29 14:14:57 +09:00
Sacha Greif
f25d7a619a remove this.isSimulation checks in vote.js 2012-09-29 13:54:47 +09:00
Sacha Greif
75c8a86f4a refactoring vote.js 2012-09-29 13:51:55 +09:00
Julien Chaumond
23fccbd082 Fix bad karma 2012-09-28 15:07:25 +02:00
Sacha Greif
0e16290807 removed console.log call 2012-09-28 10:09:57 +09:00
Sacha Greif
ef38173975 added karma increase/decrease back in 2012-09-28 09:57:03 +09:00