Added 'keep as follower' for friendship requests (needs testing)
This commit is contained in:
parent
52f892f35f
commit
641921537b
@ -817,6 +817,7 @@ class peopleBuffer(feedBuffer):
|
|||||||
# Connect the accept and decline methods from here.
|
# Connect the accept and decline methods from here.
|
||||||
widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.accept)
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.accept)
|
||||||
widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline)
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline)
|
||||||
|
widgetUtils.connect_event(m, widgetUtils.MENU, self.keep_as_follower, menuitem=m.keep_as_follower)
|
||||||
else:
|
else:
|
||||||
m = menus.peopleMenu(is_request=False)
|
m = menus.peopleMenu(is_request=False)
|
||||||
# It is not allowed to send messages to people who is not your friends, so let's disble it if we're in a pending or outgoing requests folder.
|
# It is not allowed to send messages to people who is not your friends, so let's disble it if we're in a pending or outgoing requests folder.
|
||||||
@ -839,6 +840,9 @@ class peopleBuffer(feedBuffer):
|
|||||||
def decline_friendship(self, *args, **kwargs):
|
def decline_friendship(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def keep_as_follower(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
class requestsBuffer(peopleBuffer):
|
class requestsBuffer(peopleBuffer):
|
||||||
|
|
||||||
def get_items(self, show_nextpage=False):
|
def get_items(self, show_nextpage=False):
|
||||||
@ -861,7 +865,9 @@ class requestsBuffer(peopleBuffer):
|
|||||||
return retrieved
|
return retrieved
|
||||||
|
|
||||||
def accept_friendship(self, *args, **kwargs):
|
def accept_friendship(self, *args, **kwargs):
|
||||||
""" Adds a person to a list of friends. This method is done for accepting someone else's friend requet."""
|
""" Adds a person to a list of friends. This method is done for accepting someone else's friend request.
|
||||||
|
https://vk.com/dev/friends.add
|
||||||
|
"""
|
||||||
person = self.get_post()
|
person = self.get_post()
|
||||||
result = self.session.vk.client.friends.add(user_id=person["id"])
|
result = self.session.vk.client.friends.add(user_id=person["id"])
|
||||||
if result == 2:
|
if result == 2:
|
||||||
@ -871,7 +877,9 @@ class requestsBuffer(peopleBuffer):
|
|||||||
self.tab.list.remove_item(self.tab.list.get_selected())
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
def decline_friendship(self, *args, **kwargs):
|
def decline_friendship(self, *args, **kwargs):
|
||||||
""" Declines a freind request."""
|
""" Declines a freind request.
|
||||||
|
https://vk.com/dev/friends.delete
|
||||||
|
"""
|
||||||
person = self.get_post()
|
person = self.get_post()
|
||||||
result = self.session.vk.client.friends.delete(user_id=person["id"])
|
result = self.session.vk.client.friends.delete(user_id=person["id"])
|
||||||
if "out_request_deleted" in result:
|
if "out_request_deleted" in result:
|
||||||
@ -881,3 +889,15 @@ class requestsBuffer(peopleBuffer):
|
|||||||
pub.sendMessage("notify", message=msg)
|
pub.sendMessage("notify", message=msg)
|
||||||
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
self.tab.list.remove_item(self.tab.list.get_selected())
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
||||||
|
|
||||||
|
def keep_as_follower(self, *args, **kwargs):
|
||||||
|
""" Adds a person to The followers list of the current user.
|
||||||
|
https://vk.com/dev/friends.add
|
||||||
|
"""
|
||||||
|
person = self.get_post()
|
||||||
|
result = self.session.vk.client.friends.add(user_id=person["id"], follow=1)
|
||||||
|
if result == 2:
|
||||||
|
msg = _(u"{0} {1} is following you.").format(person["first_name"], person["last_name"])
|
||||||
|
pub.sendMessage("notify", message=msg)
|
||||||
|
self.session.db[self.name]["items"].pop(self.tab.list.get_selected())
|
||||||
|
self.tab.list.remove_item(self.tab.list.get_selected())
|
@ -57,6 +57,8 @@ class peopleMenu(wx.Menu):
|
|||||||
self.Append(self.accept)
|
self.Append(self.accept)
|
||||||
self.decline = wx.MenuItem(self, wx.NewId(), _(u"Decline"))
|
self.decline = wx.MenuItem(self, wx.NewId(), _(u"Decline"))
|
||||||
self.Append(self.decline)
|
self.Append(self.decline)
|
||||||
|
self.keep_as_follower = wx.MenuItem(self, wx.NewId(), _(u"Keep as follower"))
|
||||||
|
self.Append(self.keep_as_follower)
|
||||||
|
|
||||||
class commentMenu(wx.Menu):
|
class commentMenu(wx.Menu):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user