mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
bugdown: Rename get_full_name_info to get_possible_mentions_info.
This commit is contained in:
committed by
Tim Abbott
parent
604364eb65
commit
ccdf893af7
@@ -1877,7 +1877,7 @@ def get_email_info(realm_id: int, emails: Set[str]) -> Dict[str, FullNameInfo]:
|
||||
}
|
||||
return dct
|
||||
|
||||
def get_full_name_info(realm_id: int, full_names: Set[str]) -> Dict[str, FullNameInfo]:
|
||||
def get_possible_mentions_info(realm_id: int, full_names: Set[str]) -> Dict[str, FullNameInfo]:
|
||||
if not full_names:
|
||||
return dict()
|
||||
|
||||
@@ -1916,7 +1916,7 @@ def get_full_name_info(realm_id: int, full_names: Set[str]) -> Dict[str, FullNam
|
||||
class MentionData:
|
||||
def __init__(self, realm_id: int, content: str) -> None:
|
||||
full_names = possible_mentions(content)
|
||||
self.full_name_info = get_full_name_info(realm_id, full_names)
|
||||
self.full_name_info = get_possible_mentions_info(realm_id, full_names)
|
||||
self.user_id_info = {
|
||||
row['id']: row
|
||||
for row in self.full_name_info.values()
|
||||
|
||||
@@ -176,7 +176,7 @@ class BugdownMiscTest(ZulipTestCase):
|
||||
expected_diff = "\u001b[34m-\u001b[0m <p>The \u001b[33mquick brown\u001b[0m fox jumps over the lazy dog. Animal stories are fun\u001b[31m, yeah\u001b[0m</p>\n\u001b[34m+\u001b[0m <p>The \u001b[33mfast\u001b[0m fox jumps over the lazy dog\u001b[32ms and cats\u001b[0m. Animal stories are fun</p>\n"
|
||||
self.assertEqual(mdiff.diff_strings(str1, str2), expected_diff)
|
||||
|
||||
def test_get_full_name_info(self) -> None:
|
||||
def test_get_possible_mentions_info(self) -> None:
|
||||
realm = get_realm('zulip')
|
||||
|
||||
def make_user(email: str, full_name: str) -> UserProfile:
|
||||
@@ -201,7 +201,7 @@ class BugdownMiscTest(ZulipTestCase):
|
||||
fred4 = make_user('fred4@example.com', 'Fred Flintstone')
|
||||
fred4_key = 'fred flintstone|{}'.format(fred4.id)
|
||||
|
||||
dct = bugdown.get_full_name_info(realm.id, {'Fred Flintstone', 'cordelia LEAR', 'Not A User'})
|
||||
dct = bugdown.get_possible_mentions_info(realm.id, {'Fred Flintstone', 'cordelia LEAR', 'Not A User'})
|
||||
self.assertEqual(set(dct.keys()), {'fred flintstone', fred4_key, 'cordelia lear'})
|
||||
self.assertEqual(dct['fred flintstone'], dict(
|
||||
email='fred2@example.com',
|
||||
|
||||
Reference in New Issue
Block a user