Skip to content

Commit

Permalink
feat: expose component locked state in component API
Browse files Browse the repository at this point in the history
This makes it easier to obtain lock state.
  • Loading branch information
nijel committed Nov 15, 2024
1 parent 36d1b12 commit f5bc5a5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,7 @@ Components
:>json string suggestion_voting: :ref:`component-suggestion_voting`
:>json string suggestion_autoaccept: :ref:`component-suggestion_autoaccept`
:>json string push_on_commit: :ref:`component-push_on_commit`
:>json bool locked: Whether component is locked, this field is read-only; see :http:get:`/api/components/(string:project)/(string:component)/lock/`
:>json string commit_pending_age: :ref:`component-commit_pending_age`
:>json string auto_lock_error: :ref:`component-auto_lock_error`
:>json string language_regex: :ref:`component-language_regex`
Expand Down
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Not yet released.
* A shortcut to duplicate a component is now available directly in the menu (:guilabel:`Manage` → :guilabel:`Duplicate Component`)
* Included username when generating :ref:`credits`.
* :ref:`bulk-edit` shows a preview of matched strings.
* :http:get:`/api/components/(string:project)/(string:component)/` exposes component lock state.

**Bug fixes**

Expand Down
1 change: 1 addition & 0 deletions weblate/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ class ComponentSerializer(RemovableSerializer[Component]):
push_branch = LinkedField(
required=False, allow_blank=True, max_length=BRANCH_LENGTH
)
locked = serializers.BooleanField(read_only=True)

serializer_url_field = MultiFieldHyperlinkedIdentityField

Expand Down

0 comments on commit f5bc5a5

Please sign in to comment.