diff --git a/changelog.md b/changelog.md index 5a5cc8b..405e9e0 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,11 @@ ## changes in this version +* Now it is possible to post in someone else's wall. When viewing a timeline of an user, the "post" button will post in his/her wall. To post in your own wall, you'll need to go to the newsfeed or your own wall and press the post button. +* A new option for deleting wall posts has been added to the context menu in newsfeed and walls (current user's wall and timelines). This option will be visible only if the current user is allowed to delete the focused post. + +## Changes in version 0.17 (01.01.2019) + * Added support for Two factor authentication (2FA). ([#13,](https://code.manuelcortez.net/manuelcortez/socializer/issues/13)) * Added update channels in socializer. You can subscribe to the "stable" or "alpha" channel from the preferences dialog and you will receive updates published for those: * The stable channel will have releases every month, approximately, and is the channel where the code will be more tested and with less bugs. All support and help will be provided for the stable versions only. diff --git a/src/controller/buffers.py b/src/controller/buffers.py index ddd2288..39959fe 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -214,6 +214,8 @@ class baseBuffer(object): widgetUtils.connect_event(m, widgetUtils.MENU, self.do_comment, menuitem=m.comment) if hasattr(m, "view_profile"): widgetUtils.connect_event(m, widgetUtils.MENU, self.open_person_profile, menuitem=m.view_profile) + if hasattr(m, "delete"): + widgetUtils.connect_event(m, widgetUtils.MENU, self.delete, menuitem=m.delete) return m def do_like(self, *args, **kwargs): @@ -266,6 +268,20 @@ class baseBuffer(object): except Exception as msg: log.error(msg) + def delete(self, *args, **kwargs): + post = self.get_post() + if ("type" in post and post["type"] == "post") or self.name != "newsfeed": + question = commonMessages.remove_post() + if question == widgetUtils.NO: + return + if "owner_id" in self.kwargs: + result = self.session.vk.client.wall.delete(owner_id=self.kwargs["owner_id"], post_id=post[self.post_key]) + else: + result = self.session.vk.client.wall.delete(post_id=post[self.post_key]) + pub.sendMessage("post_deleted", post_id=post[self.post_key]) + self.session.db[self.name]["items"].pop(self.tab.list.get_selected()) + self.tab.list.remove_item(self.tab.list.get_selected()) + def get_event(self, ev): """ Parses keyboard input in the ListCtrl and executes the event associated with user keypresses.""" if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown() and ev.ShiftDown(): event = "pause_audio" diff --git a/src/wxUI/commonMessages.py b/src/wxUI/commonMessages.py index 74dbea2..3a7f46a 100644 --- a/src/wxUI/commonMessages.py +++ b/src/wxUI/commonMessages.py @@ -36,4 +36,7 @@ def delete_audio_album(): return wx.MessageDialog(None, _("Do you really want to delete this Album? this will be deleted from VK too."), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() def updated_status(): - return wx.MessageDialog(None, _("Your status message has been successfully updated."), _("Success")).ShowModal() \ No newline at end of file + return wx.MessageDialog(None, _("Your status message has been successfully updated."), _("Success")).ShowModal() + +def remove_post(): + return wx.MessageDialog(None, _("Do you really want to delete this post?"), _("Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal() \ No newline at end of file