Skip to content

fix(editor): stop earning post points for editing a post - #3499

Merged
feruzm merged 1 commit into
developmentfrom
bugfix/no-activity-on-post-edit
Aug 15, 2026
Merged

fix(editor): stop earning post points for editing a post#3499
feruzm merged 1 commit into
developmentfrom
bugfix/no-activity-on-post-edit

Conversation

@feruzm

@feruzm feruzm commented Aug 15, 2026

Copy link
Copy Markdown
Member

Closes #3498

What

A comment op is identical on chain whether it publishes content or edits it, so the SDK cannot tell them apart on its own and was recording a type-100 POST activity for every post edit. makeJsonMetadataForUpdate deliberately keeps the original app tag, which is correct provenance behaviour, so editing a post first published on another frontend was credited here as a post published here: post points plus the daily quest tick.

@ecency/sdk 2.3.86 adds isUpdate to the comment payload. _submitEdit now sets it on the non-reply branch.

Reply edits go through useUpdateReply, which stopped recording activity entirely in the same release, so they need no change here beyond the bump. That also covers postOptionsModal, which uses the same mutation.

Checked the other call sites: usePostSubmitter always sets a parentAuthor and only ever creates new content, so it keeps recording, correctly.

The typed payload is load-bearing

commentMutation arrives through untyped props on a class component, so an inline object literal is checked against nothing. I verified this: a deliberate isUpdatex: true passed yarn typecheck clean with 0 errors.

Annotating the payload as CommentPayload restores the check. The same typo now fails:

error TS2561: Object literal may only specify known properties, but 'isUpdatex'
does not exist in type 'CommentPayload'. Did you mean to write 'isUpdate'?

Without that, a future rename or typo would silently resume paying for edits, with nothing failing.

Verification

  • yarn install --frozen-lockfile exits 0, so the lockfile edit is consistent. Deps and peerDeps are byte-identical between 2.3.85 and 2.3.86, only the tarball and integrity changed.
  • Installed @ecency/sdk is 2.3.86 and carries the compiled gate: function hp(e){return e.isUpdate?null:e.parentAuthor?110:100}.
  • yarn typecheck: 0 errors, baseline 0. Typo variant fails as above.
  • yarn test:ci: 870 passed, 1 skipped.
  • Prettier clean, ESLint 0 errors with 13 warnings, identical to the same file on development.

Context

Third and last piece of the fix for edits earning content rewards, reported by a community member who spotted an account holding the leaderboard quest badge while publishing from another frontend.

  • ecency/ePoints#53 is the actual gate, merged and deployed. It refuses the reward server-side, so it covers every client including builds already in the wild. Verified on live traffic: 3 real edits refused with zero points minted, while 105 genuine posts and comments verified normally.
  • fix(sdk): stop recording content activity for edits vision-web#1491 is the same client-side change for web, merged.

This one stops the pointless request being made at all. It is hygiene rather than the gate, since the backend already refuses.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the reliability of editing existing posts.
    • Ensured edited posts are correctly recognized as updates, preserving expected editing behavior.
    • Added stronger validation for post edit submissions to help prevent malformed updates and improve overall editor stability.

A comment op is identical on chain whether it publishes content or edits it,
so the SDK cannot tell them apart on its own and was recording a type-100
POST activity for every post edit. makeJsonMetadataForUpdate deliberately
keeps the original app tag, so editing a post first published on another
frontend was credited here as a post published here, paying post points and
ticking the daily quest.

@ecency/sdk 2.3.86 adds isUpdate to the comment payload, which _submitEdit
now sets on the non-reply branch. Reply edits go through useUpdateReply,
which stopped recording activity in the same release, so they need no change
here beyond the bump.

The payload is annotated as CommentPayload rather than passed inline because
commentMutation arrives through untyped props: an inline literal is checked
against nothing, so a misspelt isUpdate would typecheck clean and silently
resume paying for edits. Verified both ways, the typo now fails with TS2561.

Closes #3498
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Fix editor post edits from earning post points by flagging SDK comment updates

🐞 Bug fix ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Bump @ecency/sdk to 2.3.86 to use the new isUpdate comment payload flag.
• Mark non-reply post edits as isUpdate so the SDK doesn’t record post activity/points.
• Type the edit mutation payload as CommentPayload to prevent silent typos/regressions.
Diagram

graph TD
  A["EditorContainer._submitEdit"] --> B{"Reply edit?"} --> C["SDK updateReplyMutation"] --> D{{"Hive comment op"}}
  B --> E["SDK commentMutation"] --> F{"isUpdate=true"} --> D --> G["No content activity recorded"]

  subgraph Legend
    direction LR
    _c["App/SDK component"] ~~~ _d{"Decision"} ~~~ _e{{"External system"}}
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Infer edits inside the app without SDK support
  • ➕ Avoids SDK bump by handling activity suppression purely in client logic
  • ➖ Still requires changes wherever comment mutations are used for edits
  • ➖ Risk of missing a call site and reintroducing the bug
  • ➖ Doesn’t improve type safety for the payload contract
2. Rely solely on server-side reward gating
  • ➕ Covers all clients, including older builds
  • ➖ Still emits pointless client requests for edits
  • ➖ Leaves daily quest / activity side effects to be handled downstream (or wasted work)

