muting: Refactor get_time_from_date_muted to util module.

This function will be later needed again when we split the
muted_users module from muting.
This commit is contained in:
Priyank Patel 2021-06-28 18:09:50 +00:00 committed by Tim Abbott
parent a254fa24ee
commit 88b83de5bd
2 changed files with 8 additions and 7 deletions

View File

@ -3,17 +3,11 @@ import {FoldDict} from "./fold_dict";
import {page_params} from "./page_params";
import * as stream_data from "./stream_data";
import * as timerender from "./timerender";
import {get_time_from_date_muted} from "./util";
const muted_topics = new Map();
const muted_users = new Map();
function get_time_from_date_muted(date_muted) {
if (date_muted === undefined) {
return Date.now();
}
return date_muted * 1000;
}
export function add_muted_topic(stream_id, topic, date_muted) {
let sub_dict = muted_topics.get(stream_id);
if (!sub_dict) {

View File

@ -354,3 +354,10 @@ export function filter_by_word_prefix_match(items, search_term, item_to_text) {
return filtered_items;
}
export function get_time_from_date_muted(date_muted) {
if (date_muted === undefined) {
return Date.now();
}
return date_muted * 1000;
}