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
Enhance iCal file exports #162
Conversation
This is a nice start. |
@rtnpro sure, works for me :) |
d9e3f6c
to
c087907
Compare
@pypingou Could you review it? Changes:
|
@pypingou if the above is OK, I will add tests for the same. |
@@ -59,3 +59,6 @@ APP_URL = 'https://apps.fedoraproject.org/calendar/' | |||
### In case of exception flask sends an email with some information to debug the | |||
### problem. The email is sent to the address listed here. | |||
# EMAIL_ERROR = 'pingou@pingoured.fr' | |||
|
|||
ICAL_REMINDERS = [{'days': -1}, {'hours': -1}, {'minutes': -5}] |
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.
We probably want to sync this with the default configuration and we should document a little more in the sample configuration
Changes summary: - 'ICAL_REMINDERS' in conf file replaced with 'ICAL_REMINDER_OPTIONS' for displaying dropdown menu for selecting reminder time when downloading a meeting's iCal file with a reminder. - Change in GET param: 'reminder' to 'reminder_at' for exporting iCal file for a meeting. - Change in 'add_meeting_to_vcal' API to accept no or single reminder rather than a list of reminders.
@pypingou Please review rtnpro@c99762f. Please have a look at the commit summary for a summary of the changes made. |
…nt handler across modal reloads.
@pypingou True! Currently the flow would allow setting reminders after the meeting if the user toys around the URL :) However, I wanted to keep the |
'reminder_delta=<minutes before meeting>' instead of 'reminder_at=<-?(?:\d+h)?(?:\d+m)?(?:\d+s)?>'. This leads to a simple way (int(reminder_delta)) to extract minutes before event info for setting reminder in the iCal file.
@@ -1030,7 +1038,9 @@ def view_meeting_page(meeting_id, full): | |||
tzone=tzone, | |||
title=meeting.meeting_name, | |||
editor=editor, | |||
from_date=from_date) | |||
from_date=from_date, | |||
reminder_at_options=APP.config.get('ICAL_REMINDER_AT_OPTIONS') or [] |
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.
No need for the or
here, just finish the get:
reminder_at_options=APP.config.get('ICAL_REMINDER_AT_OPTIONS', [])
The second parameter is the default to return if the key is not in the dict ;-)
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.
@pypingou I know, but
reminder_at_options=APP.config.get('ICAL_REMINDER_AT_OPTIONS') or []
handles the worst case scenario when
config[ICAL_REMINDER_AT_OPTIONS'] = None
It's unnecessary here. It's a side effect of writing fault tolerant code for E Commerce products to handle stupidity from some other sources ;). Here, it's unnecessary, I believe. I will fix it.
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.
We shouldn't be able to have
config[ICAL_REMINDER_AT_OPTIONS'] = None
as it would mean someone edited the default_config.py instead of overriding it.
So +1 on not being tolerant to this, but in the worst case, I think I would prefer a if reminder_at_options
lower down the stack.
@pypingou I have added tests for this feature enhancement. Please review it. |
@@ -54,10 +54,25 @@ <h2 class="orange">{{ _('Meeting "%(name)s"', name=meeting.meeting_name) }}</h2> | |||
{% endmacro %} | |||
<p>{{ _('Meeting organized by %(managers)s', managers=get_managers(meeting.meeting_manager)) }}</p> | |||
|
|||
<a href="{{ url_for('ical_calendar_meeting', meeting_id=meeting.meeting_id) }}" | |||
<a id="ical-meeting-export" href="{{ url_for('ical_calendar_meeting', meeting_id=meeting.meeting_id) }}" |
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.
Might be good to place the id on the line below to keep (more or less) the 80 char rule :)
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.
Done!
This is looking very nice and working nicely as well locally. Two questions still and one remark: the tests are currently failing for me here :)
|
@pypingou I am looking into the above, and I will fix it ASAP. |
- Test for non-numeric values of reminder_delta GET param when exporting ical file for a meeting. - Test for a reminder_delta value not in default choices for reminder_delta.
3eadb40
to
b3ec5c7
Compare
@pypingou I have moved the refactor related to static js files in another branch. I have also added the remainder tests that you'd mentioned. Please review it and let me know if it's ready for merge. Please note that JS issues related to ical reminder UI elements persist for meeting details page. This has been already fixed in the branch for JS refactor. |
This is looking really good! I'm just going to wait for jenkins to kick in and then merge. |
Hooray! 🏯 This was epic. 🏰 |
This branch improves export of iCal files in the following ways:
NOTE
: This is work in progress and the PR has been created for review of ongoing work.