Menší bugfixy, oprava živopříspěvků
Tento commit je obsažen v:
rodič
7c01c70b4d
revize
067e487dd6
@ -50,6 +50,11 @@ impl StreamHandler<Result<WsMessage, ProtocolError>> for LiveSession {
|
|||||||
|
|
||||||
fn handle(&mut self, msg: Result<WsMessage, ProtocolError>, ctx: &mut Self::Context) {
|
fn handle(&mut self, msg: Result<WsMessage, ProtocolError>, ctx: &mut Self::Context) {
|
||||||
match msg {
|
match msg {
|
||||||
|
Ok(WsMessage::Text(text)) => {
|
||||||
|
if text == "{\"type\":\"ping\"}" {
|
||||||
|
ctx.text("{\"type\":\"pong\"}");
|
||||||
|
}
|
||||||
|
}
|
||||||
Ok(WsMessage::Ping(data)) => ctx.pong(&data),
|
Ok(WsMessage::Ping(data)) => ctx.pong(&data),
|
||||||
Ok(WsMessage::Close(_)) => self.finished(ctx),
|
Ok(WsMessage::Close(_)) => self.finished(ctx),
|
||||||
_ => (),
|
_ => (),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
use actix_web::{post, web::Data, HttpRequest, HttpResponse};
|
use actix_web::{post, web::Data, HttpRequest, HttpResponse};
|
||||||
|
use sqlx::query;
|
||||||
use std::{collections::HashMap, fmt::Write};
|
use std::{collections::HashMap, fmt::Write};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -50,6 +51,14 @@ pub async fn edit_posts(
|
|||||||
post.update_content(&ctx, content, content_nomarkup.into())
|
post.update_content(&ctx, content, content_nomarkup.into())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
query(&format!(
|
||||||
|
"UPDATE posts_{} SET quotes = array_remove(quotes, $1) WHERE $1 = ANY(quotes)",
|
||||||
|
post.board
|
||||||
|
))
|
||||||
|
.bind(post.id)
|
||||||
|
.execute(ctx.db())
|
||||||
|
.await?;
|
||||||
|
|
||||||
for quoted_post in quoted_posts {
|
for quoted_post in quoted_posts {
|
||||||
quoted_post.update_quotes(&ctx, post.id).await?;
|
quoted_post.update_quotes(&ctx, post.id).await?;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ pub async fn update_boards(
|
|||||||
return Err(NekrochanError::BoardNameFormatError);
|
return Err(NekrochanError::BoardNameFormatError);
|
||||||
}
|
}
|
||||||
|
|
||||||
if description.is_empty() || description.len() > 128 {
|
if description.len() > 128 {
|
||||||
return Err(NekrochanError::DescriptionFormatError);
|
return Err(NekrochanError::DescriptionFormatError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,10 +21,15 @@ $(function () {
|
|||||||
|
|
||||||
let ws_location = `${protocol}//${window.location.host}/live/${thread[0]}/${thread[1]}/${last_post}`;
|
let ws_location = `${protocol}//${window.location.host}/live/${thread[0]}/${thread[1]}/${last_post}`;
|
||||||
let ws = new WebSocket(ws_location);
|
let ws = new WebSocket(ws_location);
|
||||||
|
let interval;
|
||||||
|
|
||||||
ws.addEventListener("open", function (_) {
|
ws.addEventListener("open", function (_) {
|
||||||
$("#live-indicator").css("background-color", "lime");
|
$("#live-indicator").css("background-color", "lime");
|
||||||
$("#live-status").text("Připojeno pro nové příspěvky");
|
$("#live-status").text("Připojeno pro nové příspěvky");
|
||||||
|
|
||||||
|
interval = setInterval(function () {
|
||||||
|
ws.send('{"type":"ping"}');
|
||||||
|
}, 10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
ws.addEventListener("message", function (msg) {
|
ws.addEventListener("message", function (msg) {
|
||||||
@ -63,5 +68,6 @@ $(function () {
|
|||||||
ws.addEventListener("close", function (_) {
|
ws.addEventListener("close", function (_) {
|
||||||
$("#live-indicator").css("background-color", "red");
|
$("#live-indicator").css("background-color", "red");
|
||||||
$("#live-status").text("Odpojeno, obnov stránku");
|
$("#live-status").text("Odpojeno, obnov stránku");
|
||||||
|
clearInterval(interval);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -385,8 +385,8 @@ summary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.thumb {
|
.thumb {
|
||||||
max-width: 200px;
|
max-width: 150px;
|
||||||
max-height: 200px;
|
max-height: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-content {
|
.post-content {
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="label">Popis</td>
|
<td class="label">Popis</td>
|
||||||
<td><input name="description" type="text" required=""></td>
|
<td><input name="description" type="text"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2"><input class="button" type="submit" formaction="/staff/actions/update-boards" value="Upravit vybrané"></td>
|
<td colspan="2"><input class="button" type="submit" formaction="/staff/actions/update-boards" value="Upravit vybrané"></td>
|
||||||
|
Načítá se…
Odkázat v novém úkolu
Zablokovat Uživatele