Commit 3ed8a602 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '293629-add-expires_at-param-to-groupmemberbuilder-data' into 'master'

Add expires_at param to GroupMemberBuilder data

See merge request gitlab-org/gitlab!49981
parents b22b7548 711bfc17
---
title: Add expires_at param to GroupMemberBuilder data
merge_request: 49981
author:
type: changed
......@@ -1387,6 +1387,7 @@ X-Gitlab-Event: Member Hook
"user_id": 64,
"group_access": "Guest",
"group_plan": null,
"expires_at": "2020-12-14T00:00:00Z",
"event_name": "user_add_to_group"
}
```
......
......@@ -19,6 +19,7 @@ module Gitlab
# :group_access=>"Guest",
# :created_at=>"2020-11-04T10:12:10Z",
# :updated_at=>"2020-11-04T10:12:10Z",
# :expires_at=>"2020-12-04T10:12:10Z"
# }
def build(event)
......@@ -40,7 +41,8 @@ module Gitlab
user_name: group_member.user.name,
user_email: group_member.user.email,
user_id: group_member.user.id,
group_access: group_member.human_access
group_access: group_member.human_access,
expires_at: group_member.expires_at&.xmlschema
}
end
......
......@@ -4,14 +4,14 @@ require 'spec_helper'
RSpec.describe Gitlab::HookData::GroupMemberBuilder do
let_it_be(:group) { create(:group) }
let_it_be(:group_member) { create(:group_member, :developer, group: group) }
let_it_be(:group_member) { create(:group_member, :developer, group: group, expires_at: 1.day.from_now) }
describe '#build' do
let(:data) { described_class.new(group_member).build(event) }
let(:event_name) { data[:event_name] }
let(:attributes) do
[
:event_name, :created_at, :updated_at, :group_name, :group_path,
:event_name, :created_at, :updated_at, :expires_at, :group_name, :group_path,
:group_id, :user_id, :user_username, :user_name, :user_email, :group_access
]
end
......@@ -31,6 +31,7 @@ RSpec.describe Gitlab::HookData::GroupMemberBuilder do
expect(data[:group_access]).to eq('Developer')
expect(data[:created_at]).to eq(group_member.created_at&.xmlschema)
expect(data[:updated_at]).to eq(group_member.updated_at&.xmlschema)
expect(data[:expires_at]).to eq(group_member.expires_at&.xmlschema)
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