Skip to content

fix: channel remark ignore issue - #1996

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/remark-ignore
Oct 10, 2025
Merged

fix: channel remark ignore issue#1996
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/remark-ignore

Conversation

@seefs001

@seefs001 seefs001 commented Oct 10, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Channel API now returns the remark field consistently in responses. The field is nullable, allowing clients to distinguish between no remark (null) and an empty remark ("").
    • Improves data clarity and consistency across integrations; clients should handle null values for remark.

@coderabbitai

coderabbitai Bot commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The Channel struct’s Remark field changed from string to pointer to string. The JSON tag was updated from "remark,omitempty" to "remark". GORM type and validation constraints remain the same. This enables nil values for Remark and affects serialization and nil-check behavior.

Changes

Cohort / File(s) Summary
Model struct update
model/channel.go
Convert Remark from string to *string; JSON tag changed from json:"remark,omitempty" to json:"remark"; GORM type unchanged (varchar(255)); validation unchanged (max=255).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant API
  participant Model as Channel Model
  participant DB

  Client->>API: Create/Update Channel (payload.remark)
  API->>Model: Map payload to Channel{ Remark *string }
  alt remark provided (non-null)
    Model->>DB: INSERT/UPDATE remark=VALUE
    DB-->>API: Success
  else remark omitted/null
    Model->>DB: INSERT/UPDATE remark=NULL
    DB-->>API: Success
  end
  API-->>Client: JSON response with "remark": null or string

  Client->>API: Get Channel
  API->>DB: SELECT Channel
  DB-->>API: row with remark {NULL or string}
  API->>Model: Scan to Remark *string
  alt Remark is NULL
    API-->>Client: "remark": null
  else Remark is not NULL
    API-->>Client: "remark": "..."
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • feat: add channel remark #1710 #1713 — Earlier change adding Remark as a string with json:"remark,omitempty"; directly related to this PR’s switch to *string and removal of omitempty.

Poem

A nibble of null in the carrot of text,
I hop through pointers, what value is next?
String turned to star, now absence can speak,
JSON won’t hide it, not even a squeak.
In fields of models, I bound and I cheer—
Remark can be nothing, and that’s crystal clear. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title succinctly describes the main change, which is fixing the channel remark ignore issue by adjusting the remark field behavior and JSON tag handling to ensure the remark is no longer omitted.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Calcium-Ion
Calcium-Ion merged commit f4d7bde into QuantumNous:main Oct 10, 2025
1 check was pending

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
model/channel.go (1)

49-49: No Channel.Remark usage found—pointer change is safe. Optional: add a GetRemark() helper for consistency with other pointer fields:

func (c *Channel) GetRemark() string {
    if c.Remark == nil {
        return ""
    }
    return *c.Remark
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 77130df and 6897a9f.

📒 Files selected for processing (1)
  • model/channel.go (1 hunks)

ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
jiutubaba pushed a commit to jiutubaba/fx-api that referenced this pull request May 17, 2026
…d-empty-pages

fix(anthropic): drop empty Read.pages in responses-to-anthropic tool input
salem-2007 added a commit to salem-2007/new-api that referenced this pull request Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants