Quick task completed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.9 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | must_haves | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| quick-002 | 01 | execute | 1 |
|
true |
|
Purpose: Mentors currently receive "new job" notifications every time a job transitions to publish status -- including after edits (pending -> publish). The notification should only fire once per job, on the very first publication. Subsequent republications after edits should be silent for mentors (the admin already gets a separate edit notification).
Output: Updated notify_mentors_on_job_publish method with a post meta guard that prevents
duplicate notifications.
<execution_context>
@/.claude/get-shit-done/workflows/execute-plan.md
@/.claude/get-shit-done/templates/summary.md
</execution_context>
The bug is in notify_mentors_on_job_publish() (line ~430). The current guard:
if ( 'publish' !== $new_status || 'publish' === $old_status ) {
return;
}
This correctly prevents re-notification when a published post is updated (publish -> publish), but it does NOT prevent re-notification when a previously-published job is edited and reset to pending (per decision 03-02: "Post status reset to pending after edit"), then republished by admin (pending -> publish). This second publish triggers notifications again.
The job lifecycle that causes the bug:
- Provider submits -> status: pending
- Admin publishes -> pending to publish -> mentors notified (CORRECT)
- Provider edits -> status reset to pending (per 03-02)
- Admin republishes -> pending to publish -> mentors notified AGAIN (BUG)
-
Check if post meta
_ddhh_mentors_notifiedexists and equals'1'for this post. If it does, log a message like "DDHH Job Manager: Skipping mentor notification for job #%d - mentors already notified on initial publish" and return early. -
After the
DDHH_JM_Scheduler::schedule_mentor_notification_batch()call succeeds (line ~457), set post meta:update_post_meta( $post->ID, '_ddhh_mentors_notified', '1' ).
Use underscore-prefixed meta key _ddhh_mentors_notified so it is hidden from the
WordPress custom fields UI.
Do NOT change any other logic in this method or file. The existing status transition guard should remain as-is (it still serves a purpose for publish->publish transitions).
- Read the modified file and confirm:
get_post_meta( $post->ID, '_ddhh_mentors_notified', true )check exists before mentor queryupdate_post_meta( $post->ID, '_ddhh_mentors_notified', '1' )exists after scheduling- No other methods were modified
- Run
php -l includes/class-notifications.phpto confirm no syntax errors Thenotify_mentors_on_job_publishmethod checks for_ddhh_mentors_notifiedpost meta before scheduling notifications, and sets that meta after scheduling. This ensures mentors are only notified once per job, regardless of how many times the job transitions through pending -> publish.
<success_criteria>
- First publish of a job (pending -> publish) triggers mentor notifications and sets meta flag
- Subsequent publishes of the same job (pending -> publish after edit) skip mentor notifications
- Admin notifications for edits/republications are unaffected
- No PHP syntax errors introduced </success_criteria>