Skip to content

Commit bf1c584

Browse files
committed
Bypass MoveTopic if IsNew
While new topics can—and should—be moved in memory, they cannot—and should not—be moved in the database. This is true if the topic is new, the parent is new, or even if the sibling is new, as such operations will fail until they are saved. We choose not to throw an exception since this is a rare situation that still permits usage of the in-memory functionality of the `TopicRepository`. This satisfies the `Move()` conditions of #77.
1 parent 854299a commit bf1c584

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

OnTopic/Repositories/TopicRepository.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,9 @@ topic.Parent is not null &&
515515
/*------------------------------------------------------------------------------------------------------------------------
516516
| Execute core implementation
517517
\-----------------------------------------------------------------------------------------------------------------------*/
518-
MoveTopic(topic, target, sibling);
518+
if (!topic.IsNew && !target.IsNew && !sibling.IsNew) {
519+
MoveTopic(topic, target, sibling);
520+
}
519521

520522
/*------------------------------------------------------------------------------------------------------------------------
521523
| Perform base logic

0 commit comments

Comments
 (0)