Remove friend implementation finished

This commit is contained in:
2019-01-24 17:10:32 -06:00
parent 56424cf0d1
commit 712792ac9f
3 changed files with 6 additions and 2 deletions

View File

@@ -1080,6 +1080,7 @@ class peopleBuffer(feedBuffer):
widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.add)
else:
m = menus.peopleMenu(is_request=False)
widgetUtils.connect_event(m, widgetUtils.MENU, self.decline_friendship, menuitem=m.decline)
# It is not allowed to send messages to people who is not your friends, so let's disable it if we're in a pending or outgoing requests folder.
if "friend_requests" in self.name:
m.message.Enable(False)
@@ -1107,8 +1108,7 @@ class peopleBuffer(feedBuffer):
return
result = self.session.vk.client.friends.delete(user_id=person["id"])
if "friend_deleted" in result:
msg = _("You've deleted {user1_nom} from your friends.").format(**user,)
print(msg)
msg = _("You've removed {user1_nom} from your friends.").format(**user,)
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())

View File

@@ -58,6 +58,9 @@ class peopleMenu(wx.Menu):
self.Append(self.timeline)
self.common_friends = wx.MenuItem(self, wx.NewId(), _("View friends in common"))
self.Append(self.common_friends)
if is_request == False and is_subscriber == False:
self.decline = wx.MenuItem(self, wx.NewId(), _("Remove from friends"))
self.Append(self.decline)
def create_request_items(self):
self.accept = wx.MenuItem(self, wx.NewId(), _("Accept"))