diff --git a/src/presenters/displayPosts/basePost.py b/src/presenters/displayPosts/basePost.py index 2fcae58..d296092 100644 --- a/src/presenters/displayPosts/basePost.py +++ b/src/presenters/displayPosts/basePost.py @@ -419,7 +419,7 @@ class displayPostPresenter(base.basePresenter): def show_likes(self): """ show likes for the specified post.""" - data = dict(type="post", owner_id=self.post[self.user_identifier], item_id=self.post["id"], extended=True, count=1000, skip_own=True) + data = dict(type="post", owner_id=self.post[self.user_identifier], item_id=self.post["id"], extended=True, count=100, skip_own=True) result = self.session.vk.client.likes.getList(**data) if result["count"] > 0: post = {"source_id": self.post[self.user_identifier], "friends": {"items": result["items"]}} diff --git a/src/presenters/displayPosts/comment.py b/src/presenters/displayPosts/comment.py index 9750c71..e7d9513 100644 --- a/src/presenters/displayPosts/comment.py +++ b/src/presenters/displayPosts/comment.py @@ -5,6 +5,7 @@ import languageHandler import views import interactors import logging +from pubsub import pub from sessionmanager import renderers, utils # We'll use some functions from there from mysc.thread_utils import call_threaded from presenters import base @@ -102,4 +103,13 @@ class displayCommentPresenter(basePost.displayPostPresenter): c = self.post["thread"]["items"][comment_index] c["post_id"] = self.post["post_id"] a = displayCommentPresenter(session=self.session, postObject=c, interactor=interactors.displayPostInteractor(), view=views.displayComment()) - self.clear_comments_list() \ No newline at end of file + self.clear_comments_list() + + def show_likes(self): + """ show likes for the specified post.""" + data = dict(type="comment", owner_id=self.post["owner_id"], item_id=self.post["id"], extended=True, count=100, skip_own=True) + result = self.session.vk.client.likes.getList(**data) + print(result) + if result["count"] > 0: + post = {"source_id": self.post[self.user_identifier], "friends": {"items": result["items"]}} + pub.sendMessage("open-post", post_object=post, controller_="displayFriendship", vars=dict(caption=_("people who liked this"))) diff --git a/src/presenters/displayPosts/topicComment.py b/src/presenters/displayPosts/topicComment.py index 63cc3de..e64aaa8 100644 --- a/src/presenters/displayPosts/topicComment.py +++ b/src/presenters/displayPosts/topicComment.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import logging import output +from pubsub import pub from sessionmanager import renderers, utils # We'll use some functions from there from presenters import base from presenters.createPosts.basePost import createPostPresenter @@ -42,4 +43,12 @@ class displayTopicCommentPresenter(comment.displayCommentPresenter): self.send_message("set_label", control="like", label=_("&Dislike")) self.post["likes"]["count"] = l["likes"] self.post["likes"]["user_likes"] = 1 - self.get_likes() \ No newline at end of file + self.get_likes() + + def show_likes(self): + """ show likes for the specified post.""" + data = dict(type="topic_comment", owner_id=self.post["group_id"], item_id=self.post["id"], extended=True, count=100, skip_own=True) + result = self.session.vk.client.likes.getList(**data) + if result["count"] > 0: + post = {"source_id": self.post["group_id"], "friends": {"items": result["items"]}} + pub.sendMessage("open-post", post_object=post, controller_="displayFriendship", vars=dict(caption=_("people who liked this"))) \ No newline at end of file