Retry the fix
This commit is contained in:
parent
c0583f2d43
commit
265e48f84b
@ -32,6 +32,12 @@ export const EditButtonRow = () => {
|
|||||||
setRecentlySaved(false);
|
setRecentlySaved(false);
|
||||||
|
|
||||||
flash({ message: response.data.error, type: "error" });
|
flash({ message: response.data.error, type: "error" });
|
||||||
|
} else if (response.data.errors && response.data.errors.length > 0) {
|
||||||
|
setRecentlySaved(false);
|
||||||
|
|
||||||
|
for (const error of response.data.errors) {
|
||||||
|
flash({ message: error, type: "error" });
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setRecentlySaved(true);
|
setRecentlySaved(true);
|
||||||
|
|
||||||
|
@ -274,39 +274,39 @@ pub async fn edit_reminder(
|
|||||||
reminder.channel, id
|
reminder.channel, id
|
||||||
);
|
);
|
||||||
|
|
||||||
return Err(json!({"error": "Channel not found"}));
|
error.push("Channel not found".to_string());
|
||||||
}
|
} else {
|
||||||
|
let channel = create_database_channel(
|
||||||
|
ctx.inner(),
|
||||||
|
ChannelId::new(reminder.channel),
|
||||||
|
&mut transaction,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
let channel = create_database_channel(
|
match channel {
|
||||||
ctx.inner(),
|
Ok(channel) => {
|
||||||
ChannelId::new(reminder.channel),
|
match sqlx::query!(
|
||||||
&mut transaction,
|
"UPDATE reminders SET channel_id = ? WHERE uid = ?",
|
||||||
)
|
channel,
|
||||||
.await;
|
reminder.uid
|
||||||
|
)
|
||||||
|
.execute(transaction.executor())
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(e) => {
|
||||||
|
warn!("Error setting channel: {:?}", e);
|
||||||
|
|
||||||
if let Err(e) = channel {
|
error.push("Couldn't set channel".to_string())
|
||||||
warn!("`create_database_channel` returned an error code: {:?}", e);
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Err(
|
Err(e) => {
|
||||||
json!({"error": "Failed to configure channel for reminders. Please check the bot permissions"}),
|
warn!("`create_database_channel` returned an error code: {:?}", e);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let channel = channel.unwrap();
|
error.push("Failed to configure channel for reminders. Please check the bot permissions".to_string());
|
||||||
|
}
|
||||||
match sqlx::query!(
|
|
||||||
"UPDATE reminders SET channel_id = ? WHERE uid = ?",
|
|
||||||
channel,
|
|
||||||
reminder.uid
|
|
||||||
)
|
|
||||||
.execute(transaction.executor())
|
|
||||||
.await
|
|
||||||
{
|
|
||||||
Ok(_) => {}
|
|
||||||
Err(e) => {
|
|
||||||
warn!("Error setting channel: {:?}", e);
|
|
||||||
|
|
||||||
error.push("Couldn't set channel".to_string())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,14 +317,16 @@ pub async fn edit_reminder(
|
|||||||
reminder.channel, id
|
reminder.channel, id
|
||||||
);
|
);
|
||||||
|
|
||||||
return Err(json!({"error": "Channel not found"}));
|
error.push("Channel not found".to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(e) = transaction.commit().await {
|
if let Err(e) = transaction.commit().await {
|
||||||
warn!("Couldn't commit transaction: {:?}", e);
|
warn!("Couldn't commit transaction: {:?}", e);
|
||||||
return json_err!("Couldn't commit transaction");
|
return Err(
|
||||||
|
json!({"reminder": Option::<GetReminder>::None, "errors": vec!["Unknown error"]}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
match sqlx::query_as_unchecked!(
|
match sqlx::query_as_unchecked!(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user