mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-11-22 11:31:01 +00:00
Fix the behavior of the follow button
There was a bug in Tera and in the User::is_following function. Fix #146
This commit is contained in:
parent
e581ef7d09
commit
b0e75f4d63
3 changed files with 23 additions and 4 deletions
|
@ -281,7 +281,7 @@ impl User {
|
|||
users::table.filter(users::id.eq(any(follows))).load::<User>(conn).unwrap()
|
||||
}
|
||||
|
||||
pub fn is_following(&self, conn: &PgConnection, other_id: i32) -> bool {
|
||||
pub fn is_followed_by(&self, conn: &PgConnection, other_id: i32) -> bool {
|
||||
use schema::follows;
|
||||
follows::table
|
||||
.filter(follows::follower_id.eq(other_id))
|
||||
|
@ -291,6 +291,16 @@ impl User {
|
|||
.len() > 0
|
||||
}
|
||||
|
||||
pub fn is_following(&self, conn: &PgConnection, other_id: i32) -> bool {
|
||||
use schema::follows;
|
||||
follows::table
|
||||
.filter(follows::follower_id.eq(self.id))
|
||||
.filter(follows::following_id.eq(other_id))
|
||||
.load::<Follow>(conn)
|
||||
.expect("Couldn't load follow relationship")
|
||||
.len() > 0
|
||||
}
|
||||
|
||||
pub fn has_liked(&self, conn: &PgConnection, post: &Post) -> bool {
|
||||
use schema::likes;
|
||||
likes::table
|
||||
|
|
8
plume.md
Normal file
8
plume.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
Page de présentation Plume
|
||||
|
||||
Plume
|
||||
Moteur de blog décentralisé.
|
||||
|
||||
Les auteurs peuvent gérer différents blogs au sein d'un même site.
|
||||
|
||||
Les articles sont également visibles sur d'autres sites Plume et vous pouvez interagir avec eux directement depuis d'autres plateformes telles que Mastodon.
|
|
@ -18,11 +18,12 @@
|
|||
<a class="inline-block button" href="{{ user.ap_url }}">{{ "Open on {{ instance_url }}" | _(instance_url=instance_url) }}</a>
|
||||
{% endif %}
|
||||
|
||||
{% if not is_self and account %}
|
||||
{% set not_self = not is_self %}
|
||||
{% if not_self and (account is defined) %}
|
||||
{% if follows %}
|
||||
<a href="follow/" class="inline-block button">{{ "Follow" | _ }}</a>
|
||||
{% else %}
|
||||
<a href="follow/" class="inline-block button">{{ "Unfollow" | _ }}</a>
|
||||
{% else %}
|
||||
<a href="follow/" class="inline-block button">{{ "Follow" | _ }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue