fix(show): include gitlab_id on notes in issue/MR detail views
The show command's NoteDetail and MrNoteDetail structs were missing gitlab_id, making individual notes unaddressable in robot mode output. This was inconsistent with the notes list command which already exposed gitlab_id. Without an identifier, agents consuming show output could not construct GitLab web URLs or reference specific notes for follow-up operations via glab. Added gitlab_id to: - NoteDetail / NoteDetailJson (issue discussions) - MrNoteDetail / MrNoteDetailJson (MR discussions) - Both SQL queries (shifted column indices accordingly) - Both From<&T> conversion impls Deliberately scoped to show command only — me/timeline/trace structs were evaluated and intentionally left unchanged because they serve different consumption patterns where note-level identity is not needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,7 @@ pub struct MrDiscussionDetail {
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct MrNoteDetail {
|
||||
pub gitlab_id: i64,
|
||||
pub author_username: String,
|
||||
pub body: String,
|
||||
pub created_at: i64,
|
||||
@@ -224,7 +225,7 @@ fn get_mr_discussions(conn: &Connection, mr_id: i64) -> Result<Vec<MrDiscussionD
|
||||
.collect::<std::result::Result<Vec<_>, _>>()?;
|
||||
|
||||
let mut note_stmt = conn.prepare(
|
||||
"SELECT author_username, body, created_at, is_system,
|
||||
"SELECT gitlab_id, author_username, body, created_at, is_system,
|
||||
position_old_path, position_new_path, position_old_line,
|
||||
position_new_line, position_type
|
||||
FROM notes
|
||||
@@ -236,12 +237,12 @@ fn get_mr_discussions(conn: &Connection, mr_id: i64) -> Result<Vec<MrDiscussionD
|
||||
for (disc_id, individual_note) in disc_rows {
|
||||
let notes: Vec<MrNoteDetail> = note_stmt
|
||||
.query_map([disc_id], |row| {
|
||||
let is_system: i64 = row.get(3)?;
|
||||
let old_path: Option<String> = row.get(4)?;
|
||||
let new_path: Option<String> = row.get(5)?;
|
||||
let old_line: Option<i64> = row.get(6)?;
|
||||
let new_line: Option<i64> = row.get(7)?;
|
||||
let position_type: Option<String> = row.get(8)?;
|
||||
let is_system: i64 = row.get(4)?;
|
||||
let old_path: Option<String> = row.get(5)?;
|
||||
let new_path: Option<String> = row.get(6)?;
|
||||
let old_line: Option<i64> = row.get(7)?;
|
||||
let new_line: Option<i64> = row.get(8)?;
|
||||
let position_type: Option<String> = row.get(9)?;
|
||||
|
||||
let position = if old_path.is_some()
|
||||
|| new_path.is_some()
|
||||
@@ -260,9 +261,10 @@ fn get_mr_discussions(conn: &Connection, mr_id: i64) -> Result<Vec<MrDiscussionD
|
||||
};
|
||||
|
||||
Ok(MrNoteDetail {
|
||||
author_username: row.get(0)?,
|
||||
body: row.get(1)?,
|
||||
created_at: row.get(2)?,
|
||||
gitlab_id: row.get(0)?,
|
||||
author_username: row.get(1)?,
|
||||
body: row.get(2)?,
|
||||
created_at: row.get(3)?,
|
||||
is_system: is_system == 1,
|
||||
position,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user