Consolidate GroupMember and ProjectMember notification hooks
This work forms part of our effort to remove duplication of code between GroupMember
and ProjectMember
as we consolidate to a single Member
class.
Both GroupMember
and ProjectMember
have a collection of hook processes. A lot of this code is geared towards producing notifications. E.g.
# ProjectMember
183 def after_decline_invite
184 notification_service.decline_project_invite(self)
185
186 super
187 end
# GroupMember
115 def after_decline_invite
116 notification_service.decline_group_invite(self)
117
118 super
119 end
The only difference in the methods call examples above are the calls to notification_service.decline_*_invite(self)
. notification_service
is itself in Member
and calls NotificationService.new
. In these cases we should push the group/project logic down to the notification service itself, which will later need to be also consolidated. E.g.
class NotificationService
def decline_invite(source)
case source
when Group
decline_group_invite(source)
when Project
decline_project_invite(source)
end
end
...
end
With this in place we can move notification hooks to Member
.
Plan
-
send_invite
callback - !140262 (merged) -
post_update_hook
callback - !140390 (merged) -
post_create_hook
callback - !140267 (merged) -
after_accept_invite
hook - !140586 (merged)
Possible Follow-up: Break Members initial invite emails out into th... (!140511 - merged)