debian-mirror-gitlab/lib/bulk_imports/groups/pipelines/members_pipeline.rb

27 lines
694 B
Ruby
Raw Normal View History

2021-03-11 19:13:27 +05:30
# frozen_string_literal: true
module BulkImports
module Groups
module Pipelines
class MembersPipeline
include Pipeline
extractor BulkImports::Common::Extractors::GraphqlExtractor,
query: BulkImports::Groups::Graphql::GetMembersQuery
transformer Common::Transformers::ProhibitedAttributesTransformer
transformer BulkImports::Groups::Transformers::MemberAttributesTransformer
2021-04-17 20:07:23 +05:30
def load(context, data)
return unless data
2021-09-30 23:02:18 +05:30
# Current user is already a member
return if data['user_id'].to_i == context.current_user.id
2021-04-17 20:07:23 +05:30
context.group.members.create!(data)
end
2021-03-11 19:13:27 +05:30
end
end
end
end