Skip to content

Commit 74cc613

Browse files
committed
Adding short change hero
1 parent 3f44cb4 commit 74cc613

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

vcs-worker/src/operations/object/object_history_op.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ impl ObjectHistoryOperation {
197197
None
198198
};
199199

200+
// Create short change ID (first 8 characters)
201+
let short_id = change.id.chars().take(8).collect::<String>();
202+
200203
history.push(HistoryEntry {
201204
change_id: change.id.clone(),
205+
short_change_id: short_id,
202206
change_message: change.name.clone(),
203207
change_description: change.description.clone(),
204208
author: change.author.clone(),
@@ -226,6 +230,7 @@ impl ObjectHistoryOperation {
226230
#[derive(Debug, Clone)]
227231
struct HistoryEntry {
228232
change_id: String,
233+
short_change_id: String,
229234
change_message: String,
230235
change_description: Option<String>,
231236
author: String,
@@ -244,6 +249,7 @@ impl HistoryEntry {
244249

245250
// Basic change information
246251
pairs.push((v_str("change_id"), v_str(&self.change_id)));
252+
pairs.push((v_str("short_change_id"), v_str(&self.short_change_id)));
247253
pairs.push((v_str("change_message"), v_str(&self.change_message)));
248254

249255
if let Some(desc) = &self.change_description {
@@ -312,7 +318,8 @@ impl Operation for ObjectHistoryOperation {
312318
description: "Get the complete history of an object".to_string(),
313319
moocode: r#"history = worker_request("vcs", {"object/history", "$player"});
314320
// Returns a list of maps, each containing:
315-
// - change_id: the change ID
321+
// - change_id: the full change ID
322+
// - short_change_id: abbreviated change ID (first 8 chars)
316323
// - change_message: the message of the change
317324
// - author: who made the change
318325
// - timestamp: when the change was made
@@ -375,6 +382,7 @@ endfor"#
375382
r#"[
376383
{
377384
"change_id": "abc123def456...",
385+
"short_change_id": "abc123de",
378386
"change_message": "Add player object",
379387
"author": "wizard",
380388
"timestamp": 1234567890,
@@ -387,6 +395,7 @@ endfor"#
387395
},
388396
{
389397
"change_id": "def456ghi789...",
398+
"short_change_id": "def456gh",
390399
"change_message": "Update player verbs",
391400
"author": "developer",
392401
"timestamp": 1234567900,

0 commit comments

Comments
 (0)