Update unsubscribed page's copy and css (#199)
* Update unsubscribed page's copy and css * Create view spec for email_subscriptions/unsubscribe * Update unsubscribed's page copy * Prevent search-engine crawlers
This commit is contained in:
parent
0ea3f38dbf
commit
84122959bf
5 changed files with 47 additions and 6 deletions
|
|
@ -1,20 +1,21 @@
|
|||
.unsubscribed {
|
||||
background: #66e2d5;
|
||||
color: white;
|
||||
color: #0c3d38;
|
||||
margin: 100px auto;
|
||||
padding: 40px 10px;
|
||||
|
||||
@media screen and (min-width: 550px) {
|
||||
@media screen and (min-width: 645px) {
|
||||
margin: 100px auto;
|
||||
width: 450px;
|
||||
width: 565px;
|
||||
padding: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.unsubscribed__title {
|
||||
font-weight: 600;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.unsubscribed__message {
|
||||
font-weight: 300;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,22 @@ class EmailSubscriptionsController < ApplicationController
|
|||
if verified_params[:expires_at] > Time.now
|
||||
user = User.find(verified_params[:user_id])
|
||||
user.update(verified_params[:email_type] => false)
|
||||
@email_type = preferred_email_name(verified_params[:email_type])
|
||||
else
|
||||
not_found
|
||||
end
|
||||
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
||||
not_found
|
||||
end
|
||||
|
||||
def preferred_email_name(given_email_type)
|
||||
emails_type = {
|
||||
email_digest_periodic: "DEV digest emails",
|
||||
email_comment_notifications: "comment notifications",
|
||||
email_follower_notifications: "follower notifications",
|
||||
email_mention_notifications: "mention notifications",
|
||||
email_unread_notifications: "unread notifications",
|
||||
}
|
||||
emails_type[given_email_type]
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
<meta name="robots" content="noindex" />
|
||||
<div class="unsubscribed">
|
||||
<div class="unsubscribed__title">
|
||||
You have been successfully unsubscribed. 😔
|
||||
You have been unsubscribed from <%= @email_type %>. 😔
|
||||
</div>
|
||||
<br/>
|
||||
<div class="unsubscribed__message">
|
||||
If that was a mistake or you would like to update other email preferences,
|
||||
You will no longer receive emails like this. If you'd like to re-subscribe or manage your full email preferences, please
|
||||
<a href="https://dev.to/settings/notifications">click here</a>.
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="robots" content="noindex" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="unsubscribed">
|
||||
<div class="unsubscribed__title">
|
||||
You have been unsubscribed from DEV digest emails. 😔
|
||||
</div>
|
||||
<br /><div class="unsubscribed__message">
|
||||
You will no longer receive emails like this. If you'd like to re-subscribe or manage your full email preferences, please
|
||||
<a href="https://dev.to/settings/notifications">click here</a>.
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe "email_subscriptions/unsubscribe.html.erb", type: :view do
|
||||
it "works" do
|
||||
assign(:email_type, "DEV digest emails")
|
||||
render
|
||||
Approvals.verify(rendered, name: "email_subscriptions/unsubscribe", format: :html)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue