-
Notifications
You must be signed in to change notification settings - Fork 55
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
Various updates to get it working #92
base: master
Are you sure you want to change the base?
Various updates to get it working #92
Conversation
Hm... are you using the latest version of... templates.js? or https://github.com/benchpressjs/benchpressjs ? We'd really appreciate using the latter, since it is a rewrite of the former for speed and API conformability. It should be drop-in replaceable. |
I really appreciate the PR, thank you for contributing back 😄 |
I went to the last version of template.js (before it converted to benchpressjs). I was considering moving to benchpressjs but wasn't sure about size issues of the compiled file - since it didn't appear that I could easily take out the parsing. But if you like, I can look at a client distro version and replace template.js and see what happens? LMK your thoughts - I figured the prior implementation was stripping template as much as possible to keep it light. (Even in this pull from template.js I removed references to things like |
@julianlam what exactly is the expectations with benchpressjs?
Maybe there is a more client friendly version I'm missing? If benchpressjs has a version where we can |
Get it to work again...
Support turning profile links off
Wow, so much work on this plugin 😄 We can stick with templates.js if you're not comfortable figuring it out, it was just a passing thought. If it works fine right now, there's no need to change it. |
I've pinged @pitaj for his thoughts on the tjs ➡️ bch migration. |
@@ -16,17 +16,47 @@ const groups = require.main.require('./src/groups'); | |||
|
|||
const Comments = module.exports; | |||
|
|||
// CORS Middleware | |||
const CORSMiddleware = function (req, res, next) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining what the purpose of this is.
res.header('Access-Control-Allow-Origin', url); | ||
} else { | ||
winston.warn(`[nodebb-plugin-blog-comments] Origin (${req.get('origin')}) does not match hostUrls: ${hostUrls.join(', ')}`); | ||
let postData = []; let categoryData = null; let |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be on separate lines.
document.getElementById('nodebb-comments').insertAdjacentHTML('beforebegin', '<div id="nodebb"></div>'); | ||
nodebbDiv = document.getElementById('nodebb'); | ||
const nodebbDiv = document.getElementById('nodebb'); | ||
|
||
function newXHR() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can probably switch to fetch
here, but for now you can remove the extremely old ActiveX stuff and use XMLHttpRequest directly.
} | ||
}, 500); | ||
} | ||
const XHR = newXHR(); let pagination = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put these on separate lines. We should add https://github.com/nodebb/eslint-config-nodebb to align with other plugins.
As for tjs to benchpress, it should be possible. An alternative to registering a loader is directly setting the template in Benchpress.cache['comments'] = Promise.resolve(templateFunction);
Benchpress.render('comments', data, block).then(...); I think the best approach would be to bundle |
I just tried setting up this plugin when I came across this PR and I can't believe these changes have not been merged yet. All these changes are either required or simply a great addition like the autocreate option. To quote @theaustinhowe:
Btw the General - PHP example in the README seems outdated as well. |
@waschinski I pinged @pitaj for his feedback and I think we were waiting on @theaustinhowe to provide changes before merging 😄 |
Thanks for the update, meanwhile I've been deciding not to use nodebb due to this and some other issues. |
When attempting to utilize the plugin ran into a few issues.
When initially loading a blog; because the topic didn't exist - the response would not allow for displaying the template to admin/publishers.
This was resolved by moving the topic-related content into a different promise group; and allowing the request to go through even if null.
Template shows "Powered By" and original thread link; which we didn't want/need.
This was resolved with a new setting to turn off that functionality
blog-comments:show-branding
Template was having issues with properly rendering (I'm not sure how anyone is using this now).
This was resolved by pulling the latest version of the template.js parser and replacing it in
general.js
(this may require updating in other public JS libraries)Ability to change login / registration URLs
This was resolved with 2 new settings to update the URL
blog-comments:login-url
andblog-comments:register-url
Ability to redirect instead of modal for authentication purposes.
This was resolved with a new setting:
blog-comments:auth-behavior
Ability to automatically create a topic.
This was resolved with 2 new settings one to turn on the functionality
blog-comments:autocreate
and one for default userblog-comments:autocreate-user-id
Ability to turn off profile links
This was resolved with a new setting:
blog-comments:profile-links