Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/helpers/episodes_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def episode_explicit_options
end

def episode_integration_status(integration, episode)
return "draft" if episode.draft?
return "not_publishable" unless episode.integration_feed_episode?(integration)

status = episode.episode_delivery_status(integration, true)
Expand Down
16 changes: 9 additions & 7 deletions app/views/episodes/_form_status.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@
<div class="col-12 mt-4">
<p class="status-text">
<strong><%= integration.to_s.titleize %> Status:</strong>
<span class="badge rounded-pill prx-badge-<%= integration_status %>">
<%= t("helpers.label.episode.media_statuses.#{integration_status}") %>
</span>
<br>
<strong><%= integration.to_s.titleize %> <%= t(".last_updated") %></strong>
<br>
<%= local_time_ago(episode_integration_updated_at(integration, episode)) %>
<% unless integration_status == "draft" %>
<span class="badge rounded-pill prx-badge-<%= integration_status %>">
<%= t("helpers.label.episode.media_statuses.#{integration_status}") %>
</span>
<br>
<strong><%= integration.to_s.titleize %> <%= t(".last_updated") %></strong>
<br>
<%= local_time_ago(episode_integration_updated_at(integration, episode)) %>
<% end %>
</p>
</div>
<% end %>
Expand Down
8 changes: 5 additions & 3 deletions app/views/episodes/_overview.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@
</li>
<li class="list-group-item d-flex justify-content-between align-items-center">
<span><%= t(".apple") %></span>
<span class="badge rounded-pill prx-badge-<%= episode_integration_status(:apple, episode) %>">
<%= t("helpers.label.episode.media_statuses.#{episode_integration_status(:apple, episode)}") %>
</span>
<% unless episode_integration_status(:apple, episode) == "draft" %>
<span class="badge rounded-pill prx-badge-<%= episode_integration_status(:apple, episode) %>">
<%= t("helpers.label.episode.media_statuses.#{episode_integration_status(:apple, episode)}") %>
</span>
<% end %>
</li>
<li class="list-group-item"><%= t(".spotify") %></li>
</ul>
Expand Down
6 changes: 6 additions & 0 deletions test/helpers/episodes_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class TestHelper
let(:podcast) { create(:podcast) }

describe "#episode_integration_status" do
it "returns 'draft' when episode is a draft" do
draft_episode = create(:episode, podcast: podcast, published_at: nil)
assert_equal "draft", helper.episode_integration_status(:apple, draft_episode)
assert_equal "draft", helper.episode_integration_status(:megaphone, draft_episode)
end

it "returns 'not_publishable' when episode does not publish to the integration" do
episode = create(:episode, podcast: podcast, published_at: 1.hour.ago)
assert_equal "not_publishable", helper.episode_integration_status(:apple, episode)
Expand Down