Граф коммитов

6041 Коммитов

Автор SHA1 Сообщение Дата
Cedric Amaya 074fddc19c
Update Term.entity after updating Term.text (#3133)
Problem:
When updating the Term.text, the associated entity was not correctly
updating to point to the newly created entity. This led to Term.entity
property still pointing to the previous, now obsolete entity.

Solution:
In the `create_entity()` method of the Term model, explicitly set the
term property of the associated entity to the current term instance
before saving it. This ensures that the entity is correctly associated
with the updated term instance.

Additionally, removed the `update_fields` argument from the
`entity.save()` call to ensure that all fields are properly saved,
including the `obsolete` flag if the entity is not newly created.

Changes:
- Added `entity.term = self` before updating the `entity_id` in the `create_entity()` method.
- Removed the `update_fields` argument from `entity.save()` call to ensure all fields are saved.
2024-03-12 09:45:44 +01:00
Cedric Amaya cb942ca554
Fix <Highlight /> search miscapitalization (#3134)
Problem:
In the search results list, highlighted parts of strings are currently
inherited from the search box, including its capitalisation, making
the source/translated string appear different from its actual state in
the search results list.

Solution:
Updated `<Highlight />` component to preserve the capitalization of the
source text in the search results list. The highlighted marks now
reflect the original capitalization of the source string.
2024-03-12 09:30:48 +01:00
Matjaž Horvat c18d03bfd2
Fix Resource.order docstring (#3132)
PEP-257 describes how you can use docstrings for attributes. They come *after* the attribute:
https://stackoverflow.com/questions/3051241/how-to-document-class-attributes-in-python/69754746#69754746
2024-03-11 17:23:29 +01:00
Matjaž Horvat 2015e4f2f5
Optimize filters by introducing Resource.order (#3130)
String filters can be slow, especially because ordering entities by Resource.path is slow. It turns out that:
- Adding DB index to Resource.path doesn't bring performance gains.
- Sorting entities by any other Resource.field is fast.

The reason for slowness is probably that Resource.path can be a pretty long text field.

So we're now introducing Resource.order, which to represent the alphabetic order of resources in the project. We reorder resources when new resources are added to the project.
2024-03-11 09:18:39 +01:00
Matjaž Horvat f47fa67106
Only make one DB query when string param provided in URL (#3128)
Previously, the slow (takes seconds in some cases) DB query was repeated twice.

Also: Refactor prefetching entities data.
2024-03-07 20:20:18 +01:00
Matjaž Horvat e8f2b19811
Avoid caching page headers (#3125)
* Cache /insights data, rather than entire /insights page
* Cache Contributors data, rather than entire Contributors views
2024-03-04 16:03:01 +01:00
Cedric Amaya b9b70cc172
Add new ESLint rules: no-var, prefer-const (#3126)
Additionally, fixes the ~230 issues raised by these two new rules when linting against the "pontoon/" subdirectory.
2024-03-04 13:02:13 +01:00
ayanaar 3e03b17424
Implementation of LLM-Assisted Translations Backend (#3100) 2024-02-26 21:29:45 +01:00
Matjaž Horvat 50fb285f0d
Update CONTRIBUTING.rst (#3123)
Minor fixes to the CONTRIBUTING.rst file

---------

Co-authored-by: Eemeli Aro <eemeli@mozilla.com>
2024-02-26 13:34:02 +01:00
Eemeli Aro e007c625d9
Add warning for any empty Fluent entries (#3121) 2024-02-23 21:05:56 +02:00
Matjaž Horvat 2e9ded2dc4
404 if tags don't have resources assigned (#3117) 2024-02-23 16:46:13 +01:00
Francesco Lodolo fb25c53ddc
Update to Debian 12, PostgreSQL 15, Node.js 18 in Docker (#3115) 2024-02-23 07:53:43 +01:00
Matjaž Horvat 0aa3811194
Optimize logic to retrieve Resources in the Localization dashboard (#3107) 2024-02-22 22:05:48 +01:00
Matjaž Horvat 1dcd738222
Optimize tags dashboards (#3101)
The functionality should remain identical, but the views should be significantly faster. In the case of Firefox Tag dashboards, the load times were in the 20-30 second range (or timing out), now these pages take max. 2-3 seconds to load.

The patch also:
* adds an extra DB index, which significantly impacts Tags tab performance
* drops the unused code (which represents the vast majority of changes in this patch)
* moves remaining files from tags/utils to tags/admin
2024-02-22 21:41:50 +01:00
Matjaž Horvat 00c8852fa3
Introduce dev utils, add debug_sql() (#3113) 2024-02-22 21:24:12 +01:00
Francesco Lodolo 9cf89026f2
Update to Python 3.10 (#3112)
In:
* GitHub workflows
* Docker
* Heroku

Also make related flake8, black and pyupgrade fixes (some actually only needed in future versions of python).
2024-02-22 19:33:05 +01:00
Francesco Lodolo e4b4946298
Update actions in workflows to latest versions (#3111) 2024-02-22 10:46:36 +01:00
Matjaž Horvat 4cf62b93d7
Prefetch latest_translation__approved_user (#3106) 2024-02-21 14:55:33 +01:00
potat0 0afb7d7065
Add tests for the pontoon.insights module (#3015) (#3079) 2024-02-15 19:54:34 +01:00
Matjaž Horvat 4d19972932
Update Django to the latest dot version. (#3098)
Also update django-jinja to the latest version.
2024-02-15 14:28:01 +01:00
Matjaž Horvat b013fb937f
Update New Relic (#3092) 2024-02-13 17:11:39 +01:00
Matjaž Horvat 7bdcaccc3d
Cache insights views (#3095) 2024-02-12 21:03:30 +01:00
Matjaž Horvat 26062556bf
Cache contributors views (#3091) 2024-02-12 18:01:39 +01:00
Matjaž Horvat c7e43f5ca5
Document DDoS mitigation (#3090) 2024-02-08 10:20:39 +01:00
ayanaar 96844440da
Add Specification for LLM-Assisted Translations (#3071) 2024-01-25 16:10:38 +01:00
Matjaž Horvat 2a02872440
Properly serialize Fluent placeables generated by Pretranslation (#3061)
After Fluent pretranslations are created, we need to parse and serialize them again in order to make sure they are stored in the canonical form (e.g. with spaces within curly braces).

Fix test:
- The following code only applies to non-FTL strings: "Empty strings and strings containing whitespace only do not need translation".
2024-01-18 15:13:13 +01:00
Matjaž Horvat d9f47f343d
Store pretranslations for each locale separately (#3075) 2024-01-18 13:59:56 +01:00
Matjaž Horvat 42a5285abd
Use correct Google Translate AutoML locale (#3060)
For locales that use the same locale code in Google Translate (e.g. es-AR and es-ES both use es),
we now use the correct locale code in Machinery Google Translate if AutoML is enabled.
2024-01-15 14:58:46 +01:00
dependabot[bot] c63b0c5f65
Bump jinja2 from 2.11.3 to 3.1.3 in /docs (#3062)
Bumps [jinja2](https://github.com/pallets/jinja) from 2.11.3 to 3.1.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/2.11.3...3.1.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-11 18:55:37 +01:00
ayanaar 3a95b7bb3c
Uniform Checks for Locale, Project, and ProjectLocale in AJAX Views (#3056) 2023-12-20 17:27:03 +01:00
Matjaž Horvat 5edbcad8d2
Restore Translate view full height (#3055)
It turns out the CSS property removed in cc7d3503db was not so unused afterall.
2023-12-18 23:08:08 +01:00
Matjaž Horvat 8b1542df49
Fix Request Context button Contact person mention (#3051) 2023-12-18 09:53:33 +01:00
Matjaž Horvat 0aeaa3e047
Fix broken translate view when filters result in no matches (#3054)
Always use Hooks at the top level of your React function:
https://legacy.reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
2023-12-18 09:37:35 +01:00
ayanaar 2cea74df2c
Fix Missing Link in Comment Notifications (#3049) 2023-12-14 11:22:11 +01:00
Matjaž Horvat a4c8c289ea Reposition menus on narrow screens and add 2-column view (#3044)
* Fix positions of menus and overlays on narrow screens
* Always show target locale code in the navbar
* Implement a 2-column UI for middle screen widths between 600 and 800 pixels

Also:
* Expand Header navigation breakpoint to the middle screens
* Prevent jumping when moving between tabs
* useNarrowScreen() -> useWindowWidth()
2023-12-11 22:26:15 +01:00
Matjaž Horvat 2f613fa74d Reposition panels in a single-column translate view (#3038)
Details:
* Only show one Helpers panel at the same time
* Use dot rather than count as the tab indicator
* Make visual distinction between the History panel and the Helpers.
* Add support for batch actions in the single-columm UI

Also included:
* Move OriginalString component and friends out of Metadata component
* Unify Term tab count behaviour with other Helper tabs: do not show 0
* Unify dark-theme.css and light-theme.css structure
* De-hardcode and fix color value in the FiltersPanel
2023-12-11 22:26:15 +01:00
Matjaž Horvat 3c02eeb69f Implement a single-column UI for smaller screens (#3024)
* Move third column under the middle column
* Add Entities list toggle
* Animate switching between the editor and the string list
* When hovering over strings in the string list, show indicator to open the editor
* Hide main navigation
* For easier development, move all @media max-width to App.css temporarily

Also:
* Remove unused flex properties
* Drop 700px transition on the header
2023-12-11 22:26:15 +01:00
Matjaž Horvat a2eb528a47
Improve theme switching logging and notifications (#3042)
* Do not show success notification on theme change (unify behaviour with translate view)
* If theme change fails, show human-friendly error message in the UI
* If theme change fails, log error message on the server
* Migrate old visibility_email values to the new ones
2023-12-05 21:43:04 +01:00
Matjaž Horvat e4e3fcef5e
List Admins that are also Locale Managers or Translators as members of these groups in the Locale Contributors page (#3036) 2023-11-29 13:39:18 +01:00
ayanaar c41639d7d2
Handle Locale code changes gracefully in URLs (#3023)
Fixes #2302.

Updating a locale code (e.g., changing sat-Olck to sat) previously could lead to broken links and inaccessible /settings pages for users who had their homepage set to the old locale code. Here we are adding a redirection mechanism that ensures continuity even when locale codes are changed.
2023-11-28 21:28:27 +01:00
Matjaž Horvat ae74bc474a
Restore notification panel delay back to 2 seconds (#3033) 2023-11-23 18:12:47 +01:00
Matjaž Horvat f4b2f23cc6
Fix deployment using Deploy to Heroku button (#3030)
Remove reference to Project.url field which was removed in #2862.
2023-11-23 10:49:22 +01:00
Matjaž Horvat 73c05e4777
Unescape escaped straight apostrophes (#3021)
* Unescape escaped straight apostrophes

* Fix copy-paste error.

Co-authored-by: Eemeli Aro <eemeli@gmail.com>
2023-11-15 16:56:22 +01:00
Matjaž Horvat 262d24a075
Escape straight apostrophes in strings.xml files (#3020)
* In checks, escape straight apostrophes in strings.xml files
* In serializer, escape straight apostrophes in strings.xml files. In parser, unescape them.
* Drop special-casing of Android DTD quotes in checks
* Rename pontoon/sync/formats/compare_locales -> pontoon/sync/formats/xml
2023-11-14 21:40:12 +01:00
Eemeli Aro 20de5325ab
Fix search terms for " and "" (#3017) 2023-11-10 18:23:36 +01:00
Eemeli Aro b2d4cbc728
Replace react-content-marker with a regexp (#3014)
Fixes #2515
Fixes #3006

Ports all the rules from react-content-marker into an inlined implementation. Results are cleaner, more efficient, and less buggy. Also, for placeholders we now match the rules used in the editor highlighting.

In a few places the rules are relaxed a bit and/or made more sane, but these are unlikely to actually effect real-world messages noticably. Except where they fix current bugs. Also, the placeholder rules now match the editor.
2023-11-10 01:58:47 +01:00
Matjaž Horvat 549cd93298
Optimize and fix the /insights page (#3007)
* Fix #2980: Prevent bots from checking the /insights page
* Optimize ProjectLocaleInsightsSnapshot Admin view/editing page
* Refactor data gathering for the /insights page

1. Fix #2979: Optimize /insights page.

To render the charts on the Insights pages, we use periodically gathered ProjectLocaleInsightsSnapshot data. That works fine on Project, Locale and
ProjectLocale pages, but not on the /insights page which shows data across the entire app. The amount of data requested from the DB quickly becomes big and the request starts timing out.

In this patch, we gather data directly from the ActionLog as hinted at in #2938.

2. Fix #2999: Show insights for all months.

3. Calculate monthly averages rather than averages of averages.
2023-11-10 00:16:34 +01:00
Matjaž Horvat 59211dd16d
Fix Project and ProjectLocale insights data (#3008)
Also included:
- Make created_at field visible in ActionLogAdmin
2023-11-09 03:18:30 +01:00
Matjaž Horvat f2cc421811
Improve position of the tooltip of the charts on the /insights page (#3009) 2023-11-09 03:17:52 +01:00
dependabot[bot] 78f6930a6e
Bump @babel/traverse from 7.22.1 to 7.23.2 (#2994)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.1 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-26 21:45:08 +02:00