[deploy] Add community_name to site config (#9864)
* Add community_name to site config * Fix a spec * Remove SiteConfig from constants * Change subjects to method * Fix subjects method * Fix linting
This commit is contained in:
parent
1af5e7d9f2
commit
6c71369df5
38 changed files with 114 additions and 87 deletions
|
|
@ -93,6 +93,7 @@ module Admin
|
|||
|
||||
def community_params
|
||||
%i[
|
||||
community_name
|
||||
community_description
|
||||
community_member_label
|
||||
community_action
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module Admin
|
|||
tags: welcome
|
||||
---
|
||||
|
||||
Hey there! Welcome to #{ApplicationConfig['COMMUNITY_NAME']}!
|
||||
Hey there! Welcome to #{SiteConfig.community_name}!
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ module VerifySetupCompleted
|
|||
module_function
|
||||
|
||||
MANDATORY_CONFIGS = %i[
|
||||
community_name
|
||||
community_description
|
||||
community_action
|
||||
tagline
|
||||
|
|
|
|||
|
|
@ -1,25 +1,27 @@
|
|||
class EmailSubscriptionsController < ApplicationController
|
||||
PREFERRED_EMAIL_NAME = {
|
||||
email_digest_periodic: "#{ApplicationConfig['COMMUNITY_NAME']} digest emails",
|
||||
email_comment_notifications: "comment notifications",
|
||||
email_follower_notifications: "follower notifications",
|
||||
email_mention_notifications: "mention notifications",
|
||||
email_connect_messages: "#{ApplicationConfig['COMMUNITY_NAME']} connect messages",
|
||||
email_unread_notifications: "unread notifications",
|
||||
email_badge_notifications: "badge notifications"
|
||||
}.freeze
|
||||
|
||||
def unsubscribe
|
||||
verified_params = Rails.application.message_verifier(:unsubscribe).verify(params[:ut])
|
||||
|
||||
if verified_params[:expires_at] > Time.current
|
||||
user = User.find(verified_params[:user_id])
|
||||
user.update(verified_params[:email_type] => false)
|
||||
@email_type = PREFERRED_EMAIL_NAME.fetch(verified_params[:email_type], "this list")
|
||||
@email_type = preferred_email_name.fetch(verified_params[:email_type], "this list")
|
||||
else
|
||||
render "invalid_token"
|
||||
end
|
||||
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
||||
not_found
|
||||
end
|
||||
|
||||
def preferred_email_name
|
||||
{
|
||||
email_digest_periodic: "#{SiteConfig.community_name} digest emails",
|
||||
email_comment_notifications: "comment notifications",
|
||||
email_follower_notifications: "follower notifications",
|
||||
email_mention_notifications: "mention notifications",
|
||||
email_connect_messages: "#{SiteConfig.community_name} connect messages",
|
||||
email_unread_notifications: "unread notifications",
|
||||
email_badge_notifications: "badge notifications"
|
||||
}.freeze
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ class StoriesController < ApplicationController
|
|||
"publisher": {
|
||||
"@context": "http://schema.org",
|
||||
"@type": "Organization",
|
||||
"name": "#{ApplicationConfig['COMMUNITY_NAME']} Community",
|
||||
"name": "#{SiteConfig.community_name} Community",
|
||||
"logo": {
|
||||
"@context": "http://schema.org",
|
||||
"@type": "ImageObject",
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def handle_account_tab
|
||||
community_name = ApplicationConfig["COMMUNITY_NAME"]
|
||||
community_name = SiteConfig.community_name
|
||||
@email_body = <<~HEREDOC
|
||||
Hello #{community_name} Team,\n
|
||||
I would like to delete my account.\n
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def community_name
|
||||
@community_name ||= ApplicationConfig["COMMUNITY_NAME"] # rubocop:disable Rails/HelperInstanceVariable
|
||||
@community_name ||= SiteConfig.community_name # rubocop:disable Rails/HelperInstanceVariable
|
||||
end
|
||||
|
||||
def community_qualified_name
|
||||
|
|
|
|||
|
|
@ -3,43 +3,43 @@ module FeedbackMessagesHelper
|
|||
body = <<~HEREDOC
|
||||
Hello,
|
||||
|
||||
It has been brought to our attention that you have violated the #{ApplicationConfig['COMMUNITY_NAME']} Code of Conduct and/or Terms of Use.
|
||||
It has been brought to our attention that you have violated the #{SiteConfig.community_name} Code of Conduct and/or Terms of Use.
|
||||
|
||||
If this behavior continues, we may need to suspend your #{ApplicationConfig['COMMUNITY_NAME']} account.
|
||||
If this behavior continues, we may need to suspend your #{SiteConfig.community_name} account.
|
||||
|
||||
If you think that there's been a mistake, please reply to this email and we will take another look.
|
||||
|
||||
#{ApplicationConfig['COMMUNITY_NAME']} Team
|
||||
#{SiteConfig.community_name} Team
|
||||
HEREDOC
|
||||
|
||||
{ subject: "#{ApplicationConfig['COMMUNITY_NAME']} Code of Conduct Violation", body: body }.freeze
|
||||
{ subject: "#{SiteConfig.community_name} Code of Conduct Violation", body: body }.freeze
|
||||
end
|
||||
|
||||
def reporter_email_details
|
||||
body = <<~HEREDOC
|
||||
Hi there,
|
||||
|
||||
Thank you for flagging content that may be in violation of the #{ApplicationConfig['COMMUNITY_NAME']} Code of Conduct and/or our Terms of Use. We are looking into your report and will take appropriate action.
|
||||
Thank you for flagging content that may be in violation of the #{SiteConfig.community_name} Code of Conduct and/or our Terms of Use. We are looking into your report and will take appropriate action.
|
||||
|
||||
We appreciate your help as we work to foster a positive and inclusive environment for all!
|
||||
|
||||
#{ApplicationConfig['COMMUNITY_NAME']} Team
|
||||
#{SiteConfig.community_name} Team
|
||||
HEREDOC
|
||||
|
||||
{ subject: "#{ApplicationConfig['COMMUNITY_NAME']} Report", body: body }.freeze
|
||||
{ subject: "#{SiteConfig.community_name} Report", body: body }.freeze
|
||||
end
|
||||
|
||||
def affected_email_details
|
||||
body = <<~HEREDOC
|
||||
Hi there,
|
||||
|
||||
We noticed some comments (made by others) on your post that violate the #{ApplicationConfig['COMMUNITY_NAME']} Code of Conduct and/or our Terms of Use. We have zero tolerance for such behavior and are taking appropriate action.
|
||||
We noticed some comments (made by others) on your post that violate the #{SiteConfig.community_name} Code of Conduct and/or our Terms of Use. We have zero tolerance for such behavior and are taking appropriate action.
|
||||
|
||||
Thanks for being awesome, and please don't hesitate to email us with any questions! We welcome all feedback and ideas as we continue working to foster an open and inclusive community.
|
||||
|
||||
#{ApplicationConfig['COMMUNITY_NAME']} Team
|
||||
#{SiteConfig.community_name} Team
|
||||
HEREDOC
|
||||
|
||||
{ subject: "Courtesy Notice from #{ApplicationConfig['COMMUNITY_NAME']}", body: body }.freeze
|
||||
{ subject: "Courtesy Notice from #{SiteConfig.community_name}", body: body }.freeze
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ module BadgeRewarder
|
|||
REPOSITORIES = ["thepracticaldev/dev.to", "thepracticaldev/DEV-ios", "thepracticaldev/DEV-Android"].freeze
|
||||
|
||||
LONGEST_STREAK_WEEKS = 16
|
||||
LONGEST_STREAK_MESSAGE = "16 weeks! You've achieved the longest #{ApplicationConfig['COMMUNITY_NAME']} writing " \
|
||||
LONGEST_STREAK_MESSAGE = "16 weeks! You've achieved the longest writing " \
|
||||
"streak possible. This makes you eligible for special quests in the future. Keep up the amazing contributions to" \
|
||||
" our community!".freeze
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ module BadgeRewarder
|
|||
def self.award_yearly_club_badges
|
||||
total_years = Time.current.year - SiteConfig.community_copyright_start_year.to_i
|
||||
(1..total_years).each do |i|
|
||||
message = "Happy #{ApplicationConfig['COMMUNITY_NAME']} birthday! " \
|
||||
message = "Happy #{SiteConfig.community_name} birthday! " \
|
||||
"Can you believe it's been #{i} #{'year'.pluralize(i)} already?!"
|
||||
badge = Badge.find_by!(slug: "#{YEARS[i]}-year-club")
|
||||
User.registered.where("created_at < ? AND created_at > ?", i.year.ago, i.year.ago - 2.days).find_each do |user|
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ module Constants
|
|||
description: "Used in meta description tags etc.",
|
||||
placeholder: "A fabulous community of kind and welcoming people."
|
||||
},
|
||||
community_name: {
|
||||
description: "Primary name... e.g. DEV",
|
||||
placeholder: "New Forem"
|
||||
},
|
||||
community_member_label: {
|
||||
description: "Used to determine what a member will be called e.g developer, hobbyist etc.",
|
||||
placeholder: "user"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class RedditTag < LiquidTagBase
|
|||
|
||||
# Requests to Reddit require a custom `User-Agent` header to prevent 429 errors
|
||||
json = HTTParty.get("#{@url}.json",
|
||||
headers: { "User-Agent" => "#{ApplicationConfig['COMMUNITY_NAME']} (#{URL.url})" })
|
||||
headers: { "User-Agent" => "#{SiteConfig.community_name} (#{URL.url})" })
|
||||
|
||||
# The JSON response is an array with two items.
|
||||
# The first one is the post itself, the second one are the comments
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class ApplicationMailer < ActionMailer::Base
|
|||
)
|
||||
|
||||
def email_from(topic)
|
||||
"#{ApplicationConfig['COMMUNITY_NAME']} #{topic} <#{SiteConfig.email_addresses[:default]}>"
|
||||
"#{SiteConfig.community_name} #{topic} <#{SiteConfig.email_addresses[:default]}>"
|
||||
end
|
||||
|
||||
def generate_unsubscribe_token(id, email_type)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class DigestMailer < ApplicationMailer
|
|||
end
|
||||
|
||||
def email_end_phrase
|
||||
community_name = ApplicationConfig["COMMUNITY_NAME"]
|
||||
community_name = SiteConfig.community_name
|
||||
# "more trending posts" won the previous split test
|
||||
# Included more often as per explore-exploit algorithm
|
||||
[
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
class NotifyMailer < ApplicationMailer
|
||||
SUBJECTS = {
|
||||
new_follower_email: "just followed you on #{ApplicationConfig['COMMUNITY_NAME']}".freeze
|
||||
}.freeze
|
||||
|
||||
def new_reply_email
|
||||
@comment = params[:comment]
|
||||
@user = @comment.parent_user
|
||||
|
|
@ -22,7 +18,7 @@ class NotifyMailer < ApplicationMailer
|
|||
@follower = follow.follower
|
||||
@unsubscribe = generate_unsubscribe_token(@user.id, :email_follower_notifications)
|
||||
|
||||
mail(to: @user.email, subject: "#{@follower.name} #{SUBJECTS[__method__]}")
|
||||
mail(to: @user.email, subject: "#{@follower.name} #{subjects[__method__]}")
|
||||
end
|
||||
|
||||
def new_mention_email
|
||||
|
|
@ -43,7 +39,7 @@ class NotifyMailer < ApplicationMailer
|
|||
|
||||
@unread_notifications_count = @user.notifications.unread.count
|
||||
@unsubscribe = generate_unsubscribe_token(@user.id, :email_unread_notifications)
|
||||
subject = "🔥 You have #{@unread_notifications_count} unread notifications on #{ApplicationConfig['COMMUNITY_NAME']}"
|
||||
subject = "🔥 You have #{@unread_notifications_count} unread notifications on #{SiteConfig.community_name}"
|
||||
mail(to: @user.email, subject: subject)
|
||||
end
|
||||
|
||||
|
|
@ -106,7 +102,7 @@ class NotifyMailer < ApplicationMailer
|
|||
def account_deleted_email
|
||||
@name = params[:name]
|
||||
|
||||
subject = "#{ApplicationConfig['COMMUNITY_NAME']} - Account Deletion Confirmation"
|
||||
subject = "#{SiteConfig.community_name} - Account Deletion Confirmation"
|
||||
mail(to: params[:email], subject: subject)
|
||||
end
|
||||
|
||||
|
|
@ -115,7 +111,7 @@ class NotifyMailer < ApplicationMailer
|
|||
@name = user.name
|
||||
@token = params[:token]
|
||||
|
||||
subject = "#{ApplicationConfig['COMMUNITY_NAME']} - Account Deletion Requested"
|
||||
subject = "#{SiteConfig.community_name} - Account Deletion Requested"
|
||||
mail(to: user.email, subject: subject)
|
||||
end
|
||||
|
||||
|
|
@ -140,7 +136,13 @@ class NotifyMailer < ApplicationMailer
|
|||
def trusted_role_email
|
||||
@user = params[:user]
|
||||
|
||||
subject = "You've been upgraded to #{ApplicationConfig['COMMUNITY_NAME']} Community mod status!"
|
||||
subject = "You've been upgraded to #{SiteConfig.community_name} Community mod status!"
|
||||
mail(to: @user.email, subject: subject)
|
||||
end
|
||||
|
||||
def subjects
|
||||
{
|
||||
new_follower_email: "just followed you on #{SiteConfig.community_name}".freeze
|
||||
}.freeze
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class VerificationMailer < ApplicationMailer
|
||||
default from: lambda {
|
||||
"#{ApplicationConfig['COMMUNITY_NAME']} Email Verification <#{SiteConfig.email_addresses[:default]}>"
|
||||
"#{SiteConfig.community_name} Email Verification <#{SiteConfig.email_addresses[:default]}>"
|
||||
}
|
||||
|
||||
def account_ownership_verification_email
|
||||
|
|
@ -8,6 +8,6 @@ class VerificationMailer < ApplicationMailer
|
|||
email_authorization = EmailAuthorization.create(user: @user, type_of: "account_ownership")
|
||||
@confirmation_token = email_authorization.confirmation_token
|
||||
|
||||
mail(to: @user.email, subject: "Verify Your #{ApplicationConfig['COMMUNITY_NAME']} Account Ownership")
|
||||
mail(to: @user.email, subject: "Verify Your #{SiteConfig.community_name} Account Ownership")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class SiteConfig < RailsSettings::Base
|
|||
field :campaign_articles_require_approval, type: :boolean, default: 0
|
||||
|
||||
# Community Content
|
||||
field :community_name, type: :string, default: ApplicationConfig["COMMUNITY_NAME"] || "New Forem"
|
||||
field :community_description, type: :string
|
||||
field :community_member_label, type: :string, default: "user"
|
||||
field :community_action, type: :string
|
||||
|
|
|
|||
|
|
@ -208,6 +208,15 @@
|
|||
expanded: "false"
|
||||
} %>
|
||||
<div id="contentBodyContainer" class="card-body collapse hide" aria-labelledby="contentBodyContainer">
|
||||
<div class="form-group">
|
||||
<%= admin_config_label :community_name %>
|
||||
<%= f.text_field :community_name,
|
||||
class: "form-control",
|
||||
value: SiteConfig.community_name,
|
||||
placeholder: Constants::SiteConfig::DETAILS[:community_name][:placeholder] %>
|
||||
<div class="alert alert-info"><%= Constants::SiteConfig::DETAILS[:community_name][:description] %></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= admin_config_label :community_description %>
|
||||
<%= f.text_field :community_description,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
<%= f.text_field :name, placeholder: "Unique, descriptive name" %>
|
||||
<% end %>
|
||||
<%= f.label :html %>
|
||||
<%= f.text_area :html, placeholder: "HTML to be shown. Make sure all CSS is properly scoped, and all HTML tags are closed, etc. Manditory field." %>
|
||||
<%= f.text_area :html, placeholder: "HTML to be shown. Make sure all CSS is properly scoped, and all HTML tags are closed, etc. Mandatory field." %>
|
||||
<div class="form-sub-details">
|
||||
<%= f.label :published %>
|
||||
<%= f.check_box :published %>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="crayons-card__body mod-saying-hello">
|
||||
<p class="fw-medium fs-2xl">Hello! 👋</p>
|
||||
<p>
|
||||
Thank you for helping to keep <%= ApplicationConfig["COMMUNITY_NAME"] %> safe! ❤️
|
||||
Thank you for helping to keep <%= SiteConfig.community_name %> safe! ❤️
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module Follows
|
|||
|
||||
return if EmailMessage.where(user_id: follow.followable_id)
|
||||
.where("sent_at > ?", rand(15..35).hours.ago)
|
||||
.exists?(["subject LIKE ?", "%#{NotifyMailer::SUBJECTS[:new_follower_email]}"])
|
||||
.exists?(["subject LIKE ?", "%#{NotifyMailer.subjects[:new_follower_email]}"])
|
||||
|
||||
mailer.constantize.with(follow: follow).new_follower_email.deliver_now
|
||||
end
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ seeder.create_if_none(Broadcast) do
|
|||
tags: welcome
|
||||
---
|
||||
|
||||
Hey there! Welcome to #{ApplicationConfig['COMMUNITY_NAME']}!
|
||||
Hey there! Welcome to #{SiteConfig.community_name}!
|
||||
|
||||
Leave a comment below to introduce yourself to the community!✌️
|
||||
HEREDOC
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ RSpec.describe ApplicationHelper, type: :helper do
|
|||
|
||||
describe "#community_name" do
|
||||
it "equals to the community name" do
|
||||
allow(ApplicationConfig).to receive(:[]).with("COMMUNITY_NAME").and_return("SLOAN")
|
||||
SiteConfig.community_name = "SLOAN"
|
||||
expect(helper.community_name).to eq("SLOAN")
|
||||
end
|
||||
end
|
||||
|
||||
describe "#community_qualified_name" do
|
||||
it "equals to the full qualified community name" do
|
||||
expected_name = "#{ApplicationConfig['COMMUNITY_NAME']} Community"
|
||||
expected_name = "#{SiteConfig.community_name} Community"
|
||||
expect(helper.community_qualified_name).to eq(expected_name)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ RSpec.describe FeedbackMessagesHelper, type: :helper do
|
|||
describe "#offender_email_details" do
|
||||
it "have proper subject and body" do
|
||||
expect(helper.offender_email_details).to include(
|
||||
subject: "#{ApplicationConfig['COMMUNITY_NAME']} Code of Conduct Violation",
|
||||
subject: "#{SiteConfig.community_name} Code of Conduct Violation",
|
||||
body: a_string_starting_with("Hello"),
|
||||
)
|
||||
end
|
||||
|
|
@ -13,7 +13,7 @@ RSpec.describe FeedbackMessagesHelper, type: :helper do
|
|||
describe "#reporter_email_details" do
|
||||
it "have proper subject and body" do
|
||||
expect(helper.reporter_email_details).to include(
|
||||
subject: "#{ApplicationConfig['COMMUNITY_NAME']} Report",
|
||||
subject: "#{SiteConfig.community_name} Report",
|
||||
body: a_string_starting_with("Hi"),
|
||||
)
|
||||
end
|
||||
|
|
@ -22,7 +22,7 @@ RSpec.describe FeedbackMessagesHelper, type: :helper do
|
|||
describe "#affected_email_details" do
|
||||
it "have proper subject and body" do
|
||||
expect(helper.affected_email_details).to include(
|
||||
subject: "Courtesy Notice from #{ApplicationConfig['COMMUNITY_NAME']}",
|
||||
subject: "Courtesy Notice from #{SiteConfig.community_name}",
|
||||
body: a_string_starting_with("Hi"),
|
||||
)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ RSpec.describe DigestMailer, type: :mailer do
|
|||
expect(email.subject).not_to be_nil
|
||||
expect(email.to).to eq([user.email])
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Digest <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Digest <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -41,12 +41,12 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
before { user2.follow(user) }
|
||||
|
||||
it "renders proper subject" do
|
||||
expect(email.subject).to eq("#{user2.name} just followed you on #{ApplicationConfig['COMMUNITY_NAME']}")
|
||||
expect(email.subject).to eq("#{user2.name} just followed you on #{SiteConfig.community_name}")
|
||||
end
|
||||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -98,12 +98,12 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
let(:email) { described_class.with(user: user).unread_notifications_email }
|
||||
|
||||
it "renders proper subject" do
|
||||
expect(email.subject).to eq("🔥 You have 0 unread notifications on #{ApplicationConfig['COMMUNITY_NAME']}")
|
||||
expect(email.subject).to eq("🔥 You have 0 unread notifications on #{SiteConfig.community_name}")
|
||||
end
|
||||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
let(:email_params) do
|
||||
{
|
||||
email_to: user.email,
|
||||
email_subject: "#{ApplicationConfig['COMMUNITY_NAME']} Report Status Update",
|
||||
email_subject: "#{SiteConfig.community_name} Report Status Update",
|
||||
email_body: "You've violated our code of conduct",
|
||||
email_type: "Reporter",
|
||||
feedback_message_id: feedback_message.id
|
||||
|
|
@ -277,12 +277,12 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
let(:email) { described_class.with(email_params).feedback_message_resolution_email }
|
||||
|
||||
it "renders proper subject" do
|
||||
expect(email.subject).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Report Status Update")
|
||||
expect(email.subject).to eq("#{SiteConfig.community_name} Report Status Update")
|
||||
end
|
||||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -353,7 +353,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -376,12 +376,12 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
let(:email) { described_class.with(name: user.name, email: user.email).account_deleted_email }
|
||||
|
||||
it "renders proper subject" do
|
||||
expect(email.subject).to eq("#{ApplicationConfig['COMMUNITY_NAME']} - Account Deletion Confirmation")
|
||||
expect(email.subject).to eq("#{SiteConfig.community_name} - Account Deletion Confirmation")
|
||||
end
|
||||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -449,7 +449,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -473,13 +473,13 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
let(:email) { described_class.with(user: user).trusted_role_email }
|
||||
|
||||
it "renders proper subject" do
|
||||
expected_subject = "You've been upgraded to #{ApplicationConfig['COMMUNITY_NAME']} Community mod status!"
|
||||
expected_subject = "You've been upgraded to #{SiteConfig.community_name} Community mod status!"
|
||||
expect(email.subject).to eq(expected_subject)
|
||||
end
|
||||
|
||||
it "renders proper sender" do
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(expected_from)
|
||||
end
|
||||
|
||||
|
|
@ -513,7 +513,7 @@ RSpec.describe NotifyMailer, type: :mailer do
|
|||
end
|
||||
|
||||
it "renders proper sender" do
|
||||
expected_from = "#{ApplicationConfig['COMMUNITY_NAME']} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
expected_from = "#{SiteConfig.community_name} Community <#{SiteConfig.email_addresses[:default]}>"
|
||||
|
||||
expect(moderator_email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
expect(moderator_email["from"].value).to eq(expected_from)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class NotifyMailerPreview < ActionMailer::Preview
|
|||
HEREDOC
|
||||
params = {
|
||||
email_to: @user.email,
|
||||
email_subject: "Courtesy notice from #{ApplicationConfig['COMMUNITY_NAME']}",
|
||||
email_subject: "Courtesy notice from #{SiteConfig.community_name}",
|
||||
email_body: email_body,
|
||||
email_type: "Reporter",
|
||||
feedback_message_id: rand(100)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ RSpec.describe VerificationMailer, type: :mailer do
|
|||
expect(email.subject).not_to be_nil
|
||||
expect(email.to).to eq([user.email])
|
||||
expect(email.from).to eq([SiteConfig.email_addresses[:default]])
|
||||
from = "#{ApplicationConfig['COMMUNITY_NAME']} Email Verification <#{SiteConfig.email_addresses[:default]}>"
|
||||
from = "#{SiteConfig.community_name} Email Verification <#{SiteConfig.email_addresses[:default]}>"
|
||||
expect(email["from"].value).to eq(from)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -82,6 +82,13 @@ RSpec.describe "/admin/config", type: :request do
|
|||
expect(SiteConfig.community_description).to eq(description)
|
||||
end
|
||||
|
||||
it "updates the community_name" do
|
||||
name_magoo = "Hey hey #{rand(100)}"
|
||||
post "/admin/config", params: { site_config: { community_name: name_magoo },
|
||||
confirmation: confirmation_message }
|
||||
expect(SiteConfig.community_name).to eq(name_magoo)
|
||||
end
|
||||
|
||||
it "updates the community_member_label" do
|
||||
name = "developer"
|
||||
post "/admin/config", params: { site_config: { community_member_label: name },
|
||||
|
|
@ -306,7 +313,7 @@ RSpec.describe "/admin/config", type: :request do
|
|||
expect(SiteConfig.shop_url).to eq("")
|
||||
get "/privacy"
|
||||
expect(response.body).not_to include(previous_shop_url)
|
||||
expect(response.body).not_to include("#{ApplicationConfig['COMMUNITY_NAME']} Shop")
|
||||
expect(response.body).not_to include("#{SiteConfig.community_name} Shop")
|
||||
end
|
||||
|
||||
it "updates shop url" do
|
||||
|
|
@ -316,7 +323,7 @@ RSpec.describe "/admin/config", type: :request do
|
|||
expect(SiteConfig.shop_url).to eq(expected_shop_url)
|
||||
get "/privacy"
|
||||
expect(response.body).to include(expected_shop_url)
|
||||
expect(response.body).to include("#{ApplicationConfig['COMMUNITY_NAME']} Shop")
|
||||
expect(response.body).to include("#{SiteConfig.community_name} Shop")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ RSpec.describe "admin/users", type: :request do
|
|||
|
||||
deliveries = ActionMailer::Base.deliveries
|
||||
expect(deliveries.count).to eq(1)
|
||||
expect(deliveries.first.subject).to eq("Verify Your #{ApplicationConfig['COMMUNITY_NAME']} Account Ownership")
|
||||
expect(deliveries.first.subject).to eq("Verify Your #{SiteConfig.community_name} Account Ownership")
|
||||
expect(deliveries.first.text_part.body).to include(verification_link)
|
||||
|
||||
sign_in(user)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ RSpec.describe "ArticlesShow", type: :request do
|
|||
"publisher" => {
|
||||
"@context" => "http://schema.org",
|
||||
"@type" => "Organization",
|
||||
"name" => "#{ApplicationConfig['COMMUNITY_NAME']} Community",
|
||||
"name" => "#{SiteConfig.community_name} Community",
|
||||
"logo" => {
|
||||
"@context" => "http://schema.org",
|
||||
"@type" => "ImageObject",
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ RSpec.describe "Pages", type: :request do
|
|||
describe "GET /about-listings" do
|
||||
it "has proper headline" do
|
||||
get "/about-listings"
|
||||
expect(response.body).to include("About #{ApplicationConfig['COMMUNITY_NAME']} Listings")
|
||||
expect(response.body).to include("About #{SiteConfig.community_name} Listings")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ RSpec.describe "Pages", type: :request do
|
|||
describe "GET /page/post-a-job" do
|
||||
it "has proper headline" do
|
||||
get "/page/post-a-job"
|
||||
expect(response.body).to include("Posting a Job on #{ApplicationConfig['COMMUNITY_NAME']} Listings")
|
||||
expect(response.body).to include("Posting a Job on #{SiteConfig.community_name} Listings")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ RSpec.describe "Pages", type: :request do
|
|||
get "/privacy"
|
||||
expect(response.body).to include("Privacy Policy")
|
||||
expect(response.body).to include(SiteConfig.shop_url)
|
||||
expect(response.body).to include("#{ApplicationConfig['COMMUNITY_NAME']} Shop")
|
||||
expect(response.body).to include("#{SiteConfig.community_name} Shop")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ RSpec.describe "ServiceWorker", type: :request do
|
|||
describe "GET /manifest.json" do
|
||||
it "renders file with proper text" do
|
||||
get "/manifest.json"
|
||||
expect(response.body).to include("\"name\": \"#{ApplicationConfig['COMMUNITY_NAME']} Community\"")
|
||||
expect(response.body).to include("\"name\": \"#{SiteConfig.community_name} Community\"")
|
||||
end
|
||||
|
||||
it "renders json file" do
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ RSpec.describe "UserSettings", type: :request do
|
|||
|
||||
it "displays content on RSS tab properly" do
|
||||
get "/settings/publishing-from-rss"
|
||||
title = "Publishing to #{ApplicationConfig['COMMUNITY_NAME']} from RSS"
|
||||
title = "Publishing to #{SiteConfig.community_name} from RSS"
|
||||
expect(response.body).to include(title)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ RSpec.describe "Authenticating with GitHub" do
|
|||
|
||||
expect(page).to have_current_path("/users/sign_in")
|
||||
expect(page).to have_link(sign_in_link)
|
||||
expect(page).to have_link("All about #{ApplicationConfig['COMMUNITY_NAME']}")
|
||||
expect(page).to have_link("All about #{SiteConfig.community_name}")
|
||||
end
|
||||
|
||||
it "notifies Datadog about a callback error" do
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ RSpec.describe "Authenticating with Twitter" do
|
|||
|
||||
expect(page).to have_current_path("/users/sign_in")
|
||||
expect(page).to have_link(sign_in_link)
|
||||
expect(page).to have_link("All about #{ApplicationConfig['COMMUNITY_NAME']}")
|
||||
expect(page).to have_link("All about #{SiteConfig.community_name}")
|
||||
end
|
||||
|
||||
it "notifies Datadog about a callback error" do
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ RSpec.describe "Organization index", type: :system do
|
|||
end
|
||||
|
||||
it "shows the proper title tag" do
|
||||
expect(page).to have_title("#{organization.name} - #{ApplicationConfig['COMMUNITY_NAME']}")
|
||||
expect(page).to have_title("#{organization.name} - #{SiteConfig.community_name}")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ RSpec.describe "User index", type: :system, stub_elasticsearch: true do
|
|||
end
|
||||
|
||||
it "shows proper title tag" do
|
||||
expect(page).to have_title("#{user.name} - #{ApplicationConfig['COMMUNITY_NAME']}")
|
||||
expect(page).to have_title("#{user.name} - #{SiteConfig.community_name}")
|
||||
end
|
||||
|
||||
it "shows user's articles" do
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require "rails_helper"
|
|||
|
||||
RSpec.describe "email_subscriptions/unsubscribe.html.erb", type: :view do
|
||||
it "works" do
|
||||
assign(:email_type, "#{ApplicationConfig['COMMUNITY_NAME']} digest emails")
|
||||
assign(:email_type, "#{SiteConfig.community_name} digest emails")
|
||||
render
|
||||
Approvals.verify(rendered, name: "email_subscriptions/unsubscribe", format: :html)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue