diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 816a3f488..e7bfcc48d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -309,16 +309,10 @@ class UsersController < ApplicationController def handle_account_tab community_name = ApplicationConfig["COMMUNITY_NAME"] @email_body = <<~HEREDOC - Hello #{community_name} Team, - %0A - %0A - I would like to delete my account. - %0A%0A - You can keep any comments and discussion posts under the Ghost account. - %0A - %0A + Hello #{community_name} Team,\n + I would like to delete my account.\n + You can keep any comments and discussion posts under the Ghost account.\n Regards, - %0A YOUR-#{community_name}-USERNAME-HERE HEREDOC end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 57c427023..de3ab3ce0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -170,6 +170,13 @@ module ApplicationHelper "#{start_year} - #{current_year}" end + def email_link(type = :default, text: nil, additional_info: nil) + # The allowed types for type is :default, :business, :privacy, and members. + # These options can be found in field :email_addresses of models/site_config.rb + email = SiteConfig.email_addresses[type] || SiteConfig.email_addresses[:default] + mail_to email, text || email, additional_info + end + # Creates an app internal URL # # @note Uses protocol and domain specified in the environment, ensure they are set. diff --git a/app/javascript/packs/articleForm.jsx b/app/javascript/packs/articleForm.jsx index 51a488427..33e287b39 100644 --- a/app/javascript/packs/articleForm.jsx +++ b/app/javascript/packs/articleForm.jsx @@ -2,7 +2,7 @@ import { h, render } from 'preact'; import { getUserDataAndCsrfToken } from '../chat/util'; import ArticleForm from '../article-form/articleForm'; -HTMLDocument.prototype.ready = new Promise(resolve => { +HTMLDocument.prototype.ready = new Promise((resolve) => { if (document.readyState !== 'loading') { return resolve(); } @@ -38,5 +38,3 @@ document.ready.then(() => { } }); }); - - diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index 231b44389..3408e36df 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -7,10 +7,14 @@ class ApplicationMailer < ActionMailer::Base helper ApplicationHelper default( - from: -> { "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>" }, + from: -> { email_from("Community") }, template_path: ->(mailer) { "mailers/#{mailer.class.name.underscore}" }, ) + def email_from(topic) + "#{ApplicationConfig['COMMUNITY_NAME']} #{topic} <#{SiteConfig.email_addresses[:default]}>" + end + def generate_unsubscribe_token(id, email_type) Rails.application.message_verifier(:unsubscribe).generate( user_id: id, diff --git a/app/mailers/digest_mailer.rb b/app/mailers/digest_mailer.rb index 91e5f590f..65676199f 100644 --- a/app/mailers/digest_mailer.rb +++ b/app/mailers/digest_mailer.rb @@ -1,5 +1,5 @@ class DigestMailer < ApplicationMailer - default from: -> { "#{ApplicationConfig['COMMUNITY_NAME']} Digest <#{SiteConfig.email_addresses[:default]}>" } + default from: -> { email_from("Digest") } def digest_email(user, articles) @user = user diff --git a/app/mailers/pro_membership_mailer.rb b/app/mailers/pro_membership_mailer.rb index 159d1ea42..08e4b4008 100644 --- a/app/mailers/pro_membership_mailer.rb +++ b/app/mailers/pro_membership_mailer.rb @@ -1,5 +1,5 @@ class ProMembershipMailer < ApplicationMailer - default from: -> { "#{ApplicationConfig['COMMUNITY_NAME']} Pro Memberships <#{SiteConfig.email_addresses[:default]}>" } + default from: -> { email_from("Pro Memberships") } def expiring_membership(pro_membership, expiration_date) @pro_membership = pro_membership diff --git a/app/views/chat_channel_memberships/edit.html.erb b/app/views/chat_channel_memberships/edit.html.erb index b83fc4836..7e596c2bc 100644 --- a/app/views/chat_channel_memberships/edit.html.erb +++ b/app/views/chat_channel_memberships/edit.html.erb @@ -98,7 +98,7 @@
Questions about Connect Channel moderation? Contact <%= SiteConfig.email_addresses[:default] %>
+Questions about Connect Channel moderation? Contact <%= email_link %>
<% else %>Contact <%= SiteConfig.email_addresses[:business] %> for custom bulk pricing and partnerships.
+Contact <%= email_link(:business, additional_info: { subject: "Custom Bulk Pricing/Partnerships" }) %> for custom bulk pricing and partnerships.
<%= community_name %> Events is a series of ongoing talks and workshops designed to cover important topics to help community members level up. Because we have a global community we will be hosting events at varying times so nobody is restricted by time zone. Additionally, some workshops are repeated multiple times to further account for this.
We have many more planned if you do not see a topic that interests you. Email - <%= SiteConfig.email_addresses[:members] %> to request a topic. And if you're interested in speaking, please + <%= email_link(:members) %> to request a topic. And if you're interested in speaking, please apply to our CFP.
<% @events.each do |event| %> diff --git a/app/views/feedback_messages/index.html.erb b/app/views/feedback_messages/index.html.erb index 684540c5d..c543a323a 100644 --- a/app/views/feedback_messages/index.html.erb +++ b/app/views/feedback_messages/index.html.erb @@ -9,7 +9,7 @@- Questions? Send an email to <%= SiteConfig.email_addresses[:default] %> + Questions? Send an email to <%= email_link %>
diff --git a/app/views/mailers/notify_mailer/account_deleted_email.html.erb b/app/views/mailers/notify_mailer/account_deleted_email.html.erb index f0cea5ba8..ef62413d9 100644 --- a/app/views/mailers/notify_mailer/account_deleted_email.html.erb +++ b/app/views/mailers/notify_mailer/account_deleted_email.html.erb @@ -7,7 +7,7 @@- Contact us at <%= SiteConfig.email_addresses[:default] %> if there is anything more we can help with. π + Contact us at <%= email_link %> if there is anything more we can help with. π
diff --git a/app/views/mailers/notify_mailer/account_deletion_requested_email.html.erb b/app/views/mailers/notify_mailer/account_deletion_requested_email.html.erb index aa1df0d7a..d35112572 100644 --- a/app/views/mailers/notify_mailer/account_deletion_requested_email.html.erb +++ b/app/views/mailers/notify_mailer/account_deletion_requested_email.html.erb @@ -8,7 +8,7 @@
- Contact us at <%= SiteConfig.email_addresses[:default] %> if there is anything more we can help with. π + Contact us at <%= email_link %> if there is anything more we can help with. π
diff --git a/app/views/moderations/index.html.erb b/app/views/moderations/index.html.erb index 19ae9df24..56c562c72 100644 --- a/app/views/moderations/index.html.erb +++ b/app/views/moderations/index.html.erb @@ -85,7 +85,7 @@
We periodically award some <%= community_name %> members with heightened privileges to help moderate the community.
-Email <%= SiteConfig.email_addresses[:default] %> if you'd like to be considered right away.
+Email <%= email_link %> if you'd like to be considered right away.
<% unless user_signed_in? %>P.S. You are not currently signed in.
<% end %> diff --git a/app/views/notifications/_notifications_list.html.erb b/app/views/notifications/_notifications_list.html.erb index a9addee98..c74d4a6f7 100644 --- a/app/views/notifications/_notifications_list.html.erb +++ b/app/views/notifications/_notifications_list.html.erb @@ -14,7 +14,7 @@Violations of the Code of Conduct may be reported by contacting the team via the - ">abuse report form or by sending an email to <%= SiteConfig.email_addresses[:default] %>. All reports will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Further details of specific enforcement policies may be posted separately. + ">abuse report form or by sending an email to <%= email_link %>. All reports will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Further details of specific enforcement policies may be posted separately.
Moderators have the right and responsibility to remove comments or other contributions that are not aligned to this Code of Conduct, or to suspend temporarily or permanently any members for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Users agree and certify that they have rights to share all content that they post on dev.to β including, but not limited to, information posted in articles, discussions, and comments. This rule applies to prose, code snippets, collections of links, etc. Regardless of citation, users may not post copy and pasted content that does not belong to them. Users assume all risk for the content they post, including someone else's reliance on its accuracy, claims relating to intellectual property, or other legal rights. If you believe that a user has plagiarized content, misrepresented their identity, misappropriated work, or otherwise run afoul of DMCA regulations, please email - <%= SiteConfig.email_addresses[:default] %>. <%= community_name %> may remove any content users post for any reason. + <%= email_link %>. <%= community_name %> may remove any content users post for any reason.
- All uses of the <%= community_name %> logo, <%= community_name %> badges, brand slogans, iconography, and the like, may only be used with express permission from <%= community_name %>. <%= community_name %> reserves all rights, even if certain assets are included in <%= community_name %> open source projects. Please contact <%= SiteConfig.email_addresses[:default] %> with any questions or to request permission. + All uses of the <%= community_name %> logo, <%= community_name %> badges, brand slogans, iconography, and the like, may only be used with express permission from <%= community_name %>. <%= community_name %> reserves all rights, even if certain assets are included in <%= community_name %> open source projects. Please contact <%= email_link %> with any questions or to request permission.
- Email: <%= SiteConfig.email_addresses[:default] %> π + Email: <%= email_link %> π
Twitter: ">@<%= SiteConfig.social_media_handles["twitter"] %> π» diff --git a/app/views/pages/privacy.html.erb b/app/views/pages/privacy.html.erb index 6e32e684a..50a8270d8 100644 --- a/app/views/pages/privacy.html.erb +++ b/app/views/pages/privacy.html.erb @@ -164,14 +164,14 @@
Deleting Your Personal Information
- You may request deletion of your personal information and account by emailing <%= SiteConfig.email_addresses[:privacy] %>.
+ You may request deletion of your personal information and account by emailing <%= email_link(:privacy) %>.
To protect information from accidental or malicious destruction, we may maintain residual copies for a brief time period. But, if you delete your account, your information and content will be unrecoverable after that time.
Data Portability
- If you would like to request a copy of your user data, please email <%= SiteConfig.email_addresses[:privacy] %>.
Business Transfers
If we are involved in a merger, acquisition, bankruptcy, reorganization or sale of assets such that your information would be transferred or become subject to a different privacy policy, weβll notify you in advance of any such change.
@@ -182,6 +182,6 @@
Questions
- We welcome feedback about this policy at <%= SiteConfig.email_addresses[:privacy] %>.
If you would like to keep your content under the <%= link_to "@ghost", "/ghost" %> account, - please click here. + please <%= email_link(text: "click here", additional_info: { subject: "Request Account Deletion", body: @email_body }) %>.
<% end %> -Feel free to contact <%= SiteConfig.email_addresses[:default] %> with any questions.
+Feel free to contact <%= email_link %> with any questions.
diff --git a/app/views/users/_publishing_from_rss.html.erb b/app/views/users/_publishing_from_rss.html.erb index 6cf883aeb..d6fb1b9f8 100644 --- a/app/views/users/_publishing_from_rss.html.erb +++ b/app/views/users/_publishing_from_rss.html.erb @@ -22,7 +22,7 @@Your feed will be fetched every time you submit this form and updates will be automatically fetched periodically thereafter. Contact - <%= SiteConfig.email_addresses[:default] %> if you encounter issues. + <%= email_link %> if you encounter issues.
FYI: Medium RSS feed URLs are https://medium.com/feed/@your_username
By submitting your RSS Feed URL, you agree that you own and/or have permission to syndicate the associated content.
diff --git a/app/views/users/confirm_destroy.html.erb b/app/views/users/confirm_destroy.html.erb index a62acf5fc..7c6969e9f 100644 --- a/app/views/users/confirm_destroy.html.erb +++ b/app/views/users/confirm_destroy.html.erb @@ -45,11 +45,11 @@If you would like to keep your content under the <%= link_to "@ghost", "/ghost" %> account, - please click here. + please <%= email_link(text: "click here", additional_info: { subject: "Request Account Deletion", body: @email_body }) %>
- Feel free to contact <%= SiteConfig.email_addresses[:default] %> with any questions. + Feel free to contact <%= email_link %> with any questions.
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index a6a3e834f..faaa9ced6 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -15,7 +15,7 @@ <% if params[:state] == "previous-registration" %> <% end %> diff --git a/app/views/videos/new.html.erb b/app/views/videos/new.html.erb index fe8dbcfcd..7dc0f5f31 100644 --- a/app/views/videos/new.html.erb +++ b/app/views/videos/new.html.erb @@ -33,7 +33,7 @@ <% end %>- Video is beta: Email <%= SiteConfig.email_addresses[:default] %> if you have any problems. + Video is beta: Email <%= email_link %> if you have any problems.
- If you see too many of these, please report it to <%= SiteConfig.email_addresses[:default] %>! + If you see too many of these, please report it to <%= email_link %>!