-
-
Notifications
You must be signed in to change notification settings - Fork 998
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
component: Improve duplication of components #11079
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11079 +/- ##
==========================================
- Coverage 90.82% 90.74% -0.08%
==========================================
Files 554 559 +5
Lines 57306 57618 +312
Branches 9122 9200 +78
==========================================
+ Hits 52046 52285 +239
- Misses 3640 3696 +56
- Partials 1620 1637 +17
|
a29f54e
to
18ec295
Compare
This pull request has been automatically marked as stale because there wasn’t any recent activity. It will be closed soon if no further action occurs. Thank you for your contributions! |
] | ||
widgets = { | ||
"source_language": SortedSelect, | ||
"language_code_style": SortedSelect, | ||
"license": forms.HiddenInput(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is hidden input now? This is not supposed to remove choices which were present before.
if "category" not in kwargs: | ||
kwargs["category"] = self.create_category(project=kwargs["project"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is okay for category to be not set. If you need it for a specific test, just create it there.
if "category" not in kwargs: | |
kwargs["category"] = self.create_category(project=kwargs["project"]) |
This pull request has been automatically marked as stale because there wasn’t any recent activity. It will be closed soon if no further action occurs. Thank you for your contributions! |
This pull request has been automatically marked as stale because there wasn’t any recent activity. It will be closed soon if no further action occurs. Thank you for your contributions! |
WalkthroughThe recent update introduces a feature that enhances the duplication process of components by allowing automatic cloning of additional settings, specifically in the Changes
Assessment against linked issues
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
weblate/trans/tests/utils.py (1)
170-174
: Add a docstring that documents the return value.The
create_category
function is missing a docstring that documents the return value.Add a docstring that documents the return value as follows:
def create_category(self, project, **kwargs): """Create test category. :param project: Project object :param kwargs: Additional arguments for Category creation :return: Created Category object """ return Category.objects.create( name="Test", slug="test", project=project, **kwargs )Tools
Ruff
172-174:
return
is not documented in docstring(DOC201)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- docs/changes.rst (1 hunks)
- weblate/templates/component.html (1 hunks)
- weblate/trans/forms.py (1 hunks)
- weblate/trans/tests/utils.py (3 hunks)
- weblate/trans/views/create.py (4 hunks)
Additional context used
Ruff
weblate/trans/tests/utils.py
172-174:
return
is not documented in docstring(DOC201)
Additional comments not posted (8)
weblate/templates/component.html (1)
99-99
: LGTM, but pre-select the current component.The code change is approved as it adds a direct link to duplicate the component, making the duplication option more discoverable.
However, as mentioned in the past review comment, the current component should be pre-selected when clicking the link. You can set the
initial
value of thecomponent
field in theget_form
method to pre-select the current component.weblate/trans/views/create.py (5)
435-435
: LGTM!The code changes are approved.
467-475
: LGTM!The code changes are approved.
472-476
: LGTM!The code changes are approved.
507-510
: LGTM!The code changes are approved.
536-551
: LGTM!The code changes are approved.
weblate/trans/forms.py (2)
1689-1709
: LGTM!The new fields
agreement
,merge_style
,commit_message
,add_message
,delete_message
,merge_message
,addon_message
,pull_message
are added correctly to theMeta
class ofComponentSettingsForm
.Setting their widgets to
forms.HiddenInput()
is appropriate to hide these preset fields in the component settings form.
1701-1701
: LGTM!Changing the
license
field widget toforms.HiddenInput()
inComponentCreateForm
is consistent with hiding preset fields in the component settings and creation forms.
WIP
Proposed changes
closes #10896
Checklist
Duplicate Functionality in Dropdown
Pre-selected Component in dropdown
Summary by CodeRabbit
Release Notes
New Features
Improvements
These updates aim to streamline workflows and improve user experience.