Replaced remaining hardcoded DEV with the configurable community name (#7435)

* Replaced hardcoded DEV and dev.to remainders with the configurable name
* Removed hardcoded dev.to from the rss feed
This commit is contained in:
Anna Buianova 2020-04-22 17:16:21 +03:00 committed by GitHub
parent 40b5efa517
commit 983c3d28dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 26 additions and 24 deletions

View file

@ -1,10 +1,10 @@
class EmailSubscriptionsController < ApplicationController
PREFERRED_EMAIL_NAME = {
email_digest_periodic: "DEV digest emails",
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: "DEV connect messages",
email_connect_messages: "#{ApplicationConfig['COMMUNITY_NAME']} connect messages",
email_unread_notifications: "unread notifications",
email_badge_notifications: "badge notifications"
}.freeze

View file

@ -301,8 +301,9 @@ class UsersController < ApplicationController
end
def handle_account_tab
community_name = ApplicationConfig["COMMUNITY_NAME"]
@email_body = <<~HEREDOC
Hello #{ApplicationConfig['COMMUNITY_NAME']} Team,
Hello #{community_name} Team,
%0A
%0A
I would like to delete my account.
@ -312,7 +313,7 @@ class UsersController < ApplicationController
%0A
Regards,
%0A
YOUR-DEV-USERNAME-HERE
YOUR-#{community_name}-USERNAME-HERE
HEREDOC
end

View file

@ -3,7 +3,7 @@ module BadgeRewarder
def self.award_yearly_club_badges
(1..3).each do |i|
message = "Happy DEV birthday! Can you believe it's been #{i} #{'year'.pluralize(i)} already?!"
message = "Happy #{ApplicationConfig['COMMUNITY_NAME']} birthday! Can you believe it's been #{i} #{'year'.pluralize(i)} already?!"
badge = Badge.find_by!(slug: "#{YEARS[i]}-year-club")
User.where("created_at < ? AND created_at > ?", i.year.ago, i.year.ago - 2.days).find_each do |user|
achievement = BadgeAchievement.create(
@ -78,7 +78,7 @@ module BadgeRewarder
def self.award_streak_badge(num_weeks)
article_user_ids = Article.published.where("published_at > ? AND score > ?", 1.week.ago, -25).pluck(:user_id) # No cred for super low quality
message = if num_weeks == 16
"16 weeks! You've achieved the longest DEV writing streak possible. This makes you eligible for special quests in the future. Keep up the amazing contributions to our community!"
"16 weeks! You've achieved the longest #{ApplicationConfig['COMMUNITY_NAME']} writing streak possible. This makes you eligible for special quests in the future. Keep up the amazing contributions to our community!"
else
"Congrats on achieving this streak! Consistent writing is hard. The next streak badge you can get is the #{num_weeks * 2} Week Badge. 😉"
end

View file

@ -26,7 +26,7 @@ class DigestMailer < ApplicationMailer
def email_end_phrase
community_name = ApplicationConfig["COMMUNITY_NAME"]
# "more trending DEV posts" won the previous split test
# "more trending posts" won the previous split test
# Included more often as per explore-exploit algorithm
[
"more trending #{community_name} posts",

View file

@ -1,5 +1,5 @@
class ProMembershipMailer < ApplicationMailer
default from: -> { "DEV Pro Memberships <#{SiteConfig.default_site_email}>" }
default from: -> { "#{ApplicationConfig['COMMUNITY_NAME']} Pro Memberships <#{SiteConfig.default_site_email}>" }
def expiring_membership(pro_membership, expiration_date)
@pro_membership = pro_membership

View file

@ -3,10 +3,10 @@
xml.instruct! :xml, version: "1.0"
xml.rss version: "2.0" do
xml.channel do
xml.title @user ? @user.name : "DEV Community"
xml.author @user ? @user.name : "DEV Community"
xml.title @user ? @user.name : community_qualified_name
xml.author @user ? @user.name : community_qualified_name
xml.description @user ? @user.summary : SiteConfig.community_description
xml.link @user ? "https://dev.to" + @user.path : "https://dev.to"
xml.link @user ? app_url(@user.path) : app_url
xml.language "en"
@articles.each do |article|
@ -14,8 +14,8 @@ xml.rss version: "2.0" do
xml.title article.title
xml.author(@user && @user.class.name == "User" ? @user.name : article.user.name)
xml.pubDate article.published_at.to_s(:rfc822) if article.published_at
xml.link "https://dev.to#{article.path}"
xml.guid "https://dev.to#{article.path}"
xml.link app_url(article.path)
xml.guid app_url(article.path)
xml.description sanitize article.processed_html,
tags: %w[strong em a table tbody thead tfoot th tr td col colgroup del p h1 h2 h3 h4 h5 h6 blockquote iframe time div span i em u b ul ol li dd dl dt q code pre img sup cite center br small],
attributes: %w[href strong em class ref rel src title alt colspan height width size rowspan span value start data-conversation data-lang id]

View file

@ -63,7 +63,7 @@
<%= form_with url: internal_buffer_updates_path, html: { data: { action: "submit->buffer#highlightElement" } } do %>
<input type="hidden" name="social_channel" value="listings_twitter" />
<input type="hidden" name="listing_id" value="<%= listing.id %>" />
<textarea class="form-control" wrap="hard" name="tweet" maxlength="255" data-target="buffer.bodyText">📋 New DEV Listing!&#013&#013Category: <%= listing.category %>&#013&#013<%= listing.title %>&#013&#013<% if listing.user.twitter_username? %>Posted by @<%= listing.user.twitter_username %><% end %></textarea>
<textarea class="form-control" wrap="hard" name="tweet" maxlength="255" data-target="buffer.bodyText">📋 New <%= community_name %> Listing!&#013&#013Category: <%= listing.category %>&#013&#013<%= listing.title %>&#013&#013<% if listing.user.twitter_username? %>Posted by @<%= listing.user.twitter_username %><% end %></textarea>
<button class="btn btn-primary mt-2" data-action=>🐦 Tweet 🐦</button>
<% end %>
</div>

View file

@ -22,7 +22,7 @@
Check out <a href="/tags">other popular tags</a> which may be more appropriate
<% end %>
<br><br />
Thanks for being part of DEV! If you feel like this mod action was a mistake, feel free to contact
Thanks for being part of <%= community_name %>! If you feel like this mod action was a mistake, feel free to contact
<a href="mailto:<%= SiteConfig.default_site_email %>"><%= SiteConfig.default_site_email %></a>. 🤗
<br /><br />
</div>

View file

@ -63,7 +63,7 @@
<p>or this:</p>
<code>{% post kazz/boost-your-productivity-using-markdown-1be %}</code>
<h3><strong><%= community_name %> User Embed</strong></h3>
<p>All you need is the DEV username:</p>
<p>All you need is the <%= community_name %> username:</p>
<code>{% user jess %}</code>
<h3><strong><%= community_name %> Tag Embed</strong></h3>
<p>All you need is the tag name:</p>

View file

@ -18,7 +18,7 @@
<h2>Article Content</h2>
<p>The article content is prioritized in this order: <code>&lt;content&gt;</code>,
<code>&lt;summary&gt;</code>, or
<code>&lt;description&gt;</code>. The HTML will be converted to Markdown as the body of the DEV post.</p>
<code>&lt;description&gt;</code>. The HTML will be converted to Markdown as the body of the <%= community_name %> post.</p>
<p>If you're using a Medium RSS feed, Tweet links, YouTube, and Gist iframes are converted to Liquid tags.</p>
<br />
<br />

View file

@ -2,7 +2,7 @@ json.array! @users.each do |user|
json.id user.id
json.name user.name
json.username user.username
json.summary truncate(user.summary.presence || "Active DEV author", length: 100)
json.summary truncate(user.summary.presence || "Active #{community_name} author", length: 100)
json.profile_image_url ProfileImage.new(user).get(width: 90)
json.following false
end

View file

@ -1,4 +1,4 @@
<% title "Confirm Signout - DEV" %>
<% title "Confirm Signout - #{community_name}" %>
<div class="signout_confirm-wrapper">
<h1>Are you sure you want to sign out?</h1>

View file

@ -12,7 +12,7 @@ RSpec.describe ProMembershipMailer, type: :mailer do
expect(email.subject).to eq("Your Pro Membership will expire in 7 days!")
expect(email.to).to eq([user.email])
expect(email.from).to eq([SiteConfig.default_site_email])
expect(email["from"].value).to eq("DEV Pro Memberships <#{SiteConfig.default_site_email}>")
expect(email["from"].value).to eq("#{ApplicationConfig['COMMUNITY_NAME']} Pro Memberships <#{SiteConfig.default_site_email}>")
end
end

View file

@ -4,6 +4,7 @@ RSpec.describe "RssFeed", type: :request do
let(:user) { FactoryBot.create(:user) }
let(:organization) { FactoryBot.create(:organization) }
let(:tag) { FactoryBot.create(:tag) }
let(:base_url) { "#{ApplicationConfig['APP_PROTOCOL']}#{ApplicationConfig['APP_DOMAIN']}" }
before do
FactoryBot.create(:article, user_id: user.id, featured: true)
@ -13,23 +14,23 @@ RSpec.describe "RssFeed", type: :request do
describe "GET query page" do
it "renders feed" do
get "/feed"
expect(response.body).to include("<link>https://dev.to</link>")
expect(response.body).to include("<link>#{base_url}</link>")
end
it "renders user feed" do
get "/feed/#{user.username}"
expect(response.body).to include("<link>https://dev.to/#{user.username}</link>")
expect(response.body).to include("<link>#{base_url}/#{user.username}</link>")
end
it "renders organization feed" do
create(:article, organization_id: organization.id)
get "/feed/#{organization.slug}"
expect(response.body).to include("<link>https://dev.to/#{organization.slug}</link>")
expect(response.body).to include("<link>#{base_url}/#{organization.slug}</link>")
end
it "renders tag feed" do
get "/feed/tag/#{tag.name}"
expect(response.body).to include("<link>https://dev.to</link>")
expect(response.body).to include("<link>#{base_url}</link>")
end
end
end