Skip to content

Commit

Permalink
feat: show origin content if floor deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Nov 11, 2023
1 parent 254497f commit c1c7cdb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apis/floor/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type SensitiveFloorResponse struct {
Modified int `json:"modified"`
IsActualSensitive *bool `json:"is_actual_sensitive"`
HoleID int `json:"hole_id"`
Deleted bool `json:"deleted"`
}

func (s *SensitiveFloorResponse) FromModel(floor *models.Floor) *SensitiveFloorResponse {
Expand All @@ -123,6 +124,7 @@ func (s *SensitiveFloorResponse) FromModel(floor *models.Floor) *SensitiveFloorR
s.Modified = floor.Modified
s.IsActualSensitive = floor.IsActualSensitive
s.HoleID = floor.HoleID
s.Deleted = floor.Deleted
return s
}

Expand Down
3 changes: 3 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2594,6 +2594,9 @@ const docTemplate = `{
"content": {
"type": "string"
},
"deleted": {
"type": "boolean"
},
"hole_id": {
"type": "integer"
},
Expand Down
3 changes: 3 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2587,6 +2587,9 @@
"content": {
"type": "string"
},
"deleted": {
"type": "boolean"
},
"hole_id": {
"type": "integer"
},
Expand Down
2 changes: 2 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ definitions:
properties:
content:
type: string
deleted:
type: boolean
hole_id:
type: integer
id:
Expand Down
5 changes: 4 additions & 1 deletion models/floor.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ func (floor *Floor) SetDefaults() {
floor.FoldFrontend = []string{}
}

if floor.IsSensitive == true && (floor.IsActualSensitive == nil || *floor.IsActualSensitive == true) {
if !floor.Deleted &&
floor.IsSensitive == true &&
(floor.IsActualSensitive == nil ||
*floor.IsActualSensitive == true) {
floor.Content = "该内容被猫猫吃掉了"
floor.FoldFrontend = []string{"该内容被猫猫吃掉了"}
}
Expand Down

0 comments on commit c1c7cdb

Please sign in to comment.