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: Added display message for normal users for protected images #8854

Conversation

MonalikaPatnaik
Copy link
Collaborator

@MonalikaPatnaik MonalikaPatnaik commented Aug 15, 2023

What

  • showing the “upload” button
    when the image is uploaded, a message “Image received” is displayed only, no need to display cropping tool for normal users.
  • the already selected image (from the producer) is shown.
  • not showing the unselect button (only shown for admins/moderators)
  • if the user is a moderator / an admin, he/she should still be able to select / unselect / crop images

Screenshot

Screenshot 2023-09-28 205250

Related issue(s) and discussion

  • Fixes #[ISSUE NUMBER]

@github-actions github-actions bot added 🖼️ Images Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org labels Aug 15, 2023
@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 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov-commenter
Copy link

codecov-commenter commented Sep 27, 2023

Codecov Report

Merging #8854 (66d4439) into main (495c58f) will decrease coverage by 0.01%.
Report is 1 commits behind head on main.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main    #8854      +/-   ##
==========================================
- Coverage   47.81%   47.80%   -0.01%     
==========================================
  Files          64       64              
  Lines       19942    19946       +4     
  Branches     4823     4824       +1     
==========================================
  Hits         9536     9536              
- Misses       9162     9166       +4     
  Partials     1244     1244              
Files Coverage Δ
lib/ProductOpener/Images.pm 37.84% <0.00%> (-0.20%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MonalikaPatnaik MonalikaPatnaik marked this pull request as ready for review September 29, 2023 07:42
@MonalikaPatnaik MonalikaPatnaik requested a review from a team as a code owner September 29, 2023 07:42
@@ -704,24 +714,26 @@ function get_recents(tagfield) {

var $this = $(this);
var id = $this.attr('id');
var clas= $this.attr("data-info");
Copy link
Contributor

Choose a reason for hiding this comment

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

the variable is named "clas" because "class" is a protected word? As the attribute we read is not the class anyway, could we rename the variable to data_info maybe?

Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

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

I tested it, it is working well, thank you!

@@ -427,16 +427,26 @@ function update_nutrition_image_copy() {

function update_display(imagefield, first_display) {

var display_url = imagefield_url[imagefield];
var flag=0;
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit strange to use the imagefield to specify that the image is protected, and then removing "protect_" etc.

Could you just add a parameter to update_display() ? update_display(imagefield, protected, first_display). It would be clearer that way I think, and we would not need to have the flag, modifiedimagefield etc.

@sonarcloud
Copy link

sonarcloud bot commented Sep 29, 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 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

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

Perfect, thank you!

@stephanegigandet stephanegigandet merged commit f7931a9 into openfoodfacts:main Oct 2, 2023
14 checks passed
@MonalikaPatnaik MonalikaPatnaik deleted the add-protected-image-message 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
🖼️ Images JavaScript 🌍 Multilingual products Product name, Generic name, Ingredients, Packaging text are multilingual fields. 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.

4 participants