mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-22 20:31:19 +00:00
Merge branch 'main' into std-lazy
This commit is contained in:
commit
c69d57cf1c
8 changed files with 35 additions and 18 deletions
|
@ -5,12 +5,9 @@ use lemmy_api_common::{
|
||||||
utils::send_new_applicant_email_to_admins,
|
utils::send_new_applicant_email_to_admins,
|
||||||
SuccessResponse,
|
SuccessResponse,
|
||||||
};
|
};
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::source::{
|
||||||
source::{
|
email_verification::EmailVerification,
|
||||||
email_verification::EmailVerification,
|
local_user::{LocalUser, LocalUserUpdateForm},
|
||||||
local_user::{LocalUser, LocalUserUpdateForm},
|
|
||||||
},
|
|
||||||
RegistrationMode,
|
|
||||||
};
|
};
|
||||||
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
use lemmy_db_views::structs::{LocalUserView, SiteView};
|
||||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||||
|
@ -41,9 +38,7 @@ pub async fn verify_email(
|
||||||
EmailVerification::delete_old_tokens_for_local_user(&mut context.pool(), local_user_id).await?;
|
EmailVerification::delete_old_tokens_for_local_user(&mut context.pool(), local_user_id).await?;
|
||||||
|
|
||||||
// send out notification about registration application to admins if enabled
|
// send out notification about registration application to admins if enabled
|
||||||
if site_view.local_site.registration_mode == RegistrationMode::RequireApplication
|
if site_view.local_site.application_email_admins {
|
||||||
&& site_view.local_site.application_email_admins
|
|
||||||
{
|
|
||||||
let local_user = LocalUserView::read(&mut context.pool(), local_user_id)
|
let local_user = LocalUserView::read(&mut context.pool(), local_user_id)
|
||||||
.await?
|
.await?
|
||||||
.ok_or(LemmyErrorType::CouldntFindPerson)?;
|
.ok_or(LemmyErrorType::CouldntFindPerson)?;
|
||||||
|
|
|
@ -100,15 +100,20 @@ pub async fn send_local_notifs(
|
||||||
person: &Person,
|
person: &Person,
|
||||||
do_send_email: bool,
|
do_send_email: bool,
|
||||||
context: &LemmyContext,
|
context: &LemmyContext,
|
||||||
|
local_user_view: Option<&LocalUserView>,
|
||||||
) -> LemmyResult<Vec<LocalUserId>> {
|
) -> LemmyResult<Vec<LocalUserId>> {
|
||||||
let mut recipient_ids = Vec::new();
|
let mut recipient_ids = Vec::new();
|
||||||
let inbox_link = format!("{}/inbox", context.settings().get_protocol_and_hostname());
|
let inbox_link = format!("{}/inbox", context.settings().get_protocol_and_hostname());
|
||||||
|
|
||||||
// let person = my_local_user.person;
|
// let person = my_local_user.person;
|
||||||
// Read the comment view to get extra info
|
// Read the comment view to get extra info
|
||||||
let comment_view = CommentView::read(&mut context.pool(), comment_id, None)
|
let comment_view = CommentView::read(
|
||||||
.await?
|
&mut context.pool(),
|
||||||
.ok_or(LemmyErrorType::CouldntFindComment)?;
|
comment_id,
|
||||||
|
local_user_view.map(|view| &view.local_user),
|
||||||
|
)
|
||||||
|
.await?
|
||||||
|
.ok_or(LemmyErrorType::CouldntFindComment)?;
|
||||||
let comment = comment_view.comment;
|
let comment = comment_view.comment;
|
||||||
let post = comment_view.post;
|
let post = comment_view.post;
|
||||||
let community = comment_view.community;
|
let community = comment_view.community;
|
||||||
|
|
|
@ -134,6 +134,7 @@ pub async fn create_comment(
|
||||||
&local_user_view.person,
|
&local_user_view.person,
|
||||||
true,
|
true,
|
||||||
&context,
|
&context,
|
||||||
|
Some(&local_user_view),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,15 @@ pub async fn delete_comment(
|
||||||
.await
|
.await
|
||||||
.with_lemmy_type(LemmyErrorType::CouldntUpdateComment)?;
|
.with_lemmy_type(LemmyErrorType::CouldntUpdateComment)?;
|
||||||
|
|
||||||
let recipient_ids =
|
let recipient_ids = send_local_notifs(
|
||||||
send_local_notifs(vec![], comment_id, &local_user_view.person, false, &context).await?;
|
vec![],
|
||||||
|
comment_id,
|
||||||
|
&local_user_view.person,
|
||||||
|
false,
|
||||||
|
&context,
|
||||||
|
Some(&local_user_view),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
let updated_comment_id = updated_comment.id;
|
let updated_comment_id = updated_comment.id;
|
||||||
|
|
||||||
ActivityChannel::submit_activity(
|
ActivityChannel::submit_activity(
|
||||||
|
|
|
@ -81,8 +81,15 @@ pub async fn remove_comment(
|
||||||
};
|
};
|
||||||
ModRemoveComment::create(&mut context.pool(), &form).await?;
|
ModRemoveComment::create(&mut context.pool(), &form).await?;
|
||||||
|
|
||||||
let recipient_ids =
|
let recipient_ids = send_local_notifs(
|
||||||
send_local_notifs(vec![], comment_id, &local_user_view.person, false, &context).await?;
|
vec![],
|
||||||
|
comment_id,
|
||||||
|
&local_user_view.person,
|
||||||
|
false,
|
||||||
|
&context,
|
||||||
|
Some(&local_user_view),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
let updated_comment_id = updated_comment.id;
|
let updated_comment_id = updated_comment.id;
|
||||||
|
|
||||||
ActivityChannel::submit_activity(
|
ActivityChannel::submit_activity(
|
||||||
|
|
|
@ -91,6 +91,7 @@ pub async fn update_comment(
|
||||||
&local_user_view.person,
|
&local_user_view.person,
|
||||||
false,
|
false,
|
||||||
&context,
|
&context,
|
||||||
|
Some(&local_user_view),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
|
@ -179,7 +179,7 @@ impl ActivityHandler for CreateOrUpdateNote {
|
||||||
// TODO: for compatibility with other projects, it would be much better to read this from cc or
|
// TODO: for compatibility with other projects, it would be much better to read this from cc or
|
||||||
// tags
|
// tags
|
||||||
let mentions = scrape_text_for_mentions(&comment.content);
|
let mentions = scrape_text_for_mentions(&comment.content);
|
||||||
send_local_notifs(mentions, comment.id, &actor, do_send_email, context).await?;
|
send_local_notifs(mentions, comment.id, &actor, do_send_email, context, None).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["config:recommended"],
|
"extends": ["config:recommended"],
|
||||||
"schedule": ["before 4am on the first day of the month"]
|
"schedule": ["before 4am on the first day of the month"],
|
||||||
|
"automerge": true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue