-
Notifications
You must be signed in to change notification settings - Fork 1
Handle feed inclusion delegated delivery UI #1384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e2546c3
db88ea0
5c6a377
c455d79
f8ee333
31e5dbb
1eae4fe
84f2698
612e798
7a487d0
5856f25
c6541d2
4ef48ff
15d217e
09b388d
59e063b
ab3db05
572e169
963fe93
5c33b4b
e206684
c07dd95
5eb6a3c
56dab7c
a5d05b0
410e70c
0ef3193
ec593eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ class Episode < ApplicationRecord | |
| include PublishingStatus | ||
| include TextSanitizer | ||
| include EmbedPlayerHelper | ||
| include AppleDelivery | ||
| include AppleIntegration | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that is a better name I think |
||
| include ReleaseEpisodes | ||
|
|
||
| MAX_SEGMENT_COUNT = 10 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,11 +23,36 @@ module Integrations::EpisodeIntegrations | |
| end | ||
| end | ||
|
|
||
| def integration_episode(integration) | ||
| integration_episode_method = "#{integration}_episode" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's a good idea |
||
| if respond_to?(integration_episode_method) | ||
| send(integration_episode_method) | ||
| end | ||
| end | ||
|
|
||
| def publish_to_integration?(integration) | ||
| # see if there is an integration | ||
| podcast.feeds.any? { |f| f.integration_type == integration && f.publish_integration? } | ||
| end | ||
|
|
||
| def integration_feed_episode?(integration) | ||
| feed = integration_feed(integration) | ||
| publish_to_integration?(integration) && feed&.feed_episode_ids&.include?(id) | ||
| end | ||
|
|
||
| def integration_feed(integration) | ||
| podcast.feeds.find { |f| f.integration_type == integration } | ||
| end | ||
|
|
||
| def integration_error_state?(integration) | ||
| integration_episode_method = "#{integration}_episode" | ||
| if respond_to?(integration_episode_method) | ||
| send(integration_episode_method)&.error_state? || false | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. very clean, thank you! |
||
| else | ||
| false | ||
| end | ||
| end | ||
|
|
||
| def sync_log(integration) | ||
| sync_logs.send(integration.intern).order(updated_at: :desc).first | ||
| end | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,33 +35,22 @@ | |
| <%= render "form_feeds", form: form, episode: episode %> | ||
| </div> | ||
|
|
||
| <% if episode.persisted? && episode.publish_to_apple? %> | ||
| <div class="col-12 mt-4"> | ||
| <p class="status-text"> | ||
| <strong><%= t(".apple_status") %>:</strong> | ||
| <span class="badge rounded-pill prx-badge-<%= episode_apple_status(episode) %>"> | ||
| <%= t("helpers.label.episode.media_statuses.#{episode_apple_status(episode)}") %> | ||
| </span> | ||
| <br> | ||
| <%= local_time_ago(episode_apple_updated_at(episode)) %> | ||
| </p> | ||
| </div> | ||
| <% end %> | ||
| <% if episode.persisted? && episode.publish_to_integration?(:megaphone) %> | ||
| <% integration = :megaphone %> | ||
| <% integration_status = episode_integration_status(integration, episode) %> | ||
| <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><%= t(".last_updated") %></strong> | ||
| <br> | ||
| <%= local_time_ago(episode_integration_updated_at(integration, episode)) %> | ||
| </p> | ||
| </div> | ||
| <% [:apple, :megaphone].each do |integration| %> | ||
| <% if episode.persisted? && episode.publish_to_integration?(integration) %> | ||
| <% integration_status = episode_integration_status(integration, episode) %> | ||
| <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)) %> | ||
| </p> | ||
| </div> | ||
| <% end %> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks great |
||
| <% end %> | ||
| </div> | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing to a default of complete? I guess I worry that could show complete even when it is not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking both possibilities for
delivered?boolean means that the else branch was unreachable code:feeder.prx.org/app/helpers/episodes_helper.rb
Lines 26 to 29 in b1b6d6b
Hence the rearrangement of the apple episode publishing invocation in this PR https://github.com/PRX/feeder.prx.org/pull/1384/files#diff-a2b7e8c0371fceca58ba0b83a4db37ef232d2770af6aeb616aaac0e3b0259876R148. Sort of a subtle difference, but I think makes sense to see
deliveredepisodes as being "complete" here (already published).