mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-10 05:06:46 +10:00
Ability to move issue to another project Tasks: - [x] Create scaffold of service that will move issue to another project. - [x] Close old issue, add system note about moving issue to a new project. - [x] Create a new issue, add system note about issue being moved from old project. - [x] Check if issue can be moved to another project before executing service - [x] Check permissions when moving an issue (`:admin_issue` ability) - [x] Display select box for a new project when editing an issue - [x] Show only projects that issue can be moved into in that select box - [x] Add project select handler, helper and some permission filters to it - [x] Preserve as much information as possible, including author - [x] Prepare mechanisms that unfolds local references in issue description - [x] Rewrite issue description with references unfolding and add some specs for it - [x] Rewrite all system notes and comments attached to issue that is being moved - [x] Update `Label` so that is was able to create cross reference labels (separate MR) - [x] Add notifications about moving issue to another project - [x] Display confirmation alert/message when issue move has been requested - [x] Make it possible to undo selecting project where issue will be moved to - [x] Add column to issue, that will indicate if it has been moved to another project - [x] Do not allow to move issue that has been already moved - [x] Write top-to-bottom feature spec in RSpec instead of Spinach UI:   Closes #3024 See merge request !2831
57 lines
1.4 KiB
Ruby
57 lines
1.4 KiB
Ruby
module Gitlab
|
|
# Extract possible GFM references from an arbitrary String for further processing.
|
|
class ReferenceExtractor < Banzai::ReferenceExtractor
|
|
REFERABLES = %i(user issue label milestone merge_request snippet commit commit_range)
|
|
attr_accessor :project, :current_user, :author
|
|
|
|
def initialize(project, current_user = nil, author = nil)
|
|
@project = project
|
|
@current_user = current_user
|
|
@author = author
|
|
|
|
@references = {}
|
|
|
|
super()
|
|
end
|
|
|
|
def analyze(text, context = {})
|
|
super(text, context.merge(project: project))
|
|
end
|
|
|
|
REFERABLES.each do |type|
|
|
define_method("#{type}s") do
|
|
@references[type] ||= references(type, reference_context)
|
|
end
|
|
end
|
|
|
|
def issues
|
|
if project && project.jira_tracker?
|
|
@references[:external_issue] ||= references(:external_issue, reference_context)
|
|
else
|
|
@references[:issue] ||= references(:issue, reference_context)
|
|
end
|
|
end
|
|
|
|
def all
|
|
REFERABLES.each { |referable| send(referable.to_s.pluralize) }
|
|
@references.values.flatten
|
|
end
|
|
|
|
def self.references_pattern
|
|
return @pattern if @pattern
|
|
|
|
patterns = REFERABLES.map do |ref|
|
|
ref.to_s.classify.constantize.try(:reference_pattern)
|
|
end
|
|
|
|
@pattern = Regexp.union(patterns.compact)
|
|
end
|
|
|
|
private
|
|
|
|
def reference_context
|
|
{ project: project, current_user: current_user, author: author }
|
|
end
|
|
end
|
|
end
|