Skip to content
Snippets Groups Projects
Commit 8fa87867 authored by Natalia Tepluhina's avatar Natalia Tepluhina
Browse files

Merge branch 'dg-assign-note-backward-compatibility' into 'master'

Hotfix : Resolve setWorkItemMetadata in apollo client

See merge request !116795



Merged-by: default avatarNatalia Tepluhina <ntepluhina@gitlab.com>
Approved-by: default avatarNatalia Tepluhina <ntepluhina@gitlab.com>
Approved-by: default avatarAlexandru Croitor <acroitor@gitlab.com>
Reviewed-by: default avatarNatalia Tepluhina <ntepluhina@gitlab.com>
Co-authored-by: Deepika Guliani's avatarDeepika Guliani <dguliani@gitlab.com>
parents ea4c60ae 00f2269e
No related branches found
No related tags found
2 merge requests!118700Remove refactor_vulnerability_filters feature flag,!116795Hotfix : Resolve setWorkItemMetadata in apollo client
Pipeline #833577530 passed
......@@ -81,6 +81,14 @@ export const config = {
});
},
},
userPermissions: {
read(permission = {}) {
return {
...permission,
setWorkItemMetadata: false,
};
},
},
},
},
MemberInterfaceConnection: {
......
......@@ -15,6 +15,10 @@ extend type WorkItem {
mockWidgets: [LocalWorkItemWidget]
}
extend type WorkItemPermissions {
setWorkItemMetadata: Boolean
}
input LocalUserInput {
id: ID!
name: String
......
......@@ -27,7 +27,7 @@ fragment WorkItem on WorkItem {
userPermissions {
deleteWorkItem
updateWorkItem
setWorkItemMetadata
setWorkItemMetadata @client
}
widgets {
...WorkItemWidgets
......
......@@ -6,7 +6,7 @@ class WorkItem < BasePermissionType
graphql_name 'WorkItemPermissions'
description 'Check permissions for the current user on a work item'
abilities :read_work_item, :update_work_item, :delete_work_item, :admin_work_item, :set_work_item_metadata
abilities :read_work_item, :update_work_item, :delete_work_item, :admin_work_item
end
end
end
......@@ -22477,7 +22477,6 @@ Check permissions for the current user on a work item.
| <a id="workitempermissionsadminworkitem"></a>`adminWorkItem` | [`Boolean!`](#boolean) | Indicates the user can perform `admin_work_item` on this resource. |
| <a id="workitempermissionsdeleteworkitem"></a>`deleteWorkItem` | [`Boolean!`](#boolean) | Indicates the user can perform `delete_work_item` on this resource. |
| <a id="workitempermissionsreadworkitem"></a>`readWorkItem` | [`Boolean!`](#boolean) | Indicates the user can perform `read_work_item` on this resource. |
| <a id="workitempermissionssetworkitemmetadata"></a>`setWorkItemMetadata` | [`Boolean!`](#boolean) | Indicates the user can perform `set_work_item_metadata` on this resource. |
| <a id="workitempermissionsupdateworkitem"></a>`updateWorkItem` | [`Boolean!`](#boolean) | Indicates the user can perform `update_work_item` on this resource. |
 
### `WorkItemType`
......@@ -5,7 +5,7 @@
RSpec.describe Types::PermissionTypes::WorkItem do
it do
expected_permissions = [
:read_work_item, :update_work_item, :delete_work_item, :admin_work_item, :set_work_item_metadata
:read_work_item, :update_work_item, :delete_work_item, :admin_work_item
]
expected_permissions.each do |permission|
......
......@@ -59,8 +59,7 @@
'readWorkItem' => true,
'updateWorkItem' => true,
'deleteWorkItem' => false,
'adminWorkItem' => true,
'setWorkItemMetadata' => true
'adminWorkItem' => true
},
'project' => hash_including('id' => project.to_gid.to_s, 'fullPath' => project.full_path)
)
......@@ -498,25 +497,6 @@
end
end
context 'when the user cannot set work item metadata' do
let(:current_user) { guest }
before do
project.add_guest(guest)
post_graphql(query, current_user: current_user)
end
it 'returns correct user permission' do
expect(work_item_data).to include(
'id' => work_item.to_gid.to_s,
'userPermissions' =>
hash_including(
'setWorkItemMetadata' => false
)
)
end
end
context 'when the user can not read the work item' do
let(:current_user) { create(:user) }
......
......@@ -69,7 +69,7 @@ def set_comment
find('[data-testid="work-item-note-actions"]', match: :first).click
expect(page).to have_selector('[data-testid="copy-link-action"]')
expect(page).to have_selector('[data-testid="assign-note-action"]')
expect(page).not_to have_selector('[data-testid="assign-note-action"]')
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment