mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🔧 fix: Bookmark Order Adjustment When Moving Up (#3634)
This commit is contained in:
parent
0ba08b15de
commit
e47c3f40f0
1 changed files with 11 additions and 4 deletions
|
|
@ -133,14 +133,21 @@ const adjustPositions = async (user, oldPosition, newPosition) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const update = oldPosition < newPosition ? { $inc: { position: -1 } } : { $inc: { position: 1 } };
|
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(
|
await ConversationTag.updateMany(
|
||||||
{
|
{
|
||||||
user,
|
user,
|
||||||
position: {
|
position,
|
||||||
$gt: Math.min(oldPosition, newPosition),
|
|
||||||
$lte: Math.max(oldPosition, newPosition),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
update,
|
update,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue