Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
tibetsprague committed Feb 14, 2023
2 parents f5c527a + 814d0ee commit 0e7a70f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

## [5.3.4] - 2023-02-14

### Changed
- Pinned posts now appear first in every context they are visible and regardless of the sort

## [5.3.3] - 2023-02-09

### Added
Expand Down
4 changes: 2 additions & 2 deletions api/services/Search/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ export const filterAndSortPosts = curry((opts, q) => {
q.whereRaw('locations.center && ST_MakeEnvelope(?, ?, ?, ?, 4326)', [boundingBox[0].lng, boundingBox[0].lat, boundingBox[1].lng, boundingBox[1].lat])
}

if (sort === 'posts.updated_at' && showPinnedFirst) {
q.orderByRaw('groups_posts.pinned_at is null asc, groups_posts.pinned_at desc, posts.updated_at desc')
if (showPinnedFirst) {
q.orderByRaw(`groups_posts.pinned_at is null asc, groups_posts.pinned_at desc, ${sort || 'posts.updated_at'} ${order || (sortBy === 'order' ? 'asc' : 'desc')}`)
} else if (sort) {
q.orderBy(sort, order || (sortBy === 'order' ? 'asc' : 'desc'))
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Tibet Sprague <tibet@hylo.com>",
"license": "GNU AFFERO GENERAL PUBLIC LICENSE v3",
"private": true,
"version": "5.3.3",
"version": "5.3.4",
"repository": {
"type": "git",
"url": "git://github.com/Hylozoic/hylo-node.git"
Expand Down

0 comments on commit 0e7a70f

Please sign in to comment.