Skip to content

Commit

Permalink
Subscription emails
Browse files Browse the repository at this point in the history
  • Loading branch information
moughxyz committed Nov 16, 2024
1 parent b62db3f commit 3647586
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ DOMAINS_FOLDER_PATH=
CERTIFICATES_FOLDER_PATH=

# hCaptcha
HCAPTCHA_SECRET_KEY=
HCAPTCHA_SITE_KEY=
HCAPTCHA_SECRET_KEY=0x0000000000000000000000000000000000000000
HCAPTCHA_SITE_KEY=10000000-ffff-ffff-ffff-000000000001

# Domain Events
#SNS_TOPIC_ARN=
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

# Ignore ENV variables config
.env
.env.*
!.env.sample
.ssh

dump.rdb
Expand Down
2 changes: 2 additions & 0 deletions app/mailers/subscription_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def weekly_digest(sub_id)

def new_subscription(subscription)
@author = subscription.author
@subscriber = subscription.subscriber

return if @author.email_verified == false

mail(to: subscription.author.email, subject: "New subscriber to #{subscription.author.title}")
Expand Down
5 changes: 4 additions & 1 deletion app/views/subscription_mailer/new_subscription.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
methods: :verified_subscriptions.as_json(
only: :id
)
)
),
subscriber: @subscriber.as_json(
only: :email
),
}) %>
4 changes: 0 additions & 4 deletions client/app/components/authors/Subscribe.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ const Subscribe = ({
{(!subscribedToAuthor || !subscriptionForAuthor.verification_sent_at) && (
<p className="p1">
You&apos;ll only receive email when the author publishes something new.
{" "}
{ displayAuthor.title }
{" "}
will not be able to see your email.
</p>
)}
<div id="subscription-form">
Expand Down
17 changes: 7 additions & 10 deletions client/app/components/subscription_mailer/NewSubscription.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import PropTypes from "prop-types";
import React from "react";

const NewSubscription = ({ author }) => (
const NewSubscription = ({ author, subscriber }) => (
<div>
<p>
Good news! Someone just subscribed to your blog.
They&apos;ll automatically be notified every time you publish a new post.
</p>
<p>
You now have
{" "}
{author.verified_subscriptions.length}
{" "}
subscriber(s). Keep up the good work!
Good news! {subscriber.email} just subscribed to your blog. They&apos;ll automatically be notified every
time you publish a new post.
</p>
<p>You now have {author.verified_subscriptions.length} subscriber(s). Keep up the good work!</p>
</div>
);

Expand All @@ -25,6 +19,9 @@ NewSubscription.propTypes = {
}),
).isRequired,
}).isRequired,
subscriber: PropTypes.shape({
email: PropTypes.string.isRequired,
}).isRequired,
};

export default NewSubscription;
4 changes: 2 additions & 2 deletions db/migrate/20181201104051_create_simple_captcha_data.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class CreateSimpleCaptchaData < ActiveRecord::Migration
class CreateSimpleCaptchaData < ActiveRecord::Migration[5.0]
def self.up
create_table :simple_captcha_data do |t|
t.string :key, :limit => 40
t.string :value, :limit => 6
t.timestamps
end

add_index :simple_captcha_data, :key, :name => "idx_key"
end

Expand Down

0 comments on commit 3647586

Please sign in to comment.