Skip to content

Commit

Permalink
[webui] Remove has_comment from controllers and routes
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidKang committed Dec 28, 2016
1 parent f547944 commit e450ae1
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 34 deletions.
4 changes: 1 addition & 3 deletions src/api/app/controllers/webui/package_controller.rb
Expand Up @@ -3,7 +3,6 @@

class Webui::PackageController < Webui::WebuiController
require_dependency 'opensuse/validator'
include Webui::HasComments
include ParsePackageDiff
include Webui::PackageHelper
include Escaper
Expand Down Expand Up @@ -31,8 +30,7 @@ class Webui::PackageController < Webui::WebuiController
:save_group, :remove_role, :view_file,
:abort_build, :trigger_rebuild, :trigger_services,
:wipe_binaries, :buildresult, :rpmlint_result, :rpmlint_log, :meta,
:attributes, :edit, :import_spec, :files, :comments, :users,
:save_comment]
:attributes, :edit, :import_spec, :files, :comments, :users]

# make sure it's after the require_, it requires both
before_action :require_login, except: [:show, :linking_packages, :linking_packages, :dependency,
Expand Down
3 changes: 1 addition & 2 deletions src/api/app/controllers/webui/project_controller.rb
@@ -1,6 +1,5 @@
class Webui::ProjectController < Webui::WebuiController
require_dependency 'opensuse/validator'
include Webui::HasComments
include Webui::RequestHelper
include Webui::ProjectHelper
include Webui::LoadBuildresults
Expand All @@ -18,7 +17,7 @@ class Webui::ProjectController < Webui::WebuiController
:show, :linking_projects, :add_person, :add_group, :buildresult, :delete_dialog,
:destroy, :remove_path_from_target, :rebuild_time, :packages_simple,
:requests, :save, :monitor, :toggle_watch, :meta,
:prjconf, :edit, :save_comment, :edit_comment,
:prjconf, :edit, :edit_comment,
:status, :maintained_projects,
:add_maintained_project_dialog, :add_maintained_project, :remove_maintained_project,
:maintenance_incidents, :unlock_dialog, :unlock, :save_person, :save_group, :remove_role,
Expand Down
2 changes: 0 additions & 2 deletions src/api/app/controllers/webui/request_controller.rb
@@ -1,8 +1,6 @@
require 'base64'

class Webui::RequestController < Webui::WebuiController
include Webui::HasComments

helper 'webui/comment'
helper 'webui/package'

Expand Down
4 changes: 2 additions & 2 deletions src/api/app/helpers/webui/comment_helper.rb
Expand Up @@ -2,8 +2,8 @@ module Webui::CommentHelper
# This could also be solved with
# http://apidock.com/rails/ActiveRecord/NestedAttributes/ClassMethods/accepts_nested_attributes_for
def save_comment_form
opts = {action: 'save_comment'}
opts[:controller] = params[:controller]
opts = {action: 'create'}
opts[:controller] = :comments
opts[:project] = @project.name if @project
opts[:package] = @package.to_param if @package
opts[:id] = @id if @id
Expand Down
19 changes: 0 additions & 19 deletions src/api/app/mixins/webui/has_comments.rb

This file was deleted.

7 changes: 1 addition & 6 deletions src/api/config/routes.rb
Expand Up @@ -151,7 +151,6 @@ def self.public_or_about_path?(request)
get 'package/import_spec/:project/:package' => :import_spec, constraints: cons
# compat route
get 'package/files/:project/:package' => :show, constraints: cons
post 'package/comments/:project/:package' => :save_comment, constraints: cons
end

controller 'webui/patchinfo' do
Expand Down Expand Up @@ -251,7 +250,6 @@ def self.public_or_about_path?(request)
get 'project/list_incidents/:project' => :list_incidents, constraints: cons
get 'project/unlock_dialog' => :unlock_dialog
post 'project/unlock' => :unlock
post 'project/comments/:project' => :save_comment, constraints: cons, as: 'save_project_comment'
end

controller 'webui/request' do
Expand All @@ -274,7 +272,6 @@ def self.public_or_about_path?(request)
post 'request/change_devel_request' => :change_devel_request
get 'request/set_incident_dialog' => :set_incident_dialog
post 'request/set_incident' => :set_incident
post 'request/comments/:number' => :save_comment
end

controller 'webui/search' do
Expand Down Expand Up @@ -335,9 +332,7 @@ def self.public_or_about_path?(request)
get 'group/tokens' => :tokens
end

namespace :webui do
resource :comment, only: [:destroy]
end
resources :comments, constraints: cons, only: [:create, :destroy], controller: 'webui/comments'

### /apidocs
get 'apidocs(/index)' => 'webui/apidocs#index'
Expand Down

0 comments on commit e450ae1

Please sign in to comment.