Files
wekan/server/lib/titleChangeActivity.js
T
Lauri OjansivuandClaude Opus 4.8 9aa97ab8ff Fix #3619: updating a card title fires the outgoing webhook
Title changes did not create an activity, so no outgoing webhook fired (unlike
description/dueAt changes). Log an a-changedTitle activity in the Cards
before.update hook, mirroring the timing-field activities, so the existing
Activities.after.insert webhook hook fires. Pure titleChanged helper + tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-20 17:47:56 +03:00

17 lines
791 B
JavaScript

// Pure helper used by the Cards.before.update hook to detect a card title change.
// Extracted so the title-change activity logic (issue #3619) can be unit-tested
// without the Meteor/Mongo collection machinery.
//
// Returns true only when the update modifier sets `title` to a value that
// differs from the current document's title. This mirrors how sibling tracked
// fields (e.g. dueAt) are detected in the before.update hook, so the existing
// Activities.after.insert outgoing-webhook hook fires on title changes too.
export function titleChanged(oldDoc, modifier) {
if (!modifier || !modifier.$set || !('title' in modifier.$set)) {
return false;
}
const oldTitle = (oldDoc && oldDoc.title) || '';
const newTitle = modifier.$set.title;
return newTitle !== oldTitle;
}