(pubsub) Refresh comments when a new one is added in wall posts and comments

This commit is contained in:
Manuel Cortez 2019-09-18 14:49:00 -05:00
parent 33ba50a7b4
commit ee6370bb0b
2 changed files with 9 additions and 0 deletions

View File

@ -58,7 +58,13 @@ class displayPostPresenter(base.basePresenter):
self.worker = threading.Thread(target=self.load_all_components) self.worker = threading.Thread(target=self.load_all_components)
self.worker.finished = threading.Event() self.worker.finished = threading.Event()
self.worker.start() self.worker.start()
# connect here the pubsub event for successful posting of comments.
pub.subscribe(self.posted, "posted")
self.run() self.run()
pub.unsubscribe(self.posted, "posted")
def posted(self, from_buffer=None):
self.clear_comments_list()
def get_comments(self): def get_comments(self):
""" Get comments and insert them in a list.""" """ Get comments and insert them in a list."""

View File

@ -40,7 +40,10 @@ class displayCommentPresenter(basePost.displayPostPresenter):
# We'll put images here, so it will be easier to work with them. # We'll put images here, so it will be easier to work with them.
self.images = [] self.images = []
self.imageIndex = 0 self.imageIndex = 0
# connect here the pubsub event for successful posting of comments.
pub.subscribe(self.posted, "posted")
self.run() self.run()
pub.unsubscribe(self.posted, "posted")
def load_all_components(self): def load_all_components(self):
self.get_post_information() self.get_post_information()