• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

Upvote notification tweaks

Scheduled Pinned Locked Moved Feature Requests
7 Posts 3 Posters 3.7k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • boomzillaB Offline
    boomzillaB Offline
    boomzilla GNU/Linux
    wrote on last edited by
    #1

    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:

    https://what.thedailywtf.com/uploads/files/1461679747937-upload-ab3e7c18-4329-425b-a6f0-82e8ed26dd86-resized

    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 branch

    I hope to turn those into pull requests soon.

    PitaJP 1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to boomzilla on last edited by PitaJ
    #2

    @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
    
    abarkerA 1 Reply Last reply
    1
  • boomzillaB Offline
    boomzillaB Offline
    boomzilla GNU/Linux
    wrote on last edited by
    #3

    Yeah, we discussed stuff like that. I suspect that the "every 50 votes" is probably not going to be very common as it is. Unless you really are running the next reddit on nodebb.

    PitaJP 1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to boomzilla on last edited by
    #4

    @boomzilla It's probably still best to go with the most future-proof algorithm while it hasn't been established yet, just in case.

    1 Reply Last reply
    0
  • abarkerA Offline
    abarkerA Offline
    Mod on WTDWTF
    replied to PitaJ on last edited by
    #5

    @PitaJ That actually looks pretty slick. If I'm reading that right, your code should notify on upvotes 1, 5, 10, 50, 100, 500, …

    That seems like a pretty good fit for the middle-ground option.

    PitaJP 1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    replied to Mod on WTDWTF on last edited by
    #6

    @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.

    1 Reply Last reply
    1
  • boomzillaB Offline
    boomzillaB Offline
    boomzilla GNU/Linux
    wrote on last edited by
    #7

    Submitted a pull request:
    https://github.com/NodeBB/NodeBB/pull/4591

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development