BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
16bcc550
Commit
16bcc550
authored
Mar 15, 2017
by
Robert Speicher
Committed by
DJ Mountney
Mar 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge branch '8836-mr-revert' into 'master'
Revert "Merge branch 'option-to-be-notified-of-own-activity' into 'master' See merge request !9974
parent
509282f4
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
6 additions
and
168 deletions
+6
-168
profile.js
app/assets/javascripts/profile/profile.js
+0
-1
notifications_controller.rb
app/controllers/profiles/notifications_controller.rb
+1
-1
notification_service.rb
app/services/notification_service.rb
+5
-6
show.html.haml
app/views/profiles/notifications/show.html.haml
+0
-5
option-to-be-notified-of-own-activity.yml
...logs/unreleased/option-to-be-notified-of-own-activity.yml
+0
-4
20170123061730_add_notified_of_own_activity_to_users.rb
...e/20170123061730_add_notified_of_own_activity_to_users.rb
+0
-14
schema.rb
db/schema.rb
+0
-1
notifications_controller_spec.rb
spec/controllers/profiles/notifications_controller_spec.rb
+0
-45
user_changes_notified_of_own_activity_spec.rb
...es/profiles/user_changes_notified_of_own_activity_spec.rb
+0
-32
notification_service_spec.rb
spec/services/notification_service_spec.rb
+0
-59
No files found.
app/assets/javascripts/profile/profile.js
View file @
16bcc550
...
...
@@ -25,7 +25,6 @@
bindEvents
()
{
$
(
'.js-preferences-form'
).
on
(
'change.preference'
,
'input[type=radio]'
,
this
.
submitForm
);
$
(
'#user_notification_email'
).
on
(
'change'
,
this
.
submitForm
);
$
(
'#user_notified_of_own_activity'
).
on
(
'change'
,
this
.
submitForm
);
$
(
'.update-username'
).
on
(
'ajax:before'
,
this
.
beforeUpdateUsername
);
$
(
'.update-username'
).
on
(
'ajax:complete'
,
this
.
afterUpdateUsername
);
$
(
'.update-notifications'
).
on
(
'ajax:success'
,
this
.
onUpdateNotifs
);
...
...
app/controllers/profiles/notifications_controller.rb
View file @
16bcc550
...
...
@@ -17,6 +17,6 @@ class Profiles::NotificationsController < Profiles::ApplicationController
end
def
user_params
params
.
require
(
:user
).
permit
(
:notification_email
,
:notified_of_own_activity
)
params
.
require
(
:user
).
permit
(
:notification_email
)
end
end
app/services/notification_service.rb
View file @
16bcc550
...
...
@@ -217,7 +217,7 @@ class NotificationService
recipients
=
reject_unsubscribed_users
(
recipients
,
note
.
noteable
)
recipients
=
reject_users_without_access
(
recipients
,
note
.
noteable
)
recipients
.
delete
(
note
.
author
)
unless
note
.
author
.
notified_of_own_activity?
recipients
.
delete
(
note
.
author
)
recipients
=
recipients
.
uniq
notify_method
=
"note_
#{
note
.
to_ability_name
}
_email"
.
to_sym
...
...
@@ -327,9 +327,8 @@ class NotificationService
recipients
||=
build_recipients
(
pipeline
,
pipeline
.
project
,
pipeline
.
user
,
action:
pipeline
.
status
,
skip_current_user:
false
).
map
(
&
:notification_email
)
nil
,
# The acting user, who won't be added to recipients
action:
pipeline
.
status
).
map
(
&
:notification_email
)
if
recipients
.
any?
mailer
.
public_send
(
email_template
,
pipeline
,
recipients
).
deliver_later
...
...
@@ -628,7 +627,7 @@ class NotificationService
recipients
=
reject_unsubscribed_users
(
recipients
,
target
)
recipients
=
reject_users_without_access
(
recipients
,
target
)
recipients
.
delete
(
current_user
)
if
skip_current_user
&&
!
current_user
.
notified_of_own_activity?
recipients
.
delete
(
current_user
)
if
skip_current_user
recipients
.
uniq
end
...
...
@@ -637,7 +636,7 @@ class NotificationService
recipients
=
add_labels_subscribers
([],
project
,
target
,
labels:
labels
)
recipients
=
reject_unsubscribed_users
(
recipients
,
target
)
recipients
=
reject_users_without_access
(
recipients
,
target
)
recipients
.
delete
(
current_user
)
unless
current_user
.
notified_of_own_activity?
recipients
.
delete
(
current_user
)
recipients
.
uniq
end
...
...
app/views/profiles/notifications/show.html.haml
View file @
16bcc550
...
...
@@ -34,11 +34,6 @@
.clearfix
=
form_for
@user
,
url:
profile_notifications_path
,
method: :put
do
|
f
|
%label
{
for:
'user_notified_of_own_activity'
}
=
f
.
check_box
:notified_of_own_activity
%span
Receive notifications about your own activity
%hr
%h5
Groups (
#{
@group_notifications
.
count
}
)
...
...
changelogs/unreleased/option-to-be-notified-of-own-activity.yml
deleted
100644 → 0
View file @
509282f4
---
title
:
Add option to receive email notifications about your own activity
merge_request
:
8836
author
:
Richard Macklin
db/migrate/20170123061730_add_notified_of_own_activity_to_users.rb
deleted
100644 → 0
View file @
509282f4
class
AddNotifiedOfOwnActivityToUsers
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
disable_ddl_transaction!
DOWNTIME
=
false
def
up
add_column_with_default
:users
,
:notified_of_own_activity
,
:boolean
,
default:
false
end
def
down
remove_column
:users
,
:notified_of_own_activity
end
end
db/schema.rb
View file @
16bcc550
...
...
@@ -1318,7 +1318,6 @@ ActiveRecord::Schema.define(version: 20170306170512) do
t
.
string
"incoming_email_token"
t
.
string
"organization"
t
.
boolean
"authorized_projects_populated"
t
.
boolean
"notified_of_own_activity"
,
default:
false
,
null:
false
t
.
boolean
"ghost"
end
...
...
spec/controllers/profiles/notifications_controller_spec.rb
deleted
100644 → 0
View file @
509282f4
require
'spec_helper'
describe
Profiles
::
NotificationsController
do
let
(
:user
)
do
create
(
:user
)
do
|
user
|
user
.
emails
.
create
(
email:
'original@example.com'
)
user
.
emails
.
create
(
email:
'new@example.com'
)
user
.
update
(
notification_email:
'original@example.com'
)
user
.
save!
end
end
describe
'GET show'
do
it
'renders'
do
sign_in
(
user
)
get
:show
expect
(
response
).
to
render_template
:show
end
end
describe
'POST update'
do
it
'updates only permitted attributes'
do
sign_in
(
user
)
put
:update
,
user:
{
notification_email:
'new@example.com'
,
notified_of_own_activity:
true
,
admin:
true
}
user
.
reload
expect
(
user
.
notification_email
).
to
eq
(
'new@example.com'
)
expect
(
user
.
notified_of_own_activity
).
to
eq
(
true
)
expect
(
user
.
admin
).
to
eq
(
false
)
expect
(
controller
).
to
set_flash
[
:notice
].
to
(
'Notification settings saved'
)
end
it
'shows an error message if the params are invalid'
do
sign_in
(
user
)
put
:update
,
user:
{
notification_email:
''
}
expect
(
user
.
reload
.
notification_email
).
to
eq
(
'original@example.com'
)
expect
(
controller
).
to
set_flash
[
:alert
].
to
(
'Failed to save new settings'
)
end
end
end
spec/features/profiles/user_changes_notified_of_own_activity_spec.rb
deleted
100644 → 0
View file @
509282f4
require
'spec_helper'
feature
'Profile > Notifications > User changes notified_of_own_activity setting'
,
feature:
true
,
js:
true
do
let
(
:user
)
{
create
(
:user
)
}
before
do
login_as
(
user
)
end
scenario
'User opts into receiving notifications about their own activity'
do
visit
profile_notifications_path
expect
(
page
).
not_to
have_checked_field
(
'user[notified_of_own_activity]'
)
check
'user[notified_of_own_activity]'
expect
(
page
).
to
have_content
(
'Notification settings saved'
)
expect
(
page
).
to
have_checked_field
(
'user[notified_of_own_activity]'
)
end
scenario
'User opts out of receiving notifications about their own activity'
do
user
.
update!
(
notified_of_own_activity:
true
)
visit
profile_notifications_path
expect
(
page
).
to
have_checked_field
(
'user[notified_of_own_activity]'
)
uncheck
'user[notified_of_own_activity]'
expect
(
page
).
to
have_content
(
'Notification settings saved'
)
expect
(
page
).
not_to
have_checked_field
(
'user[notified_of_own_activity]'
)
end
end
spec/services/notification_service_spec.rb
View file @
16bcc550
...
...
@@ -146,16 +146,6 @@ describe NotificationService, services: true do
should_not_email
(
@u_lazy_participant
)
end
it
"emails the note author if they've opted into notifications about their activity"
do
add_users_with_subscription
(
note
.
project
,
issue
)
note
.
author
.
notified_of_own_activity
=
true
reset_delivered_emails!
notification
.
new_note
(
note
)
should_email
(
note
.
author
)
end
it
'filters out "mentioned in" notes'
do
mentioned_note
=
SystemNoteService
.
cross_reference
(
mentioned_issue
,
issue
,
issue
.
author
)
...
...
@@ -486,20 +476,6 @@ describe NotificationService, services: true do
should_not_email
(
issue
.
assignee
)
end
it
"emails the author if they've opted into notifications about their activity"
do
issue
.
author
.
notified_of_own_activity
=
true
notification
.
new_issue
(
issue
,
issue
.
author
)
should_email
(
issue
.
author
)
end
it
"doesn't email the author if they haven't opted into notifications about their activity"
do
notification
.
new_issue
(
issue
,
issue
.
author
)
should_not_email
(
issue
.
author
)
end
it
"emails subscribers of the issue's labels"
do
user_1
=
create
(
:user
)
user_2
=
create
(
:user
)
...
...
@@ -689,19 +665,6 @@ describe NotificationService, services: true do
should_email
(
subscriber_to_label_2
)
end
it
"emails the current user if they've opted into notifications about their activity"
do
subscriber_to_label_2
.
notified_of_own_activity
=
true
notification
.
relabeled_issue
(
issue
,
[
group_label_2
,
label_2
],
subscriber_to_label_2
)
should_email
(
subscriber_to_label_2
)
end
it
"doesn't email the current user if they haven't opted into notifications about their activity"
do
notification
.
relabeled_issue
(
issue
,
[
group_label_2
,
label_2
],
subscriber_to_label_2
)
should_not_email
(
subscriber_to_label_2
)
end
it
"doesn't send email to anyone but subscribers of the given labels"
do
notification
.
relabeled_issue
(
issue
,
[
group_label_2
,
label_2
],
@u_disabled
)
...
...
@@ -855,20 +818,6 @@ describe NotificationService, services: true do
should_not_email
(
@u_lazy_participant
)
end
it
"emails the author if they've opted into notifications about their activity"
do
merge_request
.
author
.
notified_of_own_activity
=
true
notification
.
new_merge_request
(
merge_request
,
merge_request
.
author
)
should_email
(
merge_request
.
author
)
end
it
"doesn't email the author if they haven't opted into notifications about their activity"
do
notification
.
new_merge_request
(
merge_request
,
merge_request
.
author
)
should_not_email
(
merge_request
.
author
)
end
it
"emails subscribers of the merge request's labels"
do
user_1
=
create
(
:user
)
user_2
=
create
(
:user
)
...
...
@@ -1064,14 +1013,6 @@ describe NotificationService, services: true do
should_not_email
(
@u_watcher
)
end
it
"notifies the merger when the pipeline succeeds is false but they've opted into notifications about their activity"
do
merge_request
.
merge_when_pipeline_succeeds
=
false
@u_watcher
.
notified_of_own_activity
=
true
notification
.
merge_mr
(
merge_request
,
@u_watcher
)
should_email
(
@u_watcher
)
end
it_behaves_like
'participating notifications'
do
let
(
:participant
)
{
create
(
:user
,
username:
'user-participant'
)
}
let
(
:issuable
)
{
merge_request
}
...
...
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