add: channels, messages

This commit is contained in:
trisua 2025-04-27 23:11:37 -04:00
parent 67492cf73f
commit 7774124bd0
40 changed files with 2238 additions and 115 deletions

View file

@ -192,6 +192,15 @@
{{ icon "shield-off" }}
<span>{{ text "auth:action.unblock" }}</span>
</button>
{% endif %} {% if not user.settings.private_chats or
is_following_you %}
<button
onclick="create_group_chat()"
class="quaternary"
>
{{ icon "message-circle" }}
<span>{{ text "auth:action.message" }}</span>
</button>
{% endif %} {% if is_helper %}
<a
href="/mod_panel/profile/{{ profile.id }}"
@ -203,6 +212,30 @@
{% endif %}
<script>
globalThis.create_group_chat = async () => {
fetch("/api/v1/channels/group", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
title: "{{ user.username }} & {{ profile.username }}",
members: ["{{ profile.id }}"],
}),
})
.then((res) => res.json())
.then((res) => {
trigger("atto::toast", [
res.ok ? "success" : "error",
res.message,
]);
if (res.ok) {
window.location.href = `/chats/0/${res.payload}`;
}
});
};
globalThis.toggle_follow_user = async (e) => {
await trigger("atto::debounce", [
"users::follow",
@ -295,6 +328,25 @@
</div>
</div>
{% endif %}
<div class="flex flex-col gap-2" id="connections">
{% for key, value in profile.connections %} {% if
value[0].data.name and value[0].show_on_profile %}
<a
class="card small flush flex items-center justify-between gap-2"
href="{{ components::connection_url(key=key, value=value) }}"
>
<div class="flex items-center gap-2">
{{ components::connection_icon(key=key) }}
<b>{{ value[0].data.name }}</b>
</div>
<button class="camo small">
{{ icon "external-link" }}
</button>
</a>
{% endif %} {% endfor %}
</div>
</div>
<div class="rhs w-full flex flex-col gap-4">

View file

@ -530,22 +530,40 @@
{% for key, value in profile.connections %}
<div class="card-nest">
<div class="card small flex items-center gap-2">
{% if key == "Spotify" %} {{ icon "spotify" }} {% elif key ==
"LastFm" %} {{ icon "last_fm" }} {% endif %}
{{ components::connection_icon(key=key) }}
<b>
{% if value[0].data.name %} {{ value[0].data.name }} {% else
%} {{ key }} {% endif %}
<!-- prettier-ignore -->
<b class="flex items-center gap-2">
{% if value[0].data.name %}
<span>{{ value[0].data.name }}</span>
<span style="display: contents;" title="Verified connection">{{ icon "badge-check" }}</span>
{% else %}
<span>{{ key }}</span>
<span style="display: contents;">{{ icon "badge-alert" }}</span>
{% endif %}
</b>
</div>
<div class="card flex items-center gap-2">
<div class="card flex flex-col gap-2">
<button
class="quaternary red small"
onclick="trigger('connections::delete', ['{{ key }}'])"
>
{{ text "general:action.delete" }}
</button>
<label for="{{ key }}-shown" class="flex items-center gap-2">
<input
type="checkbox"
<!-- prettier-ignore -->
{% if value[0].show_on_profile %}checked{% endif %}
id="{{ key }}-shown"
onchange="trigger('connections::push_con_shown', ['{{ key }}', event.target.checked])"
class="w-content"
/>
<span>Shown on profile</span>
</label>
</div>
</div>
{% endfor %}
@ -911,6 +929,14 @@
"{{ profile.settings.private_profile }}",
"checkbox",
],
[
[
"private_chats",
"Only allow users I'm following to add me to chats",
],
"{{ profile.settings.private_chats }}",
"checkbox",
],
[
[
"private_communities",