Skip to content

Feat/add follows#1

Merged
jgmontoya merged 3 commits into
masterfrom
feat/add-follows
Mar 4, 2026
Merged

Feat/add follows#1
jgmontoya merged 3 commits into
masterfrom
feat/add-follows

Conversation

@jgmontoya

@jgmontoya jgmontoya commented Mar 3, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Follow/unfollow users from profile and search; profile shows your following list with selection and keyboard navigation (j/k to move, d to unfollow).
    • Search results show follow status and allow toggling follow with Tab.
    • Profile UI displays "Following (N)" and improved follow list hints.
  • Chores

    • Added MIT license.
    • Added CI workflow for format, lint, test, and build.

@coderabbitai

coderabbitai Bot commented Mar 3, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f514677b-3be5-4e6c-b8ce-4d96bfa5baa2

📥 Commits

Reviewing files that changed from the base of the PR and between 1191cab and c6ad76c.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • src/app.rs
  • src/main.rs
  • src/screen/user_search.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/screen/user_search.rs
  • .github/workflows/ci.yml

Walkthrough

Adds follow/unfollow features: new Action/Effect variants, App state and helper, executor handlers for follow effects, profile and search UI to display/manage follows, CI workflow, and an MIT LICENSE file.

Changes

Cohort / File(s) Summary
License
LICENSE.md
Added project MIT license text (Internet Privacy Foundation, 2024–2026).
Action / Effect Definitions
src/action.rs
Added follow-related enum variants: Action::FollowsLoaded(Vec<Value>), Action::FollowSuccess(String), Action::FollowError(String); Effect::LoadFollows { account }, Effect::FollowUser { account, pubkey }, Effect::UnfollowUser { account, pubkey }.
Application state & logic
src/app.rs
Added pub follows: Vec<Value> and pub selected_follow: usize; pub fn is_following(&self, pubkey: &str); handlers for follow actions (load/success/error); dispatches LoadFollows when entering main/profile and after follow success; key handlers and toggle_follow_selected logic.
Effect execution / runtime
src/main.rs
Implemented async handlers for LoadFollows, FollowUser, and UnfollowUser effects that call the daemon/CLI and emit FollowsLoaded, FollowSuccess, or FollowError; small refactor for daemon logs path derivation.
Profile screen UI
src/screen/profile.rs
Reworked layout to include a "Following (N)" header and a selectable follows list using ratatui List/ListState tied to app.selected_follow; updated hints and empty-state rendering.
User search UI
src/screen/user_search.rs
Display per-result follow status badge (green “[following]”); derive short pubkey from pubkey/npub; include Tab follow/unfollow hint when results exist.
CI workflow
.github/workflows/ci.yml
Added GitHub Actions CI workflow with jobs: fmt, clippy, test, build; sets up Rust toolchain and dependency caching.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feat/add follows' directly reflects the main changeset, which adds comprehensive follow/unfollow functionality across multiple files including new action types, app state management, UI rendering, and effect handlers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-follows

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/screen/user_search.rs (1)

83-90: Avoid extracting the same user identifier twice per row.
Line 83 and Line 72 both derive the same value (pubkey/npub). Reuse one local variable to keep rendering logic tighter and reduce drift risk.

♻️ Suggested cleanup
-                let npub = user
+                let user_id = user
                     .get("pubkey")
                     .or_else(|| user.get("npub"))
                     .and_then(|v| v.as_str())
                     .unwrap_or("");
