mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
Send server-log field names in camelCase
rename_all on the enum only renamed the kind tags, so the channel switch
entry arrived as from_channel/to_channel and the Server tab showed the raw
{fromChannel}/{toChannel} placeholders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
1 parent
5e7add6dc8
commit
2615904b1e
1 file changed
+16
-3
+16
-3
@@ -234,11 +234,11 @@ fn parse_codec_encryption_mode(s: &str) -> Option<CodecEncryptionMode> {
|
||||
/// Human-facing entries for the Server tab's log-style notifications
|
||||
/// (client join/leave/switch, channel group assignment, channel/server
|
||||
/// changes, own permission errors) - mirrors what the native TS3 client
|
||||
/// shows inline in the server chat. `rename_all = "camelCase"` covers both
|
||||
/// the `kind` tag values and field names, so this needs no remapping on the
|
||||
/// shows inline in the server chat. `rename_all` covers the `kind` tag values
|
||||
/// and `rename_all_fields` the field names, so this needs no remapping on the
|
||||
/// gateway side (unlike the snake_case variants below).
|
||||
#[derive(Serialize)]
|
||||
#[serde(tag = "kind", rename_all = "camelCase")]
|
||||
#[serde(tag = "kind", rename_all = "camelCase", rename_all_fields = "camelCase")]
|
||||
enum ServerLogEntry {
|
||||
ClientJoin { client: String, channel: String },
|
||||
ClientLeave { client: String },
|
||||
@@ -3194,6 +3194,19 @@ mod tests {
|
||||
format!("7\t{offset}\t{total}\t/a b.txt\t{}", base64::engine::general_purpose::STANDARD.encode(data))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn server_log_fields_are_camel_case() {
|
||||
let entry = ServerLogEntry::ClientChannelSwitch {
|
||||
client: "a".into(),
|
||||
from_channel: "b".into(),
|
||||
to_channel: "c".into(),
|
||||
};
|
||||
assert_eq!(
|
||||
serde_json::to_string(&entry).unwrap(),
|
||||
r#"{"kind":"clientChannelSwitch","client":"a","fromChannel":"b","toChannel":"c"}"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn upload_chunks_assemble_in_order_and_reject_gaps() {
|
||||
let mut partials = HashMap::new();
|
||||
|
||||
Reference in new issue
Block a user