Merge branch 'master' of github.com:Plume-org/Plume
This commit is contained in:
commit
4c3e63ec16
@ -45,6 +45,7 @@ use models::{
|
|||||||
posts::Post
|
posts::Post
|
||||||
};
|
};
|
||||||
use schema::users;
|
use schema::users;
|
||||||
|
use safe_string::SafeString;
|
||||||
|
|
||||||
pub const AUTH_COOKIE: &'static str = "user_id";
|
pub const AUTH_COOKIE: &'static str = "user_id";
|
||||||
|
|
||||||
@ -56,7 +57,7 @@ pub struct User {
|
|||||||
pub outbox_url: String,
|
pub outbox_url: String,
|
||||||
pub inbox_url: String,
|
pub inbox_url: String,
|
||||||
pub is_admin: bool,
|
pub is_admin: bool,
|
||||||
pub summary: String,
|
pub summary: SafeString,
|
||||||
pub email: Option<String>,
|
pub email: Option<String>,
|
||||||
pub hashed_password: Option<String>,
|
pub hashed_password: Option<String>,
|
||||||
pub instance_id: i32,
|
pub instance_id: i32,
|
||||||
@ -75,7 +76,7 @@ pub struct NewUser {
|
|||||||
pub outbox_url: String,
|
pub outbox_url: String,
|
||||||
pub inbox_url: String,
|
pub inbox_url: String,
|
||||||
pub is_admin: bool,
|
pub is_admin: bool,
|
||||||
pub summary: String,
|
pub summary: SafeString,
|
||||||
pub email: Option<String>,
|
pub email: Option<String>,
|
||||||
pub hashed_password: Option<String>,
|
pub hashed_password: Option<String>,
|
||||||
pub instance_id: i32,
|
pub instance_id: i32,
|
||||||
@ -200,7 +201,7 @@ impl User {
|
|||||||
outbox_url: acct["outbox"].as_str().unwrap().to_string(),
|
outbox_url: acct["outbox"].as_str().unwrap().to_string(),
|
||||||
inbox_url: acct["inbox"].as_str().unwrap().to_string(),
|
inbox_url: acct["inbox"].as_str().unwrap().to_string(),
|
||||||
is_admin: false,
|
is_admin: false,
|
||||||
summary: acct["summary"].as_str().unwrap().to_string(),
|
summary: SafeString::new(&acct["summary"].as_str().unwrap().to_string()),
|
||||||
email: None,
|
email: None,
|
||||||
hashed_password: None,
|
hashed_password: None,
|
||||||
instance_id: instance.id,
|
instance_id: instance.id,
|
||||||
@ -371,7 +372,7 @@ impl APActor for User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_summary(&self) -> String {
|
fn get_summary(&self) -> String {
|
||||||
self.summary.clone()
|
self.summary.get().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_instance(&self, conn: &PgConnection) -> Instance {
|
fn get_instance(&self, conn: &PgConnection) -> Instance {
|
||||||
@ -561,7 +562,7 @@ impl NewUser {
|
|||||||
outbox_url: String::from(""),
|
outbox_url: String::from(""),
|
||||||
inbox_url: String::from(""),
|
inbox_url: String::from(""),
|
||||||
is_admin: is_admin,
|
is_admin: is_admin,
|
||||||
summary: summary,
|
summary: SafeString::new(&summary),
|
||||||
email: Some(email),
|
email: Some(email),
|
||||||
hashed_password: Some(password),
|
hashed_password: Some(password),
|
||||||
instance_id: instance_id,
|
instance_id: instance_id,
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
{% macro post_card(article) %}
|
{% macro post_card(article) %}
|
||||||
|
{% if article.author.display_name %}
|
||||||
|
{% set name = article.author.display_name %}
|
||||||
|
{% else %}
|
||||||
|
{% set name = article.author.username %}
|
||||||
|
{% endif %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h3><a href="{{ article.url }}">{{ article.post.title }}</a></h3>
|
<h3><a href="{{ article.url }}">{{ article.post.title }}</a></h3>
|
||||||
<main><p>{{ article.post.content | striptags | truncate(length=200) }}</p></main>
|
<main><p>{{ article.post.content | striptags | truncate(length=200) }}</p></main>
|
||||||
<p>By <a href="/@/{{ article.author.fqn }}/">{{ article.author.display_name }}</a> ⋅ {{ article.date | date(format="%B %e") }}</p>
|
<p>By <a href="/@/{{ article.author.fqn }}/">{{ name }}</a> ⋅ {{ article.date | date(format="%B %e") }}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro post_card %}
|
{% endmacro post_card %}
|
||||||
|
@ -8,9 +8,15 @@
|
|||||||
<a href="../">{{ blog.title }}</a>
|
<a href="../">{{ blog.title }}</a>
|
||||||
{% endblock header %}
|
{% endblock header %}
|
||||||
|
|
||||||
|
{% if author.display_name %}
|
||||||
|
{% set name = author.display_name %}
|
||||||
|
{% else %}
|
||||||
|
{% set name = author.username %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>
|
<p>
|
||||||
<b>Written by <a href="/@/{{ author.fqn }}/">{{ author.display_name }}</a></b>
|
<b>Written by <a href="/@/{{ author.fqn }}/">{{ name }}</a></b>
|
||||||
—
|
—
|
||||||
<span>{{ date | date(format="%B %e, %Y") }}</span>
|
<span>{{ date | date(format="%B %e, %Y") }}</span>
|
||||||
</p>
|
</p>
|
||||||
@ -49,8 +55,13 @@
|
|||||||
<h2>Comments</h2>
|
<h2>Comments</h2>
|
||||||
<div class="list">
|
<div class="list">
|
||||||
{% for comment in comments %}
|
{% for comment in comments %}
|
||||||
|
{% if comment.author.display_name %}
|
||||||
|
{% set comment_author_name = comment.author.display_name %}
|
||||||
|
{% else %}
|
||||||
|
{% set comment_author_name = comment.author.username %}
|
||||||
|
{% endif %}
|
||||||
<div class="card" id="comment-{{ comment.id }}">
|
<div class="card" id="comment-{{ comment.id }}">
|
||||||
<b>{{ comment.author.display_name }}</b>
|
<b>{{ comment_author_name }}</b>
|
||||||
<div>{{ comment.content | safe }}</div>
|
<div>{{ comment.content | safe }}</div>
|
||||||
<a href="comment?responding_to={{ comment.id }}">Respond</a>
|
<a href="comment?responding_to={{ comment.id }}">Respond</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
{% extends "base" %}
|
{% extends "base" %}
|
||||||
{% import "macros" as macros %}
|
{% import "macros" as macros %}
|
||||||
|
|
||||||
|
{% if user.display_name %}
|
||||||
|
{% set name = user.display_name %}
|
||||||
|
{% else %}
|
||||||
|
{% set name = user.username %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ user.display_name }}
|
{{ name }}
|
||||||
{% endblock title %}
|
{% endblock title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>
|
||||||
<h1>
|
<h1>
|
||||||
{{ user.display_name }}
|
{{ name }}
|
||||||
{% if user.is_admin %}
|
{% if user.is_admin %}
|
||||||
<span class="badge">Admin</span>
|
<span class="badge">Admin</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -28,7 +34,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
{{ user.summary }}
|
{{ user.summary | safe }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if recents | length != 0 %}
|
{% if recents | length != 0 %}
|
||||||
|
@ -1,13 +1,19 @@
|
|||||||
{% extends "base" %}
|
{% extends "base" %}
|
||||||
|
|
||||||
|
{% if user.display_name %}
|
||||||
|
{% set name = user.display_name %}
|
||||||
|
{% else %}
|
||||||
|
{% set name = user.username %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ user.display_name }}'s Followers
|
{{ name }}'s Followers
|
||||||
{% endblock title %}
|
{% endblock title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>
|
||||||
<h1>
|
<h1>
|
||||||
{{ user.display_name }}
|
{{ name }}
|
||||||
{% if user.is_admin %}
|
{% if user.is_admin %}
|
||||||
<span class="badge">Admin</span>
|
<span class="badge">Admin</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -21,9 +27,14 @@
|
|||||||
<h2>Followers</h2>
|
<h2>Followers</h2>
|
||||||
<div class="cards">
|
<div class="cards">
|
||||||
{% for follower in followers %}
|
{% for follower in followers %}
|
||||||
|
{% if follower.display_name %}
|
||||||
|
{% set follower_name = follower.display_name %}
|
||||||
|
{% else %}
|
||||||
|
{% set follower_name = follower.username %}
|
||||||
|
{% endif %}
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h3><a href="{{ follower.ap_url }}/">{{ follower.display_name }}</a> — @{{ follower.fqn }}</h3>
|
<h3><a href="{{ follower.ap_url }}/">{{ follower_name }}</a> — @{{ follower.fqn }}</h3>
|
||||||
<main><p>{{ follower.summary }}</p></main>
|
<main><p>{{ follower.summary | safe }}</p></main>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user