SpringAll icon indicating copy to clipboard operation
SpringAll copied to clipboard

Do not show the service to the user if it is disabled, fixes #6184

Open Flaburgan opened this issue 2 years ago • 6 comments

I was wondering if we should disconnect all users if we detect that the podmin changed the config to disable the service, but first of all config change isn't easy to detect, and second I think that if the podmin then re-enables it it would be a shame to ask all users to reconnect.

Flaburgan avatar Oct 31 '22 16:10 Flaburgan

This breaks Jasmine, there are specs that have expectations around available services that are no longer true with this PR.

denschub avatar Oct 31 '22 22:10 denschub

Yep, it should be fixed now. I had to switch to another computer so it took time for diaspora-dev setup to run. Should I also add a test to test the code I wrote? Should it be rspec or cucumber?

Flaburgan avatar Oct 31 '22 23:10 Flaburgan

OK so I'm confused @SuperTux88 said this to me on IRC:

the jasmine spec is probably broken because it generates the templates with different settings ... the change you made in publisher_view_spec.js doesn't affect _publisher.html.haml so you need to change the configured services in the rspec test that generates the template that is used for the failing jasmine test ... and to test that locally you need to re-generate the fixtures locally, because you probably still have them from before your change

But actually locally the jasmine tests are green without adding anything else that what I did here. What you are saying is that I should also modify publisher_spec.rb?

Flaburgan avatar Nov 05 '22 09:11 Flaburgan

But actually locally the jasmine tests are green without adding anything else that what I did here. What you are saying is that I should also modify publisher_spec.rb?

When I wrote that I didn't check which fixture is used and where it's generated. I assumed that you didn't re-generate your fixtures locally, so you are still using fixtures that were generated before your change in _publisher.html.haml. And the change you did to publisher_view_spec.js isn't needed and doesn't change anything, as it doesn't affect the fixture (locally your tests are probably green with or without that change there? But if you re-generate fixtures with bin/rake tests:generate_fixtures, then I assume that your tests aren't green anymore).

So in the line below the line you added, you see it loads aspects_index_services, and that one is generated in aspects_spec.rb, so you need to change that so the fixture still contains the services, and then jasmine will work again.

SuperTux88 avatar Nov 06 '22 00:11 SuperTux88

The related tests are fixed, the current failure in Rspec is unrelated, develop is also failing on that test. So this should be ready for review.

Flaburgan avatar Feb 07 '23 22:02 Flaburgan

So I created a helper as suggested and used it in both version, the HTML of the desktop app works fine in the mobile app. However, it is hard to test as I can't enable services for my user locally (if you can tell me how to do that).

If I copy paste the expected HTML, the design looks good: Capture d’écran 2024-02-11 à 18 04 21

But the current helper code doesn't work apparently, it returns an empty array [] straight into the view:

Capture d’écran 2024-02-11 à 18 02 55

Could you explain me why?

Flaburgan avatar Feb 11 '24 17:02 Flaburgan

I removed your last commit, and added my own with the helper that just filters the services and also added a test for that helper.

This now just filters the services for both UIs (so fixes the bug for both of them), but keeps the design otherwise as is.

SuperTux88 avatar Jun 02 '24 03:06 SuperTux88

Thank you for finishing this

Flaburgan avatar Jun 02 '24 10:06 Flaburgan