forked from kevadesu/forgejo
enhance test & fix reviews
This commit is contained in:
parent
33648f2a4c
commit
fc38e56373
12 changed files with 101 additions and 20 deletions
|
@ -19,11 +19,11 @@ type FederationHost struct {
|
|||
HostFqdn string `xorm:"host_fqdn UNIQUE INDEX VARCHAR(255) NOT NULL"`
|
||||
NodeInfo NodeInfo `xorm:"extends NOT NULL"`
|
||||
LatestActivity time.Time `xorm:"NOT NULL"`
|
||||
Create timeutil.TimeStamp `xorm:"created"`
|
||||
Created timeutil.TimeStamp `xorm:"created"`
|
||||
Updated timeutil.TimeStamp `xorm:"updated"`
|
||||
}
|
||||
|
||||
// Factory function for PersonID. Created struct is asserted to be valid
|
||||
// Factory function for FederationHost. Created struct is asserted to be valid.
|
||||
func NewFederationHost(nodeInfo NodeInfo, hostFqdn string) (FederationHost, error) {
|
||||
result := FederationHost{
|
||||
HostFqdn: strings.ToLower(hostFqdn),
|
||||
|
@ -45,7 +45,7 @@ func (host FederationHost) Validate() []string {
|
|||
result = append(result, fmt.Sprintf("HostFqdn has to be lower case but was: %v", host.HostFqdn))
|
||||
}
|
||||
if !host.LatestActivity.IsZero() && host.LatestActivity.After(time.Now().Add(10*time.Minute)) {
|
||||
result = append(result, fmt.Sprintf("Latest Activity may not be far futurer: %v", host.LatestActivity))
|
||||
result = append(result, fmt.Sprintf("Latest Activity cannot be in the far future: %v", host.LatestActivity))
|
||||
}
|
||||
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue