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

More EE->CE fixes

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