Skip to content

Commit ad64c4f

Browse files
committed
Fix tag deleting
1 parent 2e2132d commit ad64c4f

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

api/routes/update.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ function validateUpdates(
185185
return results;
186186
}
187187

188-
// TODO: For ease of porting, I made each update a separate transaction. But it
189-
// would be more efficient to batch them all into one transaction. That said,
190-
// aside from bulk-tagging, it's most likely that only one update will be sent
191-
// at a time.
192188
async function statelyUpdate(
193189
updates: ProfileUpdate[],
194190
bungieMembershipId: number,

api/stately/item-annotations-queries.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,6 @@ export async function updateItemAnnotation(
105105
destinyVersion,
106106
});
107107

108-
if (
109-
(tagValue === 'clear' && !ia.notes) ||
110-
(notesValue === 'clear' && !ia.tag) ||
111-
(tagValue === 'clear' && notesValue === 'clear')
112-
) {
113-
itemsToDelete.push(keyFor(platformMembershipId, destinyVersion, itemAnnotation.id));
114-
continue;
115-
}
116-
117108
if (tagValue === 'clear') {
118109
ia.tag = StatelyTagValue.TagValue_UNSPECIFIED;
119110
} else if (tagValue !== null) {
@@ -130,7 +121,12 @@ export async function updateItemAnnotation(
130121
ia.craftedDate = BigInt(itemAnnotation.craftedDate * 1000);
131122
}
132123

133-
itemsToPut.push(ia);
124+
// If we're updating them both to nothing, delete the annotation
125+
if (!ia.notes && !ia.tag) {
126+
itemsToDelete.push(keyFor(platformMembershipId, destinyVersion, itemAnnotation.id));
127+
} else {
128+
itemsToPut.push(ia);
129+
}
134130
}
135131

136132
if (itemsToDelete.length) {

0 commit comments

Comments
 (0)