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
Admin, Enterprise creation : set visibility to "Hidden" by default #11247
Admin, Enterprise creation : set visibility to "Hidden" by default #11247
Conversation
bbc748f
to
0f10e60
Compare
dd76a4e
to
9c7a84c
Compare
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.
Excellent!
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.
We have a minor inconsistency with the spec factory now, but it probably isn't worth changing 👍
@@ -233,7 +233,7 @@ | |||
t.boolean "enable_subscriptions", default: false, null: false | |||
t.integer "business_address_id" | |||
t.boolean "show_customer_names_to_suppliers", default: false, null: false | |||
t.string "visible", limit: 255, default: "public", null: false | |||
t.string "visible", default: "only_through_links", null: false |
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.
I guess a later version of Rails doesn't specify a default limit anymore.
We could actually set a much smaller limit, but I don't know how much this helps optimise the db. Probably not worth it.
@@ -14,6 +14,7 @@ | |||
description { 'enterprise' } | |||
long_description { '<p>Hello, world!</p><p>This is a paragraph.</p>' } | |||
address | |||
visible { 'public' } |
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.
I guess this is for backwards-compatibility with specs assuming this value?
If so, I think it would have been better to specify it in the specs themselves (they are now using a context with a non-default value). Perhaps the specs might need updating to test the default value too.
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.
I guess this is for backwards-compatibility with specs assuming this value?
Yes.
If so, I think it would have been better to specify it in the specs themselves (they are now using a context with a non-default value).
I had hesitation yes ... I chose the easiest solution, but maybe not the best one... I will change that if you think it's better. Maybe will create a new trait for that.
Hey @jibees , A very quick test - I'll have to explore this result a bit better - but after:
I've noticed there still is no option pre-set: Checking the DB:
I'll test other scenarios but it seems not to be doing what we'd expect - or maybe |
Whoo. Super strange.
i've tested with the super-admin user I guess. What about you? Maybe this produce a difference? |
Indeed, creating an enterprise via superadmin ( I was not explicit about this when the issue was opened, apologies - I did not consider this possibility, still learning about the app 🙈 I considered only, the case in which a user wishes to create its own enterprise. This process starts by clicking this tab, on the homepage, after logging in: So, I'd propose to merge this PR, and leave the issue open, to account for enterprises created from users, sounds good @jibees ? |
hummm ... I think I'd prefer manage this case in the same PR. Maybe there will be some interaction between them, and I rather treat within the same context. Back into |
Sure - that's good too. I've indicated the relevant spec and added a couple of lines to test the upcoming fix in this PR - hope this helps. |
Back in |
+ update enterprise_factory.rb to create "public" enterprise through specs via its factory
7e915b8
to
04f83fb
Compare
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.
Looks good! The defaults for creating an enterprise were different before, but now all the same:
- Admin
- Frontend ("register here")
- API v0
I can't find any documentation for enterprises on API v0 so there's nothing to update ;)
Hi @jibees. Anyway, here are my notes BEFORE staging this PR for later reference. Test scenariosEnterprises can be created
Enterprises should show/not show
Database BEFORE stagingCheck DB before staging the PR Staging AU
Staging UK
User interface BEFORE staging
I can confirm that for If you have any ideas regarding the failing staging process let me know please. Thanks! |
Yes, it seems this was the case @drummer83 : after deleting the migration and re-deploying, it's good to test 👍 |
Hey @jibees , Creating an enterprise as admin leads to the expected result However, creating an enterprise from the homepage, still does not lead to the expected result: Maybe there is something fishy with the PR / deployment? I've just looked at the code at the staging server, and it seems that it does not have the most recent version - I've looked at the spec file: This is despite our message in devops channel: And the success logs on GH actions: Don't quite understand this result... 🤯 |
Wait... Maybe something else got staged in the meantime? ping @Matt-Yorkley 😅 Uff - that's a relief. This looked way too mysterious for this time of the day. I'll try again later 😉 |
New enterprises, created via:
Have the default Previously created enterprises seem not to be changed by this PR / data migration: I'd say this brings improvement and is good to ship. We seem to have 4 options... while the UI only displays three:
In staging-FR we have a 5th option:
The PR does not change this. I'd say we can do this DB cleanup elsewhere - please shout @jibees if you see this as a blocker for some reason. Merging! |
a975e2b
into
openfoodfoundation:master
What? Why?
What should we test?
As an admin
only_through_links
(ie. "Hidden" in the UI) by defaultAs a user
only_through_links
(ie. "Hidden" in the UI) by defaultRelease notes
Changelog Category: User facing changes