diff --git a/app/helpers/social_image_helper.rb b/app/helpers/social_image_helper.rb
index 3352d4b84..fd162f8f2 100644
--- a/app/helpers/social_image_helper.rb
+++ b/app/helpers/social_image_helper.rb
@@ -1,31 +1,5 @@
module SocialImageHelper
- # After this date we use SocialPreview controller directly rather than passing to URL2PNG.
- # Keeping old URLs around since they are already generated.
- SOCIAL_PREVIEW_MIGRATION_DATETIME = Time.zone.parse("2019-04-22T00:00:00Z")
-
- def user_social_image_url(user)
- return Images::GenerateSocialImage.call(user) unless use_new_social_url?(user)
-
- if user.is_a?(Organization)
- organization_social_preview_url(user, format: :png)
- else
- user_social_preview_url(user, format: :png)
- end
- end
-
- def listing_social_image_url(listing)
- listing_social_preview_url(listing, format: :png)
- end
-
def article_social_image_url(article, **options)
Articles::SocialImage.new(article, **options).url
end
-
- def comment_social_image_url(comment)
- comment_social_preview_url(comment, format: :png)
- end
-
- def use_new_social_url?(resource)
- resource.updated_at > SOCIAL_PREVIEW_MIGRATION_DATETIME
- end
end
diff --git a/app/views/comments/index.html.erb b/app/views/comments/index.html.erb
index 3cef81818..577383fec 100644
--- a/app/views/comments/index.html.erb
+++ b/app/views/comments/index.html.erb
@@ -25,8 +25,8 @@
" />
">
-
-
+
+
<% if @root_comment.score < 0 || @commentable.score < 0 %>
@@ -37,8 +37,8 @@
" />
">
<% if @commentable.class.name == "Article" && @commentable.published %>
-
-
+
+
<% end %>
<% end %>
<% end %>
diff --git a/app/views/listings/index.html.erb b/app/views/listings/index.html.erb
index 47f50c52e..b2affae69 100644
--- a/app/views/listings/index.html.erb
+++ b/app/views/listings/index.html.erb
@@ -11,10 +11,10 @@
<% if @displayed_listing %>
" />
-
+
">
-
+
<% else %>
diff --git a/app/views/pages/show.html.erb b/app/views/pages/show.html.erb
index 0a41d5465..8d922e3b9 100644
--- a/app/views/pages/show.html.erb
+++ b/app/views/pages/show.html.erb
@@ -7,7 +7,7 @@
-
+
@@ -15,7 +15,7 @@
">
-
+
<% end %>
diff --git a/app/views/podcast_episodes/show.html.erb b/app/views/podcast_episodes/show.html.erb
index ab022922c..1c601a912 100644
--- a/app/views/podcast_episodes/show.html.erb
+++ b/app/views/podcast_episodes/show.html.erb
@@ -18,12 +18,12 @@
<% if @episode.social_image.present? %>
-
-
+
+
<% else %>
-
-
+
+
<% end %>
<% end %>
diff --git a/app/views/stories/tagged_articles/_meta.html.erb b/app/views/stories/tagged_articles/_meta.html.erb
index 8f3ec7b02..a8f1270e9 100644
--- a/app/views/stories/tagged_articles/_meta.html.erb
+++ b/app/views/stories/tagged_articles/_meta.html.erb
@@ -22,8 +22,8 @@
<% if @tag %>
-
-
+
+
<% else %>
diff --git a/app/views/users/_meta.html.erb b/app/views/users/_meta.html.erb
index 64a329360..94ab5c750 100644
--- a/app/views/users/_meta.html.erb
+++ b/app/views/users/_meta.html.erb
@@ -5,7 +5,7 @@
" />
-
+
@@ -13,7 +13,7 @@
">
-
+
<% if @stories.any? %>
<%= auto_discovery_link_tag(:rss, app_url("/feed/#{@user.username}"), title: t("views.stories.meta.rss", name: community_name)) %>
<% end %>
diff --git a/spec/helpers/social_image_helper_spec.rb b/spec/helpers/social_image_helper_spec.rb
index 5f4419b40..d73f6f012 100644
--- a/spec/helpers/social_image_helper_spec.rb
+++ b/spec/helpers/social_image_helper_spec.rb
@@ -4,36 +4,6 @@ describe SocialImageHelper do
let(:user) { create(:user) }
let(:article) { create(:article, main_image: nil) }
- describe ".user_social_image_url" do
- it "returns social preview path for newer users" do
- url = helper.user_social_image_url(user)
-
- expect(url).to eq user_social_preview_url(user, format: :png)
- end
-
- it "returns Organization social preview path for Orgs" do
- organization = create(:organization)
-
- url = helper.user_social_image_url(organization)
-
- expect(url).to eq organization_social_preview_url(organization, format: :png)
- end
-
- it "returns older url2png image if already generated" do
- user.updated_at = SocialImageHelper::SOCIAL_PREVIEW_MIGRATION_DATETIME - 1.week
-
- url = helper.user_social_image_url(user)
-
- expect(url).to eq Images::GenerateSocialImage.call(user)
- end
-
- it "returns social preview path for newer decorated users" do
- url = helper.user_social_image_url(user.decorate)
-
- expect(url).to eq user_social_preview_url(user, format: :png)
- end
- end
-
describe ".article_social_image_url" do
it "returns social preview path for newer articles" do
allow(Settings::General).to receive(:app_domain).and_return("hello.com")
@@ -52,7 +22,7 @@ describe SocialImageHelper do
end
it "returns older url2png image if already generated" do
- article.updated_at = SocialImageHelper::SOCIAL_PREVIEW_MIGRATION_DATETIME - 1.week
+ article.updated_at = Articles::SocialImage::SOCIAL_PREVIEW_MIGRATION_DATETIME - 1.week
url = helper.article_social_image_url(article)