forked from mirror/grapevine
enable error_on_line_overflow
and fix errors
These required some manual intervention.
This commit is contained in:
parent
0afc1d2f50
commit
5cb2551422
6 changed files with 75 additions and 60 deletions
|
@ -1,6 +1,7 @@
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
condense_wildcard_suffixes = true
|
condense_wildcard_suffixes = true
|
||||||
|
error_on_line_overflow = true
|
||||||
format_code_in_doc_comments = true
|
format_code_in_doc_comments = true
|
||||||
format_macro_bodies = true
|
format_macro_bodies = true
|
||||||
format_macro_matchers = true
|
format_macro_matchers = true
|
||||||
|
|
|
@ -35,58 +35,61 @@ pub(crate) async fn report_event_route(
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
services()
|
services().admin.send_message(message::RoomMessageEventContent::text_html(
|
||||||
.admin
|
format!(
|
||||||
.send_message(message::RoomMessageEventContent::text_html(
|
"Report received from: {}\n\nEvent ID: {:?}\nRoom ID: {:?}\nSent \
|
||||||
format!(
|
By: {:?}\n\nReport Score: {:?}\nReport Reason: {:?}",
|
||||||
"Report received from: {}\n\nEvent ID: {:?}\nRoom ID: {:?}\nSent \
|
sender_user,
|
||||||
By: {:?}\n\nReport Score: {:?}\nReport Reason: {:?}",
|
pdu.event_id,
|
||||||
sender_user, pdu.event_id, pdu.room_id, pdu.sender, body.score, body.reason
|
pdu.room_id,
|
||||||
),
|
pdu.sender,
|
||||||
format!(
|
body.score,
|
||||||
r#"
|
body.reason
|
||||||
<details>
|
),
|
||||||
<summary>
|
format!(
|
||||||
Report received from:
|
r#"
|
||||||
<a href="https://matrix.to/#/{0:?}">{0:?}</a>
|
<details>
|
||||||
</summary>
|
<summary>
|
||||||
<ul>
|
Report received from:
|
||||||
<li>
|
<a href="https://matrix.to/#/{0:?}">{0:?}</a>
|
||||||
Event Info
|
</summary>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
Event ID:
|
Event Info
|
||||||
<code>{1:?}</code>
|
<ul>
|
||||||
<a href="https://matrix.to/#/{2:?}/{1:?}">🔗</a>
|
<li>
|
||||||
</li>
|
Event ID:
|
||||||
<li>
|
<code>{1:?}</code>
|
||||||
Room ID:
|
<a href="https://matrix.to/#/{2:?}/{1:?}">🔗</a>
|
||||||
<code>{2:?}</code>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
<li>
|
Room ID:
|
||||||
Sent By:
|
<code>{2:?}</code>
|
||||||
<a href="https://matrix.to/#/{3:?}">{3:?}</a>
|
</li>
|
||||||
</li>
|
<li>
|
||||||
</ul>
|
Sent By:
|
||||||
</li>
|
<a href="https://matrix.to/#/{3:?}">{3:?}</a>
|
||||||
<li>
|
</li>
|
||||||
Report Info
|
</ul>
|
||||||
<ul>
|
</li>
|
||||||
<li>Report Score: {4:?}</li>
|
<li>
|
||||||
<li>Report Reason: {5}</li>
|
Report Info
|
||||||
</ul>
|
<ul>
|
||||||
</li>
|
<li>Report Score: {4:?}</li>
|
||||||
</ul>
|
<li>Report Reason: {5}</li>
|
||||||
</details>
|
</ul>
|
||||||
"#,
|
</li>
|
||||||
sender_user,
|
</ul>
|
||||||
pdu.event_id,
|
</details>
|
||||||
pdu.room_id,
|
"#,
|
||||||
pdu.sender,
|
sender_user,
|
||||||
body.score,
|
pdu.event_id,
|
||||||
html_escape::encode_safe(body.reason.as_deref().unwrap_or(""))
|
pdu.room_id,
|
||||||
),
|
pdu.sender,
|
||||||
));
|
body.score,
|
||||||
|
html_escape::encode_safe(body.reason.as_deref().unwrap_or(""))
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
Ok(report_content::v3::Response {})
|
Ok(report_content::v3::Response {})
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,10 @@ use super::{watchers::Watchers, KeyValueDatabaseEngine, KvTree};
|
||||||
use crate::{database::Config, Result};
|
use crate::{database::Config, Result};
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static READ_CONNECTION: RefCell<Option<&'static Connection>> = RefCell::new(None);
|
static READ_CONNECTION: RefCell<Option<&'static Connection>> =
|
||||||
static READ_CONNECTION_ITERATOR: RefCell<Option<&'static Connection>> = RefCell::new(None);
|
RefCell::new(None);
|
||||||
|
static READ_CONNECTION_ITERATOR: RefCell<Option<&'static Connection>> =
|
||||||
|
RefCell::new(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PreparedStatementIterator<'a> {
|
struct PreparedStatementIterator<'a> {
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -595,9 +595,15 @@ macro_rules! impl_ruma_handler {
|
||||||
for path in meta.history.all_paths() {
|
for path in meta.history.all_paths() {
|
||||||
let handler = self.clone();
|
let handler = self.clone();
|
||||||
|
|
||||||
router = router.route(path, on(method_filter, |$( $ty: $ty, )* req| async move {
|
router = router.route(
|
||||||
handler($($ty,)* req).await.map(RumaResponse)
|
path,
|
||||||
}))
|
on(
|
||||||
|
method_filter,
|
||||||
|
|$( $ty: $ty, )* req| async move {
|
||||||
|
handler($($ty,)* req).await.map(RumaResponse)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
router
|
router
|
||||||
|
|
|
@ -243,7 +243,9 @@ impl Service {
|
||||||
Some(event) = receiver.recv() => {
|
Some(event) = receiver.recv() => {
|
||||||
let message_content = match event {
|
let message_content = match event {
|
||||||
AdminRoomEvent::SendMessage(content) => content,
|
AdminRoomEvent::SendMessage(content) => content,
|
||||||
AdminRoomEvent::ProcessMessage(room_message) => self.process_admin_message(room_message).await
|
AdminRoomEvent::ProcessMessage(room_message) => {
|
||||||
|
self.process_admin_message(room_message).await
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mutex_state = Arc::clone(
|
let mutex_state = Arc::clone(
|
||||||
|
|
|
@ -21,6 +21,8 @@ pub(crate) struct Service {
|
||||||
pub(crate) db: &'static dyn Data,
|
pub(crate) db: &'static dyn Data,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RoomsLeft = (OwnedRoomId, Vec<Raw<AnySyncStateEvent>>);
|
||||||
|
|
||||||
impl Service {
|
impl Service {
|
||||||
/// Update current membership data.
|
/// Update current membership data.
|
||||||
#[tracing::instrument(skip(self, last_state))]
|
#[tracing::instrument(skip(self, last_state))]
|
||||||
|
@ -390,8 +392,7 @@ impl Service {
|
||||||
pub(crate) fn rooms_left<'a>(
|
pub(crate) fn rooms_left<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
user_id: &UserId,
|
user_id: &UserId,
|
||||||
) -> impl Iterator<Item = Result<(OwnedRoomId, Vec<Raw<AnySyncStateEvent>>)>> + 'a
|
) -> impl Iterator<Item = Result<RoomsLeft>> + 'a {
|
||||||
{
|
|
||||||
self.db.rooms_left(user_id)
|
self.db.rooms_left(user_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue