Skip to content

Commit c3a0300

Browse files
renzonrenzon
authored andcommitted
Fixed not recorded webinar usability
part of #1681
1 parent f11d57f commit c3a0300

File tree

2 files changed

+51
-25
lines changed

2 files changed

+51
-25
lines changed

pythonpro/cohorts/templates/cohorts/webinar_detail.html

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,37 @@
99
<div class="col">
1010
<h1 class="mt-4 mb-3">{{ webinar.title }}</h1>
1111
<p>{{ webinar.description|linebreaks }}</p>
12-
<div class="embed-container mb-3">
13-
<iframe src="https://player.vimeo.com/video/{{ webinar.vimeo_id }}" width="640" height="360"
14-
frameborder="0"
15-
webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
16-
</div>
17-
<blockquote class="blockquote mt-2 mb-3" >
18-
<p class="mb-0">{{ webinar.speaker }}</p>
19-
<footer class="blockquote-footer">{{ webinar.speaker_title }}
20-
</footer>
21-
</blockquote>
12+
{% if webinar.vimeo_id %}
13+
<div class="embed-container mb-3">
14+
<iframe src="https://player.vimeo.com/video/{{ webinar.vimeo_id }}" width="640" height="360"
15+
frameborder="0"
16+
webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
17+
</div>
2218

23-
<div id='discourse-comments'></div>
24-
<script type="text/javascript">
25-
DiscourseEmbed = {
26-
discourseUrl: '{{ DISCOURSE_BASE_URL }}',
27-
topicId: {{ webinar.discourse_topic_id }}
28-
};
19+
<blockquote class="blockquote mt-2 mb-3">
20+
<p class="mb-0">{{ webinar.speaker }}</p>
21+
<footer class="blockquote-footer">{{ webinar.speaker_title }}
22+
</footer>
23+
</blockquote>
2924

30-
(function () {
31-
var d = document.createElement('script');
32-
d.type = 'text/javascript';
33-
d.async = true;
34-
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
35-
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
36-
})();
37-
</script>
25+
<div id='discourse-comments'></div>
26+
<script type="text/javascript">
27+
DiscourseEmbed = {
28+
discourseUrl: '{{ DISCOURSE_BASE_URL }}',
29+
topicId: {{ webinar.discourse_topic_id }}
30+
};
31+
32+
(function () {
33+
var d = document.createElement('script');
34+
d.type = 'text/javascript';
35+
d.async = true;
36+
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
37+
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
38+
})();
39+
</script>
40+
{% else %}
41+
<p class="mt-5 mb-5 h3">Ainda não temos máquina do tempo, esse webinário ainda não foi gravado 😉</p>
42+
{% endif %}
3843

3944
</div>
4045
</div>

pythonpro/cohorts/tests/test_webinar_detail.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from pythonpro.cohorts.models import Webinar
77
from pythonpro.cohorts.tests.conftest import img_path
8-
from pythonpro.django_assertions import dj_assert_contains
8+
from pythonpro.django_assertions import dj_assert_contains, dj_assert_not_contains
99

1010

1111
@pytest.fixture
@@ -34,6 +34,27 @@ def test_basic_contents(resp, webinar, property_name):
3434
dj_assert_contains(resp, getattr(webinar, property_name))
3535

3636

37+
@pytest.fixture
38+
def resp_video_not_recorded(client_with_member, webinar: Webinar):
39+
webinar.vimeo_id = None
40+
webinar.save()
41+
return client_with_member.get(reverse('cohorts:webinar', kwargs={'slug': webinar.slug}), secure=True)
42+
43+
44+
def test_pending_webinar_msg(resp_video_not_recorded):
45+
dj_assert_contains(
46+
resp_video_not_recorded,
47+
'Ainda não temos máquina do tempo, esse webinário ainda não foi gravado'
48+
)
49+
50+
51+
def test_vime_player_not_present(resp_video_not_recorded):
52+
dj_assert_not_contains(
53+
resp_video_not_recorded,
54+
'src="https://player.vimeo.com/video/"'
55+
)
56+
57+
3758
@pytest.fixture
3859
def resp_client(client_with_client, webinar: Webinar, mocker, logged_user):
3960
return client_with_client.get(reverse('cohorts:webinar', kwargs={'slug': webinar.slug}), secure=True)

0 commit comments

Comments
 (0)