Finished fault tolerance in socializer. Now also topic comments are fully supported
This commit is contained in:
parent
4e14801db6
commit
63fb0e0ff9
@ -4,6 +4,7 @@
|
||||
|
||||
### New additions
|
||||
|
||||
* Socializer is now more tolerant to internet issues. When attempting to create a wall post, comment, topic or send a chat message, if the data is unable to be posted to VK, socializer will allow you to try to post it again, giving you the opportunity to edit or copy the text of the post in case you want to save it for later.
|
||||
* when selecting multiple audio files in audio buffers, multiple actions can be performed in all items, these actions are present in the contextual menu of the buffer (namely play, add/remove from the library and move to a different playlist). This means you can select all the audios you want and Socializer will perform the selected options in all items, making it a bit easier to operate with multiple songs.
|
||||
* Now it is possible to like and see who liked a comment when displaying it individually. This applies to comments in wall posts and topics.
|
||||
* Now it is possible to choose how many items Socializer will load in conversation buffers, from the General tab in the preferences dialog. The default value is 50 items, and the maximum value is 200.
|
||||
@ -19,7 +20,6 @@
|
||||
|
||||
### Changes
|
||||
|
||||
* Socializer is now more tolerant to internet issues. When attempting to create a wall post, topic or send a chat message, if the data is unable to be posted to VK, socializer will allow you to try to post it again, giving you the opportunity to edit or copy the text of the post in case you want to save it for later. Later change will also be introduced when posting comments, too.
|
||||
* Less confidential user data will be send to the logs, so it will be much safer to pass logs publicly.
|
||||
* automatic update checks will be disabled if using socializer from the source code.
|
||||
* it is possible to post in an user's wall by using the post button located next to the user, in people buffers. This applies only to online users and list of friends.
|
||||
|
@ -376,6 +376,13 @@ class Controller(object):
|
||||
if hasattr(p, "attachments"):
|
||||
attachments_list = p.attachments
|
||||
call_threaded(pub.sendMessage, "post", parent_endpoint=parent_endpoint, child_endpoint=child_endpoint, from_buffer=from_buffer, attachments_list=attachments_list, post_arguments=post_arguments)
|
||||
elif child_endpoint == "createComment": # topic comments.
|
||||
p = presenters.createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=_("Add a comment to the topic"), message="", text=post_arguments.get("message"), mode="comment"))
|
||||
if hasattr(p, "text") or hasattr(p, "privacy"):
|
||||
post_arguments.update(message=p.text)
|
||||
if hasattr(p, "attachments"):
|
||||
attachments_list = p.attachments
|
||||
call_threaded(pub.sendMessage, "post", parent_endpoint=parent_endpoint, child_endpoint=child_endpoint, from_buffer=from_buffer, attachments_list=attachments_list, post_arguments=post_arguments)
|
||||
elif parent_endpoint == "messages": # Private messages
|
||||
if child_endpoint == "send":
|
||||
buffer = self.search(from_buffer)
|
||||
|
@ -6,6 +6,7 @@ import views
|
||||
import interactors
|
||||
import output
|
||||
import logging
|
||||
from pubsub import pub
|
||||
from sessionmanager import utils # We'll use some functions from there
|
||||
from mysc.thread_utils import call_threaded
|
||||
from presenters import base
|
||||
@ -39,7 +40,10 @@ class displayTopicPresenter(basePost.displayPostPresenter):
|
||||
self.worker.finished = threading.Event()
|
||||
self.worker.start()
|
||||
self.attachments = []
|
||||
# connect pubsub event for posted comments.
|
||||
pub.subscribe(self.posted, "posted")
|
||||
self.run()
|
||||
pub.unsubscribe(self.posted, "posted")
|
||||
|
||||
def load_all_components(self):
|
||||
self.get_comments()
|
||||
@ -106,23 +110,11 @@ class displayTopicPresenter(basePost.displayPostPresenter):
|
||||
def add_comment(self):
|
||||
comment = createPostPresenter(session=self.session, interactor=interactors.createPostInteractor(), view=views.createPostDialog(title=_("Add a comment"), message="", text="", mode="comment"))
|
||||
if hasattr(comment, "text") or hasattr(comment, "privacy"):
|
||||
group_id = self.group_id
|
||||
topic_id = self.post["id"]
|
||||
call_threaded(self.do_last, comment, group_id=group_id, topic_id=topic_id)
|
||||
|
||||
def do_last(self, comment, **kwargs):
|
||||
msg = comment.text
|
||||
attachments = ""
|
||||
if hasattr(comment, "attachments"):
|
||||
attachments = self.upload_attachments(comment.attachments)
|
||||
if msg != "":
|
||||
kwargs.update(message=msg)
|
||||
if attachments != "":
|
||||
kwargs.update(attachments=attachments)
|
||||
if "message" not in kwargs and "attachments" not in kwargs:
|
||||
return # No comment made here.
|
||||
result = self.session.vk.client.board.createComment(**kwargs)
|
||||
self.clear_comments_list()
|
||||
post_arguments = dict(group_id=self.group_id, topic_id=self.post["id"], message=comment.text)
|
||||
attachments = []
|
||||
if hasattr(comment, "attachments"):
|
||||
attachments = comment.attachments
|
||||
call_threaded(pub.sendMessage, "post", parent_endpoint="board", child_endpoint="createComment", attachments_list=attachments, post_arguments=post_arguments)
|
||||
|
||||
def reply(self, comment):
|
||||
c = self.comments["items"][comment]
|
||||
@ -133,7 +125,11 @@ class displayTopicPresenter(basePost.displayPostPresenter):
|
||||
comment.text = "[post{post_id}|{name}], {text}".format(post_id=c["id"], text=comment.text, name=name)
|
||||
group_id = self.group_id
|
||||
topic_id = self.post["id"]
|
||||
call_threaded(self.do_last, comment, group_id=group_id, topic_id=topic_id, reply_to_comment=c["id"])
|
||||
post_arguments = dict(group_id=group_id, topic_id=topic_id, reply_to_comment=c["id"], message=comment.text)
|
||||
attachments = []
|
||||
if hasattr(comment, "attachments"):
|
||||
attachments = comment.attachments
|
||||
call_threaded(pub.sendMessage, "post", parent_endpoint="board", child_endpoint="createComment", attachments_list=attachments, post_arguments=post_arguments)
|
||||
|
||||
def show_comment(self, comment_index):
|
||||
c = self.comments["items"][comment_index]
|
||||
@ -167,3 +163,6 @@ class displayTopicPresenter(basePost.displayPostPresenter):
|
||||
if left_comments > 100:
|
||||
left_comments = 100
|
||||
self.send_message("set_label", control="load_more_comments", label=_("Load {comments} previous comments").format(comments=left_comments))
|
||||
|
||||
def posted(self, from_buffer=None):
|
||||
self.clear_comments_list()
|
Loading…
Reference in New Issue
Block a user