Now it is possible to create a timeline by using an user domain. Closes #18

This commit is contained in:
Manuel Cortez 2019-01-03 17:53:51 -06:00
parent 536aea6c48
commit 9d2fc5bc6e
2 changed files with 11 additions and 3 deletions

View File

@ -4,6 +4,8 @@
* Now it is possible to post in someone else's wall. When viewing a timeline of an user, the "post" button will post in his/her wall. To post in your own wall, you'll need to go to the newsfeed or your own wall and press the post button. * Now it is possible to post in someone else's wall. When viewing a timeline of an user, the "post" button will post in his/her wall. To post in your own wall, you'll need to go to the newsfeed or your own wall and press the post button.
* A new option for deleting wall posts has been added to the context menu in newsfeed and walls (current user's wall and timelines). This option will be visible only if the current user is allowed to delete the focused post. * A new option for deleting wall posts has been added to the context menu in newsfeed and walls (current user's wall and timelines). This option will be visible only if the current user is allowed to delete the focused post.
* Socializer will be able to handle all users correctly. Before, if an user that was not present in the local storage system was needed, the program was displaying "no specified user". ([#17,](https://code.manuelcortez.net/manuelcortez/socializer/issues/17))
* It is possible to use user domains (short names for users) to create timelines. Just write @username and the program will create the needed timelines, regardless if the user is present in your friend list. ([#18,](https://code.manuelcortez.net/manuelcortez/socializer/issues/18))
## Changes in version 0.17 (01.01.2019) ## Changes in version 0.17 (01.01.2019)

View File

@ -331,11 +331,14 @@ class Controller(object):
def new_timeline(self, *args, **kwargs): def new_timeline(self, *args, **kwargs):
b = self.get_current_buffer() b = self.get_current_buffer()
# If executing this method from an empty buffer we should get the newsfeed buffer.
if not hasattr(b, "get_users"): if not hasattr(b, "get_users"):
b = self.search("home_timeline") b = self.search("home_timeline")
# Get a list of (id, user) objects.
d = [] d = []
for i in self.session.db["users"]: for i in self.session.db["users"]:
d.append((i, self.session.get_user_name(i, "nom"))) d.append((i, self.session.get_user_name(i, "nom")))
# Do the same for communities.
for i in self.session.db["groups"]: for i in self.session.db["groups"]:
d.append((-i, self.session.get_user_name(-i))) d.append((-i, self.session.get_user_name(-i)))
a = timeline.timelineDialog([i[1] for i in d]) a = timeline.timelineDialog([i[1] for i in d])
@ -346,9 +349,12 @@ class Controller(object):
for i in d: for i in d:
if i[1] == user: if i[1] == user:
user_id = i[0] user_id = i[0]
if user_id == None: if user_id == "":
commonMessages.no_user_exist() user_data = self.session.vk.client.utils.resolveScreenName(screen_name=user)
return if type(user_data) == list:
commonMessages.no_user_exist()
return
user_id = user_data["object_id"]
if buffertype == "audio": if buffertype == "audio":
buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio".format(user_id,), composefunc="render_audio", session=self.session, endpoint="get", parent_endpoint="audio", owner_id=user_id) buffer = buffers.audioBuffer(parent=self.window.tb, name="{0}_audio".format(user_id,), composefunc="render_audio", session=self.session, endpoint="get", parent_endpoint="audio", owner_id=user_id)
# Translators: {0} will be replaced with an user. # Translators: {0} will be replaced with an user.