No commit activity in last 3 years
No release in over 3 years
Some of your users don't want to hear from you or your shitty application. You can add unsubscribe links to your mail views so that your users can relieve themselves of the pain you have endured on them.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

tl;dr

Build Status Coverage Status Code Climate

Enable unsubscribe links within your emails

Description

Some of your users don't want to hear from you or your shitty application. You can add unsubscribe links to your mail views so that your users can relieve themselves of the pain you have endured on them.

Installation

# Gemfile
gem 'toolong-dontread'
rails g tldr:install

rake db:migrate

Usage

Inside your mailer you can generate an uninstall url.

class AccountMailer < ActionMailer::Base
  def new_follower_notification(user, follower)
    ...
    token = Tldr::TokenGenerator.new(user, :new_follower_notification).token
    @unsubscribe_url = unsubscribe_url(token)
    ...
  end
end

Inside your model to test if someone is subscribed

  class User < ActiveRecord::Base
    include Tldr::Subscriber
  end

  # elsewhere
  user = User.find params[:id]
  user.subscribed_to? :new_follower_notification

Inside your controller if you are using Rails

class AccountsController < ApplicationController
  def unsubscribe
    subscription = Tldr.unsubscribe params[:token]
    redirect_to dashboard_path(subscription.values[:user]), notice: 'You have successfully been unsubscribed from that stupid ass email'
  end
end

Pushing a new gem

  1. Bump the version number in tldr\lib\version.rb
  2. gem build tldr.gemspec
  3. gem push toolong-dontread-<version-number>.gem
  4. git tag -a gem-<version-number> -m "gem version <version-number>
  5. git push origin --tags

Contributing

  1. Clone the repository git clone https://github.com/brilliantfantastic/tldr
  2. Create a feature branch git checkout -b my-awesome-feature
  3. Codez!
  4. Commit your changes (small commits please)
  5. Push your new branch git push origin my-awesome-feature
  6. Create a pull request hub pull-request -b brilliantfantastic:master -h brilliantfantastic:my-awesome-feature