From 3ef8298745c7a224a18da3374fb4028da90d58d1 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sun, 30 Oct 2022 16:53:52 +0200 Subject: [PATCH] add "nick_username" feature for messages - useful for bridges to other chat platforms --- frontend/public/global.css | 17 ++++++ frontend/src/components/Message.svelte | 20 ++++++- .../src/components/PresenceSidebar.svelte | 17 ------ frontend/src/stores.js | 8 ++- src/database/init.ts | 55 +++++++++++-------- src/database/templates.ts | 8 +-- src/impl.ts | 7 ++- src/routes/api/v1/channels.ts | 3 +- src/routes/matrix/index.ts | 2 +- 9 files changed, 87 insertions(+), 50 deletions(-) diff --git a/frontend/public/global.css b/frontend/public/global.css index 07f5b02..9b40f63 100644 --- a/frontend/public/global.css +++ b/frontend/public/global.css @@ -387,6 +387,23 @@ body { user-select: none; } +/* badges */ + +.user-badge { + display: inline-flex; + justify-content: center; + align-items: center; + background-color: var(--purple-2); + padding-top: 1px; + padding-bottom: 1px; + padding-left: 0.375rem; + padding-right: 0.375rem; + border-radius: 9999px; + font-size: x-small; + margin-left: var(--space-sm); + cursor: pointer; +} + /*! the tweaks below are heavily based on modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */ *, diff --git a/frontend/src/components/Message.svelte b/frontend/src/components/Message.svelte index 2787b8c..36c7d03 100644 --- a/frontend/src/components/Message.svelte +++ b/frontend/src/components/Message.svelte @@ -53,11 +53,18 @@ } .author { + display: inline-flex; + align-items: center; + justify-content: center; flex-shrink: 0; font-weight: bold; margin-right: var(--space-xs); } + .author-more { + margin-right: 0; + } + .edit-message { flex-shrink: 0; float: right; @@ -106,10 +113,21 @@ .message.clumped { padding: 2px 2px 2px var(--space-normplus); } + + .via-badge { + margin-left: var(--space-xs); + margin-right: var(--space-md); + cursor: default; + }
+ + {#if message._viaBadge} +