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

"Disable comments" on the page where there are no comments initially #262

Closed
ob-tk opened this issue Jan 25, 2019 · 12 comments
Closed

"Disable comments" on the page where there are no comments initially #262

ob-tk opened this issue Jan 25, 2019 · 12 comments
Assignees
Milestone

Comments

@ob-tk
Copy link

ob-tk commented Jan 25, 2019

If the admin clicks "Disable comments" on the page where there are no comments, the option does not switch to "Enable comments", the input window is not removed. With each click, in the logs we get "......&ro=1".

However, it is no longer possible to add a comment on this page, we get "Something went wrong. Please try again a bit later".

@umputun
Copy link
Owner

umputun commented Jan 25, 2019

@Reeywhaar @igoradamenko - I think smth with ui goes a little bit crazy here

@Reeywhaar
Copy link
Collaborator

Reeywhaar commented Jan 25, 2019

ui goes crazy because if post is marked readonly and there are no comments
/api/v1/find?url=https://remark42.com/demo/&sort=-active&format=tree&site=remark
responds with:

{"details":"can't find comments","error":"no bucket https://remark42.com/demo/ in store"}

While if there are at least one comment and post is read-only the response would be:

{"comments":[▋▋▋▋▋▋▋▋▋],"info":{"url":"https://remark42.com/demo/","count":1,"read_only":true,"first_time":"2019-01-25T16:16:14.7060253-06:00","last_time":"2019-01-25T16:16:14.7060253-06:00"}}

So, in first case ui doesn't know if post is read-only so it can't change button to enable comments because there is no info.read_only in response.

@umputun
Copy link
Owner

umputun commented Jan 25, 2019

I'd say it is a good reason to go crazy :) Probably I should change response (on api level) in this case and return empty comment list but valid/current info document.

@umputun
Copy link
Owner

umputun commented Jan 26, 2019

@Reeywhaar I think api should be playing better now for such "no bucket" finds. Can you pls make sure it is all good from UI point of view?

@Reeywhaar
Copy link
Collaborator

yep, ui side is broken now, loading spinner and nothing more.
screenshot 2019-01-26 at 03 33 57

@Reeywhaar
Copy link
Collaborator

Reeywhaar commented Jan 26, 2019

Right now /api/v1/find returns {comments: null, info: {...}} and null is unexpected value for comments. I'll add check for null but I think it's better to set comments to empty slice by default on the backend too.

Same applies to /api/v1/last

@umputun
Copy link
Owner

umputun commented Jan 26, 2019

I have fixed find response, however not sure why last affected as I didn't touch it. Probably it always returned null on empty comments. Anyway, made it to return [] as well

@umputun
Copy link
Owner

umputun commented Jan 26, 2019

@Reeywhaar - if this change working as you expect we could probably drop #264 ?

@Reeywhaar
Copy link
Collaborator

Reeywhaar commented Jan 26, 2019

Last time the response was treated like error which has been caught, and handled by return of default placeholder data instead.

Edit: you must be talking about last comments endpoint. Well, there must have been an error, it just was that outcome of it is the same (empty widget), so no one noticed.

Let me see if everything works, and if so, I'll drop

@Reeywhaar
Copy link
Collaborator

Reeywhaar commented Jan 26, 2019

So, yes, everything works good regarding comments.

As for last comments there are errors in console, which I think rather ugly :-) From ui point as I said it's just an empty widget. If you can change response to be [] would be great.

edit:

Anyway, made it to return [] as well

Haven't noticed, it's still null :/

screenshot 2019-01-26 at 08 05 51

umputun added a commit that referenced this issue Jan 26, 2019
@umputun
Copy link
Owner

umputun commented Jan 26, 2019

hopefully, this time is [] for real

@Reeywhaar
Copy link
Collaborator

yep, now everything great 👍

@umputun umputun closed this as completed Jan 26, 2019
@umputun umputun added this to the v1.3 milestone Apr 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants