Added experimental support to communities. Only posts are supported so far

This commit is contained in:
Manuel Cortez 2019-01-10 17:35:32 -06:00
parent 1f75ba41cf
commit 14a2313e5f
2 changed files with 2 additions and 3 deletions

View File

@ -430,7 +430,7 @@ class feedBuffer(baseBuffer):
self.can_post = True self.can_post = True
self.can_write_private_message = True self.can_write_private_message = True
# if this is an user timeline we must check permissions to hide buttons when needed. # 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") 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_post = permissions[0]["can_post"]
self.can_see_all_posts = permissions[0]["can_see_all_posts"] self.can_see_all_posts = permissions[0]["can_see_all_posts"]

View File

@ -210,7 +210,7 @@ class Controller(object):
call_threaded(self.create_unread_messages) call_threaded(self.create_unread_messages)
wx.CallAfter(self.get_audio_albums, self.session.user_id) wx.CallAfter(self.get_audio_albums, self.session.user_id)
wx.CallAfter(self.get_video_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): def create_longpoll_thread(self, notify=False):
try: try:
@ -532,7 +532,6 @@ class Controller(object):
def get_communities(self, user_id=None, create_buffers=True): def get_communities(self, user_id=None, create_buffers=True):
log.debug("Create community buffers...") 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") 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"] self.session.groups=groups["items"]
# Let's feed the local database cache with new groups coming from here. # Let's feed the local database cache with new groups coming from here.
data= dict(profiles=[], groups=groups["items"]) data= dict(profiles=[], groups=groups["items"])