Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
996f7009
Commit
996f7009
authored
Oct 31, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
083d64c6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
113 additions
and
11 deletions
+113
-11
app/models/concerns/subscribable.rb
app/models/concerns/subscribable.rb
+8
-0
changelogs/unreleased/34132-graphql-epic-subscribtions.yml
changelogs/unreleased/34132-graphql-epic-subscribtions.yml
+5
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+8
-0
lib/gitlab/regex.rb
lib/gitlab/regex.rb
+4
-0
locale/gitlab.pot
locale/gitlab.pot
+9
-0
spec/frontend/environment.js
spec/frontend/environment.js
+6
-0
spec/javascripts/u2f/mock_u2f_device.js
spec/javascripts/u2f/mock_u2f_device.js
+7
-11
spec/lib/gitlab/regex_spec.rb
spec/lib/gitlab/regex_spec.rb
+10
-0
spec/models/concerns/subscribable_spec.rb
spec/models/concerns/subscribable_spec.rb
+56
-0
No files found.
app/models/concerns/subscribable.rb
View file @
996f7009
...
...
@@ -59,6 +59,14 @@ module Subscribable
.
update
(
subscribed:
false
)
end
def
set_subscription
(
user
,
desired_state
,
project
=
nil
)
if
desired_state
subscribe
(
user
,
project
)
else
unsubscribe
(
user
,
project
)
end
end
private
def
unsubscribe_from_other_levels
(
user
,
project
)
...
...
changelogs/unreleased/34132-graphql-epic-subscribtions.yml
0 → 100644
View file @
996f7009
---
title
:
Graphql mutation for (un)subscribing to an epic
merge_request
:
19083
author
:
type
:
added
doc/api/graphql/reference/index.md
View file @
996f7009
...
...
@@ -271,6 +271,14 @@ The API can be explored interactively using the [GraphiQL IDE](../index.md#graph
|
`createNote`
| Boolean! | Whether or not a user can perform
`create_note`
on this resource |
|
`awardEmoji`
| Boolean! | Whether or not a user can perform
`award_emoji`
on this resource |
### EpicSetSubscriptionPayload
| Name | Type | Description |
| --- | ---- | ---------- |
|
`clientMutationId`
| String | A unique identifier for the client performing the mutation. |
|
`errors`
| String! => Array | Reasons why the mutation failed. |
|
`epic`
| Epic | The epic after mutation |
### EpicTreeReorderPayload
| Name | Type | Description |
...
...
lib/gitlab/regex.rb
View file @
996f7009
...
...
@@ -128,6 +128,10 @@ module Gitlab
def
aws_arn_regex_message
"must be a valid Amazon Resource Name"
end
def
utc_date_regex
@utc_date_regex
||=
/\A[0-9]{4}-[0-9]{2}-[0-9]{2}\z/
.
freeze
end
end
end
...
...
locale/gitlab.pot
View file @
996f7009
...
...
@@ -4801,6 +4801,12 @@ msgstr ""
msgid "Created a branch and a merge request to resolve this issue."
msgstr ""
msgid "Created after"
msgstr ""
msgid "Created before"
msgstr ""
msgid "Created branch '%{branch_name}' and a merge request to resolve this issue."
msgstr ""
...
...
@@ -9153,6 +9159,9 @@ msgstr ""
msgid "Invalid date"
msgstr ""
msgid "Invalid date format. Please use UTC format as YYYY-MM-DD"
msgstr ""
msgid "Invalid feature"
msgstr ""
...
...
spec/frontend/environment.js
View file @
996f7009
...
...
@@ -41,6 +41,12 @@ class CustomEnvironment extends JSDOMEnvironment {
this
.
global
.
fixturesBasePath
=
`
${
ROOT_PATH
}
/tmp/tests/frontend/fixtures
${
IS_EE
?
'
-ee
'
:
''
}
`
;
this
.
global
.
staticFixturesBasePath
=
`
${
ROOT_PATH
}
/spec/frontend/fixtures`
;
/**
* window.fetch() is required by the apollo-upload-client library otherwise
* a ReferenceError is generated: https://github.com/jaydenseric/apollo-upload-client/issues/100
*/
this
.
global
.
fetch
=
()
=>
{};
// Not yet supported by JSDOM: https://github.com/jsdom/jsdom/issues/317
this
.
global
.
document
.
createRange
=
()
=>
({
setStart
:
()
=>
{},
...
...
spec/javascripts/u2f/mock_u2f_device.js
View file @
996f7009
/* eslint-disable no-unused-expressions
, no-return-assign, no-param-reassign
*/
/* eslint-disable no-unused-expressions */
export
default
class
MockU2FDevice
{
constructor
()
{
this
.
respondToAuthenticateRequest
=
this
.
respondToAuthenticateRequest
.
bind
(
this
);
this
.
respondToRegisterRequest
=
this
.
respondToRegisterRequest
.
bind
(
this
);
window
.
u2f
||
(
window
.
u2f
=
{});
window
.
u2f
.
register
=
(
function
(
_this
)
{
return
function
(
appId
,
registerRequests
,
signRequests
,
callback
)
{
return
(
_this
.
registerCallback
=
callback
);
};
})(
this
);
window
.
u2f
.
sign
=
(
function
(
_this
)
{
return
function
(
appId
,
challenges
,
signRequests
,
callback
)
{
return
(
_this
.
authenticateCallback
=
callback
);
};
})(
this
);
window
.
u2f
.
register
=
(
appId
,
registerRequests
,
signRequests
,
callback
)
=>
{
this
.
registerCallback
=
callback
;
};
window
.
u2f
.
sign
=
(
appId
,
challenges
,
signRequests
,
callback
)
=>
{
this
.
authenticateCallback
=
callback
;
};
}
respondToRegisterRequest
(
params
)
{
...
...
spec/lib/gitlab/regex_spec.rb
View file @
996f7009
...
...
@@ -75,4 +75,14 @@ describe Gitlab::Regex do
it
{
is_expected
.
not_to
match
(
'123456789012'
)
}
it
{
is_expected
.
not_to
match
(
'role/role-name'
)
}
end
describe
'.utc_date_regex'
do
subject
{
described_class
.
utc_date_regex
}
it
{
is_expected
.
to
match
(
'2019-10-20'
)
}
it
{
is_expected
.
to
match
(
'1990-01-01'
)
}
it
{
is_expected
.
not_to
match
(
'11-1234-90'
)
}
it
{
is_expected
.
not_to
match
(
'aa-1234-cc'
)
}
it
{
is_expected
.
not_to
match
(
'9/9/2018'
)
}
end
end
spec/models/concerns/subscribable_spec.rb
View file @
996f7009
...
...
@@ -133,4 +133,60 @@ describe Subscribable, 'Subscribable' do
end
end
end
describe
'#set_subscription'
do
shared_examples
'setting subscriptions'
do
context
'when desired_state is set to true'
do
context
'when a user is subscribed to the resource'
do
it
'keeps the user subscribed'
do
resource
.
subscriptions
.
create
(
user:
user_1
,
subscribed:
true
,
project:
resource_project
)
resource
.
set_subscription
(
user_1
,
true
,
resource_project
)
expect
(
resource
.
subscribed?
(
user_1
,
resource_project
)).
to
be_truthy
end
end
context
'when a user is not subscribed to the resource'
do
it
'subscribes the user to the resource'
do
expect
{
resource
.
set_subscription
(
user_1
,
true
,
resource_project
)
}
.
to
change
{
resource
.
subscribed?
(
user_1
,
resource_project
)
}
.
from
(
false
).
to
(
true
)
end
end
end
context
'when desired_state is set to false'
do
context
'when a user is subscribed to the resource'
do
it
'unsubscribes the user from the resource'
do
resource
.
subscriptions
.
create
(
user:
user_1
,
subscribed:
true
,
project:
resource_project
)
expect
{
resource
.
set_subscription
(
user_1
,
false
,
resource_project
)
}
.
to
change
{
resource
.
subscribed?
(
user_1
,
resource_project
)
}
.
from
(
true
).
to
(
false
)
end
end
context
'when a user is not subscribed to the resource'
do
it
'keeps the user unsubscribed'
do
resource
.
set_subscription
(
user_1
,
false
,
resource_project
)
expect
(
resource
.
subscribed?
(
user_1
,
resource_project
)).
to
be_falsey
end
end
end
end
context
'without project'
do
let
(
:resource_project
)
{
nil
}
it_behaves_like
'setting subscriptions'
end
context
'with project'
do
let
(
:resource_project
)
{
project
}
it_behaves_like
'setting subscriptions'
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment