File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed
Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -1026,7 +1026,29 @@ func ModifyFloorSensitive(c *fiber.Ctx) (err error) {
10261026
10271027 if ! body .IsActualSensitive {
10281028 // save actual_sensitive only
1029- return tx .Model (& floor ).Select ("IsActualSensitive" ).UpdateColumns (& floor ).Error
1029+ err := tx .Model (& floor ).Select ("IsActualSensitive" ).UpdateColumns (& floor ).Error
1030+ if err != nil {
1031+ return err
1032+ }
1033+
1034+ // update CreatedAt and UpdatedAt to prevent new posts from being buried due to review delays
1035+ if floor .Ranking == 0 {
1036+ var hole Hole
1037+ err = tx .First (& hole , floor .HoleID ).Error
1038+ if err != nil {
1039+ return err
1040+ }
1041+
1042+ now := time .Now ()
1043+ hole .CreatedAt = now
1044+ hole .UpdatedAt = now
1045+ err = tx .Model (& hole ).Select ("CreatedAt" , "UpdatedAt" ).UpdateColumns (& hole ).Error
1046+ if err != nil {
1047+ return err
1048+ }
1049+ }
1050+
1051+ return nil
10301052 }
10311053
10321054 reason := "违反社区规范"
Original file line number Diff line number Diff line change @@ -369,7 +369,7 @@ func (hole *Hole) SetHoleFloor() {
369369 hole .HoleFloor .Floors = hole .Floors [0 : holeFloorSize - 1 ]
370370 }
371371 } else if len (hole .HoleFloor .Floors ) != 0 {
372- holeFloorSize := len (hole .Floors )
372+ holeFloorSize := len (hole .HoleFloor . Floors )
373373
374374 hole .HoleFloor .FirstFloor = hole .HoleFloor .Floors [0 ]
375375 hole .HoleFloor .LastFloor = hole .HoleFloor .Floors [holeFloorSize - 1 ]
You can’t perform that action at this time.
0 commit comments