feat(user): implement like_status flow (UC10)#84
Merged
Conversation
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
|
✔️ 502e9a2...02f8e18 - Conventional commits check succeeded. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
like_status,unlike_statusandget_likedon the User Canister with idempotent semantics and federation dispatch (Like/Undo(Like)).handle_incomingcases for inboundLikeandUndo(Like)that adjust the cachedlike_counton local statuses (best-effort, validates URI host + handle, saturating decrement).like_countandboost_counton thedid::common::StatusDTO 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_allproduces all three wasm artifactsjust test— 289 user-canister unit tests pass, including new tests inliked/{like,unlike,get_liked}.rs,urls.rs, and 6 newhandle_incomingcases (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 inintegration-tests/tests/like.rs:Notes
send_activityalready routes opaque JSON to the target inbox, so no Like-specific code was needed there.Likereferences a status it owns beyond URI matching —handle_likeignores remote URIs and mismatched handles, and falls through silently when the target id is missing. The cachedlike_countis therefore a hint, not a reconciled total. Documented inline in the handler.