fix: Abstract code knowledge of the notes function away from specific implementations (#4761)

* fix: abstract codes knowledge of the note function away from specific implementations.

* refactor: make uses_notes a meeting's responsibility.
This commit is contained in:
Robert Sparks 2022-11-15 14:10:13 -06:00 committed by GitHub
parent 3c2e004ab8
commit 41eafa2727
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 14 deletions

View file

@ -293,7 +293,7 @@ const meetingEvents = computed(() => {
color: 'red'
})
}
if (agendaStore.useHedgeDoc) {
if (agendaStore.useNotes) {
links.push({
id: `lnk-${item.id}-note`,
label: 'Notepad for note-takers',

View file

@ -50,7 +50,7 @@ export const useAgendaStore = defineStore('agenda', {
selectedCatSubs: [],
settingsShown: false,
timezone: DateTime.local().zoneName,
useHedgeDoc: false,
useNotes: false,
visibleDays: []
}),
getters: {
@ -160,7 +160,7 @@ export const useAgendaStore = defineStore('agenda', {
this.isCurrentMeeting = agendaData.isCurrentMeeting
this.meeting = agendaData.meeting
this.schedule = agendaData.schedule
this.useHedgeDoc = agendaData.useHedgeDoc
this.useNotes = agendaData.useNotes
// -> Compute current info note hash
this.infoNoteHash = murmur(agendaData.meeting.infoNote, 0).toString()

View file

@ -405,6 +405,9 @@ class Meeting(models.Model):
def previous_meeting(self):
return Meeting.objects.filter(type_id=self.type_id,date__lt=self.date).order_by('-date').first()
def uses_notes(self):
return self.date>=datetime.date(2020,7,6)
class Meta:
ordering = ["-date", "-id"]
indexes = [

View file

@ -215,7 +215,7 @@ class MeetingTests(BaseMeetingTestCase):
},
"categories": rjson.get("categories"), # Just expect the value to exist
"isCurrentMeeting": True,
"useHedgeDoc": True,
"useNotes": True,
"schedule": rjson.get("schedule"), # Just expect the value to exist
"floors": []
}

View file

@ -1579,7 +1579,7 @@ def agenda_plain(request, num=None, name=None, base=None, ext=None, owner=None,
"now": timezone.now().astimezone(meeting.tz()),
"display_timezone": display_timezone,
"is_current_meeting": is_current_meeting,
"use_codimd": True if meeting.date>=settings.MEETING_USES_CODIMD_DATE else False,
"use_notes": meeting.uses_notes(),
"cache_time": 150 if is_current_meeting else 3600,
},
content_type=mimetype[ext],
@ -1654,7 +1654,7 @@ def api_get_agenda_data (request, num=None):
},
"categories": filter_organizer.get_filter_categories(),
"isCurrentMeeting": is_current_meeting,
"useHedgeDoc": True if meeting.date>=settings.MEETING_USES_CODIMD_DATE else False,
"useNotes": meeting.uses_notes(),
"schedule": list(map(agenda_extract_schedule, filtered_assignments)),
"floors": list(map(agenda_extract_floorplan, floors))
})
@ -2365,7 +2365,7 @@ def session_details(request, num, acronym):
'can_view_request': can_view_request,
'thisweek': datetime_today()-datetime.timedelta(days=7),
'now': timezone.now(),
'use_codimd': True if meeting.date>=settings.MEETING_USES_CODIMD_DATE else False,
'use_notes': meeting.uses_notes(),
})
class SessionDraftsForm(forms.Form):
@ -3528,7 +3528,6 @@ def upcoming(request):
'menu_entries': menu_entries,
'selected_menu_entry': selected_menu_entry,
'now': timezone.now(),
'use_codimd': (date_today() >= settings.MEETING_USES_CODIMD_DATE),
})

View file

@ -972,8 +972,6 @@ INTERNET_DRAFT_DAYS_TO_EXPIRE = 185
FLOORPLAN_MEDIA_DIR = 'floor'
FLOORPLAN_DIR = os.path.join(MEDIA_ROOT, FLOORPLAN_MEDIA_DIR)
MEETING_USES_CODIMD_DATE = datetime.date(2020,7,6)
MEETING_LEGACY_OFFICE_HOURS_END = 112 # last meeting to use legacy office hours representation
# Maximum dimensions to accept at all

View file

@ -31,8 +31,8 @@
<i class="bi bi-file-pdf"></i>
</a>
{% endif %}
{# etherpad #}
{% if use_codimd %}
{# notes #}
{% if use_notes %}
<a class="btn btn-outline-primary"
href="{{ session.notes_url }}"
aria-label="Notepad for note-takers"

View file

@ -85,7 +85,7 @@
<span class="badge rounded-pill bg-warning">Cancelled</span>
</td>
{% else %}
<td class="text-end">{% include "meeting/interim_session_buttons.html" with show_agenda=True %}</td>
<td class="text-end">{% include "meeting/interim_session_buttons.html" with show_agenda=True use_notes=meeting.uses_notes %}</td>
{% endif %}
{% endwith %}
{% else %}

View file

@ -628,7 +628,7 @@ module.exports = {
},
categories,
isCurrentMeeting: dateMode !== 'past',
useHedgeDoc: true,
useNotes: true,
schedule,
floors
}