mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-04-05 11:22:30 -04:00
Fixed user actions from dm's buffer. Closes #237
This commit is contained in:
parent
b4020d0f95
commit
5b5d762759
@ -694,7 +694,7 @@ class baseBufferController(bufferController):
|
|||||||
def user_details(self):
|
def user_details(self):
|
||||||
tweet = self.get_right_tweet()
|
tweet = self.get_right_tweet()
|
||||||
if self.type == "dm":
|
if self.type == "dm":
|
||||||
users = self.session.get_user(tweet["message_create"]["sender_id"])
|
users = [self.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
elif self.type == "people":
|
elif self.type == "people":
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
else:
|
else:
|
||||||
|
@ -497,7 +497,8 @@ class Controller(object):
|
|||||||
output.speak(_(u"No session is currently in focus. Focus a session with the next or previous session shortcut."), True)
|
output.speak(_(u"No session is currently in focus. Focus a session with the next or previous session shortcut."), True)
|
||||||
return
|
return
|
||||||
# Let's prevent filtering of some buffers (people buffers, direct messages, events and sent items).
|
# Let's prevent filtering of some buffers (people buffers, direct messages, events and sent items).
|
||||||
if (page.name == "direct_messages" or page.name =="sent_direct_messages" or page.name == "sent_tweets" or page.name == "events") or page.type == "people":
|
# ToDo: Remove events from here after August 16.
|
||||||
|
if (page.name == "direct_messages" or page.name == "sent_tweets" or page.name == "events") or page.type == "people":
|
||||||
output.speak(_(u"Filters cannot be applied on this buffer"))
|
output.speak(_(u"Filters cannot be applied on this buffer"))
|
||||||
return
|
return
|
||||||
new_filter = filterController.filter(page)
|
new_filter = filterController.filter(page)
|
||||||
@ -545,10 +546,12 @@ class Controller(object):
|
|||||||
buff = self.get_best_buffer()
|
buff = self.get_best_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
user = dlg.get_user()
|
user = dlg.get_user()
|
||||||
@ -560,10 +563,12 @@ class Controller(object):
|
|||||||
buff = self.get_best_buffer()
|
buff = self.get_best_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
user = dlg.get_user()
|
user = dlg.get_user()
|
||||||
@ -587,10 +592,12 @@ class Controller(object):
|
|||||||
buff = self.get_best_buffer()
|
buff = self.get_best_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
dlg = dialogs.utils.selectUserDialog(_(u"Select the user"), users)
|
||||||
if dlg.get_response() == widgetUtils.OK:
|
if dlg.get_response() == widgetUtils.OK:
|
||||||
user = dlg.get_user()
|
user = dlg.get_user()
|
||||||
@ -671,7 +678,6 @@ class Controller(object):
|
|||||||
session_.sessions[item].sound.cleaner.cancel()
|
session_.sessions[item].sound.cleaner.cancel()
|
||||||
log.debug("Shelving database for " + session_.sessions[item].session_id)
|
log.debug("Shelving database for " + session_.sessions[item].session_id)
|
||||||
session_.sessions[item].shelve()
|
session_.sessions[item].shelve()
|
||||||
|
|
||||||
if system == "Windows":
|
if system == "Windows":
|
||||||
self.systrayIcon.RemoveIcon()
|
self.systrayIcon.RemoveIcon()
|
||||||
widgetUtils.exit_application()
|
widgetUtils.exit_application()
|
||||||
@ -680,70 +686,84 @@ class Controller(object):
|
|||||||
buff = self.get_current_buffer()
|
buff = self.get_current_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
u = userActionsController.userActionsController(buff, users)
|
u = userActionsController.userActionsController(buff, users)
|
||||||
|
|
||||||
def unfollow(self, *args, **kwargs):
|
def unfollow(self, *args, **kwargs):
|
||||||
buff = self.get_current_buffer()
|
buff = self.get_current_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
u = userActionsController.userActionsController(buff, users, "unfollow")
|
u = userActionsController.userActionsController(buff, users, "unfollow")
|
||||||
|
|
||||||
def mute(self, *args, **kwargs):
|
def mute(self, *args, **kwargs):
|
||||||
buff = self.get_current_buffer()
|
buff = self.get_current_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
u = userActionsController.userActionsController(buff, users, "mute")
|
u = userActionsController.userActionsController(buff, users, "mute")
|
||||||
|
|
||||||
def unmute(self, *args, **kwargs):
|
def unmute(self, *args, **kwargs):
|
||||||
buff = self.get_current_buffer()
|
buff = self.get_current_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
u = userActionsController.userActionsController(buff, users, "unmute")
|
u = userActionsController.userActionsController(buff, users, "unmute")
|
||||||
|
|
||||||
def block(self, *args, **kwargs):
|
def block(self, *args, **kwargs):
|
||||||
buff = self.get_current_buffer()
|
buff = self.get_current_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
u = userActionsController.userActionsController(buff, users, "block")
|
u = userActionsController.userActionsController(buff, users, "block")
|
||||||
|
|
||||||
def unblock(self, *args, **kwargs):
|
def unblock(self, *args, **kwargs):
|
||||||
buff = self.get_current_buffer()
|
buff = self.get_current_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
u = userActionsController.userActionsController(buff, users, "unblock")
|
u = userActionsController.userActionsController(buff, users, "unblock")
|
||||||
|
|
||||||
def report(self, *args, **kwargs):
|
def report(self, *args, **kwargs):
|
||||||
buff = self.get_current_buffer()
|
buff = self.get_current_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
u = userActionsController.userActionsController(buff, users, "report")
|
u = userActionsController.userActionsController(buff, users, "report")
|
||||||
|
|
||||||
def post_tweet(self, event=None):
|
def post_tweet(self, event=None):
|
||||||
@ -752,16 +772,13 @@ class Controller(object):
|
|||||||
|
|
||||||
def post_reply(self, *args, **kwargs):
|
def post_reply(self, *args, **kwargs):
|
||||||
buffer = self.get_current_buffer()
|
buffer = self.get_current_buffer()
|
||||||
if buffer.name == "sent_direct_messages" or buffer.name == "sent-tweets": return
|
if buffer.name == "direct_messages":
|
||||||
elif buffer.name == "direct_messages":
|
|
||||||
buffer.direct_message()
|
buffer.direct_message()
|
||||||
else:
|
else:
|
||||||
buffer.reply()
|
buffer.reply()
|
||||||
|
|
||||||
def send_dm(self, *args, **kwargs):
|
def send_dm(self, *args, **kwargs):
|
||||||
buffer = self.get_current_buffer()
|
buffer = self.get_current_buffer()
|
||||||
if buffer.name == "sent_direct_messages" or buffer.name == "sent-tweets": return
|
|
||||||
else:
|
|
||||||
buffer.direct_message()
|
buffer.direct_message()
|
||||||
|
|
||||||
def post_retweet(self, *args, **kwargs):
|
def post_retweet(self, *args, **kwargs):
|
||||||
@ -820,10 +837,12 @@ class Controller(object):
|
|||||||
buff = self.get_best_buffer()
|
buff = self.get_best_buffer()
|
||||||
if not hasattr(buff, "get_right_tweet"): return
|
if not hasattr(buff, "get_right_tweet"): return
|
||||||
tweet = buff.get_right_tweet()
|
tweet = buff.get_right_tweet()
|
||||||
if buff.type != "people":
|
if buff.type == "people":
|
||||||
users = utils.get_all_users(tweet, buff.session.db)
|
|
||||||
else:
|
|
||||||
users = [tweet["screen_name"]]
|
users = [tweet["screen_name"]]
|
||||||
|
elif buff.type == "dm":
|
||||||
|
users = [buff.session.get_user(tweet["message_create"]["sender_id"])["screen_name"]]
|
||||||
|
else:
|
||||||
|
users = utils.get_all_users(tweet, buff.session.db)
|
||||||
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:
|
||||||
usr = utils.if_user_exists(buff.session.twitter.twitter, dlg.get_user())
|
usr = utils.if_user_exists(buff.session.twitter.twitter, dlg.get_user())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user