forked from MirrorHub/synapse
Merge pull request #2560 from matrix-org/rav/kill_pointless_method
Remove pointless create() method
This commit is contained in:
commit
bd0d84bf92
6 changed files with 8 additions and 12 deletions
|
@ -55,7 +55,7 @@ class EventBuilderFactory(object):
|
|||
|
||||
local_part = str(int(self.clock.time())) + i + random_string(5)
|
||||
|
||||
e_id = EventID.create(local_part, self.hostname)
|
||||
e_id = EventID(local_part, self.hostname)
|
||||
|
||||
return e_id.to_string()
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ class AuthHandler(BaseHandler):
|
|||
user_id = authdict["user"]
|
||||
password = authdict["password"]
|
||||
if not user_id.startswith('@'):
|
||||
user_id = UserID.create(user_id, self.hs.hostname).to_string()
|
||||
user_id = UserID(user_id, self.hs.hostname).to_string()
|
||||
|
||||
return self._check_password(user_id, password)
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ class RoomCreationHandler(BaseHandler):
|
|||
if wchar in config["room_alias_name"]:
|
||||
raise SynapseError(400, "Invalid characters in room alias")
|
||||
|
||||
room_alias = RoomAlias.create(
|
||||
room_alias = RoomAlias(
|
||||
config["room_alias_name"],
|
||||
self.hs.hostname,
|
||||
)
|
||||
|
@ -123,7 +123,7 @@ class RoomCreationHandler(BaseHandler):
|
|||
while attempts < 5:
|
||||
try:
|
||||
random_string = stringutils.random_string(18)
|
||||
gen_room_id = RoomID.create(
|
||||
gen_room_id = RoomID(
|
||||
random_string,
|
||||
self.hs.hostname,
|
||||
)
|
||||
|
|
|
@ -211,7 +211,7 @@ class LoginRestServlet(ClientV1RestServlet):
|
|||
user_id = identifier["user"]
|
||||
|
||||
if not user_id.startswith('@'):
|
||||
user_id = UserID.create(
|
||||
user_id = UserID(
|
||||
user_id, self.hs.hostname
|
||||
).to_string()
|
||||
|
||||
|
@ -278,7 +278,7 @@ class LoginRestServlet(ClientV1RestServlet):
|
|||
if user is None:
|
||||
raise LoginError(401, "Invalid JWT", errcode=Codes.UNAUTHORIZED)
|
||||
|
||||
user_id = UserID.create(user, self.hs.hostname).to_string()
|
||||
user_id = UserID(user, self.hs.hostname).to_string()
|
||||
auth_handler = self.auth_handler
|
||||
registered_user_id = yield auth_handler.check_user_exists(user_id)
|
||||
if registered_user_id:
|
||||
|
@ -444,7 +444,7 @@ class CasTicketServlet(ClientV1RestServlet):
|
|||
if required_value != actual_value:
|
||||
raise LoginError(401, "Unauthorized", errcode=Codes.UNAUTHORIZED)
|
||||
|
||||
user_id = UserID.create(user, self.hs.hostname).to_string()
|
||||
user_id = UserID(user, self.hs.hostname).to_string()
|
||||
auth_handler = self.auth_handler
|
||||
registered_user_id = yield auth_handler.check_user_exists(user_id)
|
||||
if not registered_user_id:
|
||||
|
|
|
@ -412,7 +412,7 @@ class GroupCreateServlet(RestServlet):
|
|||
# TODO: Create group on remote server
|
||||
content = parse_json_object_from_request(request)
|
||||
localpart = content.pop("localpart")
|
||||
group_id = GroupID.create(localpart, self.server_name).to_string()
|
||||
group_id = GroupID(localpart, self.server_name).to_string()
|
||||
|
||||
result = yield self.groups_handler.create_group(group_id, user_id, content)
|
||||
|
||||
|
|
|
@ -131,10 +131,6 @@ class DomainSpecificString(
|
|||
|
||||
__str__ = to_string
|
||||
|
||||
@classmethod
|
||||
def create(cls, localpart, domain,):
|
||||
return cls(localpart=localpart, domain=domain)
|
||||
|
||||
|
||||
class UserID(DomainSpecificString):
|
||||
"""Structure representing a user ID."""
|
||||
|
|
Loading…
Reference in a new issue