Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🔧 fix: Bookmark Order Adjustment When Moving Up (#3634)

Yuichi Onedae47c3f40f048
diff --git a/api/models/ConversationTag.js b/api/models/ConversationTag.js
index 0293ea83c3..d64dcfa521 100644
--- a/api/models/ConversationTag.js
+++ b/api/models/ConversationTag.js
@@ -133,14 +133,21 @@ const adjustPositions = async (user, oldPosition, newPosition) => {
}
const update = oldPosition < newPosition ? { $inc: { position: -1 } } : { $inc: { position: 1 } };
+ const position =
+ oldPosition < newPosition
+ ? {
+ $gt: Math.min(oldPosition, newPosition),
+ $lte: Math.max(oldPosition, newPosition),
+ }
+ : {
+ $gte: Math.min(oldPosition, newPosition),
+ $lt: Math.max(oldPosition, newPosition),
+ };
await ConversationTag.updateMany(
{
user,
- position: {
- $gt: Math.min(oldPosition, newPosition),
- $lte: Math.max(oldPosition, newPosition),
- },
+ position,
},
update,
);