Now that HS->HS Profile lookups use Federation Queries, we don't need the 'local_only' antirecursion hack
This commit is contained in:
parent
505917cb97
commit
80c056c148
|
@ -50,14 +50,14 @@ class ProfileHandler(BaseHandler):
|
||||||
self.store.create_profile(user.localpart)
|
self.store.create_profile(user.localpart)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_displayname(self, target_user, local_only=False):
|
def get_displayname(self, target_user):
|
||||||
if target_user.is_mine:
|
if target_user.is_mine:
|
||||||
displayname = yield self.store.get_profile_displayname(
|
displayname = yield self.store.get_profile_displayname(
|
||||||
target_user.localpart
|
target_user.localpart
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue(displayname)
|
defer.returnValue(displayname)
|
||||||
elif not local_only:
|
else:
|
||||||
try:
|
try:
|
||||||
result = yield self.federation.make_query(
|
result = yield self.federation.make_query(
|
||||||
destination=target_user.domain,
|
destination=target_user.domain,
|
||||||
|
@ -76,8 +76,6 @@ class ProfileHandler(BaseHandler):
|
||||||
logger.exception("Failed to get displayname")
|
logger.exception("Failed to get displayname")
|
||||||
else:
|
else:
|
||||||
defer.returnValue(result["displayname"])
|
defer.returnValue(result["displayname"])
|
||||||
else:
|
|
||||||
raise SynapseError(400, "User is not hosted on this Home Server")
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def set_displayname(self, target_user, auth_user, new_displayname):
|
def set_displayname(self, target_user, auth_user, new_displayname):
|
||||||
|
@ -100,14 +98,14 @@ class ProfileHandler(BaseHandler):
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_avatar_url(self, target_user, local_only=False):
|
def get_avatar_url(self, target_user):
|
||||||
if target_user.is_mine:
|
if target_user.is_mine:
|
||||||
avatar_url = yield self.store.get_profile_avatar_url(
|
avatar_url = yield self.store.get_profile_avatar_url(
|
||||||
target_user.localpart
|
target_user.localpart
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue(avatar_url)
|
defer.returnValue(avatar_url)
|
||||||
elif not local_only:
|
else:
|
||||||
try:
|
try:
|
||||||
result = yield self.federation.make_query(
|
result = yield self.federation.make_query(
|
||||||
destination=target_user.domain,
|
destination=target_user.domain,
|
||||||
|
@ -125,8 +123,6 @@ class ProfileHandler(BaseHandler):
|
||||||
logger.exception("Failed to get avatar_url")
|
logger.exception("Failed to get avatar_url")
|
||||||
|
|
||||||
defer.returnValue(result["avatar_url"])
|
defer.returnValue(result["avatar_url"])
|
||||||
else:
|
|
||||||
raise SynapseError(400, "User is not hosted on this Home Server")
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def set_avatar_url(self, target_user, auth_user, new_avatar_url):
|
def set_avatar_url(self, target_user, auth_user, new_avatar_url):
|
||||||
|
|
|
@ -30,7 +30,6 @@ class ProfileDisplaynameRestServlet(RestServlet):
|
||||||
|
|
||||||
displayname = yield self.handlers.profile_handler.get_displayname(
|
displayname = yield self.handlers.profile_handler.get_displayname(
|
||||||
user,
|
user,
|
||||||
local_only="local_only" in request.args
|
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue((200, {"displayname": displayname}))
|
defer.returnValue((200, {"displayname": displayname}))
|
||||||
|
@ -64,7 +63,6 @@ class ProfileAvatarURLRestServlet(RestServlet):
|
||||||
|
|
||||||
avatar_url = yield self.handlers.profile_handler.get_avatar_url(
|
avatar_url = yield self.handlers.profile_handler.get_avatar_url(
|
||||||
user,
|
user,
|
||||||
local_only="local_only" in request.args
|
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue((200, {"avatar_url": avatar_url}))
|
defer.returnValue((200, {"avatar_url": avatar_url}))
|
||||||
|
|
Loading…
Reference in New Issue