lib/mailkick/url_helper.rb in mailkick-0.4.3 vs lib/mailkick/url_helper.rb in mailkick-1.0.0
- old
+ new
@@ -1,15 +1,8 @@
module Mailkick
module UrlHelper
- def mailkick_unsubscribe_url(email: nil, user: nil, list: nil, **options)
- email ||= controller.try(:message).try(:to).try(:first)
-
- Mailkick::Engine.routes.url_helpers.url_for(
- (ActionMailer::Base.default_url_options || {}).merge(options).merge(
- controller: "mailkick/subscriptions",
- action: "unsubscribe",
- id: Mailkick.generate_token(email, user: user, list: list)
- )
- )
+ def mailkick_unsubscribe_url(subscriber, list, **options)
+ token = Mailkick.generate_token(subscriber, list)
+ mailkick.unsubscribe_subscription_url(token, **options)
end
end
end