alert_words: Remove unnecessary do_set_alert_words.

This function was only in test_bugdown.py and did the same thing as
add_alert_words in that context.
This commit is contained in:
Abhishek-Balaji
2020-04-15 16:04:26 +05:30
committed by Tim Abbott
parent b3ce150aac
commit c83f147a9a
2 changed files with 9 additions and 13 deletions

View File

@@ -145,7 +145,7 @@ from zerver.decorator import statsd_increment
from zerver.lib.utils import log_statsd_event, statsd
from zerver.lib.i18n import get_language_name
from zerver.lib.alert_words import add_user_alert_words, \
remove_user_alert_words, set_user_alert_words
remove_user_alert_words
from zerver.lib.email_notifications import enqueue_welcome_emails
from zerver.lib.exceptions import JsonableError, ErrorCode, BugdownRenderingException
from zerver.lib.sessions import delete_user_sessions
@@ -5370,10 +5370,6 @@ def do_remove_alert_words(user_profile: UserProfile, alert_words: Iterable[str])
words = remove_user_alert_words(user_profile, alert_words)
notify_alert_words(user_profile, words)
def do_set_alert_words(user_profile: UserProfile, alert_words: List[str]) -> None:
set_user_alert_words(user_profile, alert_words)
notify_alert_words(user_profile, alert_words)
def do_mute_topic(user_profile: UserProfile, stream: Stream, recipient: Recipient, topic: str,
date_muted: Optional[datetime.datetime]=None) -> None:
if date_muted is None:

View File

@@ -5,7 +5,7 @@ from zerver.lib import bugdown
from zerver.lib.actions import (
do_set_user_display_setting,
do_remove_realm_emoji,
do_set_alert_words,
do_add_alert_words,
do_set_realm_property,
)
from zerver.lib.alert_words import get_alert_word_automaton
@@ -1115,7 +1115,7 @@ class BugdownTest(ZulipTestCase):
def test_alert_words(self) -> None:
user_profile = self.example_user('othello')
do_set_alert_words(user_profile, ["ALERTWORD", "scaryword"])
do_add_alert_words(user_profile, ["ALERTWORD", "scaryword"])
msg = Message(sender=user_profile, sending_client=get_client("test"))
realm_alert_words_automaton = get_alert_word_automaton(user_profile.realm)
@@ -1146,7 +1146,7 @@ class BugdownTest(ZulipTestCase):
user_profile = self.example_user(username)
user_profiles.update({username: user_profile})
user_ids.add(user_profile.id)
do_set_alert_words(user_profile, alert_words)
do_add_alert_words(user_profile, alert_words)
sender_user_profile = self.example_user('polonius')
user_ids.add(sender_user_profile.id)
msg = Message(sender=sender_user_profile, sending_client=get_client("test"))
@@ -1180,7 +1180,7 @@ class BugdownTest(ZulipTestCase):
user_profile = self.example_user(username)
user_profiles.update({username: user_profile})
user_ids.add(user_profile.id)
do_set_alert_words(user_profile, alert_words)
do_add_alert_words(user_profile, alert_words)
sender_user_profile = self.example_user('polonius')
user_ids.add(sender_user_profile.id)
msg = Message(sender=sender_user_profile, sending_client=get_client("test"))
@@ -1221,7 +1221,7 @@ class BugdownTest(ZulipTestCase):
user_profile = self.example_user(username)
user_profiles.update({username: user_profile})
user_ids.add(user_profile.id)
do_set_alert_words(user_profile, alert_words)
do_add_alert_words(user_profile, alert_words)
sender_user_profile = self.example_user('polonius')
user_ids.add(sender_user_profile.id)
msg = Message(sender=sender_user_profile, sending_client=get_client("test"))
@@ -1252,7 +1252,7 @@ class BugdownTest(ZulipTestCase):
for (username, alert_words) in alert_words_for_users.items():
user_profile = self.example_user(username)
user_profiles.update({username: user_profile})
do_set_alert_words(user_profile, alert_words)
do_add_alert_words(user_profile, alert_words)
sender_user_profile = self.example_user('polonius')
msg = Message(sender=user_profile, sending_client=get_client("test"))
realm_alert_words_automaton = get_alert_word_automaton(sender_user_profile.realm)
@@ -1288,7 +1288,7 @@ class BugdownTest(ZulipTestCase):
for (username, alert_words) in alert_words_for_users.items():
user_profile = self.example_user(username)
user_profiles.update({username: user_profile})
do_set_alert_words(user_profile, alert_words)
do_add_alert_words(user_profile, alert_words)
sender_user_profile = self.example_user('polonius')
user_ids = {user_profiles['hamlet'].id, user_profiles['iago'].id, user_profiles['othello'].id}
msg = Message(sender=sender_user_profile, sending_client=get_client("test"))
@@ -1318,7 +1318,7 @@ class BugdownTest(ZulipTestCase):
for (username, alert_words) in alert_words_for_users.items():
user_profile = self.example_user(username)
user_profiles.update({username: user_profile})
do_set_alert_words(user_profile, alert_words)
do_add_alert_words(user_profile, alert_words)
sender_user_profile = self.example_user('polonius')
user_ids = {user_profiles['hamlet'].id, user_profiles['iago'].id, user_profiles['othello'].id}
msg = Message(sender=sender_user_profile, sending_client=get_client("test"))