Upvote notification tweaks
-
Back home we've had complaints about the number of notifications people receive due to upvotes. We are a community that likes to upvote and it is a lot of notifications.
So I've been working on changing the way upvote notifications are handled. Here's the drop down from the user settings page:
The code is up on github if anyone is interested in testing or just taking a look:
NodeBB - upvote-notifications branch
Persona Theme - upvote-notifications branch
Vanilla Theme - upvote-notifications branchI hope to turn those into pull requests soon.
-
@boomzilla Very cool. I'd like it if reddit were to give me notifications when my posts receive landmarks of upvotes.
Maybe it should be an exponential growth kind of thing? So like if the log-base-10 of the # of upvotes is a whole number, it would give you a notification?
Here's some code:
const isWhole = num => num % 1 === 0; const shouldNotify = upvotes => { // notify if [a power of 10] or if [5 * (a power of 10)] if (isWhole(Math.log10(upvotes)) || isWhole(Math.log10(upvotes / 5))) { return true; } return false; } // test Array.from({ length: 20 }, (x, i) => { const p = Math.pow(10, Math.floor(i / 4)); if (i % 4 === 0) { return p; } if (i % 4 === 3) { return p * 7; } if (i % 4 === 2) { return p * 5; } return p * 3; }).map(shouldNotify); // should be an array with alternating true/false
-
@boomzilla It's probably still best to go with the most future-proof algorithm while it hasn't been established yet, just in case.
-
@abarker yeah, that's exactly what it should do. Haven't tested it yet. One reservation I have is that it may be more representative to use 3 instead of 5 since, on a log scale, 3 is closer to a half-decade. That may not be seen as true by actual users, though.