Commit c0e9eb0e authored by Jarka Košanová's avatar Jarka Košanová

Support short reference to group entities from project entities

- add a direct project parent (group) to Banzai context
- if an epic is referenced from a direct descendant
  -> change epic to_reference to use short reference
parent 2243e4d4
# GitLab quick actions # GitLab quick actions
Quick actions are textual shortcuts for common actions on issues, epics, merge requests, Quick actions are textual shortcuts for common actions on issues, epics, merge requests,
and commits that are usually done by clicking buttons or dropdowns in GitLab's UI. and commits that are usually done by clicking buttons or dropdowns in GitLab's UI.
You can enter these commands while creating a new issue or merge request, or You can enter these commands while creating a new issue or merge request, or
in comments of issues, epics, merge requests, and commits. Each command should be in comments of issues, epics, merge requests, and commits. Each command should be
on a separate line in order to be properly detected and executed. Once executed, on a separate line in order to be properly detected and executed. Once executed,
the commands are removed from the text body and not visible to anyone else. the commands are removed from the text body and not visible to anyone else.
...@@ -70,7 +70,7 @@ The following quick actions are applicable for epics threads and description: ...@@ -70,7 +70,7 @@ The following quick actions are applicable for epics threads and description:
|:---------------------------|:----------------------------------------| |:---------------------------|:----------------------------------------|
| `/tableflip <Comment>` | Append the comment with `(╯°□°)╯︵ ┻━┻` | | `/tableflip <Comment>` | Append the comment with `(╯°□°)╯︵ ┻━┻` |
| `/shrug <Comment>` | Append the comment with `¯\_(ツ)_/¯` | | `/shrug <Comment>` | Append the comment with `¯\_(ツ)_/¯` |
| `/todo` | Add a todo | | `/todo` | Add a todo |
| `/done` | Mark todo as done | | `/done` | Mark todo as done |
| `/subscribe` | Subscribe | | `/subscribe` | Subscribe |
| `/unsubscribe` | Unsubscribe | | `/unsubscribe` | Unsubscribe |
...@@ -80,4 +80,4 @@ The following quick actions are applicable for epics threads and description: ...@@ -80,4 +80,4 @@ The following quick actions are applicable for epics threads and description:
| `/award :emoji:` | Toggle emoji award | | `/award :emoji:` | Toggle emoji award |
| `/label ~label1 ~label2` | Add label(s) | | `/label ~label1 ~label2` | Add label(s) |
| `/unlabel ~label1 ~label2` | Remove all or specific label(s) | | `/unlabel ~label1 ~label2` | Remove all or specific label(s) |
| `/relabel ~label1 ~label2` | Replace label | | `/relabel ~label1 ~label2` | Replace label |
\ No newline at end of file
...@@ -9,6 +9,12 @@ module Banzai ...@@ -9,6 +9,12 @@ module Banzai
def self.object_class def self.object_class
Epic Epic
end end
private
def group
context[:group] || context[:project]&.group
end
end end
end end
end end
...@@ -331,11 +331,12 @@ describe CacheMarkdownField do ...@@ -331,11 +331,12 @@ describe CacheMarkdownField do
end end
context 'with a project' do context 'with a project' do
let(:thing) { thing_subclass(:project).new(foo: markdown, foo_html: html, project: :project_value) } let(:project) { create(:project, group: create(:group)) }
let(:thing) { thing_subclass(:project).new(foo: markdown, foo_html: html, project: project) }
it 'sets the project in the context' do it 'sets the project in the context' do
is_expected.to have_key(:project) is_expected.to have_key(:project)
expect(context[:project]).to eq(:project_value) expect(context[:project]).to eq(project)
end end
it 'invalidates the cache when project changes' do it 'invalidates the cache when project changes' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment