forked from lavina/lavina
parent
0105a5b710
commit
757d7c5665
|
@ -30,4 +30,19 @@ impl Storage {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn set_room_topic(&mut self, id: u32, topic: &str) -> Result<()> {
|
||||
let mut executor = self.conn.lock().await;
|
||||
sqlx::query(
|
||||
"update rooms
|
||||
set topic = ?
|
||||
where id = ?;",
|
||||
)
|
||||
.bind(topic)
|
||||
.bind(id)
|
||||
.fetch_optional(&mut *executor)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,9 @@ impl RoomHandle {
|
|||
|
||||
pub async fn set_topic(&self, changer_id: &PlayerId, new_topic: Str) {
|
||||
let mut lock = self.0.write().await;
|
||||
let storage_id = lock.storage_id;
|
||||
lock.topic = new_topic.clone();
|
||||
lock.storage.set_room_topic(storage_id, &new_topic).await.unwrap();
|
||||
let update = Updates::RoomTopicChanged {
|
||||
room_id: lock.room_id.clone(),
|
||||
new_topic: new_topic.clone(),
|
||||
|
|
Loading…
Reference in New Issue