Show who sent calendar entry

main
Bob Mottram 2021-03-06 18:12:43 +00:00
parent beba75f9bc
commit 6b89f77ce6
3 changed files with 15 additions and 6 deletions

View File

@ -11472,7 +11472,8 @@ class PubServer(BaseHTTPRequestHandler):
if htmlGET and usersInPath:
if '/calendar' in self.path:
# show the calendar screen
msg = htmlCalendar(self.server.cssCache,
msg = htmlCalendar(self.server.personCache,
self.server.cssCache,
self.server.translate,
self.server.baseDir, self.path,
self.server.httpPrefix,

View File

@ -10,6 +10,7 @@ import os
from datetime import datetime
from datetime import date
from shutil import copyfile
from utils import getDisplayName
from utils import getConfigParam
from utils import getNicknameFromActor
from utils import getDomainFromActor
@ -94,7 +95,7 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, baseDir: str,
return deletePostStr
def _htmlCalendarDay(cssCache: {}, translate: {},
def _htmlCalendarDay(personCache: {}, cssCache: {}, translate: {},
baseDir: str, path: str,
year: int, monthNumber: int, dayNumber: int,
nickname: str, domain: str, dayEvents: [],
@ -134,6 +135,12 @@ def _htmlCalendarDay(cssCache: {}, translate: {},
eventDescription = None
eventPlace = None
postId = None
# get display name from sending actor
senderName = ''
if eventPost.get('actor'):
actor = eventPost['actor']
senderName = '<a href="' + actor + '">' + \
getDisplayName(baseDir, actor, personCache) + '</a>: '
# get the time place and description
for ev in eventPost:
if ev['type'] == 'Event':
@ -145,7 +152,7 @@ def _htmlCalendarDay(cssCache: {}, translate: {},
"%Y-%m-%dT%H:%M:%S%z")
eventTime = eventDate.strftime("%H:%M").strip()
if ev.get('name'):
eventDescription = ev['name'].strip()
eventDescription = senderName + ev['name'].strip()
elif ev['type'] == 'Place':
if ev.get('name'):
eventPlace = ev['name']
@ -200,7 +207,7 @@ def _htmlCalendarDay(cssCache: {}, translate: {},
return calendarStr
def htmlCalendar(cssCache: {}, translate: {},
def htmlCalendar(personCache: {}, cssCache: {}, translate: {},
baseDir: str, path: str,
httpPrefix: str, domainFull: str,
textModeBanner: str) -> str:
@ -259,7 +266,8 @@ def htmlCalendar(cssCache: {}, translate: {},
if events:
if events.get(str(dayNumber)):
dayEvents = events[str(dayNumber)]
return _htmlCalendarDay(cssCache, translate, baseDir, path,
return _htmlCalendarDay(personCache, cssCache,
translate, baseDir, path,
year, monthNumber, dayNumber,
nickname, domain, dayEvents,
monthName, actor)