Topic Color
-
Hey,
static:app.load
has a fourth parameter (callback), ex:
https://github.com/psychobunny/nodebb-plugin-registration-question/blob/master/library.js#L6-L11 -
Version 1.2.0 is out.
- Bug fixes.
- Massive code revamp on main.js thanks to @Xevious. Would be easier to keep up-to-date. There's less request and a lot of improvement.
- Updated the ACP view.
- Compatible with next version of NodeBB, the topics will be colored on homepage for this version thanks to
https://github.com/NodeBB/NodeBB/commit/83de5ba5a43c15157ac2f879f44f857638325981
-
While the plugin is fully functional on 0.5.0...
Major issue DO NOT USE THIS PLUGIN WITH LATEST MASTER BUILD !
Your topics will return 404 pages. Deactivating the plugin give access back.On the code side and why there will likely be an update in not a long time but I need to be sure before.
NodeBB seems to have changed how the slugs are interpreted, so a topic calledI'm a test
is accessible via
domain/topic/1/i-m-a-test
If you write
%(violet)[I'm a test]
the address will become
domain/topic/1/violet-i-m-a-test
The thing is that having the color in the url was something I considered ugly and so I used a little regex to clean the address like to be again
domain/topic/1/i-m-a-test
But what worked before is no longer working it will return a 404 because NodeBB is looking for this address to display the topic information
domain/api/topic/1/i-m-a-test?_=1411760431011
Checking
domain/api/topic/1/
returnsdomain/topic/1/violet-i-m-a-test
so I guess it could just be a URL rewriting thing. I also don't know why the slugs would have change to be the exact same as the topic before doingdomain/topic/1/whatever
was displaying the topic.I did that rewriting for SEO issues and also to avoid things like
domain/topic/14/rgb-41-223-143-test
@baris, @julian, @psychobunny
What is the behaviour to keep, if the new one is the one to preserve I'll update the plugin in consequence, but I think rewriting urls should be something to consider. -
The wrong slugs are returning 404 now because of this issue.
Previously if you would include an image in your post with
![](test)
it would load the entire topic again because it would make a request todomain.com/topic/1/test
and since the slug didn't matter it would reload the entire topic.If we can figure out a better way to handle this instead of just sending 404 for wrong slugs then we can go back to ignoring slug.
-
@baris Isn't the problem to figure out why
![](test)
is callingdomain.com/topic/1/test
?
So if understand I'll have to wait and see if I remove this feature from the plugin or keep it.Maybe the solution is to be able to set custom slugs via plugin on action:topic.save
-
It's just the way it works, it treats it as a local image and tries to load from /topic/1/test which matches the topic route and loads the topic if we don't check the slug.
I haven't found another way to prevent it other than checking the slug and making sure its correct.