🐛 Fix bugs in status

This commit is contained in:
LittleSheep 2024-06-27 01:10:57 +08:00
parent 7fed35dd04
commit 17e0fa3b18
2 changed files with 9 additions and 5 deletions

8
.idea/workspace.xml generated
View File

@ -4,9 +4,9 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":ambulance: Fix getting user panic again..."> <list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":bug: Fix status validation issue">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/statuses_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/statuses_api.go" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pkg/internal/services/statuses.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/statuses.go" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -152,7 +152,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value=":recycle: OAuth authenticate" />
<MESSAGE value=":sparkles: Recommend app component" /> <MESSAGE value=":sparkles: Recommend app component" />
<MESSAGE value=":bug: Bug fixes" /> <MESSAGE value=":bug: Bug fixes" />
<MESSAGE value=":arrow_up: Fix notification listen" /> <MESSAGE value=":arrow_up: Fix notification listen" />
@ -177,7 +176,8 @@
<MESSAGE value=":ambulance: Fix nil pointer panic" /> <MESSAGE value=":ambulance: Fix nil pointer panic" />
<MESSAGE value=":bug: Not supposed to appear to status at the same time" /> <MESSAGE value=":bug: Not supposed to appear to status at the same time" />
<MESSAGE value=":ambulance: Fix getting user panic again..." /> <MESSAGE value=":ambulance: Fix getting user panic again..." />
<option name="LAST_COMMIT_MESSAGE" value=":ambulance: Fix getting user panic again..." /> <MESSAGE value=":bug: Fix status validation issue" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix status validation issue" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -49,8 +49,10 @@ func GetStatusOnline(uid uint) error {
return nil return nil
} else if err == nil && status.IsInvisible { } else if err == nil && status.IsInvisible {
return fmt.Errorf("invisible") return fmt.Errorf("invisible")
} else { } else if !isOnline {
return fmt.Errorf("offline") return fmt.Errorf("offline")
} else {
return nil
} }
} }
@ -78,6 +80,8 @@ func ClearStatus(user models.Account) error {
Where("clear_at < ?", time.Now()). Where("clear_at < ?", time.Now()).
Updates(models.Status{ClearAt: lo.ToPtr(time.Now())}).Error; err != nil { Updates(models.Status{ClearAt: lo.ToPtr(time.Now())}).Error; err != nil {
return err return err
} else {
delete(statusCache, user.ID)
} }
return nil return nil