Parse replies in comments. Start changes for #1

This commit is contained in:
Manuel Cortez 2016-08-17 16:25:01 -05:00
parent ee308fb5aa
commit f079907a9e
2 changed files with 8 additions and 4 deletions

View File

@ -6,6 +6,7 @@
* Added two more buffers: "Followers" and "I follow", located in the people buffer, under "friendship requests". * 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. * 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. * 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) ## Changes in build 2016.07.08 (08/07/2016)

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import re
import os import os
import cStringIO import cStringIO
import threading import threading
@ -104,11 +105,13 @@ class postController(object):
from_ = get_user(i["from_id"], self.comments["profiles"]) from_ = get_user(i["from_id"], self.comments["profiles"])
if i.has_key("reply_to_user"): if i.has_key("reply_to_user"):
extra_info = get_user(i["reply_to_user"], self.comments["profiles"]) extra_info = get_user(i["reply_to_user"], self.comments["profiles"])
from_ = _(u"{0} Has replied to {1}").format(from_, extra_info) from_ = _(u"{0} > {1}").format(from_, extra_info)
if len(i["text"]) > 140: # As we set the comment reply properly in the from_ field, let's remove the first username from here if it exists.
text = i["text"][:141] fixed_text = re.sub("^\[id\d+\|\D+\], ", "", i["text"])
if len(fixed_text) > 140:
text = fixed_text[:141]
else: else:
text = i["text"] text = fixed_text
original_date = arrow.get(i["date"]) original_date = arrow.get(i["date"])
created_at = original_date.humanize(locale=languageHandler.getLanguage()) created_at = original_date.humanize(locale=languageHandler.getLanguage())
likes = str(i["likes"]["count"]) likes = str(i["likes"]["count"])