Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups
    1. Home
    2. wktang
    • Profile
    • Following 1
    • Followers 0
    • Topics 3
    • Posts 7
    • Best 2
    • Groups 0

    wktang

    @wktang

    6
    Reputation
    472
    Profile views
    7
    Posts
    0
    Followers
    1
    Following
    Joined Last Online
    Website leetcode.com

    wktang Unfollow Follow

    Best posts made by wktang

    • [nodebb-plugin-category-sort-by-votes] Sort topics by votes within a category!

      Nodebb-Plugin-Category-Sort-By-Votes


      Description

      NodeBB allows you to sort posts by votes in a topic, but within a category you can't sort topics by votes.

      This plugin allows you to sort topics by votes within a category. See screenshot below, you get a little "Most votes" selection from the "Sort by" dropdown menu.

      As requested here and here. Developed and maintained by @xidui and @wktang.

      image

      Installation

      • Install it from NodeBB Admin Panel, or

          npm install nodebb-plugin-category-sort-by-votes
        

      Usage

      1. Go to the ACP (Admin Control Panel).

      2. Activate plugin and reload NodeBB.

      3. Click Plugins -> Category Sort to go to the Plugin's settings.

      4. Click "Re Index" to index all topics (see below screenshot).

        image

      5. Go to any category, select "Most votes" from the "Sort by" dropdown and it should work!

      Notes

      Feature of sorting by votes use cid:[cid]:tids:votes as key, while it is not supported by NodeBB. So we must recreate the index to make it work.
      If "reindex" is not applied before you use "Sort By Votes" option in the category page, the category page will be blank.

      We also use action:post.downvote, action:post.unvote, action:post.upvote hook to listen user actions and dynamically update the sortedSet which use cid:[cid]:tids:votes as key.

      GitHub | Bugs & Suggestions

      posted in NodeBB Plugins
      wktang
      wktang
    • RE: Editing post flagged as spam by Akismet

      @meshmellow After waited for few hours and I went back to edit the post, it succeeded. Seems like there's some throttling involved.

      posted in NodeBB Development
      wktang
      wktang

    Latest posts made by wktang

    • RE: why do i see the deleted topic :(

      @julian @baris @psychobunny

      A user in our forum reported the below feedback to me, and I agreed that this is really ugly and hurt user experience:

      I just viewed a topic without being logged in and I saw a post I deleted still showing up, with the body "This post is deleted!". I think that's rather ugly and that deleted posts should only be visible to the author and admins.

      posted in General Discussion
      wktang
      wktang
    • RE: Possible bug? Deleted Posts listed

      @julian said in Possible bug? Deleted Posts listed:

      if the user happens to not be able to see some of them, then a page with 20 topics suddenly only has 18

      Does this apply to infinite scrolling as well?

      posted in NodeBB Development
      wktang
      wktang
    • RE: Editing post flagged as spam by Akismet

      @meshmellow After waited for few hours and I went back to edit the post, it succeeded. Seems like there's some throttling involved.

      posted in NodeBB Development
      wktang
      wktang
    • Editing post flagged as spam by Akismet

      I got the following error when trying to edit my post here:

      0_1466226118593_upload-93e1c071-78ec-4b4d-b610-d9edc6bfcd0c

      May I know why it was flagged as spam by Akismet?

      posted in NodeBB Development
      wktang
      wktang
    • [nodebb-plugin-category-sort-by-votes] Sort topics by votes within a category!

      Nodebb-Plugin-Category-Sort-By-Votes


      Description

      NodeBB allows you to sort posts by votes in a topic, but within a category you can't sort topics by votes.

      This plugin allows you to sort topics by votes within a category. See screenshot below, you get a little "Most votes" selection from the "Sort by" dropdown menu.

      As requested here and here. Developed and maintained by @xidui and @wktang.

      image

      Installation

      • Install it from NodeBB Admin Panel, or

          npm install nodebb-plugin-category-sort-by-votes
        

      Usage

      1. Go to the ACP (Admin Control Panel).

      2. Activate plugin and reload NodeBB.

      3. Click Plugins -> Category Sort to go to the Plugin's settings.

      4. Click "Re Index" to index all topics (see below screenshot).

        image

      5. Go to any category, select "Most votes" from the "Sort by" dropdown and it should work!

      Notes

      Feature of sorting by votes use cid:[cid]:tids:votes as key, while it is not supported by NodeBB. So we must recreate the index to make it work.
      If "reindex" is not applied before you use "Sort By Votes" option in the category page, the category page will be blank.

      We also use action:post.downvote, action:post.unvote, action:post.upvote hook to listen user actions and dynamically update the sortedSet which use cid:[cid]:tids:votes as key.

      GitHub | Bugs & Suggestions

      posted in NodeBB Plugins
      wktang
      wktang
    • RE: Setting user lastonline field does not work as expected?

      @pichalite Yes. I have tested that if the user is not currently online, the user is able to receive email from executing the above code.

      posted in Technical Support
      wktang
      wktang
    • Setting user lastonline field does not work as expected?

      @julian

      I want to send a chat message to a user, and to ensure that the user will be notified via email, I set the user's lastonline to 5 minutes before current timestamp.

      I see that the user's lastonline field is being set correctly (verified via api call), but the user is still not being notified via email.

      // set lastonline field to 5 minutes before current timestamp
      Users.setUserField(req.params.uid, 'lastonline', Date.now() - 300000, function(err) {
              Messaging.newRoom(req.user.uid, [req.params.uid], function(err, roomId) {
                      Messaging.addMessage(req.user.uid, roomId, req.body.message, timestamp, function(err, message) {
                              // this should send an email notification to the user
                              Messaging.notifyUsersInRoom(req.user.uid, roomId, message);
      
                              return errorHandler.handle(err, res, message);
                      });
              });
      });
      

      This is the condition which determines whether the user is online:
      https://github.com/NodeBB/NodeBB/blob/dcb73f9647bd73acce0d0907d04d060e7fe05eb7/src/user.js#L152

      I print the lastonline field value inside the isOnline method, which prints the previous set value and this is strange. Is this due to some kind of caching in the db layer? I am using mongodb by the way.

      This commit shows that to make the user offline, all that's needed is to set the lastonline field, so I am not sure what I'm missing.
      https://github.com/NodeBB/NodeBB/commit/18e68346e713fce2efb49aff0b18bd2bbf0be332

      0 barisusakli committed to NodeBB/NodeBB
      closes #4507
      posted in Technical Support
      wktang
      wktang