# Adds a related issue to a changeset
# POST /projects/:project_id/repository/(:repository_id/)revisions/:rev/issues
def add_related_issue
- @issue = @changeset.find_referenced_issue_by_id(params[:issue_id])
+ issue_id = params[:issue_id].to_s.sub(/^#/,'')
+ @issue = @changeset.find_referenced_issue_by_id(issue_id)
if @issue && (!@issue.visible? || @changeset.issues.include?(@issue))
@issue = nil
end
assert_include 'Feature request #2', response.body
end
+ def test_add_related_issue_should_accept_issue_id_with_sharp
+ @request.session[:user_id] = 2
+ assert_difference 'Changeset.find(103).issues.size' do
+ xhr :post, :add_related_issue, :id => 1, :rev => 4, :issue_id => "#2", :format => 'js'
+ end
+ assert_equal [2], Changeset.find(103).issue_ids
+ end
+
def test_add_related_issue_with_invalid_issue_id
@request.session[:user_id] = 2
assert_no_difference 'Changeset.find(103).issues.size' do