DisplayPost: It is possible to see who liked a comment or topic comment by pressing the likes button

This commit is contained in:
Manuel Cortez 2019-08-27 08:29:02 -05:00
parent 52e55a24fa
commit 2ed26bc8d9
3 changed files with 22 additions and 3 deletions

View File

@ -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"]}}

View File

@ -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()
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")))

View File

@ -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()
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")))