Display quoted tweets properly when original_tweet is made with Twishort

This commit is contained in:
Manuel Cortez 2018-03-14 11:34:49 -06:00
parent a16f16d36d
commit b1c5ddbca8
3 changed files with 24 additions and 9 deletions

View File

@ -2,6 +2,7 @@
## changes in this version
* When you quote a Tweet, if the original tweet was posted with Twishort, TWBlue should display properly the quoted tweet. Before it was displaying the original tweet only. ([#206](https://github.com/manuelcortez/TWBlue/issues/206))
* It is possible to filter by retweets, quotes and replies when creating a new filter.
* Added support for playing youtube Links directly from the client. ([#94](https://github.com/manuelcortez/TWBlue/issues/94))
* Replaced Bass with libVLC for playing URL streams.

View File

@ -484,6 +484,8 @@ class Session(object):
original_tweet = self.check_long_tweet(original_tweet)
if original_tweet.has_key("full_text"):
value = "full_text"
elif original_tweet.has_key("message"):
value = "message"
else:
value = "text"
urls = utils.find_urls_in_text(original_tweet[value])
@ -495,12 +497,22 @@ class Session(object):
def check_long_tweet(self, tweet):
long = twishort.is_long(tweet)
if long != False and config.app["app-settings"]["handle_longtweets"]:
tweet["message"] = twishort.get_full_text(long)
message = twishort.get_full_text(long)
if tweet.has_key("quoted_status"):
tweet["quoted_status"]["message"] = message
if tweet["quoted_status"]["message"] == False: return False
tweet["quoted_status"]["twishort"] = True
for i in tweet["quoted_status"]["entities"]["user_mentions"]:
if "@%s" % (i["screen_name"]) not in tweet["quoted_status"]["message"] and i["screen_name"] != tweet["user"]["screen_name"]:
if tweet["quoted_status"].has_key("retweeted_status") and tweet["retweeted_status"]["user"]["screen_name"] == i["screen_name"]:
continue
tweet["quoted_status"]["message"] = u"@%s %s" % (i["screen_name"], tweet["message"])
else:
tweet["message"] = message
if tweet["message"] == False: return False
tweet["twishort"] = True
for i in tweet["entities"]["user_mentions"]:
if "@%s" % (i["screen_name"]) not in tweet["message"] and i["screen_name"] != tweet["user"]["screen_name"]:
if tweet.has_key("retweeted_status") and tweet["retweeted_status"]["user"]["screen_name"] == i["screen_name"]:
continue
tweet["message"] = u"@%s %s" % (i["screen_name"], tweet["message"])
return tweet

View File

@ -127,7 +127,9 @@ def compose_quoted_tweet(quoted_tweet, original_tweet, show_screen_names=False):
text = "rt @%s: %s" % (quoted_tweet["retweeted_status"]["user"]["screen_name"], text)
if text[-1] in chars: text=text+"."
original_user = original_tweet["user"]["screen_name"]
if original_tweet.has_key("full_text"):
if original_tweet.has_key("message"):
original_text = original_tweet["message"]
elif original_tweet.has_key("full_text"):
original_text = StripChars(original_tweet["full_text"])
else:
original_text = StripChars(original_tweet["text"])