From a19b19f866fd85aaae9351bb898ab2898d202a47 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 3 Jan 2021 19:07:35 +0800 Subject: fix: Fix a critical bug in bookmark timeline service. It used to create two entry with the same timeline. Now it will not create a duplicate one. --- BackEnd/Timeline/Services/BookmarkTimelineService.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'BackEnd/Timeline/Services/BookmarkTimelineService.cs') diff --git a/BackEnd/Timeline/Services/BookmarkTimelineService.cs b/BackEnd/Timeline/Services/BookmarkTimelineService.cs index 09438193..2ec3af62 100644 --- a/BackEnd/Timeline/Services/BookmarkTimelineService.cs +++ b/BackEnd/Timeline/Services/BookmarkTimelineService.cs @@ -94,6 +94,11 @@ namespace Timeline.Services var timelineId = await _timelineService.GetTimelineIdByName(timelineName); + if (await _database.BookmarkTimelines.SingleOrDefaultAsync(t => t.TimelineId == timelineId) is not null) + { + return; + } + _database.BookmarkTimelines.Add(new BookmarkTimelineEntity { TimelineId = timelineId, -- cgit v1.2.3