mirror of
https://github.com/go-gitea/gitea.git
synced 2026-04-13 18:15:21 +02:00
fix(websocket): replace json.RawMessage with any in stopwatchesEvent
This commit is contained in:
parent
256aeb9dc9
commit
bf7c30e282
@ -19,8 +19,8 @@ import (
|
||||
)
|
||||
|
||||
type stopwatchesEvent struct {
|
||||
Type string `json:"type"`
|
||||
Data json.RawMessage `json:"data"`
|
||||
Type string `json:"type"`
|
||||
Data any `json:"data"`
|
||||
}
|
||||
|
||||
// PublishEmptyStopwatches immediately pushes an empty stopwatches list to the
|
||||
@ -28,7 +28,7 @@ type stopwatchesEvent struct {
|
||||
func PublishEmptyStopwatches(userID int64) {
|
||||
msg, err := json.Marshal(stopwatchesEvent{
|
||||
Type: "stopwatches",
|
||||
Data: json.RawMessage(`[]`),
|
||||
Data: []any{},
|
||||
})
|
||||
if err != nil {
|
||||
log.Error("websocket: marshal empty stopwatches: %v", err)
|
||||
@ -88,15 +88,9 @@ func runStopwatch(ctx context.Context) {
|
||||
continue
|
||||
}
|
||||
|
||||
dataBs, err := json.Marshal(apiSWs)
|
||||
if err != nil {
|
||||
log.Error("websocket: marshal stopwatches: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
msg, err := json.Marshal(stopwatchesEvent{
|
||||
Type: "stopwatches",
|
||||
Data: dataBs,
|
||||
Data: apiSWs,
|
||||
})
|
||||
if err != nil {
|
||||
continue
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user