Based on unscientific local testing, the rendering speed benefits from eagerly populating the aggregated stats into Project, ProjectLocale & Locale don't exist, compared to collating the data on the fly from TranslatedResource objects. Therefore, we should not be doing this complex extra work. This significantly simplifies the logic around stats updates, and makes the stats much easier to reason about.
The AggregatedStats class no longer extends Model, and it's mostly a crutch for reducing the risks in this change; hence its move from base/models/ to base/. With it, fields like total_strings and strings_with_errors will continue to work for the Django models from which the corresponding DB fields were removed.
Adds a GraphQL API call support for simple case-insensitive search of terms and their translations for a given locale.
Example:
```graphql
query {
termSearch(search: "open", locale: "sl") {
text
partOfSpeech
definition
usage
translationText
}
}
```
Response:
```json
{
"data": {
"termSearch": [
{
"text": "open source",
"partOfSpeech": "ADJECTIVE",
"definition": "Refers to any program whose source code is made available for use or modification.",
"usage": "These terms are not intended to limit any rights granted under open source licenses",
"translationText": "odprtokoden"
}
]
}
}
```
Also enables GraphiQL everywhere.
Here, sync status logging is collapsed into a single table of events, which is written to only from sync_project_task(), with the following states:
* IN_PROGRESS
* DONE - sync complete, with some changes to DB or repo
* NO_CHANGES - sync complete, with no changed to DB or repo
* NO_COMMIT - sync complete, but commit=False was set while a repo write should've occurred
* PREV_BUSY - skipped due to previous sync still running
* FAIL - an exception was raised
* INCOMPLETE - sync never completed; set by a subsequent successful run
For FAIL, an error message is retained in the error field.
The logs are made available via the following views:
* /sync - latest sync status and start time for each project
* /sync/projects/<project> - sync events for each project
* /sync/errors - all anomalous sync events with a status other than DONE or NO_CHANGES
Old sync events are ported to the new format, setting the status as NO_CHANGES for all that were "skipped" and INCOMPLETE for ones with no end time set.
Also included:
* Do not clear ChangedEntityLocale during a sync with commit=False
* Add Sync Log menu entry to the Profile menu
Co-authored-by: Matjaž Horvat <matjaz.horvat@gmail.com>
Sending a lot of emails could result in a request timeout when sent synchronously.
That's only really possible when emails sent from the Messaging Center, because the rest are sent to a small number of recipients (e.g. Welcome Email, Email Verification, Project Requests...) or on a dedicated worker via management commands (Notification Emails, Monthly Report, Inactive Accounts...).
Store transactional email content in the DB and make it editable in Django Admin. That allows us to keep the Mozilla-specific content outside the codebase and inside the DB.
Also included:
* Move contact email verification to pontoon.messaging and use HTML template
* Move more general styles to the base email template
* Add spaces around variables in curly braces
* Document new management commands
* Unify HTML editor experience between the Homepage and Email content
1. Only uncheck email check boxes
2. Read toggle button value from the value attribute. Currently, the value to send to the backend is read from the text node value of the button, which might be changed by machine translation, in which case the settings cannot be changed.
Minor copy updates and fixes in Onboarding and Inactive account emails.
Also included:
* Fix Firefox Add-On URL
* Add "Has not received inactive account reminder" as the condition for inactive Translator and Manager emails
* Email communications > News and updates
* Exclude system-project submissions from the Inactive contributor requirement
Send notification and open a pop-up (feat. a confetti animation!) when badge gets awarded.
Also included:
* New `ActionLog.is_implicit_action` field. Some action types (e.g. `TRANSLATION_CREATED`) may trigger other actions (e.g. `TRANSLATION_REJECTED`) without direct user intervention. The latter actions now have `is_implicit_action` set to `True`. That allows us to only include explicit actions in badge counts.
The changeset also factors out the base HTML email template, which is currently shared with the notifications email template. In the future, we'll use it for all HTML emails we send.
In addition to the spec, a configurable Thank you note is added. The day of the month to send the summary emails on is also configurable.
We broke sending new contributor notifications in #2677 by moving the is_new_contributor() check after the point when translation is saved, while keeping its logic (return True whether the user has not made any contributions yet). That way the function always returns False.
This changeset:
* Fixes the logic to detect that the submitted translation is the user's first contribution to the locale.
* Add an additional check that the new contributor notification is not sent to project managers.
* Adds a test case to checks whether the new contributor notification is sent and that it's only sent once.
Some notification types (suggestions available for review, suggestions have been reviewed and new contributor has joined the team) use relative URLs. That means they won't work in emails. This patch fixes that.
It also:
* Moves notification content from multiline strings to HTML templates.
* Moves management commands for sending notifications to the messaging module.
* Moves notification template files to the messaging module.
This PR implements all the changes to the user settings as per the spec:
https://github.com/mozilla/pontoon/blob/main/specs/0120-transactional-emails.md#settings-changes
It also introduces a management command to send daily or weekly email notifications.
Related changes:
* Add PNG logo, needed for the display in emails (SVG is not supported in Gmail)
* Store notification categories in the data model
- Use these categories to determine to which category the user is subscribed
- Add data migration to store categories for old notifications
Other changes, not directly related to the PR:
* Reorder sections in the Settings page by moving Email and Notifications sections next to another.
* The settings.html file has been reformatted. Please hide whitespace in the diff for easier overview of changes.
* Minor changes to the check-box widget markup and styling.
* Minor changes to the success messages when toggling checkboxes.
* Explicity set from: email address everywhere we send emails.
* Use default font weight in <li> elements in the Messaging Center Preview / Inbox
* <li> elements in the notification message should have the same color on hover as the rest of the text
This is the final step towards Translation Memory Management: ability for team managers and translators to upload .TMX files to their locale's TM.
Details:
- The maximum file upload size is 20 MB.
- Supported srclang values (read from <header> and <tu> elements) are en, en-US and en_US (in all cases).
- In <tuv> elements, lang or xml:lang value must match the locale code.
- Source-target combinations that already exist in the DB are not imported.
Also included:
* Cancel button that appears while editing or deleting a TM entry is now positioned left to the main button.
* Error messages are now presented as errors (red color), rather than regular messages (green).