mirror of https://github.com/zulip/zulip.git
api: Remove (sender_)short_name from message APIs.
This commit is contained in:
parent
e6974d3013
commit
b375581f58
|
@ -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
|
`/register` and `/server_settings` responses to determine which of the
|
||||||
below features are supported.
|
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
|
## Changes in Zulip 3.0
|
||||||
|
|
||||||
**Feature level 25**
|
**Feature level 25**
|
||||||
|
|
|
@ -76,7 +76,7 @@ for msg in result['messages']:
|
||||||
continue
|
continue
|
||||||
# Remove extraneous metadata
|
# Remove extraneous metadata
|
||||||
for k in ['flags', 'edit_history', 'topic_links',
|
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']:
|
'content_type', 'client', 'sender_realm_str', 'id', 'type']:
|
||||||
msg.pop(k, None)
|
msg.pop(k, None)
|
||||||
messages.append(msg)
|
messages.append(msg)
|
||||||
|
|
|
@ -29,7 +29,7 @@ DESKTOP_WARNING_VERSION = "5.2.0"
|
||||||
#
|
#
|
||||||
# Changes should be accompanied by documentation explaining what the
|
# Changes should be accompanied by documentation explaining what the
|
||||||
# new level means in templates/zerver/api/changelog.md.
|
# 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
|
# 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
|
# only when going from an old version of the code to a newer version. Bump
|
||||||
|
|
|
@ -16,7 +16,6 @@ display_recipient_fields = [
|
||||||
"id",
|
"id",
|
||||||
"email",
|
"email",
|
||||||
"full_name",
|
"full_name",
|
||||||
"short_name",
|
|
||||||
"is_mirror_dummy",
|
"is_mirror_dummy",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -445,7 +445,6 @@ class MessageDict:
|
||||||
query = UserProfile.objects.values(
|
query = UserProfile.objects.values(
|
||||||
'id',
|
'id',
|
||||||
'full_name',
|
'full_name',
|
||||||
'short_name',
|
|
||||||
'delivery_email',
|
'delivery_email',
|
||||||
'email',
|
'email',
|
||||||
'realm__string_id',
|
'realm__string_id',
|
||||||
|
@ -465,7 +464,6 @@ class MessageDict:
|
||||||
sender_id = obj['sender_id']
|
sender_id = obj['sender_id']
|
||||||
user_row = sender_dict[sender_id]
|
user_row = sender_dict[sender_id]
|
||||||
obj['sender_full_name'] = user_row['full_name']
|
obj['sender_full_name'] = user_row['full_name']
|
||||||
obj['sender_short_name'] = user_row['short_name']
|
|
||||||
obj['sender_email'] = user_row['email']
|
obj['sender_email'] = user_row['email']
|
||||||
obj['sender_delivery_email'] = user_row['delivery_email']
|
obj['sender_delivery_email'] = user_row['delivery_email']
|
||||||
obj['sender_realm_str'] = user_row['realm__string_id']
|
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_is_mirror_dummy = obj['sender_is_mirror_dummy']
|
||||||
sender_email = obj['sender_email']
|
sender_email = obj['sender_email']
|
||||||
sender_full_name = obj['sender_full_name']
|
sender_full_name = obj['sender_full_name']
|
||||||
sender_short_name = obj['sender_short_name']
|
|
||||||
sender_id = obj['sender_id']
|
sender_id = obj['sender_id']
|
||||||
|
|
||||||
if recipient_type == Recipient.STREAM:
|
if recipient_type == Recipient.STREAM:
|
||||||
|
@ -501,7 +498,6 @@ class MessageDict:
|
||||||
recip: UserDisplayRecipient = {
|
recip: UserDisplayRecipient = {
|
||||||
'email': sender_email,
|
'email': sender_email,
|
||||||
'full_name': sender_full_name,
|
'full_name': sender_full_name,
|
||||||
'short_name': sender_short_name,
|
|
||||||
'id': sender_id,
|
'id': sender_id,
|
||||||
'is_mirror_dummy': sender_is_mirror_dummy,
|
'is_mirror_dummy': sender_is_mirror_dummy,
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ ProfileFieldData = Dict[str, Union[Dict[str, str], str]]
|
||||||
class UserDisplayRecipient(TypedDict):
|
class UserDisplayRecipient(TypedDict):
|
||||||
email: str
|
email: str
|
||||||
full_name: str
|
full_name: str
|
||||||
short_name: str
|
|
||||||
id: int
|
id: int
|
||||||
is_mirror_dummy: bool
|
is_mirror_dummy: bool
|
||||||
DisplayRecipientT = Union[str, List[UserDisplayRecipient]]
|
DisplayRecipientT = Union[str, List[UserDisplayRecipient]]
|
||||||
|
|
|
@ -182,7 +182,6 @@ paths:
|
||||||
"sender_full_name": "Othello Bot",
|
"sender_full_name": "Othello Bot",
|
||||||
"sender_id": 13215,
|
"sender_id": 13215,
|
||||||
"sender_realm_str": "example",
|
"sender_realm_str": "example",
|
||||||
"sender_short_name": "othello-bot",
|
|
||||||
"topic": "Castle",
|
"topic": "Castle",
|
||||||
"topic_links": [],
|
"topic_links": [],
|
||||||
"timestamp": 1375978403,
|
"timestamp": 1375978403,
|
||||||
|
@ -204,7 +203,6 @@ paths:
|
||||||
"email": "hamlet@example.com",
|
"email": "hamlet@example.com",
|
||||||
"full_name": "Hamlet of Denmark",
|
"full_name": "Hamlet of Denmark",
|
||||||
"id": 31572,
|
"id": 31572,
|
||||||
"short_name": "hamlet",
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"id": 12345679,
|
"id": 12345679,
|
||||||
|
@ -213,7 +211,6 @@ paths:
|
||||||
"sender_full_name": "Othello Bot",
|
"sender_full_name": "Othello Bot",
|
||||||
"sender_id": 13215,
|
"sender_id": 13215,
|
||||||
"sender_realm_str": "example",
|
"sender_realm_str": "example",
|
||||||
"sender_short_name": "othello-bot",
|
|
||||||
"subject": "",
|
"subject": "",
|
||||||
"topic_links": [],
|
"topic_links": [],
|
||||||
"timestamp": 1375978404,
|
"timestamp": 1375978404,
|
||||||
|
@ -636,21 +633,18 @@ paths:
|
||||||
"display_recipient":
|
"display_recipient":
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"short_name": "hamlet",
|
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"is_mirror_dummy": false,
|
"is_mirror_dummy": false,
|
||||||
"email": "hamlet@zulip.com",
|
"email": "hamlet@zulip.com",
|
||||||
"full_name": "King Hamlet",
|
"full_name": "King Hamlet",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"short_name": "iago",
|
|
||||||
"id": 5,
|
"id": 5,
|
||||||
"is_mirror_dummy": false,
|
"is_mirror_dummy": false,
|
||||||
"email": "iago@zulip.com",
|
"email": "iago@zulip.com",
|
||||||
"full_name": "Iago",
|
"full_name": "Iago",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"short_name": "prospero",
|
|
||||||
"id": 8,
|
"id": 8,
|
||||||
"is_mirror_dummy": false,
|
"is_mirror_dummy": false,
|
||||||
"email": "prospero@zulip.com",
|
"email": "prospero@zulip.com",
|
||||||
|
@ -659,7 +653,6 @@ paths:
|
||||||
],
|
],
|
||||||
"content_type": "text/html",
|
"content_type": "text/html",
|
||||||
"is_me_message": false,
|
"is_me_message": false,
|
||||||
"sender_short_name": "hamlet",
|
|
||||||
"timestamp": 1527921326,
|
"timestamp": 1527921326,
|
||||||
"sender_id": 4,
|
"sender_id": 4,
|
||||||
"sender_full_name": "King Hamlet",
|
"sender_full_name": "King Hamlet",
|
||||||
|
@ -682,7 +675,6 @@ paths:
|
||||||
"display_recipient": "Verona",
|
"display_recipient": "Verona",
|
||||||
"content_type": "text/html",
|
"content_type": "text/html",
|
||||||
"is_me_message": false,
|
"is_me_message": false,
|
||||||
"sender_short_name": "hamlet",
|
|
||||||
"timestamp": 1527939746,
|
"timestamp": 1527939746,
|
||||||
"sender_id": 4,
|
"sender_id": 4,
|
||||||
"sender_full_name": "King Hamlet",
|
"sender_full_name": "King Hamlet",
|
||||||
|
@ -4354,7 +4346,6 @@ paths:
|
||||||
"is_me_message": false,
|
"is_me_message": false,
|
||||||
"reactions": [],
|
"reactions": [],
|
||||||
"sender_realm_str": "zulip",
|
"sender_realm_str": "zulip",
|
||||||
"sender_short_name": "iago",
|
|
||||||
},
|
},
|
||||||
"bot_email": "outgoing-bot@localhost",
|
"bot_email": "outgoing-bot@localhost",
|
||||||
}
|
}
|
||||||
|
@ -4452,10 +4443,6 @@ components:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
Full name of the user.
|
Full name of the user.
|
||||||
short_name:
|
|
||||||
type: string
|
|
||||||
description: |
|
|
||||||
Short name of the user.
|
|
||||||
is_mirror_dummy:
|
is_mirror_dummy:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: |
|
description: |
|
||||||
|
@ -4542,10 +4529,6 @@ components:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
Full name of the user.
|
Full name of the user.
|
||||||
short_name:
|
|
||||||
type: string
|
|
||||||
description: |
|
|
||||||
Short name of the user.
|
|
||||||
is_mirror_dummy:
|
is_mirror_dummy:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: |
|
description: |
|
||||||
|
@ -4575,10 +4558,6 @@ components:
|
||||||
the context of a given Zulip server.
|
the context of a given Zulip server.
|
||||||
|
|
||||||
E.g. on `example.zulip.com`, this will be `example`.
|
E.g. on `example.zulip.com`, this will be `example`.
|
||||||
sender_short_name:
|
|
||||||
type: string
|
|
||||||
description: |
|
|
||||||
Reserved for future use.
|
|
||||||
stream_id:
|
stream_id:
|
||||||
type: integer
|
type: integer
|
||||||
description: |
|
description: |
|
||||||
|
|
|
@ -376,7 +376,6 @@ class NormalActionsTest(BaseAction):
|
||||||
('sender_email', check_string),
|
('sender_email', check_string),
|
||||||
('sender_full_name', check_string),
|
('sender_full_name', check_string),
|
||||||
('sender_id', check_int),
|
('sender_id', check_int),
|
||||||
('sender_short_name', check_string),
|
|
||||||
('stream_id', check_int),
|
('stream_id', check_int),
|
||||||
(TOPIC_NAME, check_string),
|
(TOPIC_NAME, check_string),
|
||||||
(TOPIC_LINKS, check_list(check_string)),
|
(TOPIC_LINKS, check_list(check_string)),
|
||||||
|
@ -2092,7 +2091,6 @@ class NormalActionsTest(BaseAction):
|
||||||
('content_type', equals('text/html')),
|
('content_type', equals('text/html')),
|
||||||
('sender_email', equals('notification-bot@zulip.com')),
|
('sender_email', equals('notification-bot@zulip.com')),
|
||||||
('sender_id', check_int),
|
('sender_id', check_int),
|
||||||
('sender_short_name', equals('notification-bot')),
|
|
||||||
('display_recipient', equals(new_name)),
|
('display_recipient', equals(new_name)),
|
||||||
('id', check_int),
|
('id', check_int),
|
||||||
('stream_id', check_int),
|
('stream_id', check_int),
|
||||||
|
|
|
@ -347,7 +347,6 @@ class MessageHydrationTest(ZulipTestCase):
|
||||||
sender_is_mirror_dummy=False,
|
sender_is_mirror_dummy=False,
|
||||||
sender_email=cordelia.email,
|
sender_email=cordelia.email,
|
||||||
sender_full_name=cordelia.full_name,
|
sender_full_name=cordelia.full_name,
|
||||||
sender_short_name=cordelia.short_name,
|
|
||||||
sender_id=cordelia.id,
|
sender_id=cordelia.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -362,7 +361,6 @@ class MessageHydrationTest(ZulipTestCase):
|
||||||
dict(
|
dict(
|
||||||
email='aaron@example.com',
|
email='aaron@example.com',
|
||||||
full_name='Aaron Smith',
|
full_name='Aaron Smith',
|
||||||
short_name='Aaron',
|
|
||||||
id=999,
|
id=999,
|
||||||
is_mirror_dummy=False,
|
is_mirror_dummy=False,
|
||||||
),
|
),
|
||||||
|
@ -374,7 +372,6 @@ class MessageHydrationTest(ZulipTestCase):
|
||||||
sender_is_mirror_dummy=False,
|
sender_is_mirror_dummy=False,
|
||||||
sender_email=cordelia.email,
|
sender_email=cordelia.email,
|
||||||
sender_full_name=cordelia.full_name,
|
sender_full_name=cordelia.full_name,
|
||||||
sender_short_name=cordelia.short_name,
|
|
||||||
sender_id=cordelia.id,
|
sender_id=cordelia.id,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -386,7 +383,6 @@ class MessageHydrationTest(ZulipTestCase):
|
||||||
dict(
|
dict(
|
||||||
email='aaron@example.com',
|
email='aaron@example.com',
|
||||||
full_name='Aaron Smith',
|
full_name='Aaron Smith',
|
||||||
short_name='Aaron',
|
|
||||||
id=999,
|
id=999,
|
||||||
is_mirror_dummy=False,
|
is_mirror_dummy=False,
|
||||||
),
|
),
|
||||||
|
@ -394,7 +390,6 @@ class MessageHydrationTest(ZulipTestCase):
|
||||||
email=cordelia.email,
|
email=cordelia.email,
|
||||||
full_name=cordelia.full_name,
|
full_name=cordelia.full_name,
|
||||||
id=cordelia.id,
|
id=cordelia.id,
|
||||||
short_name=cordelia.short_name,
|
|
||||||
is_mirror_dummy=False,
|
is_mirror_dummy=False,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -482,7 +477,7 @@ class MessageHydrationTest(ZulipTestCase):
|
||||||
|
|
||||||
# Find which display_recipient in the list is cordelia:
|
# Find which display_recipient in the list is cordelia:
|
||||||
for display_recipient in message['display_recipient']:
|
for display_recipient in message['display_recipient']:
|
||||||
if display_recipient['short_name'] == 'cordelia':
|
if display_recipient['id'] == cordelia.id:
|
||||||
cordelia_display_recipient = display_recipient
|
cordelia_display_recipient = display_recipient
|
||||||
|
|
||||||
# Make sure the email is up-to-date.
|
# Make sure the email is up-to-date.
|
||||||
|
@ -499,7 +494,6 @@ class TestMessageForIdsDisplayRecipientFetching(ZulipTestCase):
|
||||||
recipient_dict: UserDisplayRecipient = {
|
recipient_dict: UserDisplayRecipient = {
|
||||||
'email': user_profile.email,
|
'email': user_profile.email,
|
||||||
'full_name': user_profile.full_name,
|
'full_name': user_profile.full_name,
|
||||||
'short_name': user_profile.short_name,
|
|
||||||
'id': user_profile.id,
|
'id': user_profile.id,
|
||||||
'is_mirror_dummy': user_profile.is_mirror_dummy,
|
'is_mirror_dummy': user_profile.is_mirror_dummy,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1066,7 +1066,7 @@ class GetOldMessagesTest(ZulipTestCase):
|
||||||
for message in result["messages"]:
|
for message in result["messages"]:
|
||||||
for field in ("content", "content_type", "display_recipient",
|
for field in ("content", "content_type", "display_recipient",
|
||||||
"avatar_url", "recipient_id", "sender_full_name",
|
"avatar_url", "recipient_id", "sender_full_name",
|
||||||
"sender_short_name", "timestamp", "reactions"):
|
"timestamp", "reactions"):
|
||||||
self.assertIn(field, message)
|
self.assertIn(field, message)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,6 @@ class TestGenericOutgoingWebhookService(ZulipTestCase):
|
||||||
'sender_full_name': 'Othello, the Moor of Venice',
|
'sender_full_name': 'Othello, the Moor of Venice',
|
||||||
'sender_id': othello.id,
|
'sender_id': othello.id,
|
||||||
'sender_realm_str': 'zulip',
|
'sender_realm_str': 'zulip',
|
||||||
'sender_short_name': 'othello',
|
|
||||||
'stream_id': stream.id,
|
'stream_id': stream.id,
|
||||||
TOPIC_NAME: 'test',
|
TOPIC_NAME: 'test',
|
||||||
'submessages': [],
|
'submessages': [],
|
||||||
|
|
Loading…
Reference in New Issue