Revert "Merge two of the room join codepaths"

This reverts commit cf81375b94.

It subtly violates a guest joining auth check
This commit is contained in:
Daniel Wagner-Hall 2016-02-12 16:17:24 +00:00
parent d7aa103f00
commit 4de08a4672
5 changed files with 69 additions and 73 deletions

View file

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from synapse.api.errors import SynapseError, BadIdentifierError
from synapse.api.errors import SynapseError
from collections import namedtuple
@ -51,13 +51,13 @@ class DomainSpecificString(
def from_string(cls, s):
"""Parse the string given by 's' into a structure object."""
if len(s) < 1 or s[0] != cls.SIGIL:
raise BadIdentifierError(400, "Expected %s string to start with '%s'" % (
raise SynapseError(400, "Expected %s string to start with '%s'" % (
cls.__name__, cls.SIGIL,
))
parts = s[1:].split(':', 1)
if len(parts) != 2:
raise BadIdentifierError(
raise SynapseError(
400, "Expected %s of the form '%slocalname:domain'" % (
cls.__name__, cls.SIGIL,
)
@ -69,14 +69,6 @@ class DomainSpecificString(
# names on one HS
return cls(localpart=parts[0], domain=domain)
@classmethod
def is_valid(cls, s):
try:
cls.from_string(s)
return True
except:
return False
def to_string(self):
"""Return a string encoding the fields of the structure object."""
return "%s%s:%s" % (self.SIGIL, self.localpart, self.domain)