Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Nov 12, 2024
2 parents 31df238 + 758e99e commit c74ca55
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Weblate 5.8.4

Not yet released.

**Improvements**

* :ref:`search-users` can search based on user changes.

**Bug fixes**

* Fixed occasional crash in :ref:`rss`.
Expand Down
7 changes: 7 additions & 0 deletions docs/user/search.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Searching
=========

.. _search-strings:

Searching for strings
+++++++++++++++++++++

Expand Down Expand Up @@ -178,6 +180,7 @@ There are many options to order the strings according to your needs:

.. image:: /screenshots/query-sort.webp

.. _search-users:

Searching for users
+++++++++++++++++++
Expand All @@ -198,6 +201,10 @@ The user browsing has similar search abilities:
User has contributed to a given language in the past 90 days.
``contributes:TEXT``
User has contributed to a given project or component in the past 90 days.
``change_time:DATETIME``
Same as in :ref:`search-strings`.
``change_action:TEXT``
Same as in :ref:`search-strings`.

Additional lookups are available in the :ref:`management-interface`:

Expand Down
2 changes: 1 addition & 1 deletion weblate/templates/snippets/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ <h4 class="panel-title">{% trans "Trends of last 30 days" %}</h4>
</div>
<div class="col-sm-3">
<div class="metric">
<a href="{% url "user_list" %}?q={% if language %}translates:{{ language.code|urlencode }}{% elif translation %}translates:{{ translation.language.code|urlencode }}{% endif %} {% if component %}contributes:{{ component.full_slug|urlencode }}{% elif project %}contributes:{{ project.slug|urlencode }}{% endif %}">
<a href="{% url "user_list" %}?q={% if language %}translates:{{ language.code|urlencode }}{% elif translation %}translates:{{ translation.language.code|urlencode }}{% endif %} {% if component %}contributes:{{ component.full_slug|urlencode }}{% elif project %}contributes:{{ project.slug|urlencode }}{% endif %} change_time:&gt;'30 days ago' ">
<div class="metric-number">{{ metrics.contributors|number_format }}</div>
<div class="metric-text">{% trans "Contributors" %}</div>
</a>
Expand Down
8 changes: 5 additions & 3 deletions weblate/utils/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ def convert_change_action(self, text: str) -> int:
except KeyError:
return Change.ACTION_STRINGS[text]

def convert_change_time(self, text: str) -> datetime | tuple[datetime, datetime]:
return self.convert_datetime(text)

def field_name(self, field: str, suffix: str | None = None) -> str:
if suffix is None:
suffix = OPERATOR_MAP[self.operator]
Expand Down Expand Up @@ -541,9 +544,6 @@ def path_field(self, text: str, context: dict) -> Q:
msg = f"Unsupported path lookup: {obj}"
raise TypeError(msg)

def convert_change_time(self, text: str) -> datetime | tuple[datetime, datetime]:
return self.convert_datetime(text)

def convert_changed(self, text: str) -> datetime | tuple[datetime, datetime]:
return self.convert_datetime(text)

Expand Down Expand Up @@ -596,6 +596,8 @@ class UserTermExpr(BaseTermExpr):
PLAIN_FIELDS: set[str] = {"username", "full_name"}
NONTEXT_FIELDS: dict[str, str] = {
"joined": "date_joined",
"change_time": "change__timestamp",
"change_action": "change__action",
}
EXACT_FIELD_MAP: dict[str, str] = {
"language": "profile__languages__code",
Expand Down

0 comments on commit c74ca55

Please sign in to comment.