From 89a58dc5964f4df8c54c9c216d8fff3a63d86462 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 17 May 2018 23:38:35 +0900 Subject: 添付されたメディアのURLは省略して表示するように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/scripts/can-hide-text.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/client/app/common/scripts/can-hide-text.ts (limited to 'src/client/app/common/scripts/can-hide-text.ts') diff --git a/src/client/app/common/scripts/can-hide-text.ts b/src/client/app/common/scripts/can-hide-text.ts new file mode 100644 index 0000000000..4a4be8d9d0 --- /dev/null +++ b/src/client/app/common/scripts/can-hide-text.ts @@ -0,0 +1,16 @@ +export default function(note) { + if (note.text == null) return true; + + let txt = note.text; + + if (note.media) { + note.media.forEach(file => { + txt = txt.replace(file.url, ''); + if (file.src) txt = txt.replace(file.src, ''); + }); + + if (txt == '') return true; + } + + return false; +} -- cgit v1.2.3-freya