Skip to content

Commit

Permalink
Allow silos to not implement Listen
Browse files Browse the repository at this point in the history
Although they will be in the minority, there is the chance that we may
not support Listen flows on some silos.

Therefore we can make sure that `social_user` keeps this in mind when
rendering, and ignore the Listen-specific UI if unnecessary.
  • Loading branch information
jamietanna committed Feb 16, 2020
1 parent 3cfa4ac commit 260c36c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions models.py
Expand Up @@ -85,6 +85,8 @@ class Source(StringIdModel, metaclass=SourceMeta):
GR_CLASS = None
# oauth-dropins StartHandler class
OAUTH_START_HANDLER = None
# whether Bridgy supports listen for this silo - this is unlikely, so we default to True
CAN_LISTEN = True
# whether Bridgy supports publish for this silo
CAN_PUBLISH = None
# how often to poll for responses
Expand Down
6 changes: 4 additions & 2 deletions templates/social_user.html
Expand Up @@ -56,6 +56,7 @@

<div class="row">

{% if source.CAN_LISTEN %}
<!-- Listen UI -->
<div id="listen-ui" class="{% if source.CAN_PUBLISH %}col-sm-6{% endif %}">

Expand Down Expand Up @@ -179,10 +180,11 @@
{% endif %}

</div>
{% endif %}


<!-- Publish UI -->
<div id="publish-ui" class="col-sm-6">
<div id="publish-ui" class="{% if source.CAN_LISTEN %}col-sm-6{% endif %}">

{% if "publish" in source.features and source.status != "disabled" %}
<data class="p-bridgy-publish-status" value="enabled">
Expand Down Expand Up @@ -329,7 +331,7 @@
{% endfor %}
</ul>

{% else %}
{% elif source.CAN_LISTEN %}
<p class="big">No responses.</p>
{% endif %}

Expand Down

0 comments on commit 260c36c

Please sign in to comment.