Skip to content

Commit 0c777ee

Browse files
committed
feat: set ai summary unavailable if the hole is locked or hidden or frozen
1 parent f081434 commit 0c777ee

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

models/hole.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,11 @@ func (holes Holes) Preprocess(c *fiber.Ctx) error {
290290
floors = append(floors, hole.Floors...)
291291
// set ai_summary_available
292292
uid, _ := common.GetUserID(c)
293+
294+
// for users in whitelist or whitelist is empty, AISummaryAvailable is true,
293295
hole.AISummaryAvailable = config.Config.WhiteListUserIds == nil || slices.Contains(config.Config.WhiteListUserIds, uid)
296+
297+
hole.AISummaryAvailable = !(hole.Locked || hole.Hidden || hole.Frozen)
294298
for _, tag := range hole.Tags {
295299
if len(tag.Name) > 0 && tag.Name[0] == '*' {
296300
hole.AISummaryAvailable = false
@@ -313,7 +317,6 @@ func (holes Holes) Preprocess(c *fiber.Ctx) error {
313317
return err
314318
}
315319

316-
// var discard any
317320
hole.AISummaryAvailable = hole.Reply > config.Config.SummaryFloorLimit || contentSum >= config.Config.SummaryContentLimit // || utils.GetCache("AISummary"+strconv.Itoa(hole.ID), &discard)
318321

319322
if hole.AISummaryAvailable {

0 commit comments

Comments
 (0)