From 9e3ff74b98162d3e48c55ff064674dad073b706a Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 31 Jan 2019 16:45:31 -0600 Subject: [PATCH] Added renderer for group topics --- src/sessionmanager/renderers.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sessionmanager/renderers.py b/src/sessionmanager/renderers.py index 4c39e81..0c08b23 100644 --- a/src/sessionmanager/renderers.py +++ b/src/sessionmanager/renderers.py @@ -249,4 +249,14 @@ def render_audio_message(audio_message, session=None): ["Voice message", "01:30:28"]""" if audio_message == False: return [_("Voice message not available"), "", ""] - return [seconds_to_string(audio_message["duration"])] \ No newline at end of file + return [seconds_to_string(audio_message["duration"])] + +def render_topic(topic, session): + user = session.get_user(topic["created_by"]) + title = topic["title"] + comments = topic["comments"] + last_commenter = session.get_user(topic["updated_by"]) + last_update = arrow.get(topic["updated"]).humanize(locale=languageHandler.curLang[:2]) + last_commenter.update(date=last_update) + lastupdate = _("Last post by {user1_nom} {date}").format(**last_commenter) + return [user["user1_nom"], title, str(comments), lastupdate] \ No newline at end of file