Change sender_domain to sender_realm_str in message dict.

This commit is contained in:
Rishi Gupta 2017-03-14 15:31:05 -07:00 committed by Tim Abbott
parent 88abb7871d
commit b416587aab
7 changed files with 13 additions and 13 deletions

View File

@ -81,7 +81,7 @@
'sender_full_name': 'Othello Bot',
'sender_email': 'othello-bot@example.com',
'sender_short_name': 'othello-bot',
'sender_domain': 'example.com',
'sender_realm_str': 'example',
'content': 'Something is rotten in the state of Denmark.',
'gravatar_hash': '17d93357cca1e793739836ecbc7a9bf7',
'recipient_id': 12314,
@ -106,7 +106,7 @@
'sender_full_name': 'Othello Bot',
'sender_email': 'othello-bot@example.com',
'sender_short_name': 'othello-bot',
'sender_domain': 'example.com',
'sender_realm_str': 'example',
'content': 'I come not, friends, to steal away your hearts.',
'gravatar_hash': '17d93357cca1e793739836ecbc7a9bf7',
'recipient_id': 18391,

View File

@ -81,7 +81,7 @@ for msg in result['messages']:
# Remove extraneous metadata
for k in ['flags', 'edit_history', 'subject_links', 'gravatar_hash',
'avatar_url', 'recipient_id', 'sender_short_name',
'content_type', 'client', 'sender_domain', 'id', 'type']:
'content_type', 'client', 'sender_realm_str', 'id', 'type']:
msg.pop(k, None)
messages.append(msg)

View File

@ -56,8 +56,8 @@ def deliver_feedback_by_zulip(message):
content += '\nticket Z%03d (@support please ack)' % (ticket_number,)
content += '\nsender: %s' % (message['sender_full_name'],)
content += '\nemail: %s' % (sender_email,)
if 'sender_domain' in message:
content += '\nrealm: %s' % (message['sender_domain'],)
if 'sender_realm_str' in message:
content += '\nrealm: %s' % (message['sender_realm_str'],)
content += '\n~~~'
content += '\n\n'

View File

@ -75,7 +75,7 @@ class MessageDict(object):
sender_id = message.sender.id,
sender_email = message.sender.email,
sender_realm_id = message.sender.realm_id,
sender_realm_domain = message.sender.realm.domain,
sender_realm_str = message.sender.realm.string_id,
sender_full_name = message.sender.full_name,
sender_short_name = message.sender.short_name,
sender_avatar_source = message.sender.avatar_source,
@ -109,7 +109,7 @@ class MessageDict(object):
sender_id = row['sender_id'],
sender_email = row['sender__email'],
sender_realm_id = row['sender__realm__id'],
sender_realm_domain = row['sender__realm__domain'],
sender_realm_str = row['sender__realm__string_id'],
sender_full_name = row['sender__full_name'],
sender_short_name = row['sender__short_name'],
sender_avatar_source = row['sender__avatar_source'],
@ -137,7 +137,7 @@ class MessageDict(object):
sender_id,
sender_email,
sender_realm_id,
sender_realm_domain,
sender_realm_str,
sender_full_name,
sender_short_name,
sender_avatar_source,
@ -186,7 +186,7 @@ class MessageDict(object):
sender_email = sender_email,
sender_full_name = sender_full_name,
sender_short_name = sender_short_name,
sender_domain = sender_realm_domain,
sender_realm_str = sender_realm_str,
sender_id = sender_id,
type = display_type,
display_recipient = display_recipient,

View File

@ -1008,7 +1008,7 @@ class Message(AbstractMessage):
id = self.id,
sender_id = self.sender.id,
sender_email = self.sender.email,
sender_domain = self.sender.realm.domain,
sender_realm_str = self.sender.realm.string_id,
sender_full_name = self.sender.full_name,
sender_short_name = self.sender.short_name,
sending_client = self.sending_client.name,
@ -1041,7 +1041,7 @@ class Message(AbstractMessage):
'sender__full_name',
'sender__short_name',
'sender__realm__id',
'sender__realm__domain',
'sender__realm__string_id',
'sender__avatar_source',
'sender__avatar_version',
'sender__is_mirror_dummy',

View File

@ -397,7 +397,7 @@ class EventsRegisterTest(ZulipTestCase):
('gravatar_hash', check_string),
('id', check_int),
('recipient_id', check_int),
('sender_domain', check_string),
('sender_realm_str', check_string),
('sender_email', check_string),
('sender_full_name', check_string),
('sender_id', check_int),

View File

@ -1859,7 +1859,7 @@ class LogDictTest(ZulipTestCase):
self.assertEqual(dct['content'], 'find me some good coffee shops')
self.assertEqual(dct['id'], message.id)
self.assertEqual(dct['recipient'], 'Denmark')
self.assertEqual(dct['sender_domain'], 'zulip.com')
self.assertEqual(dct['sender_realm_str'], 'zulip')
self.assertEqual(dct['sender_email'], 'hamlet@zulip.com')
self.assertEqual(dct['sender_full_name'], 'King Hamlet')
self.assertEqual(dct['sender_id'], get_user_profile_by_email(email).id)