Auto-favorite nodes on direct message, except CLIENT_BASE role
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #1491 by @FawwazLawal — closed without merging
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- api
Research direction
Start in packages/sdk/src/features/chat/ChatClient.ts, in the onMessagePacket subscriber where direct messages are classified, and read how NodesClient.favorite() in packages/sdk/src/features/nodes/NodesClient.ts is used. The local role comes from client.config.radio.value.device?.role via ConfigClient. Done means a direct-message peer is favorited on send and receive unless the local role is CLIENT_BASE, with no duplicate admin message, and the three cases are covered by tests modeled on ChatClient.send.test.ts. The design question in meshtastic/design#39 should be confirmed first.
Written by the indexing model from the issue text.
Description
Summary
Per cross-platform alignment issue meshtastic/design#39, all Meshtastic clients should automatically mark a node as a "favorite" when a direct message is sent or received with that node — except when the local device's own role is CLIENT_BASE, in which case auto-favoriting must be skipped to avoid creating unintended routing/relay behavior.
This is already implemented on iOS and Android. Based on a code search of this repo (meshtastic/web, main branch), the web client does not implement this yet: it has a favorite/unfavorite concept, but it is purely user-triggered from the UI, with no automatic trigger tied to direct-message send/receive, and there is no CLIENT_BASE role check anywhere in the codebase.
Related prior report: #932 (same behavior gap, auto-closed by the stale bot without a fix landing — re-filing with full implementation context since an agent/contributor needs a concrete starting point).
Reference implementations (other platforms)
iOS — meshtastic/Meshtastic-Apple, Meshtastic/Accessory/Accessory Manager/AccessoryManager+ToRadio.swift (around line 339):
user.userNode?.favorite = user.userNode?.deviceConfig?.role ?? 0 != DeviceRoles.clientBase.rawValue
// Do not auto-favorite when using CLIENT_BASE role to avoid creating routing issues.
Android — meshtastic/Meshtastic-Android, core/repository/src/commonMain/kotlin/org/meshtastic/core/repository/usecase/SendMessageUseCase.kt (around lines 89-143):
val isClientBase = ourNode?.user?.role == Config.DeviceConfig.Role.CLIENT_BASE
...
if (!destNode.isFavorite && !isClientBase) {
// ...setFavorite(node.num, favorite = true)...
}
Both platforms: on send/receive of a direct message, if the peer node is not already a favorite AND the local device's own configured role is not CLIENT_BASE, mark the peer as a favorite.
Current state in this repo
- Favoriting exists but is entirely manual, driven from the UI:
apps/web/src/core/hooks/useFavoriteNode.ts— toggle callback used by node detail/table UI.packages/sdk-react/src/hooks/useFavoriteNode.ts— thin SDK-react wrapper.packages/sdk/src/features/nodes/NodesClient.ts(favorite()/unfavorite()methods, ~lines 176-186) — sends the admin message and patches local node state (isFavorite).packages/sdk/src/features/nodes/application/FavoriteNodeUseCase.ts— sendssetFavoriteNode/removeFavoriteNodeadmin messages viaAdminMessageSender.packages/sdk/src/features/nodes/domain/Node.ts—Node.isFavorite: boolean.
- There is no reference to
CLIENT_BASEanywhere in the TypeScript source (only in the generated proto definition,packages/protobufs/meshtastic/config.proto, whereCLIENT_BASE = 12is aConfig.DeviceConfig.Roleenum value — the concept exists in the protocol but is unused by any app logic). - Direct-message detection already happens in
packages/sdk/src/features/chat/ChatClient.ts(~lines 108-131), in theclient.events.onMessagePacket.subscribe(...)handler. It already computes whether a packet is a direct message and derives the peer node number:
This looks like the natural hook point for triggering auto-favorite logic on both inbound and outbound (echoed) direct messages, for the derivedconst conv: ConversationKey = packet.type === "direct" && packet.to !== Constants.broadcastNum ? { kind: "direct", peer: packet.from === client.myNodeNum ? packet.to : packet.from } : { kind: "channel", channel: packet.channel };peernode number. - The local device's configured role is available via
ConfigClient—client.config.radio.value.device?.role(packages/sdk/src/features/config/ConfigClient.ts,packages/sdk/src/features/config/domain/RadioConfig.ts), which maps to thedevicevariant of theConfig.Configprotobuf oneof (Config_DeviceConfig.role, generated frompackages/protobufs/meshtastic/config.proto). NodesClientalready exposesfavorite(nodeNum)and each node's currentisFavoritestate, so the missing piece is purely the "when" — wiring a call toclient.nodes.favorite(peer)from the direct-message handler, guarded by the CLIENT_BASE role check.
Suggested implementation approach
- In
ChatClient.ts'sonMessagePacketsubscriber (or a small use case it delegates to), whenconv.kind === "direct":- Look up the peer node via
client.nodesand skip if it's alreadyisFavorite. - Read the local device role via
client.config.radio.value.device?.role. - If the role is not
Protobuf.Config.Config_DeviceConfig_Role.CLIENT_BASE, callclient.nodes.favorite(peer). - Skip entirely if the role is
CLIENT_BASE.
- Look up the peer node via
- This should fire for both inbound direct messages and locally-sent outbound direct messages (matching the "receives/sends a direct message" wording in meshtastic/design#39, and mirroring the Android use case which triggers on send).
- Add unit test coverage similar to
packages/sdk/src/features/nodes/NodesClient.test.ts/ChatClient.send.test.ts, covering: (a) normal role auto-favorites an un-favorited DM peer, (b) already-favorited peer is left alone / no duplicate admin message sent, (c)CLIENT_BASErole never triggers auto-favorite.
References
- Alignment issue: meshtastic/design#39
- Prior report (auto-closed by stale bot, not fixed): #932
- Dominant language
- TypeScript
- Stars
- 861
- Forks
- 316
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 18
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from meshtastic/web
-
i18n
Difficulty 1/5 Under an hour Newbie friendliness 82/100
meshtastic/web#1187 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
meshtastic/web#1532 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 52/100
meshtastic/web#1504 ·
Maintainers usually reply within 1 day
-
[Bug]: Serial connection to nRF52 device (T1000-E) never loads; port opened without DTR assertedOpen
Difficulty 3/5 Half a day Newbie friendliness 45/100
meshtastic/web#1499 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 58/100
meshtastic/web#1498 ·
Maintainers usually reply within 1 day
Similar issues
-
P3
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug L3 level 1 needs-review wocs
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
SatyamPandey-07/WorkSphere#10739 · 1 comment ·
Maintainers usually reply within 1 day
-
maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
assistant-ui/assistant-ui#10946 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:auth-provider issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
openclaw/openclaw#206303 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day