-                let short_npub = if npub.len() > 20 {
-                    format!("{}...", &npub[..17])
+                let short_npub = if user_id.len() > 20 {
+                    format!("{}...", &user_id[..17])
                 } else {
-                    npub.to_string()
+                    user_id.to_string()
                 };
-
-                let pubkey = user
-                    .get("pubkey")
-                    .or_else(|| user.get("npub"))
-                    .and_then(|v| v.as_str())
-                    .unwrap_or("");
-                let is_following = app.is_following(pubkey);
+                let is_following = app.is_following(user_id);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/screen/user_search.rs` around lines 83 - 90, The code extracts the same
identifier twice (first as `pubkey`/`npub` earlier and again around `let pubkey
= user.get("pubkey")...`) — instead, compute the identifier once and reuse it
for following checks and rendering: keep one local variable (e.g., the existing
`pubkey` from the earlier extraction) and replace the later extraction with that
variable when calling `app.is_following(pubkey)` and building `follow_badge`;
update references to `pubkey`/`npub` in the `user_search` rendering path so all
logic (including `is_following` and `follow_badge`) uses the single reused
identifier.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app.rs`:
- Around line 1177-1205: The help overlay for Screen::Profile and
Screen::UserSearch is missing the new follow/unfollow keybindings ('d' for
unfollow and Tab for follow); update the help data where help entries are
constructed (the function or constant that builds the help overlay for
Screen::Profile and Screen::UserSearch) to include entries describing the Tab
key (follow) and the 'd' key (unfollow) with brief labels so they appear in the
overlay; ensure the same text appears where help entries are generated for both
Profile and UserSearch screens (search the code for the help-generation function
or constant used by render_help or the Screen enum match) and add the two
keybinding entries in those cases.

---

Nitpick comments:
In `@src/screen/user_search.rs`:
- Around line 83-90: The code extracts the same identifier twice (first as
`pubkey`/`npub` earlier and again around `let pubkey = user.get("pubkey")...`) —
instead, compute the identifier once and reuse it for following checks and
rendering: keep one local variable (e.g., the existing `pubkey` from the earlier
extraction) and replace the later extraction with that variable when calling
`app.is_following(pubkey)` and building `follow_badge`; update references to
`pubkey`/`npub` in the `user_search` rendering path so all logic (including
`is_following` and `follow_badge`) uses the single reused identifier.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6cd6d6c and 9d4bc4c.

📒 Files selected for processing (6)
  • LICENSE.md
  • src/action.rs
  • src/app.rs
  • src/main.rs
  • src/screen/profile.rs
  • src/screen/user_search.rs

Comment thread src/app.rs
Comment thread src/app.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app.rs`:
- Around line 1636-1639: The help text added to the help lines is incorrect:
replace the hint call that currently uses "j / k" for navigation with the actual
navigation keys and correct description; specifically, in the block that pushes
hints into lines (the calls to hint(...) that build the help text), change
hint("j / k", "Navigate results") to hint("Up / Down", "Navigate results") and
either remove or repurpose the existing hint("j / k", ...) entry to reflect that
j/k modify the search input (e.g., hint("j / k", "Move cursor in input") or
simply omit it) so the help matches the UserSearch behavior. Ensure you update
the same calls to hint(...) that populate lines so labels and descriptions are
consistent with the UserSearch navigation code.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d4bc4c and 19a263c.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • src/app.rs
  • src/screen/user_search.rs

Comment thread src/app.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/app.rs (1)

1636-1638: ⚠️ Potential issue | 🟡 Minor

Fix UserSearch navigation hint to match actual keys.

Line 1637 still says j / k navigate, but navigation is handled by arrow keys (Line 1286-Line 1295); j/k type into input.

Suggested fix
-            lines.push(hint("j / k", "Navigate results"));
+            lines.push(hint("↑ / ↓", "Navigate results"));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app.rs` around lines 1636 - 1638, The navigation hint text is wrong:
locate the call lines.push(hint("j / k", "Navigate results")) (used alongside
lines.push(hint("Enter", "Search")) and lines.push(hint("Tab", "Follow /
Unfollow")) in app.rs) and change the key label to match actual navigation keys
(e.g., replace "j / k" with "↑ / ↓" or "Arrow keys") so the hint reflects that
navigation is handled by the arrow keys; keep the hint helper function name hint
and other surrounding calls unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/app.rs`:
- Around line 1636-1638: The navigation hint text is wrong: locate the call
lines.push(hint("j / k", "Navigate results")) (used alongside
lines.push(hint("Enter", "Search")) and lines.push(hint("Tab", "Follow /
Unfollow")) in app.rs) and change the key label to match actual navigation keys
(e.g., replace "j / k" with "↑ / ↓" or "Arrow keys") so the hint reflects that
navigation is handled by the arrow keys; keep the hint helper function name hint
and other surrounding calls unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9d47b81b-6575-421b-a496-89c038c70809

📥 Commits

Reviewing files that changed from the base of the PR and between 19a263c and 1191cab.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • src/app.rs
  • src/main.rs
  • src/screen/user_search.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

@jgmontoya
jgmontoya merged commit 72f81d2 into master Mar 4, 2026
4 checks passed
@jgmontoya
jgmontoya deleted the feat/add-follows branch March 4, 2026 14:41
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.

1 participant