Add "Watch task" to get notified of changes ποΈ
File: server/models/Task.js + TaskModal.jsx
No way to follow a task you didn't create π
Teammates can't track progress fr!!
Fix: add watchers array to Task model:
watchers: [{ type: mongoose.Schema.Types.ObjectId,
ref: 'User' }]
// add toggle in TaskModal:
const isWatching = task?.watchers?.includes(user?._id)
const handleWatch = async () => {
await updateTask(task._id, {
watchers: isWatching
? task.watchers.filter(w => w !== user._id)
: [...(task.watchers || []), user._id]
})
}
<button onClick={handleWatch}
className={text-xs px-3 py-1.5 rounded-lg border transition ${isWatching ? 'border-purple-500 text-purple-400' : 'border-[#2a2a2f] text-[#666]'}}>
{isWatching ? 'ποΈ Watching' : 'ποΈ Watch'}
~12 lines! π―
Add "Watch task" to get notified of changes ποΈ
File: server/models/Task.js + TaskModal.jsx
No way to follow a task you didn't create π
Teammates can't track progress fr!!
Fix: add watchers array to Task model:
watchers: [{ type: mongoose.Schema.Types.ObjectId,
ref: 'User' }]
// add toggle in TaskModal:
const isWatching = task?.watchers?.includes(user?._id)
const handleWatch = async () => {
await updateTask(task._id, {
watchers: isWatching
? task.watchers.filter(w => w !== user._id)
: [...(task.watchers || []), user._id]
})
}
<button onClick={handleWatch}
className={
text-xs px-3 py-1.5 rounded-lg border transition ${isWatching ? 'border-purple-500 text-purple-400' : 'border-[#2a2a2f] text-[#666]'}}>{isWatching ? 'ποΈ Watching' : 'ποΈ Watch'}
~12 lines! π―