Commit Graph

22 Commits

Author SHA1 Message Date
gfyoung 50abbd3e53 Enable frozen string in app/models/*.rb
Partially addresses #47424.
2018-07-26 16:55:41 -07:00
Sean McGivern 6e614bd5e0 Merge branch 'issue_44230' into 'master'
Apply notification settings level of groups to all child objects

Closes #44230

See merge request gitlab-org/gitlab-ce!19191
2018-06-07 20:10:45 +00:00
Felipe Artur afe5d7d56e Apply notification settings level of groups to all child objects 2018-06-07 15:47:39 -03:00
Sean McGivern 0206476ae2 Fix some N+1s when calculating notification recipients
First N+1: we may have loaded a user's notification settings already, but not
have loaded their sources. Because we're iterating through, we'd potentially
load sources that are completely unrelated, just because they belong to this
user.

Second N+1: we do a separate query for each user who could be subscribed to or
unsubcribed from the target. It's actually more efficient in this case to get
all subscriptions at once, as we will need to check most of them.

We can fix both by the slightly unpleasant means of checking IDs manually,
rather than object equality.
2018-06-07 12:37:57 +01:00
🙈 jacopo beschi 🙉 c6b1043e9d Resolve "Make a Rubocop that forbids returning from a block" 2018-04-18 09:19:40 +00:00
YarNayar 99b01e2359 Send notification emails when push to a merge request
Closes #23460
2018-03-26 13:24:52 +01:00
Mario de la Ossa 4cb3b71d9d
Always notify new mentions even if explicitly unsubscribed 2018-03-19 12:13:03 -06:00
Bob Van Landuyt 148816cd67 Port `read_cross_project` ability from EE 2018-02-22 17:11:36 +01:00
Mario de la Ossa 23a20c20f8
Initial work to add notification reason to emails
Adds `#build_notification_recipients` to `NotificationRecipientService`
that returns the `NotificationRecipient` objects in order to be able to
access the new attribute `reason`.

This new attribute is used in the different notifier methods in order to
add the reason as a header: `X-GitLab-NotificationReason`.

Only the reason with the most priority gets sent.
2018-01-16 19:17:55 -06:00
🙈 jacopo beschi 🙉 729f05f0e3 Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +00:00
http://jneen.net/ 3676275a5a don't rely on order of notification levels
factor out #suitable_notification_level? and check manually by
notification level. this makes the notification logic clear and actually
reflect what is in the documentation as to what should happen with each
setting.
2017-08-21 15:34:25 -07:00
http://jneen.net/ 38737345ab skip the :read_project check for new_project_member
since we're just adding them as a member, the permission may still
return false.
2017-08-11 16:02:08 -07:00
http://jneen.net/ 7e7f602d29 make NotificationRecipient a little more customizable 2017-08-11 16:02:01 -07:00
http://jneen.net/ eaa503d679 move the read_ability logic into NotificationRecipient 2017-08-03 09:07:18 -07:00
http://jneen.net/ e5496e1e8e use the accessor for `type` 2017-08-03 09:07:18 -07:00
http://jneen.net/ 4af2c64713 fix comment 2017-08-03 09:07:18 -07:00
http://jneen.net/ 444c858449 use safe navigation on notification_setting 2017-08-03 09:07:18 -07:00
http://jneen.net/ c2dd4239c9 short-circuit if there is no policy, and add :read_project check 2017-08-03 09:07:18 -07:00
http://jneen.net/ 18288fe21e style fixes 2017-08-03 09:07:18 -07:00
http://jneen.net/ e7d136ebda don't require project
it's not there in the case of personal snippets, f. ex., and we've
already guarded against its being missing in #find_notification_setting
2017-08-03 09:07:18 -07:00
http://jneen.net/ 19309b9705 default the project to target.project 2017-08-03 09:07:18 -07:00
http://jneen.net/ 618a3d125c move Recipient to its own NotificationRecipient file 2017-08-03 09:07:18 -07:00