mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-11 05:36:44 +02:00
Fix parts of issue #8221 and part of PR #4767
Is linked to https://codeberg.org/forgejo/forgejo/pulls/8274
The commit 555f6e57ad
fixes timeout forgejo/forgejo#8274 (Kommentar)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8708
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
35 lines
860 B
Go
35 lines
860 B
Go
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package federation
|
|
|
|
import "github.com/go-ap/activitypub"
|
|
|
|
type ServiceResult struct {
|
|
HTTPStatus int
|
|
Bytes []byte
|
|
Activity activitypub.Activity
|
|
withBytes bool
|
|
withActivity bool
|
|
statusOnly bool
|
|
}
|
|
|
|
func NewServiceResultStatusOnly(status int) ServiceResult {
|
|
return ServiceResult{HTTPStatus: status, statusOnly: true}
|
|
}
|
|
|
|
func NewServiceResultWithBytes(status int, bytes []byte) ServiceResult {
|
|
return ServiceResult{HTTPStatus: status, Bytes: bytes, withBytes: true}
|
|
}
|
|
|
|
func (serviceResult ServiceResult) WithBytes() bool {
|
|
return serviceResult.withBytes
|
|
}
|
|
|
|
func (serviceResult ServiceResult) WithActivity() bool {
|
|
return serviceResult.withActivity
|
|
}
|
|
|
|
func (serviceResult ServiceResult) StatusOnly() bool {
|
|
return serviceResult.statusOnly
|
|
}
|