2020-07-03 05:08:53 -04:00
# frozen_string_literal: true
module NotifyHelper
def merge_request_reference_link ( entity , * args )
link_to ( entity . to_reference , merge_request_url ( entity , * args ) )
end
2020-12-04 07:09:39 -05:00
def issue_reference_link ( entity , * args , full : false )
link_to ( entity . to_reference ( full : full ) , issue_url ( entity , * args ) )
2020-07-03 05:08:53 -04:00
end
2021-02-12 16:09:01 -05:00
def invited_to_description ( source )
2021-06-15 11:10:04 -04:00
default_description =
case source
when Project
s_ ( 'InviteEmail|Projects are used to host and collaborate on code, track issues, and continuously build, test, and deploy your app with built-in GitLab CI/CD.' )
when Group
s_ ( 'InviteEmail|Groups assemble related projects together and grant members access to several projects at once.' )
end
( source . description || default_description ) . truncate ( 200 , separator : ' ' )
2021-02-12 16:09:01 -05:00
end
2021-08-19 08:08:53 -04:00
def invited_join_url ( token , member )
additional_params = { invite_type : Emails :: Members :: INITIAL_INVITE }
2021-12-06 10:14:39 -05:00
if experiment ( :invite_email_preview_text , actor : member ) . enabled?
2021-08-19 08:08:53 -04:00
additional_params [ :experiment_name ] = 'invite_email_preview_text'
end
invite_url ( token , additional_params )
end
2020-07-03 05:08:53 -04:00
end