fix: preserve moderation status when updating existing skills (#134)

Previously, publishing an update to an existing skill would set
moderationStatus to 'hidden' unconditionally, causing the skill to
disappear from search and listings even if it was previously active.

Now, when publishing an update to an existing skill that is currently
active, we preserve its moderation status. Only new skills start as
'hidden' pending scan.

This fixes the issue where skills with downloads and stars would
disappear immediately after the owner published an update.

Fixes #134

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Steve
2026-02-13 16:59:56 -04:00
parent 75937e8b53
commit 78adda1d4e
+11 -3
View File
@@ -3172,6 +3172,7 @@ export const insertVersion = internalMutation({
}
const latestBefore = skill.latestVersionId
const isUpdate = Boolean(latestBefore)
const nextSummary =
args.summary ?? getFrontmatterValue(args.parsed.frontmatter, 'description') ?? skill.summary
@@ -3181,6 +3182,13 @@ export const insertVersion = internalMutation({
files: args.files,
})
// For updates to existing skills, preserve the current moderation status
// Only new skills start as hidden pending scan
const shouldPreserveStatus = isUpdate && skill.moderationStatus === 'active'
const nextModerationStatus = shouldPreserveStatus ? skill.moderationStatus : 'hidden'
const nextModerationReason = shouldPreserveStatus ? skill.moderationReason : moderationReason
const nextModerationNotes = shouldPreserveStatus ? skill.moderationNotes : moderationNotes
await ctx.db.patch(skill._id, {
displayName: args.displayName,
summary: nextSummary ?? undefined,
@@ -3188,9 +3196,9 @@ export const insertVersion = internalMutation({
tags: nextTags,
stats: { ...skill.stats, versions: skill.stats.versions + 1 },
softDeletedAt: undefined,
moderationStatus: 'hidden',
moderationReason,
moderationNotes,
moderationStatus: nextModerationStatus,
moderationReason: nextModerationReason,
moderationNotes: nextModerationNotes,
quality: qualityRecord ?? skill.quality,
moderationFlags: moderationFlags.length ? moderationFlags : undefined,
updatedAt: now,