Skip to content

feat(user): implement like_status flow (UC10)#84

Merged
veeso merged 2 commits intomainfrom
feat/17-wi-1-6-implement-user-canister-like-status
Apr 30, 2026
Merged

feat(user): implement like_status flow (UC10)#84
veeso merged 2 commits intomainfrom
feat/17-wi-1-6-implement-user-canister-like-status

Conversation

@veeso
Copy link
Copy Markdown
Owner

@veeso veeso commented Apr 30, 2026

Summary

  • Implements like_status, unlike_status and get_liked on the User Canister with idempotent semantics and federation dispatch (Like / Undo(Like)).
  • Adds handle_incoming cases for inbound Like and Undo(Like) that adjust the cached like_count on local statuses (best-effort, validates URI host + handle, saturating decrement).
  • Exposes like_count and boost_count on the did::common::Status DTO so callers can render counters; updates the typed Candid spec accordingly.

Closes #17

Test plan

  • just check_code (nightly fmt + clippy -D warnings)
  • just build_all produces all three wasm artifacts
  • just test — 289 user-canister unit tests pass, including new tests in liked/{like,unlike,get_liked}.rs, urls.rs, and 6 new handle_incoming cases (local Like, Undo(Like), remote-target ignore, mismatched-handle ignore, missing-status no-op, saturating decrement)
  • just integration_test — full integration suite green, plus 4 new tests in integration-tests/tests/like.rs:
    • like + count incremented and liked list contains the URI
    • double-like idempotency (single liked entry, like_count == 1)
    • unlike decrements count back to 0 and clears liked list
    • unlike-without-prior-like is a silent no-op

Notes

  • Federation send_activity already routes opaque JSON to the target inbox, so no Like-specific code was needed there.
  • The User Canister cannot authoritatively prove that an inbound Like references a status it owns beyond URI matching — handle_like ignores remote URIs and mismatched handles, and falls through silently when the target id is missing. The cached like_count is therefore a hint, not a reconciled total. Documented inline in the handler.

veeso added 2 commits April 30, 2026 20:40
Hashtag validator now accepts Unicode letters and numbers in addition
to ASCII, matching Mastodon's `[[:word:]]` semantics. The sanitizer
already lowercased Unicode-aware, so cased scripts (Latin, Greek,
Cyrillic) are folded; non-cased scripts (Han, Arabic, Myanmar) pass
through. Spec doc updated with the new pattern, examples, and an
explicit note that NFC normalization is not yet applied.

Handles spec clarifies that local handles remain ASCII (Mastic owns
the namespace and the unique index must stay normalization-safe),
while remote handles per RFC 7565 carry UTF-8 userparts and IDN hosts
(e.g. `north@ꩰ.com`). Storage form for remote is documented as
Unicode-lowercased userpart + lowercase A-label domain; runtime IDN
normalization is tracked separately.
Wire like_status, unlike_status and get_liked end-to-end on the User
Canister: outbound Like / Undo(Like) activities through federation,
inbound handlers that adjust the cached like_count on local statuses,
and StatusRepository helpers for find_by_id and saturating
increment/decrement of the count. Status DTO now exposes like_count
and boost_count so clients can render counters.

Closes #17
@cocogitto-bot
Copy link
Copy Markdown

cocogitto-bot Bot commented Apr 30, 2026

✔️ 502e9a2...02f8e18 - Conventional commits check succeeded.

@veeso veeso merged commit f3f4b9d into main Apr 30, 2026
3 checks passed
@veeso veeso deleted the feat/17-wi-1-6-implement-user-canister-like-status branch April 30, 2026 20:01
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.

WI-1.6: Implement User Canister - like status

1 participant