summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarka Košanová <jarka@gitlab.com>2018-09-22 10:07:20 +0200
committerJarka Košanová <jarka@gitlab.com>2018-10-04 10:22:00 +0200
commitc0e9eb0eaca198f5ae12d6bd693ddcd705f79369 (patch)
tree5b7f5f0750c6c5d54745cd8e142c5d95e6f3c5d1
parent2243e4d4ca4bbd96a05059d463d283d468a3fc57 (diff)
downloadgitlab-ce-ce-7287-epic-references.tar.gz
Support short reference to group entities from project entitiesce-7287-epic-references
- 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
-rw-r--r--doc/user/project/quick_actions.md8
-rw-r--r--lib/banzai/filter/epic_reference_filter.rb6
-rw-r--r--spec/models/concerns/cache_markdown_field_spec.rb5
3 files changed, 13 insertions, 6 deletions
diff --git a/doc/user/project/quick_actions.md b/doc/user/project/quick_actions.md
index 21a9d2adf4f..c2f53540089 100644
--- a/doc/user/project/quick_actions.md
+++ b/doc/user/project/quick_actions.md
@@ -1,9 +1,9 @@
# 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.
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,
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:
|:---------------------------|:----------------------------------------|
| `/tableflip <Comment>` | Append the comment with `(╯°□°)╯︵ ┻━┻` |
| `/shrug <Comment>` | Append the comment with `¯\_(ツ)_/¯` |
-| `/todo` | Add a todo |
+| `/todo` | Add a todo |
| `/done` | Mark todo as done |
| `/subscribe` | Subscribe |
| `/unsubscribe` | Unsubscribe |
@@ -80,4 +80,4 @@ The following quick actions are applicable for epics threads and description:
| `/award :emoji:` | Toggle emoji award |
| `/label ~label1 ~label2` | Add label(s) |
| `/unlabel ~label1 ~label2` | Remove all or specific label(s) |
-| `/relabel ~label1 ~label2` | Replace label | \ No newline at end of file
+| `/relabel ~label1 ~label2` | Replace label |
diff --git a/lib/banzai/filter/epic_reference_filter.rb b/lib/banzai/filter/epic_reference_filter.rb
index e06e2fb3870..26bcf5c04b4 100644
--- a/lib/banzai/filter/epic_reference_filter.rb
+++ b/lib/banzai/filter/epic_reference_filter.rb
@@ -9,6 +9,12 @@ module Banzai
def self.object_class
Epic
end
+
+ private
+
+ def group
+ context[:group] || context[:project]&.group
+ end
end
end
end
diff --git a/spec/models/concerns/cache_markdown_field_spec.rb b/spec/models/concerns/cache_markdown_field_spec.rb
index da26d802688..f8d50e89d40 100644
--- a/spec/models/concerns/cache_markdown_field_spec.rb
+++ b/spec/models/concerns/cache_markdown_field_spec.rb
@@ -331,11 +331,12 @@ describe CacheMarkdownField do
end
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
is_expected.to have_key(:project)
- expect(context[:project]).to eq(:project_value)
+ expect(context[:project]).to eq(project)
end
it 'invalidates the cache when project changes' do