[nodebb-plugin-category-sections] Update for compatibility with latest NodeBB



  • So, I came across https://github.com/NodeBB/nodebb-plugin-category-sections but have tried to use it and encountered the forum crashing after saving category sections via the ACP. It happens when you try to view the forums, or the ACP section.

    I've fix the issue, but I haven't been able to figure out what's going wrong. The error that occurs is: "Unexpected token o" which causes the board to shutdown.

    If anyone has any ideas and could lend a hand, it would be greatly appreciated!


  • Plugin & Theme Dev

    @crashdoom JSON.parse produces that error.

    I see it's used in this line

    https://github.com/NodeBB/nodebb-plugin-category-sections/blob/master/library.js#L71

    Not sure if you need that line. Try removing that line.



  • This post is deleted!


  • @pichalite From what I can tell, it's storing the data in Redis as "[object Object],[object Object]". If I remove the JSON.parse, I get this error:

    30/12 10:41 [8088] - error: TypeError: sections.forEach is not a function at C:\Users\crashdoom\Documents\NodeBB\node_modules\nodebb-plugin-category-sections\library.js:80:13 at try_callback (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:592:9) at RedisClient.return_reply (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:685:13) at ReplyParser.<anonymous> (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:321:14) at emitOne (events.js:77:13) at ReplyParser.emit (events.js:169:7) at ReplyParser.send_reply (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\lib\parser\javascript.js:300:10) at ReplyParser.execute (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\lib\parser\javascript.js:203:22) at RedisClient.on_data (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:547:27) at Socket.<anonymous> (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:102:14) TypeError: sections.forEach is not a function at C:\Users\crashdoom\Documents\NodeBB\node_modules\nodebb-plugin-category-sections\library.js:80:13 at try_callback (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:592:9) at RedisClient.return_reply (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:685:13) at ReplyParser.<anonymous> (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:321:14) at emitOne (events.js:77:13) at ReplyParser.emit (events.js:169:7) at ReplyParser.send_reply (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\lib\parser\javascript.js:300:10) at ReplyParser.execute (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\lib\parser\javascript.js:203:22) at RedisClient.on_data (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:547:27) at Socket.<anonymous> (C:\Users\crashdoom\Documents\NodeBB\node_modules\redis\index.js:102:14)

    I presume that the fact that [object Object] is present in the Redis database is causing the error, but I'm unsure where the data from the ACP is serialized and stored.


  • Plugin & Theme Dev

    @crashdoom What's your NodeBB version? I cannot even get the plugin to save the sections in the ACP




Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.