openstreetmap-ng
openstreetmap-ng copied to clipboard
feat: tag web-created notes with #osm-ng hashtag
Summary
Notes opened through the OSM-NG web frontend now include an application hashtag (#osm-ng) in their opening comment, identifying the application that created the note — mirroring how editors tag the notes they create.
Resolves #76
Design
- The hashtag is appended only on the web/RPC path (
app/rpc/note.py→NoteService.create(..., append_app_hashtag=True)). - Notes created via the 0.6 API (
app/controllers/api06_note.py) by third-party clients keep their text verbatim — they are not OSM-NG-created, so tagging them would be incorrect and would also change the public API's stored note text. - Appending is idempotent (no double-tag if the text already contains the hashtag) and empty-text safe (a note with no text becomes just the hashtag).
- The hashtag string is configurable via
NOTE_CREATED_BY_HASHTAGinapp/config.py.
Changes
app/config.py: addNOTE_CREATED_BY_HASHTAG = '#osm-ng'.app/services/note_service.py:create()gains a keyword-onlyappend_app_hashtag: bool = False; builds the opening-comment body idempotently.app/rpc/note.py: webCreatepassesappend_app_hashtag=True.tests/services/test_note_service.py: covers append, empty-text, idempotency, and the default verbatim path.
Notes
The default-off design keeps the existing 0.6-API note tests green (they assert exact note text via the API path).