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

Add functionality for counting file uploads #3522

Merged
merged 5 commits into from
Jan 15, 2025

Conversation

harmitgoswami
Copy link
Collaborator

Fix #3482

This PR adds badge stat counting logic for file uploads.

The communication between frontend and backend is done using the Django messaging framework.

To reproduce results: Head to any resource, click on your profile in the top right, and then click "Download Translations". Save this file in a text editor, and edit 5 translations. Then, head back to the resource, click on your profile again, and click "Upload Translations". Upload the file you edited. Once the upload is complete, you should be awarded the Translation Champion Badge for this action.

Copy link
Collaborator

@mathjazz mathjazz left a comment

Choose a reason for hiding this comment

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

I haven't tested the code yet, but it make sense. Left some suggestions.

pontoon/base/views.py Outdated Show resolved Hide resolved
pontoon/base/views.py Outdated Show resolved Hide resolved
pontoon/sync/core/translations_from_repo.py Outdated Show resolved Hide resolved
pontoon/sync/core/translations_from_repo.py Outdated Show resolved Hide resolved
translate/src/context/BadgeTooltip.tsx Show resolved Hide resolved
translate/src/context/BadgeTooltip.tsx Outdated Show resolved Hide resolved
translate/src/context/BadgeTooltip.tsx Outdated Show resolved Hide resolved
translate/src/context/BadgeTooltip.tsx Show resolved Hide resolved
Factored out notification useEffect hook, added extra tag for badge messages
@codecov-commenter
Copy link

codecov-commenter commented Jan 15, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.17%. Comparing base (cf74554) to head (d4145d7).
Report is 7 commits behind head on main.

Additional details and impacted files

@mathjazz
Copy link
Collaborator

Sorry for the confusion - in https://github.com/mozilla/pontoon/pull/3522/files#r1913781900 and the following comment I meant to communicate that the approach I used in the linked gist is not good enough to be used and we should just factor out a function that checks if we have any notifications to display.

translate/src/hooks/useNotifications.ts Outdated Show resolved Hide resolved
translate/src/hooks/useNotifications.ts Outdated Show resolved Hide resolved
@mathjazz mathjazz merged commit 89f390a into mozilla:main Jan 15, 2025
7 checks passed
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.

Award badges for file uploads
3 participants