Compare commits
2 Commits
e8184a5a4c
...
ae29a0221c
Author | SHA1 | Date |
---|---|---|
Niko Abeler | ae29a0221c | |
Niko Abeler | 9559d27bf6 |
3
post.go
3
post.go
|
@ -2,6 +2,7 @@ package owl
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
@ -308,7 +309,7 @@ func (post *Post) SendWebmention(webmention WebmentionOut) error {
|
||||||
|
|
||||||
// if last scan is less than 7 days ago, don't send webmention
|
// if last scan is less than 7 days ago, don't send webmention
|
||||||
if webmention.ScannedAt.After(time.Now().Add(-7*24*time.Hour)) && !webmention.Supported {
|
if webmention.ScannedAt.After(time.Now().Add(-7*24*time.Hour)) && !webmention.Supported {
|
||||||
return nil
|
return errors.New("did not scan. Last scan was less than 7 days ago")
|
||||||
}
|
}
|
||||||
|
|
||||||
webmention.ScannedAt = time.Now()
|
webmention.ScannedAt = time.Now()
|
||||||
|
|
|
@ -392,8 +392,8 @@ func TestSendWebmentionOnlyScansOncePerWeek(t *testing.T) {
|
||||||
webmention = webmentions[0]
|
webmention = webmentions[0]
|
||||||
|
|
||||||
err := post.SendWebmention(webmention)
|
err := post.SendWebmention(webmention)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
t.Errorf("Error sending webmention: %v", err)
|
t.Errorf("Expected error, got nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
webmentions = post.OutgoingWebmentions()
|
webmentions = post.OutgoingWebmentions()
|
||||||
|
|
Loading…
Reference in New Issue