Skip to content

Commit f551a53

Browse files
committed
api types [nfc]: Move UserSettings to modelTypes.js
1 parent 26b1ce7 commit f551a53

File tree

5 files changed

+87
-78
lines changed

5 files changed

+87
-78
lines changed

src/api/eventTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import type {
2323
UserMessageFlag,
2424
UserPresence,
2525
UserStatusUpdate,
26+
UserSettings,
2627
} from './modelTypes';
2728
import type { RealmDataForUpdate } from './realmDataTypes';
28-
import type { UserSettings } from './initialDataTypes';
2929

3030
export const EventTypes = keyMirror({
3131
alert_words: null,

src/api/initialDataTypes.js

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @flow strict-local */
22

3-
import type { CustomProfileField, UserStatusUpdate } from './modelTypes';
3+
import type { CustomProfileField, UserStatusUpdate, UserSettings } from './modelTypes';
44
import type {
55
CrossRealmBot,
66
MutedTopicTuple,
@@ -598,80 +598,6 @@ export type InitialDataUpdateMessageFlags = $ReadOnly<{|
598598
|}>,
599599
|}>;
600600

601-
/**
602-
* The user settings, stored on the server.
603-
*
604-
* See:
605-
* - PATCH /settings doc: https://zulip.com/api/update-settings
606-
* - POST /register doc: https://zulip.com/api/register-queue
607-
*/
608-
// Assumes FL 89+, because servers added user_settings to the /register
609-
// response in FL 89.
610-
//
611-
// Current to FL 152; property ordering follows the /register doc. See the
612-
// "Current to" note on the InitialDataUserSettings type and update that as
613-
// needed too.
614-
//
615-
// TODO(server-5.0): Remove FL 89+ comment.
616-
export type UserSettings = {|
617-
+twenty_four_hour_time: boolean,
618-
+dense_mode: boolean,
619-
+starred_message_counts: boolean,
620-
+fluid_layout_width: boolean,
621-
+high_contrast_mode: boolean,
622-
+color_scheme: 1 | 2 | 3,
623-
+translate_emoticons: boolean,
624-
625-
// TODO(server-6.0): New in FL 125.
626-
+display_emoji_reaction_users?: boolean,
627-
628-
+default_language: string,
629-
+default_view: 'recent_topics' | 'all_messages',
630-
631-
// TODO(server-5.0): New in FL 107.
632-
+escape_navigates_to_default_view?: boolean,
633-
634-
+left_side_userlist: boolean,
635-
+emojiset: 'google' | 'google-blob' | 'twitter' | 'text',
636-
+demote_inactive_streams: 1 | 2 | 3,
637-
638-
// TODO(server-6.0): New in FL 141.
639-
+user_list_style: 1 | 2 | 3,
640-
641-
+timezone: string,
642-
+enter_sends: boolean,
643-
+enable_drafts_synchronization: boolean,
644-
+enable_stream_desktop_notifications: boolean,
645-
+enable_stream_email_notifications: boolean,
646-
+enable_stream_push_notifications: boolean,
647-
+enable_stream_audible_notifications: boolean,
648-
+notification_sound: string,
649-
+enable_desktop_notifications: boolean,
650-
+enable_sounds: boolean,
651-
+email_notifications_batching_period_seconds: number,
652-
+enable_offline_email_notifications: boolean,
653-
+enable_offline_push_notifications: boolean,
654-
+enable_online_push_notifications: boolean,
655-
+enable_digest_emails: boolean,
656-
+enable_marketing_emails: boolean,
657-
+enable_login_emails: boolean,
658-
+message_content_in_email_notifications: boolean,
659-
+pm_content_in_desktop_notifications: boolean,
660-
+wildcard_mentions_notify: boolean,
661-
+desktop_icon_count_display: 1 | 2 | 3,
662-
+realm_name_in_notifications: boolean,
663-
+presence_enabled: boolean,
664-
665-
// TODO(server-5.0): New in FL 105.
666-
+send_private_typing_notifications?: boolean,
667-
668-
// TODO(server-5.0): New in FL 105.
669-
+send_stream_typing_notifications?: boolean,
670-
671-
// TODO(server-5.0): New in FL 105.
672-
+send_read_receipts?: boolean,
673-
|};
674-
675601
/**
676602
* Initial data for `user_settings` events.
677603
*

src/api/modelTypes.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,88 @@ export type RealmLinkifier = $ReadOnly<{|
147147
url_format: string,
148148
|}>;
149149

150+
//
151+
//
152+
//
153+
// ===================================================================
154+
// Data attached to the current user on the realm.
155+
//
156+
//
157+
158+
/**
159+
* The user settings, stored on the server.
160+
*
161+
* See:
162+
* - PATCH /settings doc: https://zulip.com/api/update-settings
163+
* - POST /register doc: https://zulip.com/api/register-queue
164+
*/
165+
// Assumes FL 89+, because servers added user_settings to the /register
166+
// response in FL 89.
167+
//
168+
// Current to FL 152; property ordering follows the /register doc. See the
169+
// "Current to" note on the InitialDataUserSettings type and update that as
170+
// needed too.
171+
//
172+
// TODO(server-5.0): Remove FL 89+ comment.
173+
export type UserSettings = {|
174+
+twenty_four_hour_time: boolean,
175+
+dense_mode: boolean,
176+
+starred_message_counts: boolean,
177+
+fluid_layout_width: boolean,
178+
+high_contrast_mode: boolean,
179+
+color_scheme: 1 | 2 | 3,
180+
+translate_emoticons: boolean,
181+
182+
// TODO(server-6.0): New in FL 125.
183+
+display_emoji_reaction_users?: boolean,
184+
185+
+default_language: string,
186+
+default_view: 'recent_topics' | 'all_messages',
187+
188+
// TODO(server-5.0): New in FL 107.
189+
+escape_navigates_to_default_view?: boolean,
190+
191+
+left_side_userlist: boolean,
192+
+emojiset: 'google' | 'google-blob' | 'twitter' | 'text',
193+
+demote_inactive_streams: 1 | 2 | 3,
194+
195+
// TODO(server-6.0): New in FL 141.
196+
+user_list_style: 1 | 2 | 3,
197+
198+
+timezone: string,
199+
+enter_sends: boolean,
200+
+enable_drafts_synchronization: boolean,
201+
+enable_stream_desktop_notifications: boolean,
202+
+enable_stream_email_notifications: boolean,
203+
+enable_stream_push_notifications: boolean,
204+
+enable_stream_audible_notifications: boolean,
205+
+notification_sound: string,
206+
+enable_desktop_notifications: boolean,
207+
+enable_sounds: boolean,
208+
+email_notifications_batching_period_seconds: number,
209+
+enable_offline_email_notifications: boolean,
210+
+enable_offline_push_notifications: boolean,
211+
+enable_online_push_notifications: boolean,
212+
+enable_digest_emails: boolean,
213+
+enable_marketing_emails: boolean,
214+
+enable_login_emails: boolean,
215+
+message_content_in_email_notifications: boolean,
216+
+pm_content_in_desktop_notifications: boolean,
217+
+wildcard_mentions_notify: boolean,
218+
+desktop_icon_count_display: 1 | 2 | 3,
219+
+realm_name_in_notifications: boolean,
220+
+presence_enabled: boolean,
221+
222+
// TODO(server-5.0): New in FL 105.
223+
+send_private_typing_notifications?: boolean,
224+
225+
// TODO(server-5.0): New in FL 105.
226+
+send_stream_typing_notifications?: boolean,
227+
228+
// TODO(server-5.0): New in FL 105.
229+
+send_read_receipts?: boolean,
230+
|};
231+
150232
//
151233
//
152234
//

src/realm/__tests__/realmReducer-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
EVENT_REALM_FILTERS,
1111
EVENT,
1212
} from '../../actionConstants';
13-
import type { UserSettings } from '../../api/initialDataTypes';
13+
import type { UserSettings } from '../../api/modelTypes';
1414
import type { RealmDataForUpdate } from '../../api/realmDataTypes';
1515
import {
1616
CreatePublicOrPrivateStreamPolicy,

src/settings/__tests__/settingsReducer-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
EVENT_UPDATE_GLOBAL_NOTIFICATIONS_SETTINGS,
88
EVENT,
99
} from '../../actionConstants';
10-
import type { InitialData, UserSettings } from '../../api/initialDataTypes';
10+
import type { InitialData } from '../../api/initialDataTypes';
11+
import type { UserSettings } from '../../api/modelTypes';
1112
import { EventTypes } from '../../api/eventTypes';
1213
import settingsReducer from '../settingsReducer';
1314
import * as eg from '../../__tests__/lib/exampleData';

0 commit comments

Comments
 (0)