Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

api: Remove (sender_)short_name from message APIs.

Steve Howellb375581f5844
diff --git a/templates/zerver/api/changelog.md b/templates/zerver/api/changelog.md
index 571ae98e041..b35cbad1576 100644
--- a/templates/zerver/api/changelog.md
+++ b/templates/zerver/api/changelog.md
@@ -8,6 +8,15 @@ server versions is to check the `zulip_feature_level` parameter in the
`/register` and `/server_settings` responses to determine which of the
below features are supported.
+## Changes in Zulip 3.1
+
+**Feature level 26**
+
+* The `sender_short_name` field is no longer included in
+ `GET /messages`.
+* The `short_name` field is removed from `display_recipients`
+ in `GET /messages`.
+
## Changes in Zulip 3.0
**Feature level 25**
diff --git a/tools/zulip-export/zulip-export b/tools/zulip-export/zulip-export
index 0ab2627f47b..b07c47fadf0 100755
--- a/tools/zulip-export/zulip-export
+++ b/tools/zulip-export/zulip-export
@@ -76,7 +76,7 @@ for msg in result['messages']:
continue
# Remove extraneous metadata
for k in ['flags', 'edit_history', 'topic_links',
- 'avatar_url', 'recipient_id', 'sender_short_name',
+ 'avatar_url', 'recipient_id',
'content_type', 'client', 'sender_realm_str', 'id', 'type']:
msg.pop(k, None)
messages.append(msg)
diff --git a/version.py b/version.py
index 7ee23d3b182..08c34af2a6b 100644
--- a/version.py
+++ b/version.py
@@ -29,7 +29,7 @@ DESKTOP_WARNING_VERSION = "5.2.0"
#
# Changes should be accompanied by documentation explaining what the
# new level means in templates/zerver/api/changelog.md.
-API_FEATURE_LEVEL = 25
+API_FEATURE_LEVEL = 26
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump
diff --git a/zerver/lib/display_recipient.py b/zerver/lib/display_recipient.py
index 8ed179264f2..cb9967f8a49 100644
--- a/zerver/lib/display_recipient.py
+++ b/zerver/lib/display_recipient.py
@@ -16,7 +16,6 @@ display_recipient_fields = [
"id",
"email",
"full_name",
- "short_name",
"is_mirror_dummy",
]
diff --git a/zerver/lib/message.py b/zerver/lib/message.py
index d0ae175ffa8..dabfdb5c653 100644
--- a/zerver/lib/message.py
+++ b/zerver/lib/message.py
@@ -445,7 +445,6 @@ class MessageDict:
query = UserProfile.objects.values(
'id',
'full_name',
- 'short_name',
'delivery_email',
'email',
'realm__string_id',
@@ -465,7 +464,6 @@ class MessageDict:
sender_id = obj['sender_id']
user_row = sender_dict[sender_id]
obj['sender_full_name'] = user_row['full_name']
- obj['sender_short_name'] = user_row['short_name']
obj['sender_email'] = user_row['email']
obj['sender_delivery_email'] = user_row['delivery_email']
obj['sender_realm_str'] = user_row['realm__string_id']
@@ -487,7 +485,6 @@ class MessageDict:
sender_is_mirror_dummy = obj['sender_is_mirror_dummy']
sender_email = obj['sender_email']
sender_full_name = obj['sender_full_name']
- sender_short_name = obj['sender_short_name']
sender_id = obj['sender_id']
if recipient_type == Recipient.STREAM:
@@ -501,7 +498,6 @@ class MessageDict:
recip: UserDisplayRecipient = {
'email': sender_email,
'full_name': sender_full_name,
- 'short_name': sender_short_name,
'id': sender_id,
'is_mirror_dummy': sender_is_mirror_dummy,
}
diff --git a/zerver/lib/types.py b/zerver/lib/types.py
index fe33e4cd750..76af4e23638 100644
--- a/zerver/lib/types.py
+++ b/zerver/lib/types.py
@@ -35,7 +35,6 @@ ProfileFieldData = Dict[str, Union[Dict[str, str], str]]
class UserDisplayRecipient(TypedDict):
email: str
full_name: str
- short_name: str
id: int
is_mirror_dummy: bool
DisplayRecipientT = Union[str, List[UserDisplayRecipient]]
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index 3513484cfc3..ead35703d39 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -182,7 +182,6 @@ paths:
"sender_full_name": "Othello Bot",
"sender_id": 13215,
"sender_realm_str": "example",
- "sender_short_name": "othello-bot",
"topic": "Castle",
"topic_links": [],
"timestamp": 1375978403,
@@ -204,7 +203,6 @@ paths:
"email": "[email protected]",
"full_name": "Hamlet of Denmark",
"id": 31572,
- "short_name": "hamlet",
},
],
"id": 12345679,
@@ -213,7 +211,6 @@ paths:
"sender_full_name": "Othello Bot",
"sender_id": 13215,
"sender_realm_str": "example",
- "sender_short_name": "othello-bot",
"subject": "",
"topic_links": [],
"timestamp": 1375978404,
@@ -636,21 +633,18 @@ paths:
"display_recipient":
[
{
- "short_name": "hamlet",
"id": 4,
"is_mirror_dummy": false,
"email": "[email protected]",
"full_name": "King Hamlet",
},
{
- "short_name": "iago",
"id": 5,
"is_mirror_dummy": false,
"email": "[email protected]",
"full_name": "Iago",
},
{
- "short_name": "prospero",
"id": 8,
"is_mirror_dummy": false,
"email": "[email protected]",
@@ -659,7 +653,6 @@ paths:
],
"content_type": "text/html",
"is_me_message": false,
- "sender_short_name": "hamlet",
"timestamp": 1527921326,
"sender_id": 4,
"sender_full_name": "King Hamlet",
@@ -682,7 +675,6 @@ paths:
"display_recipient": "Verona",
"content_type": "text/html",
"is_me_message": false,
- "sender_short_name": "hamlet",
"timestamp": 1527939746,
"sender_id": 4,
"sender_full_name": "King Hamlet",
@@ -4354,7 +4346,6 @@ paths:
"is_me_message": false,
"reactions": [],
"sender_realm_str": "zulip",
- "sender_short_name": "iago",
},
"bot_email": "outgoing-bot@localhost",
}
@@ -4452,10 +4443,6 @@ components:
type: string
description: |
Full name of the user.
- short_name:
- type: string
- description: |
- Short name of the user.
is_mirror_dummy:
type: boolean
description: |
@@ -4542,10 +4529,6 @@ components:
type: string
description: |
Full name of the user.
- short_name:
- type: string
- description: |
- Short name of the user.
is_mirror_dummy:
type: boolean
description: |
@@ -4575,10 +4558,6 @@ components:
the context of a given Zulip server.
E.g. on `example.zulip.com`, this will be `example`.
- sender_short_name:
- type: string
- description: |
- Reserved for future use.
stream_id:
type: integer
description: |
diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py
index 9528abbfd01..fa49af6a060 100644
--- a/zerver/tests/test_events.py
+++ b/zerver/tests/test_events.py
@@ -376,7 +376,6 @@ class NormalActionsTest(BaseAction):
('sender_email', check_string),
('sender_full_name', check_string),
('sender_id', check_int),
- ('sender_short_name', check_string),
('stream_id', check_int),
(TOPIC_NAME, check_string),
(TOPIC_LINKS, check_list(check_string)),
@@ -2092,7 +2091,6 @@ class NormalActionsTest(BaseAction):
('content_type', equals('text/html')),
('sender_email', equals('[email protected]')),
('sender_id', check_int),
- ('sender_short_name', equals('notification-bot')),
('display_recipient', equals(new_name)),
('id', check_int),
('stream_id', check_int),
diff --git a/zerver/tests/test_message_dict.py b/zerver/tests/test_message_dict.py
index cb11b621da2..269578fc1f6 100644
--- a/zerver/tests/test_message_dict.py
+++ b/zerver/tests/test_message_dict.py
@@ -347,7 +347,6 @@ class MessageHydrationTest(ZulipTestCase):
sender_is_mirror_dummy=False,
sender_email=cordelia.email,
sender_full_name=cordelia.full_name,
- sender_short_name=cordelia.short_name,
sender_id=cordelia.id,
)
@@ -362,7 +361,6 @@ class MessageHydrationTest(ZulipTestCase):
dict(
full_name='Aaron Smith',
- short_name='Aaron',
id=999,
is_mirror_dummy=False,
),
@@ -374,7 +372,6 @@ class MessageHydrationTest(ZulipTestCase):
sender_is_mirror_dummy=False,
sender_email=cordelia.email,
sender_full_name=cordelia.full_name,
- sender_short_name=cordelia.short_name,
sender_id=cordelia.id,
)
@@ -386,7 +383,6 @@ class MessageHydrationTest(ZulipTestCase):
dict(
full_name='Aaron Smith',
- short_name='Aaron',
id=999,
is_mirror_dummy=False,
),
@@ -394,7 +390,6 @@ class MessageHydrationTest(ZulipTestCase):
email=cordelia.email,
full_name=cordelia.full_name,
id=cordelia.id,
- short_name=cordelia.short_name,
is_mirror_dummy=False,
),
],
@@ -482,7 +477,7 @@ class MessageHydrationTest(ZulipTestCase):
# Find which display_recipient in the list is cordelia:
for display_recipient in message['display_recipient']:
- if display_recipient['short_name'] == 'cordelia':
+ if display_recipient['id'] == cordelia.id:
cordelia_display_recipient = display_recipient
# Make sure the email is up-to-date.
@@ -499,7 +494,6 @@ class TestMessageForIdsDisplayRecipientFetching(ZulipTestCase):
recipient_dict: UserDisplayRecipient = {
'email': user_profile.email,
'full_name': user_profile.full_name,
- 'short_name': user_profile.short_name,
'id': user_profile.id,
'is_mirror_dummy': user_profile.is_mirror_dummy,
}
diff --git a/zerver/tests/test_message_fetch.py b/zerver/tests/test_message_fetch.py
index 6b96e0b08b8..f0e2a332192 100644
--- a/zerver/tests/test_message_fetch.py
+++ b/zerver/tests/test_message_fetch.py
@@ -1066,7 +1066,7 @@ class GetOldMessagesTest(ZulipTestCase):
for message in result["messages"]:
for field in ("content", "content_type", "display_recipient",
"avatar_url", "recipient_id", "sender_full_name",
- "sender_short_name", "timestamp", "reactions"):
+ "timestamp", "reactions"):
self.assertIn(field, message)
return result
diff --git a/zerver/tests/test_outgoing_webhook_interfaces.py b/zerver/tests/test_outgoing_webhook_interfaces.py
index 75b8ecdc873..bdb38dcbd26 100644
--- a/zerver/tests/test_outgoing_webhook_interfaces.py
+++ b/zerver/tests/test_outgoing_webhook_interfaces.py
@@ -89,7 +89,6 @@ class TestGenericOutgoingWebhookService(ZulipTestCase):
'sender_full_name': 'Othello, the Moor of Venice',
'sender_id': othello.id,
'sender_realm_str': 'zulip',
- 'sender_short_name': 'othello',
'stream_id': stream.id,
TOPIC_NAME: 'test',
'submessages': [],