Commit 22439322 authored by Felipe Artur's avatar Felipe Artur

Fix specs and fix boards visibility for public groups

parent b5510ac8
...@@ -7,6 +7,7 @@ module Boards ...@@ -7,6 +7,7 @@ module Boards
before_action :authorize_read_issue, only: [:index] before_action :authorize_read_issue, only: [:index]
before_action :authorize_create_issue, only: [:create] before_action :authorize_create_issue, only: [:create]
before_action :authorize_update_issue, only: [:update] before_action :authorize_update_issue, only: [:update]
skip_before_action :authenticate_user!, only: [:index]
def index def index
issues = Boards::Issues::ListService.new(board_parent, current_user, filter_params).execute issues = Boards::Issues::ListService.new(board_parent, current_user, filter_params).execute
......
...@@ -5,6 +5,7 @@ module Boards ...@@ -5,6 +5,7 @@ module Boards
before_action :authorize_admin_list, only: [:create, :update, :destroy, :generate] before_action :authorize_admin_list, only: [:create, :update, :destroy, :generate]
before_action :authorize_read_list, only: [:index] before_action :authorize_read_list, only: [:index]
skip_before_action :authenticate_user!, only: [:index]
def index def index
lists = Boards::Lists::ListService.new(board.parent, current_user).execute(board) lists = Boards::Lists::ListService.new(board.parent, current_user).execute(board)
......
...@@ -24,9 +24,18 @@ class GroupPolicy < BasePolicy ...@@ -24,9 +24,18 @@ class GroupPolicy < BasePolicy
with_options scope: :subject, score: 0 with_options scope: :subject, score: 0
condition(:request_access_enabled) { @subject.request_access_enabled } condition(:request_access_enabled) { @subject.request_access_enabled }
rule { public_group } .enable :read_group rule { public_group }.policy do
enable :read_group
enable :read_list
end
rule { logged_in_viewable }.enable :read_group rule { logged_in_viewable }.enable :read_group
rule { guest } .enable :read_group
rule { guest }.policy do
enable :read_group
enable :read_list
end
rule { admin } .enable :read_group rule { admin } .enable :read_group
rule { has_projects } .enable :read_group rule { has_projects } .enable :read_group
......
module Boards module Boards
module Lists module Lists
class CreateService < BaseService class CreateService < Boards::BaseService
prepend EE::Boards::Lists::CreateService prepend EE::Boards::Lists::CreateService
def execute(board) def execute(board)
......
module Boards module Boards
module Lists module Lists
class DestroyService < BaseService class DestroyService < Boards::BaseService
def execute(list) def execute(list)
return false unless list.destroyable? return false unless list.destroyable?
......
module Boards module Boards
module Lists module Lists
class GenerateService < BaseService class GenerateService < Boards::BaseService
def execute(board) def execute(board)
return false unless board.lists.movable.empty? return false unless board.lists.movable.empty?
......
module Boards module Boards
module Lists module Lists
class ListService < BaseService class ListService < Boards::BaseService
def execute(board) def execute(board)
board.lists.create(list_type: :backlog) unless board.lists.backlog.exists? board.lists.create(list_type: :backlog) unless board.lists.backlog.exists?
......
module Boards module Boards
module Lists module Lists
class MoveService < BaseService class MoveService < Boards::BaseService
def execute(list) def execute(list)
@board = list.board @board = list.board
@old_position = list.position @old_position = list.position
......
...@@ -99,7 +99,7 @@ describe Boards::Issues::MoveService, services: true do ...@@ -99,7 +99,7 @@ describe Boards::Issues::MoveService, services: true do
issue.move_to_end && issue.save! issue.move_to_end && issue.save!
end end
params.merge!(move_after_iid: issue1.iid, move_before_iid: issue2.iid) params.merge!(move_after_id: issue1.id, move_before_id: issue2.id)
described_class.new(group, user, params).execute(issue) described_class.new(group, user, params).execute(issue)
......
...@@ -80,7 +80,7 @@ describe Issues::UpdateService, :mailer do ...@@ -80,7 +80,7 @@ describe Issues::UpdateService, :mailer do
issue.save issue.save
end end
opts[:move_between_iids] = [issue1.iid, issue2.iid] opts[:move_between_ids] = [issue1.id, issue2.id]
update_issue(opts) update_issue(opts)
......
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