mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
TWBlue does not open timelines for protected users when is not possible
This commit is contained in:
parent
2e70cbc298
commit
15eb0f62ea
@ -631,7 +631,14 @@ class Controller(object):
|
|||||||
dlg = dialogs.userSelection.selectUserDialog(users=users, default=default)
|
dlg = dialogs.userSelection.selectUserDialog(users=users, default=default)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
buffer = self.get_best_buffer()
|
buffer = self.get_best_buffer()
|
||||||
if utils.if_user_exists(buffer.session.twitter.twitter, dlg.get_user()) != None:
|
usr = utils.if_user_exists(buffer.session.twitter.twitter, dlg.get_user())
|
||||||
|
if usr != None:
|
||||||
|
if usr["protected"] == True:
|
||||||
|
if usr["following"] == False:
|
||||||
|
commonMessageDialogs.no_following()
|
||||||
|
return
|
||||||
|
answer = commonMessageDialogs.protected_user()
|
||||||
|
if answer == widgetUtils.NO: return
|
||||||
if dlg.get_action() == "tweets":
|
if dlg.get_action() == "tweets":
|
||||||
if dlg.get_user() in buffer.session.settings["other_buffers"]["timelines"]:
|
if dlg.get_user() in buffer.session.settings["other_buffers"]["timelines"]:
|
||||||
commonMessageDialogs.timeline_exist()
|
commonMessageDialogs.timeline_exist()
|
||||||
|
@ -82,7 +82,7 @@ def get_all_users(tweet, conf):
|
|||||||
def if_user_exists(twitter, user):
|
def if_user_exists(twitter, user):
|
||||||
try:
|
try:
|
||||||
data = twitter.show_user(screen_name=user)
|
data = twitter.show_user(screen_name=user)
|
||||||
return data["screen_name"]
|
return data
|
||||||
except TwythonError as err:
|
except TwythonError as err:
|
||||||
if err.error_code == 404:
|
if err.error_code == 404:
|
||||||
return None
|
return None
|
||||||
|
@ -38,3 +38,9 @@ def timeline_exist():
|
|||||||
|
|
||||||
def no_tweets():
|
def no_tweets():
|
||||||
return wx.MessageDialog(None, _(u"This user has no tweets. You can't open a timeline for this user"), _(u"Error!"), wx.ICON_ERROR).ShowModal()
|
return wx.MessageDialog(None, _(u"This user has no tweets. You can't open a timeline for this user"), _(u"Error!"), wx.ICON_ERROR).ShowModal()
|
||||||
|
|
||||||
|
def protected_user():
|
||||||
|
return wx.MessageDialog(None, _(u"This is a protected Twitter user. It means you can not open a timeline using the Streaming API. The user's tweets will not update due to a twitter policy. Do you want to continue?"), _(u"Warning"), wx.ICON_WARNING|wx.YES_NO).ShowModal()
|
||||||
|
|
||||||
|
def no_following():
|
||||||
|
return wx.MessageDialog(None, _(u"This is a protected user account, you need follow to this user for viewing your tweets or favourites."), _(u"Error"), wx.ICON_ERROR).ShowModal()
|
Loading…
Reference in New Issue
Block a user