| |   |
| 11 | 11 | Contributors |
| 12 | 12 | ------------- |
| 13 | 13 | |
| 14 | | A number of people have contributed directly to Gitorious by writing documentation |
| 15 | | or developing code and/or graphics that the project wishes to thank. |
| 14 | A number of people have contributed directly to Gitorious by writing documentation |
| 15 | or developing code and/or graphics that the project wishes to thank. |
| 16 | 16 | A list of these people in order of appearance: |
| 17 | 17 | |
| 18 | 18 | * David A. Cuadrado <krawek@gmail.com> |
| … | … | |
| 22 | 22 | * Dag Odenhall <dag.odenhall@gmail.com> |
| 23 | 23 | * Will Fisher <will@gina.alaska.edu> |
| 24 | 24 | * Jonas Fonseca <fonseca@diku.dk> |
| 25 | | |
| 25 | |
| toggle raw diff |
--- a/AUTHORS
+++ b/AUTHORS
@@ -11,8 +11,8 @@ and he remains the project lead.
Contributors
-------------
-A number of people have contributed directly to Gitorious by writing documentation
-or developing code and/or graphics that the project wishes to thank.
+A number of people have contributed directly to Gitorious by writing documentation
+or developing code and/or graphics that the project wishes to thank.
A list of these people in order of appearance:
* David A. Cuadrado <krawek@gmail.com>
@@ -22,4 +22,4 @@ A list of these people in order of appearance:
* Dag Odenhall <dag.odenhall@gmail.com>
* Will Fisher <will@gina.alaska.edu>
* Jonas Fonseca <fonseca@diku.dk>
-
\ No newline at end of file
+ |
| |   |
| 12 | 12 | (in no particular order) |
| 13 | 13 | |
| 14 | 14 | two from Yurii: |
| 15 | | 1) show commits actually merged for merge request after actual merge (I see them on open request, but do not on merged one) |
| 15 | 1) show commits actually merged for merge request after actual merge (I see them on open request, but do not on merged one) |
| 16 | 16 | 2) provide clone url on every repo browsing page, so I can get url to pull from even if I am reading a commit |
| 17 | 17 | |
| 18 | 18 | * tree browser: deal better with funny characters: http://gitorious.org/projects/avara/repos/mainline/trees/master |
| toggle raw diff |
--- a/TODO.txt
+++ b/TODO.txt
@@ -12,7 +12,7 @@ new-ui:
(in no particular order)
two from Yurii:
-1) show commits actually merged for merge request after actual merge (I see them on open request, but do not on merged one)
+1) show commits actually merged for merge request after actual merge (I see them on open request, but do not on merged one)
2) provide clone url on every repo browsing page, so I can get url to pull from even if I am reading a commit
* tree browser: deal better with funny characters: http://gitorious.org/projects/avara/repos/mainline/trees/master |
| |   |
| 5 | 5 | session :session_key => '_ks1_session_id', :secret => GitoriousConfig["cookie_secret"] |
| 6 | 6 | include AuthenticatedSystem |
| 7 | 7 | include ExceptionNotifiable |
| 8 | | |
| 8 | |
| 9 | 9 | rescue_from ActiveRecord::RecordNotFound, :with => :render_not_found |
| 10 | 10 | rescue_from ActionController::UnknownController, :with => :render_not_found |
| 11 | 11 | rescue_from ActionController::UnknownAction, :with => :render_not_found |
| 12 | | |
| 12 | |
| 13 | 13 | def rescue_action(exception) |
| 14 | 14 | return super if RAILS_ENV != "production" |
| 15 | | |
| 15 | |
| 16 | 16 | case exception |
| 17 | | # Can't catch RoutingError with rescue_from it seems, |
| 17 | # Can't catch RoutingError with rescue_from it seems, |
| 18 | 18 | # so do it the old-fashioned way |
| 19 | 19 | when ActionController::RoutingError |
| 20 | 20 | render_not_found |
| … | … | |
| 22 | 22 | super |
| 23 | 23 | end |
| 24 | 24 | end |
| 25 | | |
| 25 | |
| 26 | 26 | protected |
| 27 | 27 | def require_user_has_ssh_keys |
| 28 | 28 | unless current_user.ssh_keys.count > 0 |
| 29 | 29 | flash[:error] = "You need to upload your public key first" |
| 30 | 30 | redirect_to new_account_key_path |
| 31 | | return |
| 31 | return |
| 32 | 32 | end |
| 33 | 33 | end |
| 34 | | |
| 34 | |
| 35 | 35 | def find_project |
| 36 | 36 | @project = Project.find_by_slug!(params[:project_id]) |
| 37 | 37 | end |
| 38 | | |
| 38 | |
| 39 | 39 | def find_project_and_repository |
| 40 | 40 | @project = Project.find_by_slug!(params[:project_id]) |
| 41 | 41 | @repository = @project.repositories.find_by_name!(params[:repository_id]) |
| 42 | 42 | end |
| 43 | | |
| 43 | |
| 44 | 44 | def check_repository_for_commits |
| 45 | 45 | unless @repository.has_commits? |
| 46 | 46 | flash[:notice] = "The repository doesn't have any commits yet" |
| 47 | 47 | redirect_to project_repository_path(@project, @repository) and return |
| 48 | 48 | end |
| 49 | 49 | end |
| 50 | | |
| 50 | |
| 51 | 51 | def render_not_found |
| 52 | 52 | render :file => "#{RAILS_ROOT}/public/404.html", :status => 404 |
| 53 | 53 | end |
| toggle raw diff |
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -5,16 +5,16 @@ class ApplicationController < ActionController::Base
session :session_key => '_ks1_session_id', :secret => GitoriousConfig["cookie_secret"]
include AuthenticatedSystem
include ExceptionNotifiable
-
+
rescue_from ActiveRecord::RecordNotFound, :with => :render_not_found
rescue_from ActionController::UnknownController, :with => :render_not_found
rescue_from ActionController::UnknownAction, :with => :render_not_found
-
+
def rescue_action(exception)
return super if RAILS_ENV != "production"
-
+
case exception
- # Can't catch RoutingError with rescue_from it seems,
+ # Can't catch RoutingError with rescue_from it seems,
# so do it the old-fashioned way
when ActionController::RoutingError
render_not_found
@@ -22,32 +22,32 @@ class ApplicationController < ActionController::Base
super
end
end
-
+
protected
def require_user_has_ssh_keys
unless current_user.ssh_keys.count > 0
flash[:error] = "You need to upload your public key first"
redirect_to new_account_key_path
- return
+ return
end
end
-
+
def find_project
@project = Project.find_by_slug!(params[:project_id])
end
-
+
def find_project_and_repository
@project = Project.find_by_slug!(params[:project_id])
@repository = @project.repositories.find_by_name!(params[:repository_id])
end
-
+
def check_repository_for_commits
unless @repository.has_commits?
flash[:notice] = "The repository doesn't have any commits yet"
redirect_to project_repository_path(@project, @repository) and return
end
end
-
+
def render_not_found
render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
end |
| |   |
| 2 | 2 | before_filter :login_required, :only => [:new, :create, :edit, :update, :destroy] |
| 3 | 3 | before_filter :find_project |
| 4 | 4 | before_filter :find_repository |
| 5 | | |
| 5 | |
| 6 | 6 | def index |
| 7 | 7 | @comments = @repository.comments.find(:all, :include => :user) |
| 8 | 8 | @merge_request_count = @repository.merge_requests.count_open |
| … | … | |
| 12 | 12 | format.atom { } |
| 13 | 13 | end |
| 14 | 14 | end |
| 15 | | |
| 15 | |
| 16 | 16 | def commit |
| 17 | 17 | @git = @repository.git |
| 18 | 18 | @commit = @git.commit(params[:sha]) |
| 19 | 19 | @comments = @repository.comments.find_all_by_sha1(params[:sha], :include => :user) |
| 20 | 20 | end |
| 21 | | |
| 21 | |
| 22 | 22 | def new |
| 23 | 23 | @comment = @repository.comments.new |
| 24 | 24 | end |
| 25 | | |
| 25 | |
| 26 | 26 | def create |
| 27 | 27 | @comment = @repository.comments.new(params[:comment]) |
| 28 | 28 | @comment.user = current_user |
| … | … | |
| 39 | 39 | end |
| 40 | 40 | end |
| 41 | 41 | end |
| 42 | | |
| 42 | |
| 43 | 43 | protected |
| 44 | 44 | def find_repository |
| 45 | 45 | @repository = @project.repositories.find_by_name!(params[:repository_id]) |
| toggle raw diff |
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -2,7 +2,7 @@ class CommentsController < ApplicationController
before_filter :login_required, :only => [:new, :create, :edit, :update, :destroy]
before_filter :find_project
before_filter :find_repository
-
+
def index
@comments = @repository.comments.find(:all, :include => :user)
@merge_request_count = @repository.merge_requests.count_open
@@ -12,17 +12,17 @@ class CommentsController < ApplicationController
format.atom { }
end
end
-
+
def commit
@git = @repository.git
@commit = @git.commit(params[:sha])
@comments = @repository.comments.find_all_by_sha1(params[:sha], :include => :user)
end
-
+
def new
@comment = @repository.comments.new
end
-
+
def create
@comment = @repository.comments.new(params[:comment])
@comment.user = current_user
@@ -39,7 +39,7 @@ class CommentsController < ApplicationController
end
end
end
-
+
protected
def find_repository
@repository = @project.repositories.find_by_name!(params[:repository_id]) |
| |   |
| 1 | 1 | class CommitsController < ApplicationController |
| 2 | 2 | before_filter :find_project_and_repository |
| 3 | 3 | before_filter :check_repository_for_commits |
| 4 | | |
| 4 | |
| 5 | 5 | def index |
| 6 | 6 | redirect_to project_repository_log_path(@project, @repository, @repository.head_candidate.name) |
| 7 | 7 | end |
| … | … | |
| 17 | 17 | # TODO: format.diff { render :content_type => "text/plain" } |
| 18 | 18 | end |
| 19 | 19 | end |
| 20 | | |
| 20 | |
| 21 | 21 | end |
| toggle raw diff |
--- a/app/controllers/commits_controller.rb
+++ b/app/controllers/commits_controller.rb
@@ -1,7 +1,7 @@
class CommitsController < ApplicationController
before_filter :find_project_and_repository
before_filter :check_repository_for_commits
-
+
def index
redirect_to project_repository_log_path(@project, @repository, @repository.head_candidate.name)
end
@@ -17,5 +17,5 @@ class CommitsController < ApplicationController
# TODO: format.diff { render :content_type => "text/plain" }
end
end
-
+
end |
| |   |
| 1 | 1 | class CommittersController < ApplicationController |
| 2 | 2 | before_filter :login_required, :only => [:new, :create, :destroy, :list] |
| 3 | 3 | before_filter :find_project |
| 4 | | before_filter :find_repository, |
| 4 | before_filter :find_repository, |
| 5 | 5 | :only => [:show, :new, :create, :edit, :update, :destroy, :list] |
| 6 | | |
| 6 | |
| 7 | 7 | def new |
| 8 | 8 | @committer = User.new |
| 9 | 9 | end |
| 10 | | |
| 10 | |
| 11 | 11 | def create |
| 12 | 12 | @committer = User.find_by_login(params[:user][:login]) |
| 13 | 13 | unless @committer |
| … | … | |
| 24 | 24 | @committership = @repository.committerships.find_by_user_id(@committer.id) |
| 25 | 25 | @project.create_event(Action::ADD_COMMITTER, @committership, current_user) |
| 26 | 26 | format.html { redirect_to([@repository.project, @repository]) } |
| 27 | | format.xml do |
| 27 | format.xml do |
| 28 | 28 | render :xml => @committer |
| 29 | 29 | end |
| 30 | 30 | else |
| … | … | |
| 34 | 34 | end |
| 35 | 35 | end |
| 36 | 36 | end |
| 37 | | |
| 37 | |
| 38 | 38 | def destroy |
| 39 | 39 | @committership = @repository.committerships.find_by_user_id(params[:id]) |
| 40 | | |
| 40 | |
| 41 | 41 | respond_to do |format| |
| 42 | 42 | if @committership.destroy |
| 43 | 43 | @project.create_event(Action::REMOVE_COMMITTER, @repository, current_user, params[:id]) |
| … | … | |
| 48 | 48 | flash[:error] = "Could not remove user from repository" |
| 49 | 49 | format.html { redirect_to [@repository.project, @repository] } |
| 50 | 50 | format.xml { render :nothing, :status => :unprocessable_entity } |
| 51 | | end |
| 52 | | |
| 51 | end |
| 52 | |
| 53 | 53 | end |
| 54 | 54 | end |
| 55 | | |
| 55 | |
| 56 | 56 | def list |
| 57 | 57 | @committers = @repository.committers |
| 58 | 58 | respond_to do |format| |
| 59 | 59 | format.xml { render :xml => @committers } |
| 60 | 60 | end |
| 61 | 61 | end |
| 62 | | |
| 62 | |
| 63 | 63 | def auto_complete_for_user_login |
| 64 | 64 | login = params[:user][:login] |
| 65 | | @users = User.find(:all, |
| 65 | @users = User.find(:all, |
| 66 | 66 | :conditions => [ 'LOWER(login) LIKE ?', '%' + login.downcase + '%' ], |
| 67 | 67 | :limit => 10) |
| 68 | 68 | render :layout => false |
| 69 | 69 | end |
| 70 | | |
| 70 | |
| 71 | 71 | private |
| 72 | 72 | def find_repository |
| 73 | 73 | @repository = @project.repositories.find_by_name!(params[:repository_id]) |
| toggle raw diff |
--- a/app/controllers/committers_controller.rb
+++ b/app/controllers/committers_controller.rb
@@ -1,13 +1,13 @@
class CommittersController < ApplicationController
before_filter :login_required, :only => [:new, :create, :destroy, :list]
before_filter :find_project
- before_filter :find_repository,
+ before_filter :find_repository,
:only => [:show, :new, :create, :edit, :update, :destroy, :list]
-
+
def new
@committer = User.new
end
-
+
def create
@committer = User.find_by_login(params[:user][:login])
unless @committer
@@ -24,7 +24,7 @@ class CommittersController < ApplicationController
@committership = @repository.committerships.find_by_user_id(@committer.id)
@project.create_event(Action::ADD_COMMITTER, @committership, current_user)
format.html { redirect_to([@repository.project, @repository]) }
- format.xml do
+ format.xml do
render :xml => @committer
end
else
@@ -34,10 +34,10 @@ class CommittersController < ApplicationController
end
end
end
-
+
def destroy
@committership = @repository.committerships.find_by_user_id(params[:id])
-
+
respond_to do |format|
if @committership.destroy
@project.create_event(Action::REMOVE_COMMITTER, @repository, current_user, params[:id])
@@ -48,26 +48,26 @@ class CommittersController < ApplicationController
flash[:error] = "Could not remove user from repository"
format.html { redirect_to [@repository.project, @repository] }
format.xml { render :nothing, :status => :unprocessable_entity }
- end
-
+ end
+
end
end
-
+
def list
@committers = @repository.committers
respond_to do |format|
format.xml { render :xml => @committers }
end
end
-
+
def auto_complete_for_user_login
login = params[:user][:login]
- @users = User.find(:all,
+ @users = User.find(:all,
:conditions => [ 'LOWER(login) LIKE ?', '%' + login.downcase + '%' ],
:limit => 10)
render :layout => false
end
-
+
private
def find_repository
@repository = @project.repositories.find_by_name!(params[:repository_id]) |
| |   |
| 1 | 1 | class EventsController < ApplicationController |
| 2 | 2 | def index |
| 3 | | @events = Event.paginate(:all, :order => "events.created_at desc", |
| 3 | @events = Event.paginate(:all, :order => "events.created_at desc", |
| 4 | 4 | :page => params[:page], :include => [:user]) |
| 5 | 5 | @atom_auto_discovery_url = formatted_events_path(:atom) |
| 6 | | |
| 6 | |
| 7 | 7 | respond_to do |if_format_is| |
| 8 | 8 | if_format_is.html {} |
| 9 | 9 | if_format_is.atom {} |
| 10 | 10 | end |
| 11 | 11 | end |
| 12 | | |
| 12 | |
| 13 | 13 | end |
| toggle raw diff |
--- a/app/controllers/events_controller.rb
+++ b/app/controllers/events_controller.rb
@@ -1,13 +1,13 @@
class EventsController < ApplicationController
def index
- @events = Event.paginate(:all, :order => "events.created_at desc",
+ @events = Event.paginate(:all, :order => "events.created_at desc",
:page => params[:page], :include => [:user])
@atom_auto_discovery_url = formatted_events_path(:atom)
-
+
respond_to do |if_format_is|
if_format_is.html {}
if_format_is.atom {}
end
end
-
+
end |
| |   |
| 1 | 1 | class KeysController < ApplicationController |
| 2 | 2 | before_filter :login_required |
| 3 | | |
| 3 | |
| 4 | 4 | def index |
| 5 | 5 | @ssh_keys = current_user.ssh_keys |
| 6 | 6 | respond_to do |format| |
| … | … | |
| 8 | 8 | format.xml { render :xml => @ssh_keys } |
| 9 | 9 | end |
| 10 | 10 | end |
| 11 | | |
| 11 | |
| 12 | 12 | def new |
| 13 | 13 | @ssh_key = current_user.ssh_keys.new |
| 14 | 14 | end |
| … | … | |
| 24 | 24 | def create |
| 25 | 25 | @ssh_key = current_user.ssh_keys.new |
| 26 | 26 | @ssh_key.key = params[:ssh_key][:key] |
| 27 | | |
| 27 | |
| 28 | 28 | respond_to do |format| |
| 29 | 29 | if @ssh_key.save |
| 30 | 30 | flash[:notice] = "Key added" |
| … | … | |
| 36 | 36 | end |
| 37 | 37 | end |
| 38 | 38 | end |
| 39 | | |
| 39 | |
| 40 | 40 | def show |
| 41 | 41 | @ssh_key = current_user.ssh_keys.find(params[:id]) |
| 42 | | |
| 42 | |
| 43 | 43 | respond_to do |format| |
| 44 | 44 | format.html |
| 45 | 45 | format.xml { render :xml => @ssh_key } |
| 46 | 46 | end |
| 47 | 47 | end |
| 48 | 48 | |
| 49 | | # can't update keys since yet we'd have to to search/replace through |
| 49 | # can't update keys since yet we'd have to to search/replace through |
| 50 | 50 | # authorized_keys |
| 51 | 51 | # def edit |
| 52 | 52 | # @ssh_key = current_user.ssh_keys.find(params[:id]) |
| 53 | 53 | # end |
| 54 | | # |
| 54 | # |
| 55 | 55 | # def update |
| 56 | 56 | # @ssh_key = current_user.ssh_keys.find(params[:id]) |
| 57 | 57 | # @ssh_key.key = params[:ssh_key][:key] |
| … | … | |
| 62 | 62 | # render :action => "new" |
| 63 | 63 | # end |
| 64 | 64 | # end |
| 65 | | |
| 65 | |
| 66 | 66 | def destroy |
| 67 | 67 | @ssh_key = current_user.ssh_keys.find(params[:id]) |
| 68 | 68 | if @ssh_key.destroy |
| 69 | 69 | flash[:notice] = "Key removed" |
| 70 | 70 | end |
| 71 | | redirect_to account_path |
| 71 | redirect_to account_path |
| 72 | 72 | end |
| 73 | 73 | end |
| toggle raw diff |
--- a/app/controllers/keys_controller.rb
+++ b/app/controllers/keys_controller.rb
@@ -1,6 +1,6 @@
class KeysController < ApplicationController
before_filter :login_required
-
+
def index
@ssh_keys = current_user.ssh_keys
respond_to do |format|
@@ -8,7 +8,7 @@ class KeysController < ApplicationController
format.xml { render :xml => @ssh_keys }
end
end
-
+
def new
@ssh_key = current_user.ssh_keys.new
end
@@ -24,7 +24,7 @@ class KeysController < ApplicationController
def create
@ssh_key = current_user.ssh_keys.new
@ssh_key.key = params[:ssh_key][:key]
-
+
respond_to do |format|
if @ssh_key.save
flash[:notice] = "Key added"
@@ -36,22 +36,22 @@ class KeysController < ApplicationController
end
end
end
-
+
def show
@ssh_key = current_user.ssh_keys.find(params[:id])
-
+
respond_to do |format|
format.html
format.xml { render :xml => @ssh_key }
end
end
- # can't update keys since yet we'd have to to search/replace through
+ # can't update keys since yet we'd have to to search/replace through
# authorized_keys
# def edit
# @ssh_key = current_user.ssh_keys.find(params[:id])
# end
- #
+ #
# def update
# @ssh_key = current_user.ssh_keys.find(params[:id])
# @ssh_key.key = params[:ssh_key][:key]
@@ -62,12 +62,12 @@ class KeysController < ApplicationController
# render :action => "new"
# end
# end
-
+
def destroy
@ssh_key = current_user.ssh_keys.find(params[:id])
if @ssh_key.destroy
flash[:notice] = "Key removed"
end
- redirect_to account_path
+ redirect_to account_path
end
end |
| |   |
| 1 | 1 | class LogsController < ApplicationController |
| 2 | 2 | before_filter :find_project_and_repository |
| 3 | 3 | before_filter :check_repository_for_commits |
| 4 | | |
| 4 | |
| 5 | 5 | def index |
| 6 | 6 | redirect_to project_repository_log_path(@project, @repository, @repository.head_candidate.name) |
| 7 | 7 | end |
| 8 | | |
| 8 | |
| 9 | 9 | def show |
| 10 | 10 | @git = @repository.git |
| 11 | 11 | @commits = @repository.paginated_commits(params[:id], params[:page]) |
| … | … | |
| 14 | 14 | format.html |
| 15 | 15 | end |
| 16 | 16 | end |
| 17 | | |
| 17 | |
| 18 | 18 | def feed |
| 19 | 19 | @git = @repository.git |
| 20 | 20 | @commits = @repository.git.commits(params[:id]) |
| … | … | |
| 23 | 23 | format.atom |
| 24 | 24 | end |
| 25 | 25 | end |
| 26 | | |
| 26 | |
| 27 | 27 | end |
| toggle raw diff |
--- a/app/controllers/logs_controller.rb
+++ b/app/controllers/logs_controller.rb
@@ -1,11 +1,11 @@
class LogsController < ApplicationController
before_filter :find_project_and_repository
before_filter :check_repository_for_commits
-
+
def index
redirect_to project_repository_log_path(@project, @repository, @repository.head_candidate.name)
end
-
+
def show
@git = @repository.git
@commits = @repository.paginated_commits(params[:id], params[:page])
@@ -14,7 +14,7 @@ class LogsController < ApplicationController
format.html
end
end
-
+
def feed
@git = @repository.git
@commits = @repository.git.commits(params[:id])
@@ -23,5 +23,5 @@ class LogsController < ApplicationController
format.atom
end
end
-
+
end |
| |   |
| 5 | 5 | before_filter :find_merge_request, :except => [:index, :show, :new, :create] |
| 6 | 6 | before_filter :assert_merge_request_ownership, :except => [:index, :show, :new, :create, :resolve] |
| 7 | 7 | before_filter :assert_merge_request_resolvable, :only => [:resolve] |
| 8 | | |
| 8 | |
| 9 | 9 | def index |
| 10 | 10 | @merge_requests = @repository.merge_requests |
| 11 | 11 | @comment_count = @repository.comments.count |
| 12 | 12 | #@proposed_merge_requests = @repository.proposed_merge_requests |
| 13 | 13 | end |
| 14 | | |
| 14 | |
| 15 | 15 | def show |
| 16 | 16 | @merge_request = @repository.merge_requests.find(params[:id]) |
| 17 | 17 | @commits = @merge_request.target_repository.git.commit_deltas_from( |
| 18 | | @merge_request.source_repository.git, |
| 18 | @merge_request.source_repository.git, |
| 19 | 19 | @merge_request.target_branch, |
| 20 | 20 | @merge_request.source_branch |
| 21 | 21 | ) |
| 22 | 22 | end |
| 23 | | |
| 23 | |
| 24 | 24 | def new |
| 25 | 25 | @merge_request = @repository.proposed_merge_requests.new(:user => current_user) |
| 26 | 26 | @repositories = @project.repositories.find(:all, :conditions => ["id != ?", @repository.id]) |
| 27 | 27 | end |
| 28 | | |
| 28 | |
| 29 | 29 | def create |
| 30 | 30 | @merge_request = @repository.proposed_merge_requests.new(params[:merge_request]) |
| 31 | 31 | @merge_request.user = current_user |
| … | … | |
| 46 | 46 | end |
| 47 | 47 | end |
| 48 | 48 | end |
| 49 | | |
| 49 | |
| 50 | 50 | def resolve |
| 51 | 51 | # TODO: put to change status |
| 52 | 52 | @merge_request.status = params[:merge_request][:status] |
| … | … | |
| 54 | 54 | @project.create_event(Action::RESOLVE_MERGE_REQUEST, @merge_request, current_user) |
| 55 | 55 | flash[:notice] = "The merge request was marked as #{@merge_request.status_string}" |
| 56 | 56 | end |
| 57 | | redirect_to [@project, @repository, @merge_request] |
| 57 | redirect_to [@project, @repository, @merge_request] |
| 58 | 58 | end |
| 59 | | |
| 59 | |
| 60 | 60 | def edit |
| 61 | 61 | @repositories = @project.repositories.find(:all, :conditions => ["id != ?", @repository.id]) |
| 62 | 62 | end |
| 63 | | |
| 63 | |
| 64 | 64 | def update |
| 65 | 65 | @merge_request.attributes = params[:merge_request] |
| 66 | 66 | if @merge_request.save |
| … | … | |
| 72 | 72 | render :action => "edit" |
| 73 | 73 | end |
| 74 | 74 | end |
| 75 | | |
| 75 | |
| 76 | 76 | def destroy |
| 77 | 77 | @merge_request.destroy |
| 78 | 78 | @project.create_event(Action::DELETE_MERGE_REQUEST, @repository, current_user) |
| 79 | 79 | flash[:success] = "Merge request was retracted" |
| 80 | 80 | redirect_to project_repository_path(@project, @repository) |
| 81 | 81 | end |
| 82 | | |
| 82 | |
| 83 | 83 | protected |
| 84 | 84 | def find_repository |
| 85 | 85 | @repository = @project.repositories.find_by_name!(params[:repository_id]) |
| 86 | 86 | end |
| 87 | | |
| 87 | |
| 88 | 88 | def find_merge_request |
| 89 | 89 | @merge_request = @repository.merge_requests.find(params[:id]) |
| 90 | 90 | end |
| 91 | | |
| 91 | |
| 92 | 92 | def assert_merge_request_resolvable |
| 93 | 93 | unless @merge_request.resolvable_by?(current_user) |
| 94 | 94 | respond_to do |format| |
| … | … | |
| 99 | 99 | return |
| 100 | 100 | end |
| 101 | 101 | end |
| 102 | | |
| 102 | |
| 103 | 103 | def assert_merge_request_ownership |
| 104 | 104 | if @merge_request.user != current_user |
| 105 | 105 | respond_to do |format| |
| … | … | |
| 110 | 110 | return |
| 111 | 111 | end |
| 112 | 112 | end |
| 113 | | |
| 113 | |
| 114 | 114 | end |
| toggle raw diff |
--- a/app/controllers/merge_requests_controller.rb
+++ b/app/controllers/merge_requests_controller.rb
@@ -5,27 +5,27 @@ class MergeRequestsController < ApplicationController
before_filter :find_merge_request, :except => [:index, :show, :new, :create]
before_filter :assert_merge_request_ownership, :except => [:index, :show, :new, :create, :resolve]
before_filter |