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
37afc065
Commit
37afc065
authored
Mar 21, 2018
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hard failing mirror no longer fails for personal project of a blocked user
parent
87f19344
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
8 deletions
+41
-8
app/models/group.rb
app/models/group.rb
+2
-2
app/models/member.rb
app/models/member.rb
+1
-1
app/services/notification_service.rb
app/services/notification_service.rb
+2
-2
ee/app/services/ee/notification_service.rb
ee/app/services/ee/notification_service.rb
+3
-3
ee/changelogs/unreleased/5358-hard-failing-mirror-fails-for-personal-project-with-blocked-owners.yml
...mirror-fails-for-personal-project-with-blocked-owners.yml
+5
-0
ee/spec/services/ee/notification_service_spec.rb
ee/spec/services/ee/notification_service_spec.rb
+28
-0
No files found.
app/models/group.rb
View file @
37afc065
...
...
@@ -268,13 +268,13 @@ class Group < Namespace
end
GroupMember
.
active_without_invites
.
active_without_invites
_and_requests
.
where
(
source_id:
source_ids
)
end
def
members_with_descendants
GroupMember
.
active_without_invites
.
active_without_invites
_and_requests
.
where
(
source_id:
self_and_descendants
.
reorder
(
nil
).
select
(
:id
))
end
...
...
app/models/member.rb
View file @
37afc065
...
...
@@ -53,7 +53,7 @@ class Member < ActiveRecord::Base
end
# Like active, but without invites. For when a User is required.
scope
:active_without_invites
,
->
do
scope
:active_without_invites
_and_requests
,
->
do
left_join_users
.
where
(
users:
{
state:
'active'
})
.
non_request
...
...
app/services/notification_service.rb
View file @
37afc065
...
...
@@ -231,9 +231,9 @@ class NotificationService
def
new_access_request
(
member
)
return
true
unless
member
.
notifiable?
(
:subscription
)
recipients
=
member
.
source
.
members
.
active_without_invites
.
owners_and_masters
recipients
=
member
.
source
.
members
.
active_without_invites
_and_requests
.
owners_and_masters
if
fallback_to_group_owners_masters?
(
recipients
,
member
)
recipients
=
member
.
source
.
group
.
members
.
active_without_invites
.
owners_and_masters
recipients
=
member
.
source
.
group
.
members
.
active_without_invites
_and_requests
.
owners_and_masters
end
recipients
.
each
{
|
recipient
|
deliver_access_request_email
(
recipient
,
member
)
}
...
...
ee/app/services/ee/notification_service.rb
View file @
37afc065
...
...
@@ -24,10 +24,10 @@ module EE
end
def
mirror_was_hard_failed
(
project
)
recipients
=
project
.
members
.
active_without_invites
.
owners_and_masters
recipients
=
project
.
members
.
active_without_invites
_and_requests
.
owners_and_masters
unless
recipients
.
present?
recipients
=
project
.
group
.
members
.
active_without_invites
.
owners_and_masters
if
recipients
.
empty?
&&
project
.
group
recipients
=
project
.
group
.
members
.
active_without_invites
_and_requests
.
owners_and_masters
end
recipients
.
each
do
|
recipient
|
...
...
ee/changelogs/unreleased/5358-hard-failing-mirror-fails-for-personal-project-with-blocked-owners.yml
0 → 100644
View file @
37afc065
---
title
:
Hard failing a mirror no longer fails for a blocked user's personal project
merge_request
:
5063
author
:
type
:
fixed
ee/spec/services/ee/notification_service_spec.rb
View file @
37afc065
...
...
@@ -142,6 +142,34 @@ describe EE::NotificationService, :mailer do
subject
.
mirror_was_hard_failed
(
project
)
end
context
'when owner is blocked'
do
it
'does not send email'
do
project
=
create
(
:project
,
:mirror
,
:import_hard_failed
)
project
.
owner
.
block!
expect
(
Notify
).
not_to
receive
(
:mirror_was_hard_failed_email
)
subject
.
mirror_was_hard_failed
(
project
)
end
context
'when project belongs to group'
do
it
'does not send email to the blocked owner'
do
blocked_user
=
create
(
:user
,
:blocked
)
group
=
create
(
:group
,
:public
)
group
.
add_owner
(
blocked_user
)
group
.
add_owner
(
user
)
project
=
create
(
:project
,
:mirror
,
:import_hard_failed
,
namespace:
group
)
expect
(
Notify
).
not_to
receive
(
:mirror_was_hard_failed_email
).
with
(
project
.
id
,
blocked_user
.
id
).
and_call_original
expect
(
Notify
).
to
receive
(
:mirror_was_hard_failed_email
).
with
(
project
.
id
,
user
.
id
).
and_call_original
subject
.
mirror_was_hard_failed
(
project
)
end
end
end
end
context
'when user is master'
do
...
...
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