Skip to content

Commit

Permalink
Restrict event notes to 500 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Celeo committed Oct 14, 2024
1 parent 50436da commit 6095294
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion vzdv-site/src/endpoints/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use serde::{Deserialize, Serialize};
use sqlx::{Pool, Sqlite};
use std::sync::Arc;
use tower_sessions::Session;
use voca_rs::Voca;
use vzdv::{
sql::{self, Controller, Event, EventPosition, EventRegistration},
vatusa::get_controller_info,
Expand Down Expand Up @@ -486,13 +487,14 @@ async fn post_register_for_event(
Some(register_data.choice_3)
};
// upsert the registration

sqlx::query(sql::UPSERT_EVENT_REGISTRATION)
.bind(id)
.bind(cid)
.bind(c_1)
.bind(c_2)
.bind(c_3)
.bind(&register_data.notes)
.bind(register_data.notes._substring(0, 500))
.execute(&state.db)
.await?;
info!(
Expand Down
2 changes: 1 addition & 1 deletion vzdv-site/templates/events/event.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
</div>
<div class="mb-3">
<label for="notes" class="form-label">Notes</label>
<textarea name="notes" class="form-control">{{ self_register.notes }}</textarea>
<textarea name="notes" class="form-control" maxlength="500">{{ self_register.notes }}</textarea>
</div>
<div class="d-flex justify-content-between">
<button class="btn btn-warning" role="button" id="btn-modal-register-close">Close</button>
Expand Down

0 comments on commit 6095294

Please sign in to comment.