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

fix: Added unique id to API Request header. #3675

Merged
merged 1 commit into from
Feb 21, 2023

Conversation

abughalib
Copy link
Contributor

What

Added a Unique Id to each app installation.

The issue:
Data Source should show who updated something.
image

So far I have come to 2/3 ways to do this.

  • App Side
    The app has a global user and is used when an anonymous user edits the product. Ref: smoothie-app We can create an account on Open Food Facts using UUID for each app installation as a global user (I don't know if it's the right way).
  • Server Side
    If we store the comments that come with the API Request header. And show them if the user is a 'smoothie-app'.
    Ref to the Server Side Template: here And the View
  • Maybe Someone else can suggest something.

Sorry, I was not able to test if the server-side receives the comments, I tried building the server-side docker container 3 times, twice in Windows 11, and once in Debian 11. I was getting lots of errors.

Part of

#1351
#3644

@abughalib abughalib requested a review from a team as a code owner February 6, 2023 10:32
@abughalib abughalib changed the title Added unique id to API Request header. fix: Added unique id to API Request header. Feb 6, 2023
@M123-dev
Copy link
Member

M123-dev commented Feb 8, 2023

Heyy @abughalib sorry for the late answer, for the UUID, we don't need to generate a UUID. We already have one inside the app.
(OpenFoodAPIConfiguration.uuid), but this will cause a problem since its set on line 139 in main.dart but the user agent is already set in line 117, so we have to put the setupAppNetworkConfig below the ProductQuery.setUuid

@abughalib
Copy link
Contributor Author

@M123-dev
Oh, We already had that.
I'm guessing this issue was not supposed to have been open for so long.

@codecov-commenter
Copy link

codecov-commenter commented Feb 12, 2023

Codecov Report

Merging #3675 (6c43387) into develop (070b258) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop    #3675      +/-   ##
===========================================
- Coverage    10.41%   10.40%   -0.01%     
===========================================
  Files          273      273              
  Lines        13801    13806       +5     
===========================================
  Hits          1437     1437              
- Misses       12364    12369       +5     
Impacted Files Coverage Δ
...ackages/smooth_app/lib/helpers/network_config.dart 0.00% <0.00%> (ø)

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

@M123-dev
Copy link
Member

@abughalib could you update this PR to use the OpenFoodAPIConfiguration uuid.

It is persistant

@abughalib abughalib reopened this Feb 19, 2023
@abughalib
Copy link
Contributor Author

Done

Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

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

Perfect, thanks @abughalib

@M123-dev M123-dev merged commit 675911f into openfoodfacts:develop Feb 21, 2023
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.

3 participants