Skip to content

API: Support created_at for API card and comment creation#2056

Merged
jeremy merged 2 commits intobasecamp:mainfrom
jankeesvw:api-created-at-support
Dec 11, 2025
Merged

API: Support created_at for API card and comment creation#2056
jeremy merged 2 commits intobasecamp:mainfrom
jankeesvw:api-created-at-support

Conversation

@jankeesvw
Copy link
Copy Markdown
Contributor

As discussed in #1766 (comment), this adds the ability to import cards and comments with their original timestamps.

What

  • Accept created_at when creating cards via the API.
  • Accept created_at when creating comments.
  • Avoid overwriting a provided created_at during initial publication.
  • Update API docs accordingly.

Why

Needed for importing historical items, such as GitHub issues and their comments, while keeping accurate timelines.

Notes

  • created_at is optional. Existing behavior is unchanged when omitted.
  • UI flows stay the same.

Example

{
  "card": {
    "title": "Imported issue",
    "created_at": "2023-05-14T10:23:45Z"
  }
}

Discussed in
basecamp#1766 (comment),
this allows users to import cards from another system with entries from
the past. For instance I'm importing all our Github issues (including
the closed onces) to Fizzy.
Comment thread app/models/card/statuses.rb Outdated
@jankeesvw jankeesvw mentioned this pull request Dec 10, 2025
@jankeesvw jankeesvw changed the title Support created_at for API card and comment creation API: Support created_at for API card and comment creation Dec 10, 2025
@jeremy jeremy requested a review from monorkin December 11, 2025 01:56
@jeremy jeremy marked this pull request as ready for review December 11, 2025 03:44
@jeremy jeremy force-pushed the api-created-at-support branch from 7182159 to c4b0e67 Compare December 11, 2025 03:47
@jeremy jeremy merged commit 477b4d6 into basecamp:main Dec 11, 2025
4 checks passed
@jankeesvw jankeesvw deleted the api-created-at-support branch December 11, 2025 06:17
jankeesvw added a commit to jankeesvw/fizzy that referenced this pull request Dec 11, 2025
This is useful when doing an import from another system. I'm currently
working on a script to import our Github issues into Fizzy.

This is discussed in
basecamp#2056 (comment)
jankeesvw added a commit to jankeesvw/fizzy that referenced this pull request Dec 11, 2025
This is useful when doing an import from another system. I'm currently
working on a script to import our Github issues into Fizzy.

This is discussed in
basecamp#2056 (comment)
adjogima added a commit that referenced this pull request Dec 11, 2025
* main: (117 commits)
  Explain that the upload URL is account-scope
  Allow direct uploads via API
  Storage: ignore jobs for now-deleted targets
  API: Support `created_at` for API card and comment creation (#2056)
  Enforce CSP (#2070)
  CSP: full config with env vars per source (#2069)
  Speedy, auditable, deadlock-resistant storage tracking (#2026)
  Gitleaks: ignore legit non-sensitive API keys and tokens in docs/ and test/ (#2068)
  Get gitleaks-audit green again
  Bump actions/checkout from 4 to 6 (#2047)
  Bump docker/login-action from 3.5.0 to 3.6.0 (#2046)
  Bump docker/metadata-action from 5.8.0 to 5.10.0 (#2045)
  Bump sigstore/cosign-installer from 3.9.2 to 4.0.0 (#2044)
  make MySQL SSL mode configurable via env var (#2036)
  Update tip text for turning a card into a Golden Ticket
  Revert "Fix Lexxy prompt list padding by lowering rich-text specificity"
  Fix Lexxy prompt list padding by lowering rich-text specificity
  Improve phrasing
  Fix crash due to missing partial
  Fix status and filter mistakes
  ...
adjogima added a commit that referenced this pull request Dec 11, 2025
…tylesheets+edits

* mobile-app/scoped-stylesheets: (117 commits)
  Explain that the upload URL is account-scope
  Allow direct uploads via API
  Storage: ignore jobs for now-deleted targets
  API: Support `created_at` for API card and comment creation (#2056)
  Enforce CSP (#2070)
  CSP: full config with env vars per source (#2069)
  Speedy, auditable, deadlock-resistant storage tracking (#2026)
  Gitleaks: ignore legit non-sensitive API keys and tokens in docs/ and test/ (#2068)
  Get gitleaks-audit green again
  Bump actions/checkout from 4 to 6 (#2047)
  Bump docker/login-action from 3.5.0 to 3.6.0 (#2046)
  Bump docker/metadata-action from 5.8.0 to 5.10.0 (#2045)
  Bump sigstore/cosign-installer from 3.9.2 to 4.0.0 (#2044)
  make MySQL SSL mode configurable via env var (#2036)
  Update tip text for turning a card into a Golden Ticket
  Revert "Fix Lexxy prompt list padding by lowering rich-text specificity"
  Fix Lexxy prompt list padding by lowering rich-text specificity
  Improve phrasing
  Fix crash due to missing partial
  Fix status and filter mistakes
  ...
jeremy added a commit that referenced this pull request Dec 12, 2025
* Allow Card#last_updated_at to be set

This is useful when doing an import from another system. I'm currently
working on a script to import our Github issues into Fizzy.

This is discussed in
#2056 (comment)

* Add nil fallback and expand test coverage for last_active_at

Adds a safety fallback to Time.current if created_at is unexpectedly nil
during card creation.

Test coverage to verify:
* last_active_at defaults to created_at when not provided
* last_active_at can be updated via API on existing cards
* import workflow where last_active_at is restored after comments
* publishing doesn't overwrite explicit last_active_at values

---------

Co-authored-by: Jeremy Daer <jeremy@37signals.com>
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