fix: user follows, user blocks, private profile setting
This commit is contained in:
parent
de53eec0e8
commit
17564ede49
8 changed files with 220 additions and 43 deletions
|
@ -25,9 +25,24 @@
|
|||
|
||||
<div class="card">
|
||||
<select onchange="save_access(event, 'read')">
|
||||
<option value="Everybody">Everybody</option>
|
||||
<option value="Unlisted">Unlisted</option>
|
||||
<option value="Private">Private</option>
|
||||
<option
|
||||
value="Everybody"
|
||||
selected="{% if community.read_access == 'Everybody' %}true{% else %}false{% endif %}"
|
||||
>
|
||||
Everybody
|
||||
</option>
|
||||
<option
|
||||
value="Unlisted"
|
||||
selected="{% if community.read_access == 'Unlisted' %}true{% else %}false{% endif %}"
|
||||
>
|
||||
Unlisted
|
||||
</option>
|
||||
<option
|
||||
value="Private"
|
||||
selected="{% if community.read_access == 'Private' %}true{% else %}false{% endif %}"
|
||||
>
|
||||
Private
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -39,9 +54,24 @@
|
|||
|
||||
<div class="card">
|
||||
<select onchange="save_access(event, 'write')">
|
||||
<option value="Everybody">Everybody</option>
|
||||
<option value="Joined">Joined</option>
|
||||
<option value="Owner">Owner only</option>
|
||||
<option
|
||||
value="Everybody"
|
||||
selected="{% if community.write_access == 'Everybody' %}true{% else %}false{% endif %}"
|
||||
>
|
||||
Everybody
|
||||
</option>
|
||||
<option
|
||||
value="Joined"
|
||||
selected="{% if community.write_access == 'Joined' %}true{% else %}false{% endif %}"
|
||||
>
|
||||
Joined
|
||||
</option>
|
||||
<option
|
||||
value="Owner"
|
||||
selected="{% if community.write_access == 'Owner' %}true{% else %}false{% endif %}"
|
||||
>
|
||||
Owner only
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -31,21 +31,23 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card flex" id="social">
|
||||
<a
|
||||
href="/user/{{ profile.username }}/followers"
|
||||
class="w-full flex justify-center items-center gap-2"
|
||||
>
|
||||
<h4>{{ profile.follower_count }}</h4>
|
||||
<span>{{ text "auth:label.followers" }}</span>
|
||||
</a>
|
||||
<a
|
||||
href="/user/{{ profile.username }}/following"
|
||||
class="w-full flex justify-center items-center gap-2"
|
||||
>
|
||||
<h4>{{ profile.following_count }}</h4>
|
||||
<span>{{ text "auth:label.following" }}</span>
|
||||
</a>
|
||||
<div class="card flex flex-col gap-2" id="social">
|
||||
<div class="w-full flex">
|
||||
<a
|
||||
href="/user/{{ profile.username }}/followers"
|
||||
class="w-full flex justify-center items-center gap-2"
|
||||
>
|
||||
<h4>{{ profile.follower_count }}</h4>
|
||||
<span>{{ text "auth:label.followers" }}</span>
|
||||
</a>
|
||||
<a
|
||||
href="/user/{{ profile.username }}/following"
|
||||
class="w-full flex justify-center items-center gap-2"
|
||||
>
|
||||
<h4>{{ profile.following_count }}</h4>
|
||||
<span>{{ text "auth:label.following" }}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -73,6 +75,90 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{% if not is_self %}
|
||||
<div class="card-nest">
|
||||
<div class="card small">
|
||||
<b>{{ text "auth:label.relationship" }}</b>
|
||||
</div>
|
||||
|
||||
<div class="card flex gap-2 flex-wrap">
|
||||
{% if not is_blocking %} {% if not is_following %}
|
||||
<button onclick="toggle_follow_user()">
|
||||
{{ icon "user-plus" }}
|
||||
<span>{{ text "auto:action.follow" }}</span>
|
||||
</button>
|
||||
{% else %}
|
||||
<button
|
||||
onclick="toggle_follow_user()"
|
||||
class="quaternary red"
|
||||
>
|
||||
{{ icon "user-minus" }}
|
||||
<span>{{ text "auto:action.unfollow" }}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
<button
|
||||
onclick="toggle_block_user()"
|
||||
class="quaternary red"
|
||||
>
|
||||
{{ icon "shield" }}
|
||||
<span>{{ text "auto:action.block" }}</span>
|
||||
</button>
|
||||
{% else %}
|
||||
<button
|
||||
onclick="toggle_block_user()"
|
||||
class="quaternary red"
|
||||
>
|
||||
{{ icon "shield-off" }}
|
||||
<span>{{ text "auto:action.unblock" }}</span>
|
||||
</button>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
globalThis.toggle_follow_user = () => {
|
||||
fetch(
|
||||
"/api/v1/auth/profile/{{ profile.id }}/follow",
|
||||
{
|
||||
method: "POST",
|
||||
},
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger("atto::toast", [
|
||||
res.ok ? "success" : "error",
|
||||
res.message,
|
||||
]);
|
||||
});
|
||||
};
|
||||
|
||||
globalThis.toggle_block_user = async () => {
|
||||
if (
|
||||
!(await trigger("atto::confirm", [
|
||||
"Are you sure you would like to do this?",
|
||||
]))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(
|
||||
"/api/v1/auth/profile/{{ profile.id }}/block",
|
||||
{
|
||||
method: "POST",
|
||||
},
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((res) => {
|
||||
trigger("atto::toast", [
|
||||
res.ok ? "success" : "error",
|
||||
res.message,
|
||||
]);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="card-nest">
|
||||
<div class="card small flex gap-2 items-center">
|
||||
{{ icon "users-round" }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue