Added reposts to the list of handled post in buffers

This commit is contained in:
Manuel Cortez 2016-02-22 05:53:37 -06:00
parent 3b2322f56b
commit 4e72a54d0d
3 changed files with 12 additions and 4 deletions

View File

@ -70,7 +70,7 @@ class baseBuffer(object):
if event != None: if event != None:
try: try:
getattr(self, event)() getattr(self, event)()
except KeyError: except AttributeError:
pass pass
def volume_down(self): def volume_down(self):

View File

@ -36,7 +36,10 @@ class postController(object):
if self.post.has_key("type"): if self.post.has_key("type"):
if self.post["type"] == "post": if self.post["type"] == "post":
from_ = self.session.get_user_name(self.post["source_id"]) from_ = self.session.get_user_name(self.post["source_id"])
title = _(u"Post from {0}").format(from_,) if self.post.has_key("copy_owner_id"):
title = _(u"repost from {0}").format(from_,)
else:
title = _(u"Post from {0}").format(from_,)
self.dialog.set_title(title) self.dialog.set_title(title)
message = u"" message = u""
if self.post.has_key("text"): if self.post.has_key("text"):

View File

@ -59,6 +59,8 @@ def add_text(status):
def compose_new(status, session): def compose_new(status, session):
""" This method is used to compose an item of the news feed.""" """ This method is used to compose an item of the news feed."""
user = session.get_user_name(status["source_id"]) user = session.get_user_name(status["source_id"])
if status.has_key("copy_owner_id"):
user = _(u"{0} has shared the {1}'s post").format(user, session.get_user_name(status["copy_owner_id"]))
message = "" message = ""
original_date = arrow.get(status["date"]) original_date = arrow.get(status["date"])
created_at = original_date.humanize(locale=languageHandler.getLanguage()) created_at = original_date.humanize(locale=languageHandler.getLanguage())
@ -69,7 +71,7 @@ def compose_new(status, session):
if message == "": if message == "":
message = "no description available" message = "no description available"
elif status["type"] == "audio": elif status["type"] == "audio":
message = _(u"{0} has posted an audio: {1}").format(user, u", ".join(compose_audio(status["audio"][1], session)),) message = _(u"{0} has added an audio: {1}").format(user, u", ".join(compose_audio(status["audio"][1], session)),)
elif status["type"] == "friend": elif status["type"] == "friend":
msg_users = u"" msg_users = u""
for i in status["friends"][1:]: for i in status["friends"][1:]:
@ -84,7 +86,10 @@ def compose_status(status, session):
message = "" message = ""
original_date = arrow.get(status["date"]) original_date = arrow.get(status["date"])
created_at = original_date.humanize(locale=languageHandler.getLanguage()) created_at = original_date.humanize(locale=languageHandler.getLanguage())
if status["post_type"] == "post": if status.has_key("copy_owner_id"):
user = _(u"{0} has shared the {1}'s post").format(user, session.get_user_name(status["copy_owner_id"]))
print status.keys()
if status["post_type"] == "post" or status["post_type"] == "copy":
message += add_text(status) message += add_text(status)
if status.has_key("attachment") and len(status["attachment"]) > 0: if status.has_key("attachment") and len(status["attachment"]) > 0:
message += add_attachment(status["attachment"]) message += add_attachment(status["attachment"])