class InvitationMailer < ApplicationMailer
  def invite(user, approved_entry: nil)
    @user = user
    @approved_entry = approved_entry
    @invitation_url = invitation_url(@user.invitation_token)
    @expires_at = @user.invitation_sent_at + User::INVITATION_TOKEN_EXPIRY

    subject = if @approved_entry
      "Your entry request has been approved - Join Sanasto Wiki"
    else
      "You've been invited to join Sanasto Wiki"
    end

    mail(
      to: @user.email,
      subject: subject
    )
  end
end
