Merge pull request #1408 from Freika/dev

0.28.1
This commit is contained in:
Evgenii Burmakin
2025-06-11 21:37:21 +02:00
committed by GitHub
4 changed files with 51 additions and 12 deletions

View File

@@ -1 +1 @@
0.28.0
0.28.1

View File

@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
# 0.28.1 - 2025-06-11
## Fixed
- Limit notifications in navbar to 10. Fresh one will replace the oldest one. #1184
## Changed
- No osm point types are being ignored anymore.
# 0.28.0 - 2025-06-09
⚠️ This release includes a breaking change. ⚠️

View File

@@ -48,17 +48,53 @@ export default class extends BaseController {
return
}
// Create divider and notification item to match server-side structure
const divider = this.createDivider()
const li = this.createNotificationListItem(notification)
const divider = this.listTarget.querySelector(".divider")
if (divider) {
divider.parentNode.insertBefore(li, divider.nextSibling)
// Find the "See all" link to determine where to insert
const seeAllLink = this.listTarget.querySelector('li:first-child')
if (seeAllLink) {
// Insert after the "See all" link
seeAllLink.insertAdjacentElement('afterend', divider)
divider.insertAdjacentElement('afterend', li)
} else {
// Fallback: prepend to list
this.listTarget.prepend(divider)
this.listTarget.prepend(li)
}
// Enforce limit of 10 notification items (excluding the "See all" link)
this.enforceNotificationLimit()
this.updateBadge()
}
createDivider() {
const divider = document.createElement("div")
divider.className = "divider p-0 m-0"
return divider
}
enforceNotificationLimit() {
const limit = 10
const notificationItems = this.listTarget.querySelectorAll('.notification-item')
// Remove excess notifications if we exceed the limit
if (notificationItems.length > limit) {
// Remove the oldest notifications (from the end of the list)
for (let i = limit; i < notificationItems.length; i++) {
const itemToRemove = notificationItems[i]
// Also remove the divider that comes before it
const previousSibling = itemToRemove.previousElementSibling
if (previousSibling && previousSibling.classList.contains('divider')) {
previousSibling.remove()
}
itemToRemove.remove()
}
}
}
createNotificationListItem(notification) {
const li = document.createElement("li")
li.className = "notification-item"

View File

@@ -4,9 +4,6 @@
class ReverseGeocoding::Places::FetchData
attr_reader :place
IGNORED_OSM_VALUES = %w[house residential yes detached].freeze
IGNORED_OSM_KEYS = %w[highway railway].freeze
def initialize(place_id)
@place = Place.find(place_id)
end
@@ -14,6 +11,7 @@ class ReverseGeocoding::Places::FetchData
def call
unless DawarichSettings.reverse_geocoding_enabled?
Rails.logger.warn('Reverse geocoding is not enabled')
return
end
@@ -102,10 +100,5 @@ class ReverseGeocoding::Places::FetchData
radius: 1,
units: :km
)
data.reject do |place|
place.data['properties']['osm_value'].in?(IGNORED_OSM_VALUES) ||
place.data['properties']['osm_key'].in?(IGNORED_OSM_KEYS)
end
end
end