-
Notifications
You must be signed in to change notification settings - Fork 438
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
[client] js: Fetch public conf once from /config; embed.js: Preserve default config values #821
Conversation
c55c9cc
to
706d1e7
Compare
cc @pellenilsson @brad, looking forward to your reviews. Hope you can rebase your changes on top of this. |
2a88419
to
ce3f12b
Compare
6af6e1d
to
11f3e7c
Compare
@Kerumen continuing discussion from #842
That seems strange to me. With the branch from #821, I don't see a refresh of the whole window. Both But I have discovered another issue which is a race condition during the reading of the default config and fetching of the server config. See this branch with some logging. You need to refresh the page a couple of times to hit it.
Note {
"config": {
"reply-to-self": false,
"require-email": false,
"require-author": false,
"reply-notifications": false,
"gravatar": false
}
} But in some cases (like the above), it'll result in some instances being set to true and later/earlier(?) evaluating to false. This is due to some bad importing practices - a lot of code relies on My idea for how the flow should look like is this:
Further problems
|
11f3e7c
to
b25b188
Compare
This way, Isso is not confusing users when a server config value overwrites a client default one, i.e. if the user has not actually attempted to overwrite it.
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.
Check if something is ready, and if not, register self as listener to be triggered once it is ready. To be used by `embed.js` to coordinate between dependents of the `/config` endpoint.
Those two functions need to wait for the config to be fetched from the server. Utilize the newly introduced `wait_for` helper mechanism to coordinate using registered triggers instead of using timeout/retry.
Those do not need to wait for server config. By re-shuffling the logic a bit, the `init` function can also bail out earlier if no `#isso-thread` is found on page.
The `$('style#isso-style')` check was always returning `null`. Simply use the plain id to fix that.
The `isso-thread-heading` class was added to `<h4>` element, snapshots need to be updated to reflect that.
b25b188
to
1d8e059
Compare
I am positive that by introducing a sort-of lock using |
isso: js: embed.js: Preserve default config values
This way, Isso is not confusing users when a server config value overwrites a client default one, i.e. if the user has not actually attempted to overwrite it.
isso: js, py: Fetch public conf once from /config
This is an improvement on top of: 02f3ea0 "Have client read out shared settings from server (#311)"
So far, the
config
dict was being sent with the server response when fetching comments from thefetch()
/
(GET) endpoint.Remove the
config
object fromfetch()
responses and instead let client user the newly created/config
endpoint. (see #880)Extend the JS client api file to fetch from the
/config
endpoint, which will only happen once via thefetchComments
hook on page load.EDIT: Have a couple of nasty race conditions right now, needs further work. Caused by multiple instances of
config
copying fromdefault_config
, where the templates might receive either a pre-copy or post-copy instance.