mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
messages: Remove some unnecessary zephyr code paths.
The comments explain why this change is correct. This change is useful because it's better to not have dead code paths, both because it makes our life easier for coverage analysis, and because the else statement provided the illusion that it could actually happen. If the analysis in that comment is wrong, we'd rather have a 500 error so we fix the bug than things silently sorta working.
This commit is contained in:
@@ -173,10 +173,10 @@ class NarrowBuilder(object):
|
|||||||
# MIT users expect narrowing to "social" to also show messages to /^(un)*social(.d)*$/
|
# MIT users expect narrowing to "social" to also show messages to /^(un)*social(.d)*$/
|
||||||
# (unsocial, ununsocial, social.d, etc)
|
# (unsocial, ununsocial, social.d, etc)
|
||||||
m = re.search(r'^(?:un)*(.+?)(?:\.d)*$', stream.name, re.IGNORECASE)
|
m = re.search(r'^(?:un)*(.+?)(?:\.d)*$', stream.name, re.IGNORECASE)
|
||||||
if m:
|
# Since the regex has a `.+` in it and "" is invalid as a
|
||||||
base_stream_name = m.group(1)
|
# stream name, this will always match
|
||||||
else:
|
assert(m is not None)
|
||||||
base_stream_name = stream.name
|
base_stream_name = m.group(1)
|
||||||
|
|
||||||
matching_streams = get_active_streams(self.user_profile.realm).filter(
|
matching_streams = get_active_streams(self.user_profile.realm).filter(
|
||||||
name__iregex=r'^(un)*%s(\.d)*$' % (self._pg_re_escape(base_stream_name),))
|
name__iregex=r'^(un)*%s(\.d)*$' % (self._pg_re_escape(base_stream_name),))
|
||||||
@@ -195,10 +195,9 @@ class NarrowBuilder(object):
|
|||||||
# MIT users expect narrowing to topic "foo" to also show messages to /^foo(.d)*$/
|
# MIT users expect narrowing to topic "foo" to also show messages to /^foo(.d)*$/
|
||||||
# (foo, foo.d, foo.d.d, etc)
|
# (foo, foo.d, foo.d.d, etc)
|
||||||
m = re.search(r'^(.*?)(?:\.d)*$', operand, re.IGNORECASE)
|
m = re.search(r'^(.*?)(?:\.d)*$', operand, re.IGNORECASE)
|
||||||
if m:
|
# Since the regex has a `.*` in it, this will always match
|
||||||
base_topic = m.group(1)
|
assert(m is not None)
|
||||||
else:
|
base_topic = m.group(1)
|
||||||
base_topic = operand
|
|
||||||
|
|
||||||
# Additionally, MIT users expect the empty instance and
|
# Additionally, MIT users expect the empty instance and
|
||||||
# instance "personal" to be the same.
|
# instance "personal" to be the same.
|
||||||
|
|||||||
Reference in New Issue
Block a user