mirror of https://github.com/zulip/zulip.git
local_message: Convert module to typescript.
This commit is contained in:
parent
b20694aa07
commit
5f5e77afd5
|
@ -123,7 +123,7 @@ EXEMPT_FILES = make_set(
|
|||
"web/src/list_util.ts",
|
||||
"web/src/list_widget.ts",
|
||||
"web/src/loading.ts",
|
||||
"web/src/local_message.js",
|
||||
"web/src/local_message.ts",
|
||||
"web/src/localstorage.ts",
|
||||
"web/src/message_actions_popover.js",
|
||||
"web/src/message_edit.js",
|
||||
|
|
|
@ -2,19 +2,16 @@ import {all_messages_data} from "./all_messages_data";
|
|||
import * as blueslip from "./blueslip";
|
||||
import {page_params} from "./page_params";
|
||||
|
||||
function truncate_precision(float) {
|
||||
function truncate_precision(float: number): number {
|
||||
return Number.parseFloat(float.toFixed(3));
|
||||
}
|
||||
|
||||
export const get_next_id_float = (function () {
|
||||
const already_used = new Set();
|
||||
|
||||
return function () {
|
||||
return function (): number | undefined {
|
||||
const local_id_increment = 0.01;
|
||||
let latest = page_params.max_message_id;
|
||||
if (all_messages_data.last() !== undefined) {
|
||||
latest = all_messages_data.last().id;
|
||||
}
|
||||
let latest = all_messages_data.last()?.id ?? page_params.max_message_id;
|
||||
latest = Math.max(0, latest);
|
||||
const local_id_float = truncate_precision(latest + local_id_increment);
|
||||
|
|
@ -41,6 +41,7 @@ export const page_params: {
|
|||
max_avatar_file_size_mib: number;
|
||||
max_icon_file_size_mib: number;
|
||||
max_logo_file_size_mib: number;
|
||||
max_message_id: number;
|
||||
muted_users: {id: number; timestamp: number}[];
|
||||
narrow_stream?: string;
|
||||
narrow: Term[];
|
||||
|
|
Loading…
Reference in New Issue