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

feat: Enable Org Admins to View and Modify Member Admin Status #8840

Conversation

MonalikaPatnaik
Copy link
Collaborator

@MonalikaPatnaik MonalikaPatnaik commented Aug 12, 2023

@github-actions github-actions bot added 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org labels Aug 12, 2023
@stephanegigandet
Copy link
Contributor

Looks good :)

@sonarcloud
Copy link

sonarcloud bot commented Aug 21, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov-commenter
Copy link

codecov-commenter commented Sep 26, 2023

Codecov Report

Merging #8840 (4326901) into main (f344dcc) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #8840   +/-   ##
=======================================
  Coverage   47.88%   47.88%           
=======================================
  Files          65       65           
  Lines       20266    20266           
  Branches     4916     4916           
=======================================
  Hits         9704     9704           
  Misses       9307     9307           
  Partials     1255     1255           

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@MonalikaPatnaik MonalikaPatnaik marked this pull request as ready for review October 23, 2023 19:58
@MonalikaPatnaik MonalikaPatnaik requested a review from a team as a code owner October 23, 2023 19:58
Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

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

@MonalikaPatnaik first thanks for the PR and you demonstrate to be quite smart at tackling the issue.

That said it seems to me we can simplify it (the most important is on the template part).

templates/web/pages/org_form/org_form.tt.html Outdated Show resolved Hide resolved
templates/web/pages/org_form/org_form.tt.html Outdated Show resolved Hide resolved
cgi/org.pl Outdated Show resolved Hide resolved
cgi/org.pl Outdated
remove_user_from_org($org_ref, $user_id, ["admins"]);
@admin_status = grep {$_ != $user_id} @admin_status;
}
store_org($org_ref);
Copy link
Contributor

Choose a reason for hiding this comment

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

store_org() should be outside the for loop, otherwise we will save the org as many times as there are users

cgi/org.pl Outdated Show resolved Hide resolved
cgi/org.pl Outdated Show resolved Hide resolved
cgi/org.pl Outdated Show resolved Hide resolved
cgi/org.pl Outdated Show resolved Hide resolved
cgi/org.pl Outdated Show resolved Hide resolved
@alexgarel
Copy link
Member

@MonalikaPatnaik I did a commit to propose changes to simplify form (avoid JS).

Now I let you see if it's working as desired and fix lint and critic.

@alexgarel
Copy link
Member

sorry @MonalikaPatnaik I didn't have time, yet to look into this but I will !

Copy link

sonarcloud bot commented Nov 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@alexgarel alexgarel enabled auto-merge (squash) November 14, 2023 21:33
Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

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

Let's merge :-)

@alexgarel alexgarel merged commit c6aefc2 into openfoodfacts:main Nov 14, 2023
14 checks passed
alexgarel pushed a commit that referenced this pull request Nov 21, 2023
Fixes #8780

---------
Co-authored-by: Pierre Slamich <[email protected]>
Co-authored-by: Stéphane Gigandet <[email protected]>
Co-authored-by: Alex Garel <[email protected]>
@MonalikaPatnaik MonalikaPatnaik deleted the allow-org-admin-to-see-and-change-admin-status branch January 4, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers Template::Toolkit The templating toolkit used by product opener. The starting point for HTML/JS/CSS fixes. Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow org admins to see and change the admin role of other org members on the producers platform
5 participants