Recommendation: The chosen approach is best: explicitly setting isUpdate leverages the SDK’s canonical distinction between publish vs edit, and typing the payload as CommentPayload makes the fix resilient to future typos/renames. The dependency bump is justified because the required flag is introduced in @ecency/sdk 2.3.86.

Files changed (2) +16 / -4

Bug fix (1) +15 / -3
editorContainer.tsxFlag post edits as updates and type-check the edit mutation payload +15/-3

Flag post edits as updates and type-check the edit mutation payload

• Imports 'CommentPayload', constructs a typed payload for post-edit comment mutations, and sets 'isUpdate: true' so the SDK does not record a post activity for edits. Adds inline rationale documenting why typed payloads are required given untyped mutation props on this class component.

src/screens/editor/container/editorContainer.tsx

Other (1) +1 / -1
package.jsonBump @ecency/sdk to 2.3.86 for update-aware comment payloads +1/-1

Bump @ecency/sdk to 2.3.86 for update-aware comment payloads

• Updates the @ecency/sdk dependency to the version that exposes 'isUpdate' in the comment payload, enabling client-side suppression of activity recording for edits.

package.json

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix editor: prevent post points/quest credit when editing an existing post

🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Bump @ecency/sdk to 2.3.86 to use the new comment isUpdate flag.
• Mark post-edit comment mutations as updates so edits don’t record POST activity.
• Add explicit CommentPayload typing to prevent silent regressions from payload typos.
Diagram

graph TD
  A["Editor UI"] --> B["EditorContainer.tsx"] --> C["@ecency/sdk commentMutation"] --> D{"isUpdate?"}
  D -->|"true"| E["Skip activity"]
  D -->|"false"| F["Record POST activity"] --> G["Rewards/Quests backend"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Rely solely on backend to reject edit rewards
  • ➕ No client changes required
  • ➕ Consistent enforcement across all clients (including older builds)
  • ➖ Still generates pointless client-side activity requests
  • ➖ Wastes bandwidth/CPU and can skew client-side analytics/UX expectations
2. Infer edits client-side by fetching existing post state
  • ➕ Works even without SDK support for isUpdate
  • ➖ Adds extra network round-trips and latency
  • ➖ More failure modes (fetch errors) and edge cases (cache/stale data)
  • ➖ Still less robust than an explicit flag carried through the mutation

Recommendation: Use the SDK’s explicit isUpdate flag (as implemented) and keep the strong typing on the payload. It is the lowest-risk change that prevents erroneous activity creation at the source while avoiding extra network calls; backend gating remains a necessary defense-in-depth but shouldn’t be the only line of prevention.

Files changed (3) +20 / -8

Bug fix (1) +15 / -3
editorContainer.tsxFlag post edits as updates and enforce typed payload +15/-3

Flag post edits as updates and enforce typed payload

• Imports CommentPayload and constructs a typed edit payload for non-reply edits. Sets isUpdate: true so the SDK does not record a POST activity for edits, preventing post points and daily quest ticks from being awarded on edit operations.

src/screens/editor/container/editorContainer.tsx

Other (2) +5 / -5
package.jsonBump @ecency/sdk to 2.3.86 +1/-1

Bump @ecency/sdk to 2.3.86

• Updates the SDK dependency to the release that includes the isUpdate field on comment payloads, enabling clients to distinguish edits from new posts for activity recording purposes.

package.json

yarn.lockLockfile update for @ecency/sdk 2.3.86 +4/-4

Lockfile update for @ecency/sdk 2.3.86

• Updates the yarn.lock entry to reflect the new @ecency/sdk tarball version and integrity hash while keeping dependency structure stable.

yarn.lock

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: be47119b-0ab9-43db-9f78-333d6644e34a

📥 Commits

Reviewing files that changed from the base of the PR and between 90aed54 and 5670fb7.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • package.json
  • src/screens/editor/container/editorContainer.tsx

📝 Walkthrough

Walkthrough

The editor now submits non-reply post edits with a typed CommentPayload and isUpdate: true. The project upgrades @ecency/sdk to version ^2.3.86.

Changes

Post edit activity

Layer / File(s) Summary
SDK edit payload integration
package.json, src/screens/editor/container/editorContainer.tsx
The SDK dependency is upgraded. The editor uses CommentPayload and marks non-reply post edits with isUpdate: true.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 5670f

This change stops post edits from requesting post-earning activity while preserving rewards for newly created content; no actionable merge-blocking risk remains after normal checks and review.

Possibly related issues

Possibly related PRs

Poem

A rabbit taps “edit” with care,
Typed payloads hop through the air.
The SDK knows what changed today,
So post points skip the old replay.
Fresh flags guide each leafy byte.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: preventing post points from being earned when editing a post.
Linked Issues check ✅ Passed The changes upgrade the SDK and pass isUpdate: true for non-reply edits, matching issue #3498 requirements.
Out of Scope Changes check ✅ Passed The dependency update and editor payload change are directly related to the linked issue objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/no-activity-on-post-edit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@feruzm
feruzm merged commit b69530c into development Aug 15, 2026
8 checks passed
@feruzm
feruzm deleted the bugfix/no-activity-on-post-edit branch August 15, 2026 06:33
@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

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.

Post edits earn post points and tick the daily quest

1 participant