• 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

Replies to post hidden in default theme

Scheduled Pinned Locked Moved Technical Support
5 Posts 3 Posters 507 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.
  • R Offline
    R Offline
    romuald
    wrote on last edited by
    #1

    I have recently installed NodeBB 1.12.0 with default theme. When a user replies to a specific post, the reply is by default hidden below this post (one has to click to view it), while it appears as an ordinary reply to the topic below.

    Is it possible to configure NodeBB (e.g. by modifying the theme template etc.) to get the following behaviour:

    1. The replies to a post appear by default below the relevant post (as now after the click)
    2. These replies do not appear for the second time as ordinary replies later in the thread

    I would be grateful for a hint..

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

    No. NodeBB chose a flat topic structure long ago and this is unlikely to change. The replies expanding list below a post is nothing more than a convenience.

    1 Reply Last reply
    0
  • R Offline
    R Offline
    romuald
    wrote on last edited by
    #3

    Thanks. It is a pity.

    But just in case I would try to attempt some hack. I now saw that the html element which loads the replies when clicked has an attribute component="post/replies/open". I guess that clicking runs some javascript function which loads the replies. Could you indicate where is this javascript function located?

    Maybe I could then add some custom javascript to activate this function automatically on page load?

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #4

    The relevant code is here

    1 Reply Last reply
    0
  • R Offline
    R Offline
    romuald
    wrote on last edited by
    #5

    I just managed to make a quick hack which achieves the effect that I wanted. I added the following to the Custom Javascript tab in ACP:

    function showreplies() {
        $('li[component="post"]').has('a[component="post/parent"]').addClass('hidden');
        $('[component="post/replies/open"]').click();
    }
    
    function noreply(event, data){
        if(data.posts.length==1 && data.posts[0].toPid) { // this is a reply to some post
            var el = $('li[data-pid="'+data.posts[0].pid+'"]'); // newly added post
            if(el.parent('div[component="post/replies"]').length===0){  // added as a standalone post
                el.addClass('hidden');
            }
        }
        $('div[component="post/replies"]').find('a[component="post/reply"], a[component="post/quote"]').addClass('hidden');
    }
    
    $(window).on('action:ajaxify.end', showreplies);
    $(window).on('action:posts.loaded', noreply);
    

    The first line in function showreplies hides those posts which are replies to previous posts, and the second line opens up the replies below the relevant posts. (@baris This was my attempt before I read your answer. Thanks for the pointer to the code! I will try that out).

    I added the handler for action:posts.loaded in order to

    1. Eliminate Reply and Quote buttons for the replies in order not to generate higher levels of nesting (this is ok for me)
    2. After adding a reply to a post, by default it is also added at the end - in order to avoid that I set it to hidden. This does not work so well as the page gets scrolled to the top after that.. - I am not quite sure how to fix it. If I figure it out I'll make an update..
    1 Reply Last reply
    1

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