Skip to content

Commit

Permalink
Add some feedback when performing some actions (#552)
Browse files Browse the repository at this point in the history
* Add a way to display flash messages

* Make the flash messages look nice

* Add actual feedback messages

* cargo fmt

* Move flash messages to PlumeRocket

And add trait to convert PlumeRocket to BaseContext

* Remove useless lifetime
  • Loading branch information
elegaanz authored Apr 30, 2019
1 parent 18ae6e2 commit 8f1ab34
Show file tree
Hide file tree
Showing 40 changed files with 3,255 additions and 445 deletions.
5 changes: 4 additions & 1 deletion plume-models/src/plume_rocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mod module {
use crate::search;
use crate::users;
use rocket::{
request::{self, FromRequest, Request},
request::{self, FlashMessage, FromRequest, Request},
Outcome, State,
};
use scheduled_thread_pool::ScheduledThreadPool;
Expand All @@ -19,6 +19,7 @@ mod module {
pub user: Option<users::User>,
pub searcher: Arc<search::Searcher>,
pub worker: Arc<ScheduledThreadPool>,
pub flash_msg: Option<(String, String)>,
}

impl<'a, 'r> FromRequest<'a, 'r> for PlumeRocket {
Expand All @@ -30,10 +31,12 @@ mod module {
let user = request.guard::<users::User>().succeeded();
let worker = request.guard::<State<Arc<ScheduledThreadPool>>>()?;
let searcher = request.guard::<State<Arc<search::Searcher>>>()?;
let flash_msg = request.guard::<FlashMessage>().succeeded();
Outcome::Success(PlumeRocket {
conn,
intl,
user,
flash_msg: flash_msg.map(|f| (f.name().into(), f.msg().into())),
worker: worker.clone(),
searcher: searcher.clone(),
})
Expand Down
120 changes: 120 additions & 0 deletions po/plume/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ msgstr "لإنشاء مدونة جديدة، تحتاج إلى تسجيل الد
msgid "A blog with the same name already exists."
msgstr ""

# src/routes/session.rs:259
#, fuzzy
msgid "Your blog was successfully created!"
msgstr "تمت إعادة تعيين كلمتك السرية بنجاح."

# src/routes/blogs.rs:167
msgid "Your blog was deleted."
msgstr ""

# src/routes/blogs.rs:172
msgid "You are not allowed to delete this blog."
msgstr "لا يسمح لك بحذف هذه المدونة."
Expand All @@ -65,10 +74,56 @@ msgstr "لا يمكنك استخدام هذه الوسائط كأيقونة لل
msgid "You can't use this media as a blog banner."
msgstr "لا يمكنك استخدام هذه الوسائط كشعار للمدونة."

# src/routes/blogs.rs:312
msgid "Your blog information have been updated."
msgstr ""

#, fuzzy
msgid "Your comment have been posted."
msgstr "ليس لديك أية وسائط بعد."

#, fuzzy
msgid "Your comment have been deleted."
msgstr "ليس لديك أية وسائط بعد."

# src/routes/instance.rs:145
msgid "Instance settings have been saved."
msgstr ""

# src/routes/instance.rs:182
msgid "{} have been unblocked."
msgstr ""

# src/routes/instance.rs:184
msgid "{} have been blocked."
msgstr ""

# src/routes/instance.rs:218
msgid "{} have been banned."
msgstr ""

# src/routes/likes.rs:51
msgid "To like a post, you need to be logged in"
msgstr "يجب عليك تسجيل الدخول أولا للإعجاب بهذا المقال"

# src/routes/medias.rs:143
msgid "Your media have been deleted."
msgstr ""

# src/routes/blogs.rs:172
#, fuzzy
msgid "You are not allowed to delete this media."
msgstr "لا يسمح لك بحذف هذه المدونة."

# src/routes/medias.rs:154
msgid "Your avatar have been updated."
msgstr ""

# src/routes/blogs.rs:217
#, fuzzy
msgid "You are not allowed to use this media."
msgstr "لا يسمح لك بتعديل هذه المدونة."

# src/routes/notifications.rs:29
msgid "To see your notifications, you need to be logged in"
msgstr "يجب عليك تسجيل الدخول أولا لعرض الإشعارات"
Expand All @@ -93,6 +148,34 @@ msgstr "منشور جديد"
msgid "Edit {0}"
msgstr "تعديل {0}"

# src/routes/blogs.rs:217
#, fuzzy
msgid "You are not allowed to publish on this blog."
msgstr "لا يسمح لك بتعديل هذه المدونة."

# src/routes/posts.rs:351
msgid "Your article have been updated."
msgstr ""

#, fuzzy
msgid "Your post have been saved."
msgstr "ليس لديك أية وسائط بعد."

# src/routes/blogs.rs:172
#, fuzzy
msgid "You are not allowed to delete this article."
msgstr "لا يسمح لك بحذف هذه المدونة."

# src/routes/posts.rs:589
msgid "Your article have been deleted."
msgstr ""

# src/routes/posts.rs:593
msgid ""
"It looks like the article you tried to delete doesn't exist. Maybe it is "
"already gone?"
msgstr ""

# src/routes/posts.rs:630
msgid ""
"Couldn't obtain enough information about your account. Please make sure your "
Expand All @@ -103,6 +186,14 @@ msgstr ""
msgid "To reshare a post, you need to be logged in"
msgstr ""

#, fuzzy
msgid "You are now connected."
msgstr "ليست لديك التصريحات اللازمة للقيام بذلك."

#, fuzzy
msgid "You are now logged off."
msgstr "ليست لديك التصريحات اللازمة للقيام بذلك."

# src/routes/session.rs:181
msgid "Password reset"
msgstr "إعادة تعيين كلمة المرور"
Expand All @@ -123,6 +214,14 @@ msgstr "عذراً، ولكن انتهت مدة صلاحية الرابط. حا
msgid "To access your dashboard, you need to be logged in"
msgstr "يجب عليك تسجيل الدخول أولاللنفاذ إلى لوح المراقبة"

# src/routes/user.rs:158
msgid "You are no longer following {}."
msgstr ""

# src/routes/user.rs:174
msgid "You are now following {}."
msgstr ""

# src/routes/user.rs:244
msgid "To subscribe to someone, you need to be logged in"
msgstr ""
Expand All @@ -131,6 +230,27 @@ msgstr ""
msgid "To edit your profile, you need to be logged in"
msgstr ""

# src/routes/user.rs:390
msgid "Your profile have been updated."
msgstr ""

#, fuzzy
msgid "Your account have been deleted."
msgstr "ليس لديك أية وسائط بعد."

# src/routes/user.rs:411
msgid "You can't delete someone else's account."
msgstr ""

# src/routes/user.rs:473
msgid "Registrations are closed on this instance."
msgstr ""

# src/routes/user.rs:491
msgid ""
"Your account have been created. You just need to login before you can use it."
msgstr ""

msgid "Plume"
msgstr "Plume"

Expand Down
119 changes: 119 additions & 0 deletions po/plume/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ msgstr ""
msgid "A blog with the same name already exists."
msgstr "Вече съществува блог със същото име."

# src/routes/blogs.rs:142
msgid "Your blog was successfully created!"
msgstr ""

# src/routes/blogs.rs:167
msgid "Your blog was deleted."
msgstr ""

# src/routes/blogs.rs:172
msgid "You are not allowed to delete this blog."
msgstr ""
Expand All @@ -64,10 +72,56 @@ msgstr ""
msgid "You can't use this media as a blog banner."
msgstr ""

# src/routes/blogs.rs:312
msgid "Your blog information have been updated."
msgstr ""

# src/routes/comments.rs:89
msgid "Your comment have been posted."
msgstr ""

# src/routes/comments.rs:163
msgid "Your comment have been deleted."
msgstr ""

# src/routes/instance.rs:145
msgid "Instance settings have been saved."
msgstr ""

# src/routes/instance.rs:182
msgid "{} have been unblocked."
msgstr ""

# src/routes/instance.rs:184
msgid "{} have been blocked."
msgstr ""

# src/routes/instance.rs:218
msgid "{} have been banned."
msgstr ""

# src/routes/likes.rs:51
msgid "To like a post, you need to be logged in"
msgstr ""

# src/routes/medias.rs:143
msgid "Your media have been deleted."
msgstr ""

# src/routes/posts.rs:140
#, fuzzy
msgid "You are not allowed to delete this media."
msgstr "Вие не сте автор на този блог."

# src/routes/medias.rs:154
msgid "Your avatar have been updated."
msgstr ""

# src/routes/posts.rs:140
#, fuzzy
msgid "You are not allowed to use this media."
msgstr "Вие не сте автор на този блог."

# src/routes/notifications.rs:29
msgid "To see your notifications, you need to be logged in"
msgstr ""
Expand All @@ -92,6 +146,34 @@ msgstr "Нова публикация"
msgid "Edit {0}"
msgstr ""

# src/routes/posts.rs:140
#, fuzzy
msgid "You are not allowed to publish on this blog."
msgstr "Вие не сте автор на този блог."

# src/routes/posts.rs:351
msgid "Your article have been updated."
msgstr ""

# src/routes/posts.rs:527
msgid "Your post have been saved."
msgstr ""

# src/routes/posts.rs:140
#, fuzzy
msgid "You are not allowed to delete this article."
msgstr "Вие не сте автор на този блог."

# src/routes/posts.rs:589
msgid "Your article have been deleted."
msgstr ""

# src/routes/posts.rs:593
msgid ""
"It looks like the article you tried to delete doesn't exist. Maybe it is "
"already gone?"
msgstr ""

# src/routes/posts.rs:630
msgid ""
"Couldn't obtain enough information about your account. Please make sure your "
Expand All @@ -102,6 +184,14 @@ msgstr ""
msgid "To reshare a post, you need to be logged in"
msgstr ""

#, fuzzy
msgid "You are now connected."
msgstr "Не сте упълномощени."

#, fuzzy
msgid "You are now logged off."
msgstr "Не сте упълномощени."

# src/routes/session.rs:181
msgid "Password reset"
msgstr ""
Expand All @@ -122,6 +212,14 @@ msgstr ""
msgid "To access your dashboard, you need to be logged in"
msgstr ""

# src/routes/user.rs:158
msgid "You are no longer following {}."
msgstr ""

# src/routes/user.rs:174
msgid "You are now following {}."
msgstr ""

# src/routes/user.rs:244
msgid "To subscribe to someone, you need to be logged in"
msgstr ""
Expand All @@ -130,6 +228,27 @@ msgstr ""
msgid "To edit your profile, you need to be logged in"
msgstr ""

# src/routes/user.rs:390
msgid "Your profile have been updated."
msgstr ""

# src/routes/user.rs:409
msgid "Your account have been deleted."
msgstr ""

# src/routes/user.rs:411
msgid "You can't delete someone else's account."
msgstr ""

# src/routes/user.rs:473
msgid "Registrations are closed on this instance."
msgstr ""

# src/routes/user.rs:491
msgid ""
"Your account have been created. You just need to login before you can use it."
msgstr ""

msgid "Plume"
msgstr "Pluma"

Expand Down
Loading

0 comments on commit 8f1ab34

Please sign in to comment.