mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2024-12-22 08:16:28 +00:00
#66 set minimum
This commit is contained in:
parent
0db3ef4a1f
commit
9d13e607f5
@ -49,7 +49,7 @@ async fn create(note: web::Json<Note>) -> impl Responder {
|
|||||||
}
|
}
|
||||||
match n.views {
|
match n.views {
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
if v > *config::MAX_VIEWS {
|
if v > *config::MAX_VIEWS || v < 1 {
|
||||||
return bad_req;
|
return bad_req;
|
||||||
}
|
}
|
||||||
n.expiration = None; // views overrides expiration
|
n.expiration = None; // views overrides expiration
|
||||||
|
@ -18,8 +18,9 @@
|
|||||||
bind:value={note.views}
|
bind:value={note.views}
|
||||||
disabled={timeExpiration}
|
disabled={timeExpiration}
|
||||||
max={$status?.max_views}
|
max={$status?.max_views}
|
||||||
|
min={1}
|
||||||
validate={(v) =>
|
validate={(v) =>
|
||||||
($status && v <= $status?.max_views) ||
|
($status && v <= $status?.max_views && v > 0) ||
|
||||||
$t('home.errors.max', { values: { n: $status?.max_views ?? 0 } })}
|
$t('home.errors.max', { values: { n: $status?.max_views ?? 0 } })}
|
||||||
/>
|
/>
|
||||||
<div class="middle-switch">
|
<div class="middle-switch">
|
||||||
|
Loading…
Reference in New Issue
Block a user