feat(todo): comments on a task (ADR 0033, D36)
Plain text with links, written, edited and deleted in the task's sheet, counted on its row. They are sealed in `task_comment`, the task they belong to with them, and go with their task. Whats-New: Comments: write on a task, edit or delete what you wrote, and open its links. Whats-New-De: Kommentare: Schreibe zu einer Aufgabe, bearbeite oder lösche es und öffne Links darin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
6385d84cff
commit
016b74ff74
1 changed files with 20953 additions and 6 deletions
|
|
@ -5,6 +5,8 @@ import 'package:clock/clock.dart';
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_app/halkyon_app.dart';
|
||||
import 'package:halkyon_todo_flutter/src/core/privacy/todo_keys.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/comment/data/comment_repository.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/comment/model/comment.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/filter/data/filter_repository.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/filter/model/saved_filter.dart';
|
||||
import 'package:halkyon_todo_flutter/src/feature/label/data/label_repository.dart';
|
||||
|
|
@ -516,5 +518,55 @@ void main() {
|
|||
FilterRepository(rows, await keysOf(null)).add(filter),
|
||||
throwsA(isA<KeysMissing>()),
|
||||
);
|
||||
|
||||
final comments = CommentRepository(rows, await keysOf(alice));
|
||||
final comment = CommentContent(
|
||||
taskId: 't1',
|
||||
text: 'Ask the vet',
|
||||
writtenAt: DateTime.utc(2026, 11, 6),
|
||||
);
|
||||
await comments.add(comment);
|
||||
expect((await comments.all()).last.content, comment);
|
||||
expect(
|
||||
(await CommentRepository(rows, await keysOf(bob)).all()).last.content,
|
||||
isNull,
|
||||
);
|
||||
await expectLater(
|
||||
CommentRepository(rows, await keysOf(null)).add(comment),
|
||||
throwsA(isA<KeysMissing>()),
|
||||
);
|
||||
});
|
||||
|
||||
test('a task deleted takes the comments on it and its sub-tasks along, '
|
||||
'and no others', () async {
|
||||
final keys = await keysOf(alice);
|
||||
final comments = CommentRepository(MemorySealedRowGateway(), keys);
|
||||
final tasks = TaskRepository(
|
||||
MemorySealedRowGateway(),
|
||||
keys,
|
||||
onDeleted: comments.deleteOn,
|
||||
);
|
||||
final parent = await tasks.add(
|
||||
const TaskContent(title: 'Parent', projectId: 'p'),
|
||||
);
|
||||
final sub = await tasks.add(
|
||||
TaskContent(title: 'Sub', projectId: 'p', parentId: parent),
|
||||
);
|
||||
final other = await tasks.add(
|
||||
const TaskContent(title: 'Other', projectId: 'p'),
|
||||
);
|
||||
final at = DateTime.utc(2026, 11, 6);
|
||||
for (final id in [parent, sub, other]) {
|
||||
await comments.add(
|
||||
CommentContent(taskId: id, text: id, writtenAt: at),
|
||||
);
|
||||
}
|
||||
|
||||
await tasks.delete(parent);
|
||||
|
||||
expect(
|
||||
[for (final comment in await comments.all()) comment.content?.taskId],
|
||||
[other],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue