Skip to content

Commit

Permalink
Merge pull request #249 from systemli/Fix-loading-Attachments-for-Mes…
Browse files Browse the repository at this point in the history
…sages

🐛 Fix loading Attachments for Messages
  • Loading branch information
0x46616c6b authored Oct 21, 2023
2 parents 5fbd392 + 8b6c0d8 commit ebfcee9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/api/timeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (h *handler) GetTimeline(c *gin.Context) {
messages := make([]storage.Message, 0)
if ticker.Active {
pagination := pagination.NewPagination(c)
messages, err = h.storage.FindMessagesByTickerAndPagination(ticker, *pagination)
messages, err = h.storage.FindMessagesByTickerAndPagination(ticker, *pagination, storage.WithAttachments())
if err != nil {
c.JSON(http.StatusOK, response.ErrorResponse(response.CodeDefault, response.MessageFetchError))
return
Expand Down
4 changes: 2 additions & 2 deletions internal/api/timeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestGetTimelineMessageFetchError(t *testing.T) {
c, _ := gin.CreateTestContext(w)
c.Set("ticker", storage.Ticker{Active: true})
s := &storage.MockStorage{}
s.On("FindMessagesByTickerAndPagination", mock.Anything, mock.Anything).Return([]storage.Message{}, errors.New("storage error"))
s.On("FindMessagesByTickerAndPagination", mock.Anything, mock.Anything, mock.Anything).Return([]storage.Message{}, errors.New("storage error"))

h := handler{
storage: s,
Expand All @@ -92,7 +92,7 @@ func TestGetTimeline(t *testing.T) {
c, _ := gin.CreateTestContext(w)
c.Set("ticker", storage.Ticker{})
s := &storage.MockStorage{}
s.On("FindMessagesByTickerAndPagination", mock.Anything, mock.Anything).Return([]storage.Message{}, nil)
s.On("FindMessagesByTickerAndPagination", mock.Anything, mock.Anything, mock.Anything).Return([]storage.Message{}, nil)

h := handler{
storage: s,
Expand Down

0 comments on commit ebfcee9

Please sign in to comment.