diff --git a/app/rest/api/rest_test.go b/app/rest/api/rest_test.go index 6aaed077..6cc101e7 100644 --- a/app/rest/api/rest_test.go +++ b/app/rest/api/rest_test.go @@ -355,7 +355,8 @@ func TestServer_Counts(t *testing.T) { j := []store.PostInfo{} err = json.Unmarshal(body, &j) assert.Nil(t, err) - assert.Equal(t, []store.PostInfo([]store.PostInfo{store.PostInfo{URL: "https://radio-t.com/blah1", Count: 3}, store.PostInfo{URL: "https://radio-t.com/blah2", Count: 2}}), j) + assert.Equal(t, []store.PostInfo([]store.PostInfo{{URL: "https://radio-t.com/blah1", Count: 3}, + {URL: "https://radio-t.com/blah2", Count: 2}}), j) } func TestServer_List(t *testing.T) { diff --git a/app/rest/cache.go b/app/rest/cache.go index 9be8a909..d830ea31 100644 --- a/app/rest/cache.go +++ b/app/rest/cache.go @@ -6,7 +6,7 @@ import ( "strings" "time" - cache "github.com/patrickmn/go-cache" + "github.com/patrickmn/go-cache" ) // LoadingCache defines interface for caching diff --git a/app/rest/http_errors.go b/app/rest/http_errors.go index 683d0d06..5e9329b6 100644 --- a/app/rest/http_errors.go +++ b/app/rest/http_errors.go @@ -20,12 +20,12 @@ func SendErrorJSON(w http.ResponseWriter, r *http.Request, code int, err error, func logDetails(r *http.Request, code int, err error, details string) { uinfoStr := "" - if user, е := GetUserInfo(r); е == nil { + if user, e := GetUserInfo(r); e == nil { uinfoStr = user.Name + "/" + user.ID + " - " } q := r.URL.String() - if qun, е := url.QueryUnescape(q); е == nil { + if qun, e := url.QueryUnescape(q); e == nil { q = qun } diff --git a/app/store/comment.go b/app/store/comment.go index 5cd4b5bb..f4491a28 100644 --- a/app/store/comment.go +++ b/app/store/comment.go @@ -64,7 +64,7 @@ type BlockedUser struct { } // PrepareUntrusted preprocess comment received from untrusted source by clearing all -// autogen fields and reset everyting users not supposed to provide +// autogen fields and reset everything users not supposed to provide func (c *Comment) PrepareUntrusted() { c.ID = "" // don't allow user to define ID, force auto-gen c.Timestamp = time.Time{} // reset time, force auto-gen @@ -115,9 +115,3 @@ func (c *Comment) SetDeleted() { c.Edit = nil c.Deleted = true } - -// NotifUser holds id and destination for notifiable user -type NotifUser struct { - ID string `json:"id"` - Destination string `json:"destination"` -} diff --git a/app/store/service_test.go b/app/store/service_test.go index 61651611..25d7da85 100644 --- a/app/store/service_test.go +++ b/app/store/service_test.go @@ -136,13 +136,13 @@ func TestService_Counts(t *testing.T) { svc := Service{Interface: b} res, err := svc.Counts("radio-t", []string{"https://radio-t.com/2"}) assert.Nil(t, err) - assert.Equal(t, []PostInfo{PostInfo{URL: "https://radio-t.com/2", Count: 1}}, res) + assert.Equal(t, []PostInfo{{URL: "https://radio-t.com/2", Count: 1}}, res) res, err = svc.Counts("radio-t", []string{"https://radio-t.com", "https://radio-t.com/2", "blah"}) assert.Nil(t, err) assert.Equal(t, []PostInfo{ - PostInfo{URL: "https://radio-t.com", Count: 2}, - PostInfo{URL: "https://radio-t.com/2", Count: 1}, - PostInfo{URL: "blah", Count: 0}, + {URL: "https://radio-t.com", Count: 2}, + {URL: "https://radio-t.com/2", Count: 1}, + {URL: "blah", Count: 0}, }, res) } diff --git a/app/store/store.go b/app/store/store.go index 2bb8f365..bdb9a89f 100644 --- a/app/store/store.go +++ b/app/store/store.go @@ -33,13 +33,6 @@ type Admin interface { Blocked(siteID string) ([]BlockedUser, error) // get list of blocked users } -// Notifier defines all store ops to store/retrieve notification info for users -type Notifier interface { - Set(locator Locator, user NotifUser, status bool) error // subscribe / unsubscribe user to locator updates - Status(locator Locator, userID string) bool // get subscription status for user & locator - List(locator Locator) ([]NotifUser, error) // list all subscribed users -} - func sortComments(comments []Comment, sortFld string) []Comment { sort.Slice(comments, func(i, j int) bool { switch sortFld {