From 14a2313e5f3ca35cafdccc0a5d25cf462a9a5f62 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Thu, 10 Jan 2019 17:35:32 -0600 Subject: [PATCH] Added experimental support to communities. Only posts are supported so far --- src/controller/buffers.py | 2 +- src/controller/mainController.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/controller/buffers.py b/src/controller/buffers.py index 540cf59..baf78fc 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -430,7 +430,7 @@ class feedBuffer(baseBuffer): self.can_post = True self.can_write_private_message = True # if this is an user timeline we must check permissions to hide buttons when needed. - if "owner_id" in self.kwargs: + if "owner_id" in self.kwargs and self.kwargs["owner_id"] > 0: permissions = self.session.vk.client.users.get(user_ids=self.kwargs["owner_id"], fields="can_post, can_see_all_posts, can_write_private_message") self.can_post = permissions[0]["can_post"] self.can_see_all_posts = permissions[0]["can_see_all_posts"] diff --git a/src/controller/mainController.py b/src/controller/mainController.py index 5a296cf..9cf9099 100644 --- a/src/controller/mainController.py +++ b/src/controller/mainController.py @@ -210,7 +210,7 @@ class Controller(object): call_threaded(self.create_unread_messages) wx.CallAfter(self.get_audio_albums, self.session.user_id) wx.CallAfter(self.get_video_albums, self.session.user_id) -# wx.CallAfter(self.get_communities, self.session.user_id) + wx.CallAfter(self.get_communities, self.session.user_id) def create_longpoll_thread(self, notify=False): try: @@ -532,7 +532,6 @@ class Controller(object): def get_communities(self, user_id=None, create_buffers=True): log.debug("Create community buffers...") groups= self.session.vk.client.groups.get(user_id=user_id, extended=1, fields="city, country, place, description, wiki_page, members_count, counters, start_date, finish_date, can_post, can_see_all_posts, activity, status, contacts, links, fixed_post, verified, site, can_create_topic") -# print(list(groups.keys())) self.session.groups=groups["items"] # Let's feed the local database cache with new groups coming from here. data= dict(profiles=[], groups=groups["items"])