From 0c127a65ce496dd1ac37e576f443468c994b39d1 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Tue, 18 Oct 2022 19:44:42 -0700 Subject: [PATCH] Add action message type to chat. Closes #2226 --- web/utils/helpers.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/web/utils/helpers.js b/web/utils/helpers.js index fc675d14b..d6354139c 100644 --- a/web/utils/helpers.js +++ b/web/utils/helpers.js @@ -84,6 +84,7 @@ export function debounce(fn, time) { let timeout; return function () { + // eslint-disable-next-line prefer-rest-params const functionCall = () => fn.apply(this, arguments); clearTimeout(timeout); @@ -105,7 +106,7 @@ export function makeLastOnlineString(timestamp) { const time = new Date(timestamp); const comparisonDate = new Date(time).setHours(0, 0, 0, 0); - if (comparisonDate == new Date().setHours(0, 0, 0, 0)) { + if (comparisonDate === new Date().setHours(0, 0, 0, 0)) { const atTime = time.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', @@ -151,3 +152,14 @@ export function paginateArray(items, page, perPage) { items: paginatedItems, }; } + +// Take a nested object of state metadata and merge it into +// a single flattened node. +export function mergeMeta(meta) { + return Object.keys(meta).reduce((acc, key) => { + const value = meta[key]; + Object.assign(acc, value); + + return acc; + }, {}); +}