Moving topic from one Category to another



  • Long story, but here goes.

    1. Two categories: one open to registered users (CatA), one restricted to a group (CatB).

    2. Occasionally, moderators will move a topic from the open group to the closed group (CatA -> CatB) to discuss it in more detail in a closed session.

    3. The original topic shouldn't be visible in CatA anymore (and to most people, it is not) but the original poster of the topic can still see it on the list. He can't click on it (permission denied in the other forum) but can still see the first line or two of the last post in the preview on the right.

    I doubt this is a setup issue. Is this some kind of dangling reference bug?


  • Admin

    What version/hash of nodebb? What is the sort setting in the category?



  • NodeBB 1.7.0

    CatA settings: nothing special. registered users can find cat, access cat, access topic, create topic

    CatB settings: also nothing special. privileges are assignd to only one group (full privs across the board for that group)


  • Admin

    Do you have access to the forum's database to run some queries?



  • yes. My mongo is a little noobish, but I have command line access.


  • Admin

    You can run the following queries to check if the moved topic has a reference left in catA. You will have to replace the ids by finding the category id of catA and the topicId.

    db.objects.find({_key: "cid:<cat_A_id>:tids", value: "<moved_topic_id>"});
    db.objects.find({_key: "cid:<cat_A_id>:tids:posts", value: "<moved_topic_id>"});
    db.objects.find({_key: "cid:<cat_A_id>:tids:votes", value: "<moved_topic_id>"});
    db.objects.find({_key: "cid:<cat_A_id>:tids:lastposttime", value: "<moved_topic_id>"});
    db.objects.find({_key: "cid:<cat_A_id>:tids:recent_tids", value: "<moved_topic_id>"});
    

    They should all return an empty response if the topic does not have any references left in catA.



  • @baris said in Moving topic from one Category to another:

    db.objects.find({_key: "cid:<cat_A_id>:tids", value: "<moved_topic_id>"});
    db.objects.find({_key: "cid:<cat_A_id>:tids:posts", value: "<moved_topic_id>"});
    db.objects.find({_key: "cid:<cat_A_id>:tids:votes", value: "<moved_topic_id>"});
    db.objects.find({_key: "cid:<cat_A_id>:tids:lastposttime", value: "<moved_topic_id>"});
    db.objects.find({_key: "cid:<cat_A_id>:tids:recent_tids", value: "<moved_topic_id>"});

    Very odd, and matches some very odd stuff I've seen on other things.

    Replacing with the appropriate topic and category ID's doesn't return any values.

    MongoDB shell version: 3.2.16
    connecting to: nodebb
    > db.objects.find({_key: "cid:35:tids", value: "39220"});
    > db.objects.find({_key: "cid:35:tids:posts", value: "39220"});
    > db.objects.find({_key: "cid:35:tids:votes", value: "39220"});
    > db.objects.find({_key: "cid:35:tids:lastposttime", value: "39220"});
    > db.objects.find({_key: "cid:35:tids:recent_tids", value: "39220"});
    >
    

    Just so I know it's working, here's the category it was moved to:

    > db.objects.find({_key: "cid:54:tids", value: "39220"});
    { "_id" : ObjectId("5a610c4e1a911d0fab1a28aa"), "_key" : "cid:54:tids", "value" : "39220", "score" : 1516309669264 }
    

    Me, as an admin, if I go look at the CatA category, it looks completely blank (all posts moved to private CatB). If I create a regular authenticated user and look at CatA, it's completely blank.

    However, the creator of the moved_topic can still see a ghost of the topic in CatA.

    Is there some per-user server-side caching going on? I can't see a way this could be client side, especially since there have been multiple reports of seeing the snippet of the most recent post change (right side of the topic in the list when it shows the most recent user to post and the first 100 chars or so of the post itself).



  • Ok. I think I know what's going on.

    We're using a plugin called support forum that looks like it hasn't been updated in quite a while. My guess is that it keeps a hard reference to the tid, even if it's moved to another category.

    It's only 168 lines of source, but I don't know Node.js or NodeBB architecture enough to make heads or tails of it. Maybe I should put a bounty on it? Not sure how well those kinds of offers are received, though.


  • Admin

    @eric-ladner Make an issue on that plugins github, possibly that plugin needs to be updated so it is aware of topic moves. Post the link to the issue here when you create it. Thanks.




 

| |