Projet

Général

Profil

0001-agendas-include-event-description-in-reminders-49034.patch

Valentin Deniaud, 08 décembre 2020 17:50

Télécharger (4,91 ko)

Voir les différences:

Subject: [PATCH] agendas: include event description in reminders (#49034)

 .../templates/agendas/events_reminder_body.html     | 12 ++++++++++++
 .../templates/agendas/events_reminder_body.txt      |  9 +++++++++
 chrono/manager/views.py                             |  3 +++
 tests/test_agendas.py                               | 13 ++++++++++++-
 tests/test_manager.py                               |  3 +++
 5 files changed, 39 insertions(+), 1 deletion(-)
chrono/agendas/templates/agendas/events_reminder_body.html
10 10
{% endblocktrans %}
11 11
</p>
12 12

  
13
{% if booking.event.description %}
14
<p>{{ booking.event.description }}</p>
15
{% endif %}
16

  
17
{% if booking.event.pricing %}
18
<p>{% trans "Pricing:" %} {{ booking.event.pricing }}</p>
19
{% endif %}
20

  
21
{% if booking.event.url %}
22
<p>{% trans "Details:" %} {{ booking.event.url }}</p>
23
{% endif %}
24

  
13 25
{% if email_extra_info %}
14 26
<p>{{ email_extra_info }}</p>
15 27
{% endif %}
chrono/agendas/templates/agendas/events_reminder_body.txt
6 6
{% blocktrans trimmed with event=booking.event date=date|date:"l j F" time=date|time %}
7 7
You have a booking for event "{{ event }}", on {{ date }} at {{ time }}.
8 8
{% endblocktrans %}
9
{% if booking.event.description %}
10
{{ booking.event.description }}
11
{% endif %}
12
{% if booking.event.pricing %}
13
{% trans "Pricing:" %} {{ booking.event.pricing }}
14
{% endif %}
15
{% if booking.event.url %}
16
{% trans "Details:" %} {{ booking.event.url }}
17
{% endif %}
9 18
{% if email_extra_info %}
10 19
{{ email_extra_info }}
11 20
{% endif %}
chrono/manager/views.py
1589 1589
        event = Event(
1590 1590
            label='{{ event_label }}',
1591 1591
            start_datetime=datetime.datetime(year=2020, month=6, day=2, hour=14, minute=30),
1592
            description='%s (%s)' % ('{{ event_description }}', _('if any')),
1593
            pricing='%s (%s)' % ('{{ event_pricing }}', _('if any')),
1594
            url='%s (%s)' % ('{{ event_url }}', _('if any')),
1592 1595
        )
1593 1596
        booking = Booking(user_display_label='{{ user_display_label }}', form_url='#')
1594 1597
        booking.event = event
tests/test_agendas.py
1491 1491
        agenda=agenda, days=1, send_email=True, email_extra_info='Do no forget ID card.'
1492 1492
    )
1493 1493
    start_datetime = now() + datetime.timedelta(days=2)
1494
    event = Event.objects.create(agenda=agenda, start_datetime=start_datetime, places=10, label='Pool party')
1494
    event = Event.objects.create(
1495
        agenda=agenda,
1496
        start_datetime=start_datetime,
1497
        places=10,
1498
        label='Pool party',
1499
        description='Come !',
1500
        url='https://example.party',
1501
        pricing='10€',
1502
    )
1495 1503

  
1496 1504
    booking = Booking.objects.create(event=event, user_email='t@test.org')
1497 1505

  
......
1504 1512
    for body in mail_bodies:
1505 1513
        assert 'Hi,' in body
1506 1514
        assert 'You have a booking for event "Pool party", on Friday 3 January at 2 p.m..' in body
1515
        assert 'Come !' in body
1516
        assert 'Pricing: 10€' in body
1517
        assert 'Details: https://example.party' in body
1507 1518
        assert 'Do no forget ID card.' in body
1508 1519
        assert not 'cancel' in body
1509 1520
    mailoutbox.clear()
tests/test_manager.py
4761 4761
    assert len(resp.pyquery.find('p.email-subject')) == 1
4762 4762
    assert '<strong>Subject:</strong> Reminder for your booking tomorrow at 2:30 p.m.' in resp.text
4763 4763
    assert 'You have a booking for event "{{ event_label }}", on Tuesday 2 June at 2:30 p.m..' in resp.text
4764
    assert '{{ event_description }} (if any)' in resp.text
4765
    assert '{{ event_pricing }}' in resp.text
4766
    assert '{{ event_url }}' in resp.text
4764 4767
    assert 'An ID will be required' in resp.text
4765 4768

  
4766 4769
    resp = resp.click('Return to settings')
4767
-