mirror of
https://git.joinplu.me/Plume/Plume.git
synced 2024-12-29 21:40:33 +00:00
Merge branch 'master' of https://github.com/Plume-org/Plume
This commit is contained in:
commit
3de0ff79b5
10 changed files with 352 additions and 73 deletions
|
@ -33,3 +33,7 @@ Then you should fill the two `msgstr` field, one with the singular form, the sec
|
|||
## Interpolation
|
||||
|
||||
Strings you translate may contain data from Plume (a username for instance). To tell Plume where to put these data, surround their identifier by `{{` and `}}`. The identifier is also present in this form in the English string to translate (this what you can see above, with the `{{ count }} posts` message).
|
||||
|
||||
## Note
|
||||
|
||||
When translating, please try to be as inclusive as possible.
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
en
|
||||
fr
|
||||
pl
|
||||
|
|
254
po/pl.po
Normal file
254
po/pl.po
Normal file
|
@ -0,0 +1,254 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: plume\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-06-15 16:33-0700\n"
|
||||
"PO-Revision-Date: 2018-06-17 20:57+0200\n"
|
||||
"Last-Translator: Marcin Mikołajczak <me@m4sk.in>\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: pl\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n"
|
||||
|
||||
msgid "Latest articles"
|
||||
msgstr "Najnowsze artykuły"
|
||||
|
||||
msgid "No posts to see here yet."
|
||||
msgstr "Brak wpisów do wyświetlenia."
|
||||
|
||||
msgid "New article"
|
||||
msgstr "Nowy artykuł"
|
||||
|
||||
msgid "New blog"
|
||||
msgstr "Nowy blog"
|
||||
|
||||
msgid "Create a blog"
|
||||
msgstr "Utwórz blog"
|
||||
|
||||
msgid "Title"
|
||||
msgstr "Tytuł"
|
||||
|
||||
msgid "Create blog"
|
||||
msgstr "Utwórz blog"
|
||||
|
||||
msgid "Comment \"{{ post }}\""
|
||||
msgstr "Komentarz „{{ post }}”"
|
||||
|
||||
msgid "Content"
|
||||
msgstr "Zawartość"
|
||||
|
||||
msgid "Submit comment"
|
||||
msgstr "Wyślij komentarz"
|
||||
|
||||
msgid "Something broke on our side."
|
||||
msgstr "Coś poszło nie tak."
|
||||
|
||||
msgid "Sorry about that. If you think this is a bug, please report it."
|
||||
msgstr "Przepraszamy. Jeżeli uważasz że wystąpił błąd, prosimy o zgłoszenie go."
|
||||
|
||||
msgid "Configuration"
|
||||
msgstr "Konfiguracja"
|
||||
|
||||
msgid "Configure your instance"
|
||||
msgstr "Skonfiguruj swoją instancję"
|
||||
|
||||
msgid "Name"
|
||||
msgstr "Nazwa"
|
||||
|
||||
msgid "Let's go!"
|
||||
msgstr "Przejdźmy dalej!"
|
||||
|
||||
msgid "Welcome on {{ instance_name }}"
|
||||
msgstr "Witamy na {{ instance_name }}"
|
||||
|
||||
msgid "Notifications"
|
||||
msgstr "Powiadomienia"
|
||||
|
||||
msgid "Written by {{ link_1 }}{{ url }}{{ link_2 }}{{ name }}{{ link_3 }}"
|
||||
msgstr "Napisano przez {{ link_1 }}{{ url }}{{ link_2 }}{{ name }}{{ link_3 }}"
|
||||
|
||||
msgid "This article is under the {{ license }} license."
|
||||
msgstr "Ten artykuł został opublikowany na licencji {{ license }}."
|
||||
|
||||
msgid "One like"
|
||||
msgid_plural "{{ count }} likes"
|
||||
msgstr[0] "Jedno polubienie"
|
||||
msgstr[1] "{{ count }} polubienia"
|
||||
msgstr[2] "{{ count }} polubień"
|
||||
|
||||
msgid "I don't like this anymore"
|
||||
msgstr "Już tego nie lubię"
|
||||
|
||||
msgid "Add yours"
|
||||
msgstr "Dodaj swoje"
|
||||
|
||||
msgid "One reshare"
|
||||
msgid_plural "{{ count }} reshares"
|
||||
msgstr[0] "Jedno udostępnienie"
|
||||
msgstr[1] "{{ count }} udostępnienia"
|
||||
msgstr[2] "{{ count }} udostępnień"
|
||||
|
||||
msgid "I don't want to reshare this anymore"
|
||||
msgstr "Cofnij udostępnienie"
|
||||
|
||||
msgid "Reshare"
|
||||
msgstr "Udostępnij"
|
||||
|
||||
msgid "Comments"
|
||||
msgstr "Komentarze"
|
||||
|
||||
msgid "Respond"
|
||||
msgstr "Odpowiedz"
|
||||
|
||||
msgid "Comment"
|
||||
msgstr "Skomentuj"
|
||||
|
||||
msgid "New post"
|
||||
msgstr "Nowy wpis"
|
||||
|
||||
msgid "Create a post"
|
||||
msgstr "Utwórz wpis"
|
||||
|
||||
msgid "Publish"
|
||||
msgstr "Opublikuj"
|
||||
|
||||
msgid "Logowanie"
|
||||
msgstr "Zaloguj się"
|
||||
|
||||
msgid "Username or email"
|
||||
msgstr "Nazwa użytkownika lub adres e-mail"
|
||||
|
||||
msgid "Password"
|
||||
msgstr "Hasło"
|
||||
|
||||
msgid "Dashboard"
|
||||
msgstr "Panel"
|
||||
|
||||
msgid "Your Dashboard"
|
||||
msgstr "Twój panel"
|
||||
|
||||
msgid "Your Blogs"
|
||||
msgstr "Twoje blogi"
|
||||
|
||||
msgid "You don't have any blog yet. Create your own, or ask to join one."
|
||||
msgstr "Nie posiadasz żadnego bloga. Utwórz własny, lub poproś o dołączanie do istniejącego."
|
||||
|
||||
msgid "Start a new blog"
|
||||
msgstr "Utwórz nowy blog"
|
||||
|
||||
msgid "Admin"
|
||||
msgstr "Administrator"
|
||||
|
||||
msgid "It is you"
|
||||
msgstr "To Ty"
|
||||
|
||||
msgid "Edit your profile"
|
||||
msgstr "Edytuj swój profil"
|
||||
|
||||
msgid "Open on {{ instance_url }}"
|
||||
msgstr "Otwórz na {{ instance_url }}"
|
||||
|
||||
msgid "Follow"
|
||||
msgstr "Obserwuj"
|
||||
|
||||
msgid "Unfollow"
|
||||
msgstr "Przestań obserwować"
|
||||
|
||||
msgid "Recently reshared"
|
||||
msgstr "Ostatnio udostępniono"
|
||||
|
||||
msgid "One follower"
|
||||
msgid_plural "{{ count }} followers"
|
||||
msgstr[0] "Jeden obserwujący"
|
||||
msgstr[1] "{{ count }} obserwujących"
|
||||
msgstr[2] "{{ count }} obserwujących"
|
||||
|
||||
msgid "Edit your account"
|
||||
msgstr "Edytuj swoje konto"
|
||||
|
||||
msgid "Your Profile"
|
||||
msgstr "Twój profil"
|
||||
|
||||
msgid "Display Name"
|
||||
msgstr "Nazwa wyświetlana"
|
||||
|
||||
msgid "Email"
|
||||
msgstr "Adres e-mail"
|
||||
|
||||
msgid "Summary"
|
||||
msgstr "Opis"
|
||||
|
||||
msgid "Update account"
|
||||
msgstr "Aktualizuj konto"
|
||||
|
||||
msgid "{{ name }}'s followers"
|
||||
msgstr "Osoby śledzące {{ name }}"
|
||||
|
||||
msgid "Followers"
|
||||
msgstr "Śledzący"
|
||||
|
||||
msgid "New Account"
|
||||
msgstr "Nowe konto"
|
||||
|
||||
msgid "Create an account"
|
||||
msgstr "Utwórz nowe konto"
|
||||
|
||||
msgid "Username"
|
||||
msgstr "Nazwa użytkownika"
|
||||
|
||||
msgid "Password confirmation"
|
||||
msgstr "Potwierdzenie hasła"
|
||||
|
||||
msgid "Create account"
|
||||
msgstr "Utwórz konto"
|
||||
|
||||
msgid "Plume"
|
||||
msgstr "Plume"
|
||||
|
||||
msgid "Menu"
|
||||
msgstr "Menu"
|
||||
|
||||
msgid "My account"
|
||||
msgstr "Moje konto"
|
||||
|
||||
msgid "Log Out"
|
||||
msgstr "Wyloguj się"
|
||||
|
||||
msgid "Log In"
|
||||
msgstr "Zaloguj się"
|
||||
|
||||
msgid "Register"
|
||||
msgstr "Zarejestruj się"
|
||||
|
||||
msgid "You need to be logged in order to create a new blog"
|
||||
msgstr "Musisz się zalogować, aby utworzyć nowy blog"
|
||||
|
||||
msgid "You need to be logged in order to post a comment"
|
||||
msgstr "Musisz się zalogować, aby umieścić komentarz"
|
||||
|
||||
msgid "You need to be logged in order to like a post"
|
||||
msgstr "Musisz się zalogować, aby polubić wpis"
|
||||
|
||||
msgid "You need to be logged in order to see your notifications"
|
||||
msgstr "Musisz się zalogować, aby zobaczyć swoje powiadomienia"
|
||||
|
||||
msgid "You need to be logged in order to write a new post"
|
||||
msgstr "Musisz się zalogować, aby utworzyć wpis"
|
||||
|
||||
msgid "You need to be logged in order to reshare a post"
|
||||
msgstr "Musisz się zalogować, aby udostępnić wpis"
|
||||
|
||||
msgid "Invalid username or password"
|
||||
msgstr "Nieprawidłowa nazwa użytkownika lub hasło"
|
||||
|
||||
msgid "You need to be logged in order to access your dashboard"
|
||||
msgstr "Musisz się zalogować, aby uzyskać dostęp do panelu"
|
||||
|
||||
msgid "You need to be logged in order to follow someone"
|
||||
msgstr "Musisz się zalogować, aby zacząć obserwować innych"
|
||||
|
||||
msgid "You need to be logged in order to edit your profile"
|
||||
msgstr "Musisz się zalogować , aby móc edytować swój profil"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
use activitypub::{
|
||||
Activity, Object,
|
||||
Object,
|
||||
activity::{Create, Like, Undo}
|
||||
};
|
||||
use diesel::PgConnection;
|
||||
|
@ -40,7 +40,7 @@ pub trait FromActivity<T: Object>: Sized {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait Notify<T: Activity> {
|
||||
pub trait Notify<T: Object> {
|
||||
fn notify(conn: &PgConnection, act: T, actor: Id);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@ use serde_json;
|
|||
use activity_pub::{
|
||||
ap_url, Id, IntoId, PUBLIC_VISIBILTY,
|
||||
actor::Actor,
|
||||
inbox::FromActivity,
|
||||
inbox::{FromActivity, Notify},
|
||||
object::Object
|
||||
};
|
||||
use models::{
|
||||
instance::Instance,
|
||||
notifications::*,
|
||||
posts::Post,
|
||||
users::User
|
||||
};
|
||||
|
@ -128,7 +129,7 @@ impl FromActivity<Note> for Comment {
|
|||
fn from_activity(conn: &PgConnection, note: Note, actor: Id) -> Comment {
|
||||
let previous_url = note.object_props.in_reply_to.clone().unwrap().as_str().unwrap().to_string();
|
||||
let previous_comment = Comment::find_by_ap_url(conn, previous_url.clone());
|
||||
Comment::insert(conn, NewComment {
|
||||
let comm = Comment::insert(conn, NewComment {
|
||||
content: SafeString::new(¬e.object_props.content_string().unwrap()),
|
||||
spoiler_text: note.object_props.summary_string().unwrap_or(String::from("")),
|
||||
ap_url: note.object_props.id_string().ok(),
|
||||
|
@ -136,9 +137,30 @@ impl FromActivity<Note> for Comment {
|
|||
post_id: previous_comment
|
||||
.map(|c| c.post_id)
|
||||
.unwrap_or_else(|| Post::find_by_ap_url(conn, previous_url).unwrap().id),
|
||||
author_id: User::from_url(conn, actor.into()).unwrap().id,
|
||||
author_id: User::from_url(conn, actor.clone().into()).unwrap().id,
|
||||
sensitive: false // "sensitive" is not a standard property, we need to think about how to support it with the activitypub crate
|
||||
})
|
||||
});
|
||||
Comment::notify(conn, note, actor);
|
||||
comm
|
||||
}
|
||||
}
|
||||
|
||||
impl Notify<Note> for Comment {
|
||||
fn notify(conn: &PgConnection, note: Note, _actor: Id) {
|
||||
match Comment::find_by_ap_url(conn, note.object_props.id_string().unwrap()) {
|
||||
Some(comment) => {
|
||||
for author in comment.clone().get_post(conn).get_authors(conn) {
|
||||
let comment = comment.clone();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} commented your article", comment.get_author(conn).display_name.clone()),
|
||||
content: Some(comment.get_post(conn).title),
|
||||
link: comment.ap_url,
|
||||
user_id: author.id
|
||||
});
|
||||
}
|
||||
},
|
||||
None => println!("Couldn't find comment by AP id, to create a new notification")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
use activitypub::{Actor, activity::{Accept, Follow as FollowAct}};
|
||||
use diesel::{self, PgConnection, ExpressionMethods, QueryDsl, RunQueryDsl};
|
||||
|
||||
use activity_pub::{broadcast, Id, IntoId, actor::Actor as ApActor, inbox::{FromActivity, WithInbox}, sign::Signer};
|
||||
use models::blogs::Blog;
|
||||
use models::users::User;
|
||||
use activity_pub::{broadcast, Id, IntoId, actor::Actor as ApActor, inbox::{FromActivity, Notify, WithInbox}, sign::Signer};
|
||||
use models::{
|
||||
blogs::Blog,
|
||||
notifications::*,
|
||||
users::User
|
||||
};
|
||||
use schema::follows;
|
||||
|
||||
#[derive(Queryable, Identifiable, Associations)]
|
||||
|
@ -70,3 +73,15 @@ impl FromActivity<FollowAct> for Follow {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Notify<FollowAct> for Follow {
|
||||
fn notify(conn: &PgConnection, follow: FollowAct, actor: Id) {
|
||||
let follower = User::from_url(conn, actor.into()).unwrap();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} started following you", follower.display_name.clone()),
|
||||
content: None,
|
||||
link: Some(follower.ap_url),
|
||||
user_id: User::from_url(conn, follow.follow_props.object_link::<Id>().unwrap().into()).unwrap().id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,10 +7,11 @@ use activity_pub::{
|
|||
Id,
|
||||
IntoId,
|
||||
actor::Actor,
|
||||
inbox::{FromActivity, Deletable},
|
||||
inbox::{FromActivity, Deletable, Notify},
|
||||
object::Object
|
||||
};
|
||||
use models::{
|
||||
notifications::*,
|
||||
posts::Post,
|
||||
users::User
|
||||
};
|
||||
|
@ -97,14 +98,32 @@ impl Like {
|
|||
}
|
||||
|
||||
impl FromActivity<activity::Like> for Like {
|
||||
fn from_activity(conn: &PgConnection, like: activity::Like, _actor: Id) -> Like {
|
||||
fn from_activity(conn: &PgConnection, like: activity::Like, actor: Id) -> Like {
|
||||
let liker = User::from_url(conn, like.like_props.actor.as_str().unwrap().to_string());
|
||||
let post = Post::find_by_ap_url(conn, like.like_props.object.as_str().unwrap().to_string());
|
||||
Like::insert(conn, NewLike {
|
||||
let res = Like::insert(conn, NewLike {
|
||||
post_id: post.unwrap().id,
|
||||
user_id: liker.unwrap().id,
|
||||
ap_url: like.object_props.id_string().unwrap_or(String::from(""))
|
||||
})
|
||||
});
|
||||
Like::notify(conn, like, actor);
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
impl Notify<activity::Like> for Like {
|
||||
fn notify(conn: &PgConnection, like: activity::Like, actor: Id) {
|
||||
let liker = User::from_url(conn, actor.into()).unwrap();
|
||||
let post = Post::find_by_ap_url(conn, like.like_props.object_link::<Id>().unwrap().into()).unwrap();
|
||||
for author in post.get_authors(conn) {
|
||||
let post = post.clone();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} liked your article", liker.display_name.clone()),
|
||||
content: Some(post.title),
|
||||
link: Some(post.ap_url),
|
||||
user_id: author.id
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ use models::{
|
|||
use schema::posts;
|
||||
use safe_string::SafeString;
|
||||
|
||||
#[derive(Queryable, Identifiable, Serialize)]
|
||||
#[derive(Queryable, Identifiable, Serialize, Clone)]
|
||||
pub struct Post {
|
||||
pub id: i32,
|
||||
pub blog_id: i32,
|
||||
|
|
|
@ -2,8 +2,8 @@ use activitypub::activity::{Announce, Undo};
|
|||
use chrono::NaiveDateTime;
|
||||
use diesel::{self, PgConnection, QueryDsl, RunQueryDsl, ExpressionMethods};
|
||||
|
||||
use activity_pub::{Id, IntoId, actor::Actor, inbox::FromActivity, object::Object};
|
||||
use models::{posts::Post, users::User};
|
||||
use activity_pub::{Id, IntoId, actor::Actor, inbox::{FromActivity, Notify}, object::Object};
|
||||
use models::{notifications::*, posts::Post, users::User};
|
||||
use schema::reshares;
|
||||
|
||||
#[derive(Serialize, Deserialize, Queryable, Identifiable)]
|
||||
|
@ -100,13 +100,31 @@ impl Reshare {
|
|||
}
|
||||
|
||||
impl FromActivity<Announce> for Reshare {
|
||||
fn from_activity(conn: &PgConnection, announce: Announce, _actor: Id) -> Reshare {
|
||||
fn from_activity(conn: &PgConnection, announce: Announce, actor: Id) -> Reshare {
|
||||
let user = User::from_url(conn, announce.announce_props.actor.as_str().unwrap().to_string());
|
||||
let post = Post::find_by_ap_url(conn, announce.announce_props.object.as_str().unwrap().to_string());
|
||||
Reshare::insert(conn, NewReshare {
|
||||
let reshare = Reshare::insert(conn, NewReshare {
|
||||
post_id: post.unwrap().id,
|
||||
user_id: user.unwrap().id,
|
||||
ap_url: announce.object_props.id_string().unwrap_or(String::from(""))
|
||||
})
|
||||
});
|
||||
Reshare::notify(conn, announce, actor);
|
||||
reshare
|
||||
}
|
||||
}
|
||||
|
||||
impl Notify<Announce> for Reshare {
|
||||
fn notify(conn: &PgConnection, announce: Announce, actor: Id) {
|
||||
let actor = User::from_url(conn, actor.into()).unwrap();
|
||||
let post = Post::find_by_ap_url(conn, announce.announce_props.object_link::<Id>().unwrap().into()).unwrap();
|
||||
for author in post.get_authors(conn) {
|
||||
let post = post.clone();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} reshared your article", actor.display_name.clone()),
|
||||
content: Some(post.title),
|
||||
link: Some(post.ap_url),
|
||||
user_id: author.id
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,10 +37,8 @@ use db_conn::DbConn;
|
|||
use models::{
|
||||
blogs::Blog,
|
||||
blog_authors::BlogAuthor,
|
||||
comments::Comment,
|
||||
follows::Follow,
|
||||
instance::Instance,
|
||||
notifications::*,
|
||||
post_authors::PostAuthor,
|
||||
posts::Post
|
||||
};
|
||||
|
@ -458,58 +456,6 @@ impl Inbox for User {
|
|||
println!("Inbox error:\n{}\n{}\n\nActivity was: {}", err.cause(), err.backtrace(), act.to_string());
|
||||
}
|
||||
|
||||
// Notifications
|
||||
match act["type"].as_str().unwrap() {
|
||||
"Announce" => {
|
||||
let actor = User::from_url(conn, act["actor"].as_str().unwrap().to_string()).unwrap();
|
||||
let post = Post::find_by_ap_url(conn, act["object"].as_str().unwrap().to_string()).unwrap();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} reshared your article", actor.display_name.clone()),
|
||||
content: Some(post.title),
|
||||
link: Some(post.ap_url),
|
||||
user_id: self.id
|
||||
});
|
||||
},
|
||||
"Follow" => {
|
||||
let follower = User::from_url(conn, act["actor"].as_str().unwrap().to_string()).unwrap();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} started following you", follower.display_name.clone()),
|
||||
content: None,
|
||||
link: Some(follower.ap_url),
|
||||
user_id: self.id
|
||||
});
|
||||
}
|
||||
"Like" => {
|
||||
let liker = User::from_url(conn, act["actor"].as_str().unwrap().to_string()).unwrap();
|
||||
let post = Post::find_by_ap_url(conn, act["object"].as_str().unwrap().to_string()).unwrap();
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} liked your article", liker.display_name.clone()),
|
||||
content: Some(post.title),
|
||||
link: Some(post.ap_url),
|
||||
user_id: self.id
|
||||
});
|
||||
},
|
||||
"Create" => {
|
||||
match act["object"]["type"].as_str().unwrap() {
|
||||
"Note" => {
|
||||
match Comment::find_by_ap_url(conn, act["object"]["id"].as_str().unwrap().to_string()) {
|
||||
Some(comment) => {
|
||||
Notification::insert(conn, NewNotification {
|
||||
title: format!("{} commented your article", comment.get_author(conn).display_name.clone()),
|
||||
content: Some(comment.get_post(conn).title),
|
||||
link: comment.ap_url,
|
||||
user_id: self.id
|
||||
});
|
||||
},
|
||||
None => println!("Couldn't find comment by AP id, to create a new notification")
|
||||
};
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// TODO: add to stream, or whatever needs to be done
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue