From f079907a9ef39c9162ca396a9513b0fc7f38aeb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Cort=C3=A9z?= Date: Wed, 17 Aug 2016 16:25:01 -0500 Subject: [PATCH] Parse replies in comments. Start changes for #1 --- changelog.md | 1 + src/controller/posts.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 8f6b4b3..4e7542b 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,7 @@ * Added two more buffers: "Followers" and "I follow", located in the people buffer, under "friendship requests". * Added an experimental photo viewer. Will show options for see the next and previous photo if the current post contains multiple images. * Improved chats, now they should be more stable. Also you will be able to send the message by pressing enter in the text box. If you are trying to send the same message multiple times, you will be warned. +* Added video management (my videos, video albums and video search). For playing videos, you will be redirected to a website in your browser. ## Changes in build 2016.07.08 (08/07/2016) diff --git a/src/controller/posts.py b/src/controller/posts.py index 86cfce4..d5601ed 100644 --- a/src/controller/posts.py +++ b/src/controller/posts.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import re import os import cStringIO import threading @@ -104,11 +105,13 @@ class postController(object): from_ = get_user(i["from_id"], self.comments["profiles"]) if i.has_key("reply_to_user"): extra_info = get_user(i["reply_to_user"], self.comments["profiles"]) - from_ = _(u"{0} Has replied to {1}").format(from_, extra_info) - if len(i["text"]) > 140: - text = i["text"][:141] + from_ = _(u"{0} > {1}").format(from_, extra_info) + # As we set the comment reply properly in the from_ field, let's remove the first username from here if it exists. + fixed_text = re.sub("^\[id\d+\|\D+\], ", "", i["text"]) + if len(fixed_text) > 140: + text = fixed_text[:141] else: - text = i["text"] + text = fixed_text original_date = arrow.get(i["date"]) created_at = original_date.humanize(locale=languageHandler.getLanguage()) likes = str(i["likes"]["count"])