From 88b83de5bdd9649e756ec58a4f8fcbabd6d6165a Mon Sep 17 00:00:00 2001 From: Priyank Patel Date: Mon, 28 Jun 2021 18:09:50 +0000 Subject: [PATCH] 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. --- static/js/muting.js | 8 +------- static/js/util.js | 7 +++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/static/js/muting.js b/static/js/muting.js index eeaf4a9e65..5b0d48e288 100644 --- a/static/js/muting.js +++ b/static/js/muting.js @@ -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) { diff --git a/static/js/util.js b/static/js/util.js index 01f06d158a..57c02f6e2d 100644 --- a/static/js/util.js +++ b/static/js/util.js @@ -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; +}