[REQUEST] OneSignal for NodeBB

Plugin Requests

Suggested Topics


  • 0 Votes
    34 Posts
    1k Views

    @baris said in Upgrade - nodebb-plugin-topic-ratings:

    You could filter the topics in a hook like filter:topics.filterSortedTids and only return ones that have more than a certain rating.

    GPT recommend me to do this 😹

    In plugin.json add new hook "hooks": [ { "hook": "filter:category.topics.prepare", "method": "sortTopicsByRating" } ] In library.js add new methid sortTopicsByRating plugin.sortTopicsByRating = function (data, callback) { if (data.req.query.sort === 'rating') { data.req.query.sort = '-rating'; } callback(null, data); }; In templates/categories.tpl add this code for sorted <li data-sort="rating"><a href="#">[[global:topics_sorted_by_rating]]</a></li> In public/js/topic-ratings.js add this javascript $(window).on('action:ajaxify.end', function () { var $sortDropdown = $('.category-header .dropdown-menu'); if ($sortDropdown.length) { var $ratingSortItem = $('<li data-sort="rating"><a href="#">[[global:topics_sorted_by_rating]]</a></li>'); $sortDropdown.append($ratingSortItem); $ratingSortItem.on('click', function () { var url = window.location.href; url = url.replace(/(\?|&)sort=\w+/, ''); url += (url.indexOf('?') >= 0 ? '&' : '?') + 'sort=rating'; ajaxify.go(url); }); } });

    Bot say after this I can sorted a topics via url ?sort=rating

    I'm not tested this code, but it looks not bad...

  • 0 Votes
    4 Posts
    1k Views

    Since this topic was created such plugin was actually created by someone (Ben Lubar to be exact): https://github.com/BenLubar/nodebb-plugin-pwned-passwords

    I'm posting it here mostly because I haven't seen it posted anywhere on this forum, so now it will be easier to find 🙂 And also in case Duehok still wants it and didn't see that it exists.

  • 0 Votes
    12 Posts
    3k Views

    Awesome @baris : i should have a look at your changes ! 👏
    I think we should be able to display more relevant topics by sorting the results with a good mixed ponderation...

  • 0 Votes
    11 Posts
    3k Views

    That's great! Thank you!

  • 0 Votes
    3 Posts
    2k Views

    thanks, sending email