add: ability to disable reactions on posts
This commit is contained in:
parent
98d17204d7
commit
09ef0fc301
3 changed files with 21 additions and 6 deletions
|
@ -134,8 +134,11 @@
|
|||
"checkbox",
|
||||
],
|
||||
[
|
||||
["reposts_enabled", "Allow people to repost your post"],
|
||||
"{{ post.context.reposts_enabled }}",
|
||||
[
|
||||
"reactions_enabled",
|
||||
"Allow people to like/dislike your post",
|
||||
],
|
||||
"{{ post.context.reactions_enabled }}",
|
||||
"checkbox",
|
||||
],
|
||||
[
|
||||
|
|
|
@ -235,8 +235,10 @@ and show_community and community.id != config.town_square or question %}
|
|||
hook-arg:id="{{ post.id }}"
|
||||
>
|
||||
<!-- prettier-ignore -->
|
||||
{% if post.content|length > 0 %}
|
||||
{{ components::likes(id=post.id, asset_type="Post", likes=post.likes, dislikes=post.dislikes) }}
|
||||
{% if post.context.reactions_enabled %}
|
||||
{% if post.content|length > 0 %}
|
||||
{{ components::likes(id=post.id, asset_type="Post", likes=post.likes, dislikes=post.dislikes) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if post.context.repost and post.context.repost.reposting %}
|
||||
|
@ -617,7 +619,10 @@ show_community=true, secondary=false) -%}
|
|||
</span>
|
||||
|
||||
{% if question.community > 0 and show_community %}
|
||||
<a href="/api/v1/communities/find/{{ question.community }}">
|
||||
<a
|
||||
href="/api/v1/communities/find/{{ question.community }}"
|
||||
class="flex items-center"
|
||||
>
|
||||
{{ components::community_avatar(id=question.community,
|
||||
size="24px") }}
|
||||
</a>
|
||||
|
|
|
@ -176,6 +176,8 @@ pub struct PostContext {
|
|||
/// The ID of the question this post is answering.
|
||||
#[serde(default)]
|
||||
pub answering: usize,
|
||||
#[serde(default = "default_reactions_enabled")]
|
||||
pub reactions_enabled: bool,
|
||||
}
|
||||
|
||||
fn default_comments_enabled() -> bool {
|
||||
|
@ -186,17 +188,22 @@ fn default_reposts_enabled() -> bool {
|
|||
true
|
||||
}
|
||||
|
||||
fn default_reactions_enabled() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
impl Default for PostContext {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
comments_enabled: default_comments_enabled(),
|
||||
reposts_enabled: true,
|
||||
reposts_enabled: default_reposts_enabled(),
|
||||
is_pinned: false,
|
||||
is_profile_pinned: false,
|
||||
edited: 0,
|
||||
is_nsfw: false,
|
||||
repost: None,
|
||||
answering: 0,
|
||||
reactions_enabled: default_reactions_enabled(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue