Resolve "`/tag` quick action on Commit comments"
What does this MR do?
Implements the /tag
quick action on commit comments as described in #45663 (closed).
Are there points in the code the reviewer needs to double check?
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Conforms to the code review guidelines
-
Has been reviewed by a UX Designer -
Has been reviewed by a Frontend maintainer -
Has been reviewed by a Backend maintainer -
Has been reviewed by a Database specialist
-
-
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the database guides -
If you have multiple commits, please combine them into a few logically organized commits by squashing them -
Internationalization required/considered -
End-to-end tests pass ( package-and-qa
manual pipeline job)
What are the relevant issue numbers?
Closes #45663 (closed)
Notes
TODOs
-
Implement Commits::TagService
Commits::UpdateService
-
Tag the actual commit (aka git tag
equivalent) usingTags::CreateService
-
Unit tests -
Check authorization
-
-
Add new tag
command inInterpretService
-
Define condition
based on typeCommit
-
Check authorization
-
-
Feature tests (equivalent to issues/user_uses_slash_command_spec.rb
)-
Add some more ❓
-
-
Make sure that "Preview" is working -
Refactor find/building noteables -
Move building noteables from AutocompleteService#commands
inAutocompleteSourcesController#target
-
Build issues/merge_request ( @project.issues.build
) if providedtype_id
is empty or could not be found (inAutocompleteSourcesController#target
)- This will solve inconsistent behavior when passing
type=issue
vstype=Issue
- This will solve inconsistent behavior when passing
-
Remove Issueable
type-check fromAutocompleteService#commands
-
- Do not show
Command applied
if tagging fails- Currently, errors from commands are discarded
- Example:
/move non_existent_repo
won't show an error norCommand applied
- Example:
- Should errors be shown?
-
➡ already addressed in #21580 (moved)
-
- Currently, errors from commands are discarded
-
Verify that users are allowed to tag commits ( push_code
?)-
CommitPolicy
is empty❎ -
Auto complete /tag
only if user is authorized -
Authorize user before executing Commits::TagService
-
➡ Not needed because it's already done inTag::CreateService
.
-
-
- Tag commits asynchronously?
-
➡ Yes, from the UX point of view
-
- A
Commit
is notIssueable
- Avoid type checks (
is_a?(Issuable)
) inQuickActions::IntepretService
- Introduce some kind of presenter to wrap
Issue
,MergeRequest
andCommit
- Adding methods like
Commit#to_ability_name
feels wrong -
➡ Type checks are fine and the presenter is not needed
- Avoid type checks (