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

Don't show the Notifications setting for profile only enterprises in the Users section #7307

Conversation

cillian
Copy link
Contributor

@cillian cillian commented Apr 2, 2021

Fixes #1797

If a enterprise has only set up a profile they won't be getting any order notification emails so showing this setting could be confusing.

What should we test?

  1. Go to the Admin > Enterprise > Users section for a profile only enterprise and check the Notifications setting is not visible.
  2. Go to the Admin > Enterprise > Users section for a hub or shop enterprise and check the Notifications setting is visible.

Release notes

Don't show the Notifications setting for profile only enterprises in the Users section

Changelog Category: User facing changes

@cillian cillian self-assigned this Apr 2, 2021
@codecov
Copy link

codecov bot commented Apr 2, 2021

Codecov Report

Merging #7307 (8cbd51e) into master (7eac465) will not change coverage.
The diff coverage is n/a.

❗ Current head 8cbd51e differs from pull request most recent head 2bb406f. Consider uploading reports for the commit 2bb406f to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7307   +/-   ##
=======================================
  Coverage   93.26%   93.26%           
=======================================
  Files         637      637           
  Lines       18119    18119           
=======================================
  Hits        16899    16899           
  Misses       1220     1220           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7eac465...2bb406f. Read the comment docs.

expect(rendered).to have_selector("select[name='receives_notifications']")
end

it "is not visible when an enterprise is a only a profile" do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if they're a producer though...? Are there no emails in that case? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't be the most familiar with this but I had a look in wiki/Emails and I couldn't see any obvious emails for enterprises with sells == 'none' / is_distributor == false

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. order cycle producers notification
    This is email is for sells == 'none' / is_distributor == false

{{user.email}}
- else
= @enterprise.contact.email
- if @enterprise.is_distributor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe unless @enterprise.producer_profile_only would more explicitly exclude profile-only enterprises?

Copy link
Contributor Author

@cillian cillian Apr 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes unless @enterprise.producer_profile_only sounds better and I was going to change it there but I think I spotted a bug.

I don't think producer_profile_only ever gets set to true anymore, see https://github.com/openfoodfoundation/openfoodnetwork/blob/master/app/assets/javascripts/admin/enterprises/controllers/index_producer_panel_controller.js.coffee#L12 it's assigning with = instead of comparing with == That makes me wonder if the producer_profile_only column/method can be deprecated. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great catch @cillian, I'm not sure of the consequences, tbh.

Even before this PR, I'm not sure how to set the producer_profile_only to true. This should correspond to set an enterprise as a "Producer" and "Profile only" (i.e., not a Shop, and not a Hub), right?

I've found this spec, https://github.com/openfoodfoundation/openfoodnetwork/blob/master/spec/controllers/admin/enterprises_controller_spec.rb#L385 :


      context "setting producer_profile_only" do
        it "is ignored" do
          spree_post :register, id: enterprise, sells: 'none', producer_profile_only: true
          expect(response).to redirect_to spree.admin_dashboard_path
          expect(enterprise.reload.producer_profile_only).to be false
        end
      end

So, if I understand this correctly, it seems to ignores this setting and as such, enterprise.producer_profile_only seems never to be true...

Update: I saw #7835 only after posting the comment above 😉

Copy link
Contributor

@andrewpbrett andrewpbrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be merged as it is. I created #7835 for the producer_profile_only field issue. I'm going to move this to Test Ready unless you disagree @Matt-Yorkley (the failing spec is flaky).

@filipefurtad0 filipefurtad0 self-assigned this Jun 30, 2021
@filipefurtad0 filipefurtad0 added pr-staged-uk staging.openfoodnetwork.org.uk pr-staged-fr staging.coopcircuits.fr and removed pr-staged-uk staging.openfoodnetwork.org.uk pr-staged-fr staging.coopcircuits.fr labels Jun 30, 2021
…the Users settings section

If a enterprise has only set up a profile they won't be getting any order notification emails so showing this setting could be confusing.

#1797
@andrewpbrett andrewpbrett force-pushed the hide-notifications-setting-for-profiles branch from 0d7f49e to 2bb406f Compare June 30, 2021 16:48
@filipefurtad0
Copy link
Contributor

Hey @cillian ,

I tried all profile combinations, and checked whether the Notifications section appears under the Users tab:

  • Producer - Yes:

    • Profile Only - does not appear
    • Producer Shop - appears
    • Producer Hub - appears
  • Producer - No:

    • Profile Only - does not appear
    • Hub Shop - appears

Peek 2021-06-30 18-10

We're good to go, thank you! 🎉

@andrewpbrett andrewpbrett merged commit 7451f06 into openfoodfoundation:master Jun 30, 2021
@lin-d-hop
Copy link
Contributor

Hi team,
Apologies but we need to revert this with high priority.
This field is used to send notifications to producers that are supplying hubs. It is highly needed.
This should never have been merged. If this is a big problem we need a better descriptor - not removal

apricot12 added a commit to apricot12/openfoodnetwork that referenced this pull request Jul 15, 2021
@cillian cillian deleted the hide-notifications-setting-for-profiles branch September 17, 2021 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants