Commit 20d04e77 authored by Jan Provaznik's avatar Jan Provaznik Committed by Jarka Kadlecová

More EE->CE fixes

parent 23e2c08d
module TodosActions module TodosActions
include Gitlab::Utils::StrongMemoize
extend ActiveSupport::Concern extend ActiveSupport::Concern
def create def create
......
class Projects::TodosController < Projects::ApplicationController class Projects::TodosController < Projects::ApplicationController
include Gitlab::Utils::StrongMemoize
include TodosActions include TodosActions
before_action :authenticate_user!, only: [:create] before_action :authenticate_user!, only: [:create]
......
...@@ -171,9 +171,7 @@ module TodosHelper ...@@ -171,9 +171,7 @@ module TodosHelper
end end
def todo_group_options def todo_group_options
groups = current_user.authorized_groups groups = current_user.authorized_groups.map do |group|
groups = groups.map do |group|
{ id: group.id, text: group.full_name } { id: group.id, text: group.full_name }
end end
......
class Todo < ActiveRecord::Base class Todo < ActiveRecord::Base
prepend EE::Todo
include Sortable include Sortable
ASSIGNED = 1 ASSIGNED = 1
...@@ -83,7 +84,7 @@ class Todo < ActiveRecord::Base ...@@ -83,7 +84,7 @@ class Todo < ActiveRecord::Base
end end
def parent def parent
project || group project
end end
def unmergeable? def unmergeable?
......
...@@ -305,7 +305,6 @@ class TodoService ...@@ -305,7 +305,6 @@ class TodoService
def attributes_for_target(target) def attributes_for_target(target)
attributes = { attributes = {
project_id: target&.project&.id, project_id: target&.project&.id,
group_id: target.respond_to?(:group) ? target.group_id : nil,
target_id: target.id, target_id: target.id,
target_type: target.class.name, target_type: target.class.name,
commit_id: nil commit_id: nil
......
class Groups::TodosController < Groups::ApplicationController class Groups::TodosController < Groups::ApplicationController
include Gitlab::Utils::StrongMemoize
include TodosActions include TodosActions
before_action :authenticate_user!, only: [:create] before_action :authenticate_user!, only: [:create]
......
module EE
module Todo
extend ::Gitlab::Utils::Override
override :parent
def parent
project || group
end
end
end
module EE module EE
module TodoService module TodoService
extend ::Gitlab::Utils::Override
def new_epic(epic, current_user) def new_epic(epic, current_user)
create_mention_todos(nil, epic, current_user) create_mention_todos(nil, epic, current_user)
end end
...@@ -7,5 +9,16 @@ module EE ...@@ -7,5 +9,16 @@ module EE
def update_epic(epic, current_user, skip_users = []) def update_epic(epic, current_user, skip_users = [])
create_mention_todos(nil, epic, current_user, nil, skip_users) create_mention_todos(nil, epic, current_user, nil, skip_users)
end end
override :attributes_for_target
def attributes_for_target(target)
attributes = super
if target.is_a?(Epic)
attributes[:group_id] = target.group_id
end
attributes
end
end end
end end
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