提醒旧版前端分区问题
This commit is contained in:
@@ -186,10 +186,19 @@ pub async fn publish_post(
|
|||||||
db: Db,
|
db: Db,
|
||||||
rconn: RdsConn,
|
rconn: RdsConn,
|
||||||
) -> JsonApi {
|
) -> JsonApi {
|
||||||
|
let text = if poi.room_id.is_none() {
|
||||||
|
format!(
|
||||||
|
"{}\n\n---\n\n\\* 无效分区或来自旧版前端,已默认归档到0区。分区管理说明见 #100426,建议尽快更新前端(点击ⓘ ,点击“立即更新”)。",
|
||||||
|
&poi.text
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
poi.text.to_string()
|
||||||
|
};
|
||||||
|
|
||||||
let p = Post::create(
|
let p = Post::create(
|
||||||
&db,
|
&db,
|
||||||
NewPost {
|
NewPost {
|
||||||
content: poi.text.to_string(),
|
content: text,
|
||||||
cw: poi.cw.to_string(),
|
cw: poi.cw.to_string(),
|
||||||
author_hash: user.namehash.to_string(),
|
author_hash: user.namehash.to_string(),
|
||||||
author_title: poi.use_title.map(|_| user.custom_title).unwrap_or_default(),
|
author_title: poi.use_title.map(|_| user.custom_title).unwrap_or_default(),
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![allow(clippy::let_unit_value)]
|
||||||
|
|
||||||
use rocket::fairing::{Fairing, Info, Kind};
|
use rocket::fairing::{Fairing, Info, Kind};
|
||||||
use rocket::http::Header;
|
use rocket::http::Header;
|
||||||
use rocket::{Request, Response};
|
use rocket::{Request, Response};
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ async fn main() -> Result<(), rocket::Error> {
|
|||||||
let rconn = RdsConn(rmc.clone());
|
let rconn = RdsConn(rmc.clone());
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
for room_id in [None, Some(0), Some(1), Some(42)] {
|
for room_id in (0..5).map(Some).chain([None, Some(42)]) {
|
||||||
cache::PostListCache::init(room_id, 3, &rconn).clear().await;
|
cache::PostListCache::init(room_id, 3, &rconn).clear().await;
|
||||||
}
|
}
|
||||||
sleep(Duration::from_secs(5 * 60)).await;
|
sleep(Duration::from_secs(5 * 60)).await;
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ impl Post {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
PostCache::init(&rconn).clear_all().await;
|
PostCache::init(&rconn).clear_all().await;
|
||||||
for room_id in [None, Some(0), Some(1), Some(42)] {
|
for room_id in (0..5).map(Some).chain([None, Some(42)]) {
|
||||||
PostListCache::init(room_id, 2, rconn).clear().await;
|
PostListCache::init(room_id, 2, rconn).clear().await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user