Skip to content

Commit 3a4926f

Browse files
authored
Return draft status for draft episodes (#1399)
1 parent cc30a2f commit 3a4926f

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

app/helpers/episodes_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def episode_explicit_options
1616
end
1717

1818
def episode_integration_status(integration, episode)
19+
return "draft" if episode.draft?
1920
return "not_publishable" unless episode.integration_feed_episode?(integration)
2021

2122
status = episode.episode_delivery_status(integration, true)

app/views/episodes/_form_status.html.erb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@
4141
<div class="col-12 mt-4">
4242
<p class="status-text">
4343
<strong><%= integration.to_s.titleize %> Status:</strong>
44-
<span class="badge rounded-pill prx-badge-<%= integration_status %>">
45-
<%= t("helpers.label.episode.media_statuses.#{integration_status}") %>
46-
</span>
47-
<br>
48-
<strong><%= integration.to_s.titleize %> <%= t(".last_updated") %></strong>
49-
<br>
50-
<%= local_time_ago(episode_integration_updated_at(integration, episode)) %>
44+
<% unless integration_status == "draft" %>
45+
<span class="badge rounded-pill prx-badge-<%= integration_status %>">
46+
<%= t("helpers.label.episode.media_statuses.#{integration_status}") %>
47+
</span>
48+
<br>
49+
<strong><%= integration.to_s.titleize %> <%= t(".last_updated") %></strong>
50+
<br>
51+
<%= local_time_ago(episode_integration_updated_at(integration, episode)) %>
52+
<% end %>
5153
</p>
5254
</div>
5355
<% end %>

app/views/episodes/_overview.html.erb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@
4747
</li>
4848
<li class="list-group-item d-flex justify-content-between align-items-center">
4949
<span><%= t(".apple") %></span>
50-
<span class="badge rounded-pill prx-badge-<%= episode_integration_status(:apple, episode) %>">
51-
<%= t("helpers.label.episode.media_statuses.#{episode_integration_status(:apple, episode)}") %>
52-
</span>
50+
<% unless episode_integration_status(:apple, episode) == "draft" %>
51+
<span class="badge rounded-pill prx-badge-<%= episode_integration_status(:apple, episode) %>">
52+
<%= t("helpers.label.episode.media_statuses.#{episode_integration_status(:apple, episode)}") %>
53+
</span>
54+
<% end %>
5355
</li>
5456
<li class="list-group-item"><%= t(".spotify") %></li>
5557
</ul>

test/helpers/episodes_helper_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ class TestHelper
99
let(:podcast) { create(:podcast) }
1010

1111
describe "#episode_integration_status" do
12+
it "returns 'draft' when episode is a draft" do
13+
draft_episode = create(:episode, podcast: podcast, published_at: nil)
14+
assert_equal "draft", helper.episode_integration_status(:apple, draft_episode)
15+
assert_equal "draft", helper.episode_integration_status(:megaphone, draft_episode)
16+
end
17+
1218
it "returns 'not_publishable' when episode does not publish to the integration" do
1319
episode = create(:episode, podcast: podcast, published_at: 1.hour.ago)
1420
assert_equal "not_publishable", helper.episode_integration_status(:apple, episode)

0 commit comments

Comments
 (0)