Skip to content

Commit 7211c0c

Browse files
authored
Merge pull request #2 from Paca-AI/feature/implement-record-activity-function
fix: update activityInput struct to make ActorID omitempty and simpli…
2 parents c98314f + 853ee77 commit 7211c0c

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

native_backends.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ func RecordActivity(_, _, _, _ string, _ any) {}
5050

5151
// ptrOf and hostError are used by wasm_backends.go (wasip1 only); provide
5252
// stubs here so the non-WASM build does not need them.
53+
//
5354
//nolint:unused // used in wasm_backends.go in WASM builds
5455
type hostError struct{ msg string }
5556

wasm_backends.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func EmitEvent(topic string, payload any) {
185185
type activityInput struct {
186186
TaskID string `json:"task_id"`
187187
ProjectID string `json:"project_id"`
188-
ActorID string `json:"actor_id"`
188+
ActorID string `json:"actor_id,omitempty"`
189189
ActivityType string `json:"activity_type"`
190190
Content any `json:"content"`
191191
}
@@ -202,13 +202,8 @@ func RecordActivity(taskID, projectID, actorUserID, activityType string, content
202202
ActivityType: activityType,
203203
Content: content,
204204
}
205-
payloadBytes, err := json.Marshal(inp)
206-
if err != nil {
207-
return
208-
}
209-
if !hostActivityRecord(int64(ptrOf(payloadBytes)), int64(len(payloadBytes))) {
210-
return
211-
}
205+
payloadBytes, _ := json.Marshal(inp)
206+
hostActivityRecord(int64(ptrOf(payloadBytes)), int64(len(payloadBytes)))
212207
}
213208

214209
// ── Helpers ───────────────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)