Commit 6ff7590a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

issue #124

parent de5d6e95
...@@ -61,4 +61,8 @@ class ApplicationController < ActionController::Base ...@@ -61,4 +61,8 @@ class ApplicationController < ActionController::Base
def render_404 def render_404
render :file => File.join(Rails.root, "public", "404"), :layout => false, :status => "404" render :file => File.join(Rails.root, "public", "404"), :layout => false, :status => "404"
end end
def require_non_empty_project
redirect_to @project unless @project.repo_exists?
end
end end
...@@ -6,6 +6,7 @@ class CommitsController < ApplicationController ...@@ -6,6 +6,7 @@ class CommitsController < ApplicationController
# Authorize # Authorize
before_filter :add_project_abilities before_filter :add_project_abilities
before_filter :authorize_read_project! before_filter :authorize_read_project!
before_filter :require_non_empty_project
def index def index
load_refs # load @branch, @tag & @ref load_refs # load @branch, @tag & @ref
......
...@@ -6,6 +6,8 @@ class ProjectsController < ApplicationController ...@@ -6,6 +6,8 @@ class ProjectsController < ApplicationController
before_filter :authorize_read_project!, :except => [:index, :new, :create] before_filter :authorize_read_project!, :except => [:index, :new, :create]
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy] before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
before_filter :require_non_empty_project, :only => [:blob, :tree]
def index def index
@projects = current_user.projects.all @projects = current_user.projects.all
end end
...@@ -48,7 +50,7 @@ class ProjectsController < ApplicationController ...@@ -48,7 +50,7 @@ class ProjectsController < ApplicationController
def update def update
respond_to do |format| respond_to do |format|
if project.update_attributes(params[:project]) if project.update_attributes(params[:project])
format.html { redirect_to project, notice: 'Project was successfully updated.' } format.html { redirect_to project, :notice => 'Project was successfully updated.' }
format.js format.js
else else
format.html { render action: "edit" } format.html { render action: "edit" }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment