Remove friend implementation finished

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

View File

@ -15,6 +15,7 @@
* Fixed an error in the audio player that was skipping the first track if you were in the last song and pressed "play next" in the menu bar or via the keystroke. * Fixed an error in the audio player that was skipping the first track if you were in the last song and pressed "play next" in the menu bar or via the keystroke.
* Chats with unread messages will be placed at the top of the chats section. When a chat buffer receives a new message, socializer will move the buffer to the first position in the chats list. This should make easier for everyone to determine which chats contain unread items. ([#24,](https://code.manuelcortez.net/manuelcortez/socializer/issues/24)) * Chats with unread messages will be placed at the top of the chats section. When a chat buffer receives a new message, socializer will move the buffer to the first position in the chats list. This should make easier for everyone to determine which chats contain unread items. ([#24,](https://code.manuelcortez.net/manuelcortez/socializer/issues/24))
* In dialogs for displaying posts and comments, and also in the two edit boxes present in chat buffers, it is possible to select all by pressing Control+A. * In dialogs for displaying posts and comments, and also in the two edit boxes present in chat buffers, it is possible to select all by pressing Control+A.
* Now it is possible to remove friends directly from the friends buffer. There is a new option for this purpose in the context menu for the focused friend. After being removed, the person will be placed in the subscribers buffer.
## Changes in version 0.18 (21.01.2019) ## Changes in version 0.18 (21.01.2019)

View File

@ -1080,6 +1080,7 @@ class peopleBuffer(feedBuffer):
widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.add) widgetUtils.connect_event(m, widgetUtils.MENU, self.accept_friendship, menuitem=m.add)
else: else:
m = menus.peopleMenu(is_request=False) 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. # 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: if "friend_requests" in self.name:
m.message.Enable(False) m.message.Enable(False)
@ -1107,8 +1108,7 @@ class peopleBuffer(feedBuffer):
return return
result = self.session.vk.client.friends.delete(user_id=person["id"]) result = self.session.vk.client.friends.delete(user_id=person["id"])
if "friend_deleted" in result: if "friend_deleted" in result:
msg = _("You've deleted {user1_nom} from your friends.").format(**user,) msg = _("You've removed {user1_nom} from your friends.").format(**user,)
print(msg)
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())

View File

@ -58,6 +58,9 @@ class peopleMenu(wx.Menu):
self.Append(self.timeline) self.Append(self.timeline)
self.common_friends = wx.MenuItem(self, wx.NewId(), _("View friends in common")) self.common_friends = wx.MenuItem(self, wx.NewId(), _("View friends in common"))
self.Append(self.common_friends) 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): def create_request_items(self):
self.accept = wx.MenuItem(self, wx.NewId(), _("Accept")) self.accept = wx.MenuItem(self, wx.NewId(), _("Accept"))