Skip to content

Commit ea3b948

Browse files
committed
compose: Store realm_message_content_edit_limit_seconds value in Redux
I guess this one didn't go through the change that realm_message_content_delete_limit_seconds did; see the previous commit for details on that.
1 parent 965d79d commit ea3b948

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

src/boot/store.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,9 @@ const migrations: {| [string]: (GlobalState) => GlobalState |} = {
366366
outbox: state.outbox.filter(o => o.type === 'private' || o.stream_id !== undefined),
367367
}),
368368

369-
// Add messageContentDeleteLimitSeconds to RealmState. No migration;
370-
// handled automatically by merging with the new initial state.
369+
// Add messageContentDeleteLimitSeconds and messageContentEditLimitSeconds
370+
// to RealmState. No migration; handled automatically by merging with the
371+
// new initial state.
371372

372373
// TIP: When adding a migration, consider just using `dropCache`.
373374
};

src/realm/__tests__/realmReducer-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ describe('realmReducer', () => {
2323
videoChatProvider: null, // update as necessary if example data changes
2424
mandatoryTopics: action.data.realm_mandatory_topics,
2525
messageContentDeleteLimitSeconds: action.data.realm_message_content_delete_limit_seconds,
26+
messageContentEditLimitSeconds: action.data.realm_message_content_edit_limit_seconds,
2627

2728
email: action.data.email,
2829
user_id: action.data.user_id,

src/realm/realmReducer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import {
1111
} from '../actionConstants';
1212
import { objectFromEntries } from '../jsBackport';
1313

14+
// Value copied from zerver/models.py in 2021-10.
15+
const DEFAULT_MESSAGE_CONTENT_EDIT_LIMIT_SECONDS = 600;
16+
1417
const initialState = {
1518
crossRealmBots: [],
1619

@@ -20,6 +23,7 @@ const initialState = {
2023
videoChatProvider: null,
2124
mandatoryTopics: false,
2225
messageContentDeleteLimitSeconds: null,
26+
messageContentEditLimitSeconds: DEFAULT_MESSAGE_CONTENT_EDIT_LIMIT_SECONDS,
2327

2428
email: undefined,
2529
user_id: undefined,
@@ -70,6 +74,7 @@ export default (state: RealmState = initialState, action: Action): RealmState =>
7074
}),
7175
mandatoryTopics: action.data.realm_mandatory_topics,
7276
messageContentDeleteLimitSeconds: action.data.realm_message_content_delete_limit_seconds,
77+
messageContentEditLimitSeconds: action.data.realm_message_content_edit_limit_seconds,
7378

7479
email: action.data.email,
7580
user_id: action.data.user_id,

src/reduxTypes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ export type VideoChatProvider = $ReadOnly<{| name: 'jitsi_meet', jitsiServerUrl:
257257
* https://zulip.com/help/configure-message-editing-and-deletion.
258258
* A `null` value means no limit: messages can be deleted regardless of
259259
* how long ago they were sent. A `number` value will not be 0.
260+
* @prop messageContentEditLimitSeconds - Messages sent more than this many
261+
* seconds ago cannot be edited with this organization's message edit
262+
* policy; see
263+
* https://zulip.com/help/configure-message-editing-and-deletion.
260264
*
261265
* About the user:
262266
* @prop email
@@ -274,6 +278,7 @@ export type RealmState = $ReadOnly<{|
274278
videoChatProvider: VideoChatProvider | null,
275279
mandatoryTopics: boolean,
276280
messageContentDeleteLimitSeconds: number | null,
281+
messageContentEditLimitSeconds: number,
277282

278283
email: string | void,
279284
user_id: UserId | void,

0 commit comments

Comments
 (0)