Skip to content

Commit

Permalink
subject
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbobbe committed Mar 5, 2021
1 parent bac5337 commit ccd8086
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/api/modelTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ type MessageBase = $ReadOnly<{|
// Properties that behave differently for stream vs. private messages.
// TODO: Move all these to `PmMessage` and `StreamMessage`.

subject: string,
subject_links: $ReadOnlyArray<string>,
|}>;

Expand Down Expand Up @@ -588,6 +587,8 @@ export type PmMessage = $ReadOnly<{|
* The ordering is less well specified; if it matters, sort first.
*/
display_recipient: $ReadOnlyArray<PmRecipientUser>,

subject: '',
|}>;

export type StreamMessage = $ReadOnly<{|
Expand All @@ -604,6 +605,8 @@ export type StreamMessage = $ReadOnly<{|
display_recipient: string,

stream_id: number,

subject: string,
|}>;

export type Message = PmMessage | StreamMessage;
Expand Down
7 changes: 6 additions & 1 deletion src/message/messagesReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ export default (state: MessagesState = initialState, action: Action): MessagesSt
oldMessage && {
...(oldMessage: M),
content: action.rendered_content || oldMessage.content,
subject: action.subject || oldMessage.subject,
subject:
/* eslint-disable operator-linebreak */
oldMessage.type === 'private'
? ''
: // $FlowFixMe - a non-empty string is fine for stream messages
action.subject || oldMessage.subject,
subject_links: action.subject_links || oldMessage.subject_links,
edit_history: [
action.orig_rendered_content
Expand Down

0 comments on commit ccd8086

Please sign in to comment.