pre-check micropub syndication targets when the entry is on
the same silo, or has a u-syndication for that services
This commit is contained in:
parent
4d6880c284
commit
3a4a71d225
2 changed files with 11 additions and 1 deletions
|
@ -13,7 +13,7 @@
|
|||
<div class="syndication-toggles">
|
||||
{% for target in current_user.get_setting('syndicate-to', []) %}
|
||||
<div class="syndication-toggle">
|
||||
<input id="sc-{{entry.id}}-{{loop.index}}" type="checkbox" name="syndicate-to[]" value="{{ target }}"/>
|
||||
<input id="sc-{{entry.id}}-{{loop.index}}" type="checkbox" name="syndicate-to[]" value="{{ target }}"{% if entry is syndicated_to(target) %} checked{% endif %} />
|
||||
<label for="sc-{{entry.id}}-{{loop.index}}"><img src="{{ target | favicon_for_url }}" /></label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
|
|
@ -609,3 +609,13 @@ def dedupe_copies(entries):
|
|||
entry._syndicated_copies = copies
|
||||
all_copies.update(copies)
|
||||
return [e for e in entries if e not in all_copies]
|
||||
|
||||
|
||||
@views.app_template_test('syndicated_to')
|
||||
def is_syndicated_to(entry, target):
|
||||
def same_domain(u1, u2):
|
||||
return domain_for_url(u1) == domain_for_url(u2)
|
||||
|
||||
return same_domain(entry.permalink, target) or any(
|
||||
same_domain(syndurl, target)
|
||||
for syndurl in entry.get_property('syndication', []))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue