##// END OF EJS Templates
Fixed that MailHandler raises an error when email has no subject header (#12396)....
Fixed that MailHandler raises an error when email has no subject header (#12396). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10850 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r9862:855310701615
r10623:a829bfa75578
Show More
issue_relations_controller.rb
88 lines | 2.7 KiB | text/x-ruby | RubyLexer
/ app / controllers / issue_relations_controller.rb
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 # Redmine - project management software
Jean-Philippe Lang
Copyright update....
r9453 # Copyright (C) 2006-2012 Jean-Philippe Lang
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769 #
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769 #
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class IssueRelationsController < ApplicationController
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 before_filter :find_issue, :find_project_from_association, :authorize, :only => [:index, :create]
before_filter :find_relation, :except => [:index, :create]
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Separation of RSS/API auth actions....
r6077 accept_api_auth :index, :show, :create, :destroy
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Adds support for GET on /issues/:issue_id/relations (#7366)....
r6059 def index
@relations = @issue.relations
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Adds support for GET on /issues/:issue_id/relations (#7366)....
r6059 respond_to do |format|
format.html { render :nothing => true }
format.api
end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 def show
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 raise Unauthorized unless @relation.visible?
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056
respond_to do |format|
format.html { render :nothing => true }
format.api
end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 def create
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 @relation = IssueRelation.new(params[:relation])
@relation.issue_from = @issue
Jean-Philippe Lang
Strip issue id when adding a relation....
r9250 if params[:relation] && m = params[:relation][:issue_to_id].to_s.strip.match(/^#?(\d+)$/)
Jean-Philippe Lang
Issue relation: fixes error with postgres when entering a non-numeric id (#4820) + accept hash (#) before id....
r3299 @relation.issue_to = Issue.visible.find_by_id(m[1].to_i)
Jean-Philippe Lang
Fixed: users should not be able to add relations with issues they're not allowed to view (#2589)....
r2321 end
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 saved = @relation.save
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 respond_to do |format|
format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
Jean-Philippe Lang
Removes RJS from IssueRelationsController....
r9862 format.js {
Jean-Philippe Lang
Fixed: Relations are not displayed after adding/removing an issue relation (#7463)....
r4644 @relations = @issue.relations.select {|r| r.other_issue(@issue) && r.other_issue(@issue).visible? }
Jean-Philippe Lang
Removes RJS from IssueRelationsController....
r9862 }
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769 format.api {
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 if saved
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 render :action => 'show', :status => :created, :location => relation_url(@relation)
Jean-Philippe Lang
Adds REST API for issue relations (#7366)....
r6056 else
render_validation_errors(@relation)
end
}
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 def destroy
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 raise Unauthorized unless @relation.deletable?
@relation.destroy
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 respond_to do |format|
Etienne Massip
Explicitly declare all routes and deactivate default route....
r8042 format.html { redirect_to issue_path } # TODO : does this really work since @issue is always nil? What is it useful to?
Jean-Philippe Lang
Removes RJS from IssueRelationsController....
r9862 format.js
Jean-Philippe Lang
Fixed that 200 API responses have a body containing one space (#11388)....
r9792 format.api { render_api_ok }
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 end
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 private
Eric Davis
Refactor: Split the find_object methods to prep for a larger refactoring....
r3477 def find_issue
@issue = @object = Issue.find(params[:issue_id])
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 rescue ActiveRecord::RecordNotFound
render_404
end
Toshi MARUYAMA
remove trailing white-spaces from app/controllers/issue_relations_controller.rb....
r6769
Jean-Philippe Lang
Makes relations resource shallow (#7366)....
r6064 def find_relation
@relation = IssueRelation.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end
Jean-Philippe Lang
Issue relations first commit (not thoroughly tested). 4 kinds of relation are available:...
r503 end