Added wall posts deletion if allowed

This commit is contained in:
Manuel Cortez 2019-01-03 13:40:11 -06:00
parent e1f25475b1
commit 86c9ac93d5
3 changed files with 25 additions and 1 deletions

View File

@ -2,6 +2,11 @@
## changes in this version ## 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 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: * 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. * 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.

View File

@ -214,6 +214,8 @@ class baseBuffer(object):
widgetUtils.connect_event(m, widgetUtils.MENU, self.do_comment, menuitem=m.comment) widgetUtils.connect_event(m, widgetUtils.MENU, self.do_comment, menuitem=m.comment)
if hasattr(m, "view_profile"): if hasattr(m, "view_profile"):
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_person_profile, menuitem=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 return m
def do_like(self, *args, **kwargs): def do_like(self, *args, **kwargs):
@ -266,6 +268,20 @@ class baseBuffer(object):
except Exception as msg: except Exception as msg:
log.error(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): def get_event(self, ev):
""" Parses keyboard input in the ListCtrl and executes the event associated with user keypresses.""" """ 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" if ev.GetKeyCode() == wx.WXK_RETURN and ev.ControlDown() and ev.ShiftDown(): event = "pause_audio"

View File

@ -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() 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(): def updated_status():
return wx.MessageDialog(None, _("Your status message has been successfully updated."), _("Success")).ShowModal() 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()