-
Notifications
You must be signed in to change notification settings - Fork 439
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
Have client read out shared settings from server #311
Have client read out shared settings from server #311
Conversation
This is brilliant! |
Any chance you could resolve the conflicts? |
In my fork, I took this a step further and centralized all settings to the server side (see ed56921). The main content of my fork is authentication with Facebook, Google and OpenID as described in this blog post which also has a live demo. I was earlier under the impression that this line of work was not desired in mainline Isso, but since this may have changed we could have a discussion about what functionality to include before looking at the conflicts. |
When you say "this line of work", do you mean all of your fork or specifically the exposing of server settings to the client? I'm not aware of a reason why the latter would be controversial. |
I meant the entire fork. I just want to avoid multiple merges by deciding what to include. |
I think either way we'd want to merge those changes one by one rather than all at once. |
Yes, moving settings is a quite separate change of course. But i thought we could agree on moving all settings or just the "redundant" settings that now have to be specified on both server and client side. On the other hand, moving only the "redundant" settings is easier because there are no backward compatibility issues. Moving all settings would either require supporting the old way as well, or forcing users to move their settings. |
Bumping isso version to 2.x.x might be enough to indicate breaking change don't you think? |
I fixed conflicts, and it should be ok. Needs a bit of testing though. |
Great! So I might create a new pull request for centralizing all config when I find the time. |
Hi, I was going to use the pellenilsson's fork with social auth, but after reading this conversation I'm a not really sure what version (and branch) should I use. Should I use branch 'feature/get-server-config' or 'master'? Am I right, that the social login feature is only in this fork? If so, are there any plans to include it also in the posativ's repository? Thanks |
Hi @TheKerbycz! The social auth stuff is only available in the master branch of my forked repo https://github.com/pellenilsson/isso. Since it was forked some time ago it misses some of the newer features. Whether it will be merged to posativ's repo is an open question. |
This seems reasonable to me; As it has no unit tests, has anybody else managed to successfully test it? |
@pellenilsson would you mind rebasing this on top of current master? While you're at it, there are a few more settings that are shared between client and server and need to be kept in sync. I've quickly glanced over the docs and found these:
Also, it'd be nice for the "gravatar" setting to trump the regular avatars if set to true instead of having both generated. @pellenilsson if you're done with the shared settings, we'd need to document this new behaviour as well, first in CHANGES and then also in the docs. I'd be happy to help you there. Just additionally, this is wildly out of scope, but we might want to display the available HTML tags and markdown options to clients in some kind of way. So exposing those would fall under the same mechanism. |
@ix5 I merged in latest master and added the additional settings that you mentioned, and tried to handle the gravatar scenario. I also updated the docs. But I no longer have a setup for testing this out since I haven't worked on Isso for several years, so it would be nice if someone else could do some testing. |
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.
Left a few comments. Thanks for rebasing and addressing those issues. I'll try to test thoroughly once I find the time.
Pinging @stefangehn @Guts @zackw @vsajip @Konzertheld for testing/review. Would be nice of one of you to take a look at this! |
The following settings are sent as a config object from the server to the client: - `reply-to-self` - `require-author` - `require-email` - `reply-notifications` - `gravatar` This means that the following settings will be ignored when set on the client side: - `data-isso-reply-to-self` - `data-isso-require-author` - `data-isso-require-email` - `data-isso-reply-notifications` - `data-isso-gravatar` Isso will notify the user on the browser console if a client setting has been overwritten by a config from the server. Gravatar setting trumps regular avatars: In addition, `data-isso-avatar` will be set to `false` when gravatars are enabled to prevent both regular avatars and gravatars appearing side-by-side. Documentation updates: Update docs for shared server-client settings and clarify documentation for gravatar/avatar settings
The following settings are sent as a config object from the server to the client: - `reply-to-self` - `require-author` - `require-email` - `reply-notifications` - `gravatar` This means that the following settings will be ignored when set on the client side: - `data-isso-reply-to-self` - `data-isso-require-author` - `data-isso-require-email` - `data-isso-reply-notifications` - `data-isso-gravatar` Isso will notify the user on the browser console if a client setting has been overwritten by a config from the server. Gravatar setting trumps regular avatars: In addition, `data-isso-avatar` will be set to `false` when gravatars are enabled to prevent both regular avatars and gravatars appearing side-by-side. Documentation updates: Update docs for shared server-client settings and clarify documentation for gravatar/avatar settings
@pellenilsson currently, we're in a bit of a catch-22: The fix for that is to add the header and root element early, but only later insert the postbox. I'm not aware of any issues concerning the postbox being inserted after the root element. I've pushed to your branch with a few suggestions and improvements. If you like, you can reset your HEAD to https://github.com/ix5/isso/tree/pull-311-rebased , I've squashed the commits for you already there and written a succinct commit message. |
4519dbb
to
6bf98b0
Compare
Thanks! I force-pushed your squashed branch now. |
@pellenilsson I haven't forgotten your PR, I am just trying to think of ways to verify this does not break anything. |
Tested various configuration disparities between client and server and the server always takes precedence. The warning logic is off for when default client settings (from Thank you so much @pellenilsson for this great improvement! |
The following settings are sent as a config object from the server to the client: - `reply-to-self` - `require-author` - `require-email` - `reply-notifications` - `gravatar` This means that the following settings will be ignored when set on the client side: - `data-isso-reply-to-self` - `data-isso-require-author` - `data-isso-require-email` - `data-isso-reply-notifications` - `data-isso-gravatar` Isso will notify the user on the browser console if a client setting has been overwritten by a config from the server. Gravatar setting trumps regular avatars: In addition, `data-isso-avatar` will be set to `false` when gravatars are enabled to prevent both regular avatars and gravatars appearing side-by-side. Documentation updates: Update docs for shared server-client settings and clarify documentation for gravatar/avatar settings
@pellenilsson in case you still feel like contributing after such a long wait, have a look at https://github.com/ix5/isso/commits/pull-311-preserve-defaultconf for slightly correcting the warnings in the console. Also, as a note to myself: Sending the |
This restores the behavior before isso-comments#311 Closes isso-comments#815 Note: This is only a hotfix!
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Create new endpoint at `/config`, which will serve a JSON representation of the server's `public_conf`. Also remove the `config` object from `fetch()` responses. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Create new endpoint at `/config`, which will serve a JSON representation of the server's `public_conf`. Also remove the `config` object from `fetch()` responses. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Create new endpoint at `/config`, which will serve a JSON representation of the server's `public_conf`. Also remove the `config` object from `fetch()` responses. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Create new endpoint at `/config`, which will serve a JSON representation of the server's `public_conf`. Also remove the `config` object from `fetch()` responses. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Create new endpoint at `/config`, which will serve a JSON representation of the server's `public_conf`. Also remove the `config` object from `fetch()` responses. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Create new endpoint at `/config`, which will serve a JSON representation of the server's `public_conf`. Also remove the `config` object from `fetch()` responses. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Create new endpoint at `/config`, which will serve a JSON representation of the server's `public_conf`. Also remove the `config` object from `fetch()` responses. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Create new endpoint at `/config`, which will serve a JSON representation of the server's `public_conf`. Also remove the `config` object from `fetch()` responses. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Remove the `config` object from `fetch()` responses and instead let client user the newly created `/config` endpoint. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (isso-comments#311)" So far, the `config` dict was being sent with the server response when fetching comments from the `fetch()` `/` (GET) endpoint. Remove the `config` object from `fetch()` responses and instead let client user the newly created `/config` endpoint. Extend the JS client api file to fetch from the `/config` endpoint, which will only happen once via the `fetchComments` hook on page load.
This is a backport of isso-comments#820 to the 0.12.6 release branch. This restores the behavior before isso-comments#311 Closes isso-comments#815 Note: This is only a hotfix!
Some settings (reply-to-self and require-email) always need to be set to the same value on server and client side for correct operation. This change removes the need for such redundant information by having the client read out those settings from the server.
According to the docs this should be true for require-author as well, but that settings doesn't seem to be implemented.