Skip to content
代码片段 群组 项目
提交 7dd3da10 编辑于 作者: Joseph Snyder's avatar Joseph Snyder
浏览文件

Update graphql for emails_disabled transition

Following comments in front-end MR:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/135959

Split the GraphQL updates into a new merge request.
上级 cbb0fe55
No related branches found
No related tags found
无相关合并请求
...@@ -62,6 +62,11 @@ class GroupType < NamespaceType ...@@ -62,6 +62,11 @@ class GroupType < NamespaceType
null: true, null: true,
description: 'Indicates if a group has email notifications disabled.' description: 'Indicates if a group has email notifications disabled.'
field :emails_enabled,
type: GraphQL::Types::Boolean,
null: true,
description: 'Indicates if a group has email notifications enabled.'
field :max_access_level, Types::AccessLevelType, field :max_access_level, Types::AccessLevelType,
null: false, null: false,
description: 'The maximum access level of the current user in the group.' description: 'The maximum access level of the current user in the group.'
...@@ -365,6 +370,10 @@ def descendant_groups_count ...@@ -365,6 +370,10 @@ def descendant_groups_count
end end
end end
def emails_disabled
!group.emails_enabled?
end
def projects_count def projects_count
BatchLoader::GraphQL.for(object.id).batch do |group_ids, loader| BatchLoader::GraphQL.for(object.id).batch do |group_ids, loader|
projects_counts = Group.id_in(group_ids).projects_counts projects_counts = Group.id_in(group_ids).projects_counts
......
...@@ -19483,6 +19483,7 @@ GPG signature for a signed commit. ...@@ -19483,6 +19483,7 @@ GPG signature for a signed commit.
| <a id="groupdescriptionhtml"></a>`descriptionHtml` | [`String`](#string) | GitLab Flavored Markdown rendering of `description`. | | <a id="groupdescriptionhtml"></a>`descriptionHtml` | [`String`](#string) | GitLab Flavored Markdown rendering of `description`. |
| <a id="groupdora"></a>`dora` | [`Dora`](#dora) | Group's DORA metrics. | | <a id="groupdora"></a>`dora` | [`Dora`](#dora) | Group's DORA metrics. |
| <a id="groupemailsdisabled"></a>`emailsDisabled` | [`Boolean`](#boolean) | Indicates if a group has email notifications disabled. | | <a id="groupemailsdisabled"></a>`emailsDisabled` | [`Boolean`](#boolean) | Indicates if a group has email notifications disabled. |
| <a id="groupemailsenabled"></a>`emailsEnabled` | [`Boolean`](#boolean) | Indicates if a group has email notifications enabled. |
| <a id="groupenforcefreeusercap"></a>`enforceFreeUserCap` | [`Boolean`](#boolean) | Indicates whether the group has limited users for a free plan. | | <a id="groupenforcefreeusercap"></a>`enforceFreeUserCap` | [`Boolean`](#boolean) | Indicates whether the group has limited users for a free plan. |
| <a id="groupepicboards"></a>`epicBoards` | [`EpicBoardConnection`](#epicboardconnection) | Find epic boards. (see [Connections](#connections)) | | <a id="groupepicboards"></a>`epicBoards` | [`EpicBoardConnection`](#epicboardconnection) | Find epic boards. (see [Connections](#connections)) |
| <a id="groupepicsenabled"></a>`epicsEnabled` | [`Boolean`](#boolean) | Indicates if Epics are enabled for namespace. | | <a id="groupepicsenabled"></a>`epicsEnabled` | [`Boolean`](#boolean) | Indicates if Epics are enabled for namespace. |
...@@ -159,4 +159,82 @@ def clean_state_query ...@@ -159,4 +159,82 @@ def clean_state_query
end end
end end
end end
describe 'emailsDisabled' do
let_it_be(:group) { create(:group) }
let(:query) do
%(
query {
group(fullPath: "#{group.full_path}") {
emailsDisabled
}
}
)
end
subject(:result) do
result = GitlabSchema.execute(query).as_json
result.dig('data', 'group', 'emailsDisabled')
end
it 'is not a deprecated field' do
expect(described_class.fields['emailsDisabled'].deprecation).to be_nil
end
describe 'when emails_enabled is true' do
before do
group.update!(emails_enabled: true)
end
it { is_expected.to eq(false) }
end
describe 'when emails_enabled is false' do
before do
group.update!(emails_enabled: false)
end
it { is_expected.to eq(true) }
end
end
describe 'emailsEnabled' do
let_it_be(:group) { create(:group) }
let(:query) do
%(
query {
group(fullPath: "#{group.full_path}") {
emailsEnabled
}
}
)
end
subject(:result) do
result = GitlabSchema.execute(query).as_json
result.dig('data', 'group', 'emailsEnabled')
end
it 'is not a deprecated field' do
expect(described_class.fields['emailsEnabled'].deprecation).to be_nil
end
describe 'when emails_enabled is true' do
before do
group.update!(emails_enabled: true)
end
it { is_expected.to eq(true) }
end
describe 'when emails_enabled is false' do
before do
group.update!(emails_enabled: false)
end
it { is_expected.to eq(false) }
end
end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册