Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot delete custom pages or change path #68

Closed
ShlomoCode opened this issue Oct 22, 2022 · 8 comments
Closed

Cannot delete custom pages or change path #68

ShlomoCode opened this issue Oct 22, 2022 · 8 comments
Assignees
Labels

Comments

@ShlomoCode
Copy link

ShlomoCode commented Oct 22, 2022

nodebb version: 2.3.1
Plugin version: 1.1.3
nodejs version: v16.16.0


Desired behavior:
When I click the X icon next to a custom page
CleanShot 2022-10-23 at 01 46 38
The page will be removed from the ACP page, and when I click save changes it will actually be deleted.
What actually happens:
A confirmation message appears that the changes have been saved, but in practice the deleted page still exists and is accessible to users. When you refresh the ACP page it reappears.
Trying to change the page path results in the same behavior.
The description and the groups allowed to access the page, however, can be changed.
But setting only administrators as authorized to access, brings the surfers to a login page, and I want a 404 page to appear, that the page doesn't exist at all.


In addition, when starting the server, a log appears that this plugin is not compatible with the Nodebb version.
@barisusakli @julianlam

@ShlomoCode
Copy link
Author

What I did in the meantime as a hack is to enter the Mongo database (I did it with a free graphics client called Robo 3T (nowadays it's called Studio 3T but I'm more comfortable with the old one) and edit the json of the data
But it is possible to do it in any other way

db.getCollection('objects').find({"_key" : "plugins:custom-pages"})

@barisusakli
Copy link
Contributor

Does it happen on [email protected] as well?

@ShlomoCode
Copy link
Author

ShlomoCode commented Nov 23, 2022

@barisusakli I checked it now, and yes, it also happens in version 1.3.3 of the plugin (in nodebb 2.5.8).

@barisusakli barisusakli self-assigned this Nov 23, 2022
@barisusakli
Copy link
Contributor

@ShlomoCode I will take a look

@barisusakli
Copy link
Contributor

This was actually a bug in core, NodeBB/NodeBB@fc49665
We will make a patch release tomorrow for 2.x that should have this fix. When you tried to delete the custom page it was trying to reset the widgets on that template as well. But if there we no widgets it was crashing and preventing the deletion of the custom page as well.

2022-11-23T00:22:12.125Z [4567/6340] - error: admin.settings.saveCustomPages
TypeError: Cannot convert undefined or null to object
    at Function.values (<anonymous>)
    at widgets.resetTemplate (C:\Users\Baris\Desktop\github\NodeBB\src\widgets\index.js:215:39)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async widgets.resetTemplates (C:\Users\Baris\Desktop\github\NodeBB\src\widgets\index.js:225:3)      
    at async resetWidgets (C:\Users\Baris\Desktop\github\nodebb-plugin-custom-pages\library.js:219:2)      
    at async SocketAdmin.settings.saveCustomPages (C:\Users\Baris\Desktop\github\nodebb-plugin-custom-pages\library.js:50:3)
    at async onMessage (C:\Users\Baris\Desktop\github\NodeBB\src\socket.io\index.js:160:19)
    ```

barisusakli added a commit to NodeBB/NodeBB that referenced this issue Nov 23, 2022
don't crash if template doesn't have any widgets set before
@ShlomoCode
Copy link
Author

ShlomoCode commented Nov 23, 2022

@barisusakli Thanks!
Just today (a few hours ago) I downloaded the latest code and reinstalled, if I just take that commit you linked (NodeBB/NodeBB@fc49665), that should fix it?

@barisusakli
Copy link
Contributor

Yes if you apply the code I linked it should fix the issue.

@ShlomoCode
Copy link
Author

@barisusakli I have tested and confirm that this patch has resolved the bug. Thank you!

bhavya3024 pushed a commit to bhavya3024/NodeBB that referenced this issue Dec 6, 2022
don't crash if template doesn't have any widgets set before
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants