Feature: share location #437

Manually merged
hloth merged 1 commit from Enucatl/open-grind:feature/location-messages into main 2026-10-27 13:16:51 +01:00
Contributor

I implemented the ability of sharing location.

  • by panning you can choose the pin location
  • by default it starts on the location set in the app at the beginning

See #35

I implemented the ability of sharing location. - by panning you can choose the pin location - by default it starts on the location set in the app at the beginning See #35
Fix location map centering and layer overlap
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
4bf69499fb
Enucatl force-pushed feature/location-messages from 4bf69499fb
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
to a1c834780d
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
2026-10-07 16:35:31 +02:00
Compare
Owner

Please capture screenshots with the demo mode on or record a short demo video with all changes to UI

Please capture screenshots with the demo mode on or record a short demo video with all changes to UI
Author
Contributor

image

![image](/attachments/0e16a85b-0904-4a5f-b6c6-84ca244c4725)
image.png
277 KiB
Owner

@Enucatl,

The map widget is partially covered by the bottom drawer's tab bar

Also try various designs of the title/caption and whether they're needed in general, considering it's the only element in the tab and the tab itself is titled

@Enucatl, The map widget is partially covered by the bottom drawer's tab bar Also try various designs of the title/caption and whether they're needed in general, considering it's the only element in the tab and the tab itself is titled
Fix location map centering and layer overlap
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
4bf69499fb
Merge remote-tracking branch 'origin/feature/location-messages' into feature/location-messages
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
d376d9f7d8
# Conflicts:
#	e2e/composer-location-map.spec.ts
#	src/lib/components/location-chooser/GeoMapPicker.svelte
Restore location message map tiles
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
20cd5ced8d
Author
Contributor

Screenshot from android, after the latest refinements on the widget position. I never did UI/frontend in my life so please be patient :)

Screenshot from android, after the latest refinements on the widget position. I never did UI/frontend in my life so please be patient :)
Owner

I don't think we need the "1" in "send location" — there's no multiselection on that tab

I don't think we need the "1" in "send location" — there's no multiselection on that tab
Hide location send count
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
6e65105771
Author
Contributor

image

This requires ifbranching the media action I was reusing, but there we go with a minimal adaptation.

I don't think it's worth building a further abstraction on top of both media and location, then deriving both only for this.

![image](/attachments/ec9925ca-a4a8-47da-bcde-2bb4d60131a7) This requires ifbranching the media action I was reusing, but there we go with a minimal adaptation. I don't think it's worth building a further abstraction on top of both media and location, then deriving both only for this.
image.png
182 KiB
Merge remote-tracking branch 'upstream/main' into feature/location-messages
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
7fcc50ab73
# Conflicts:
#	src/lib/components/media-sheet/MediaSheetActions.svelte
First-time contributor

Still unimplemented?

Still unimplemented?
lildamnbeat00 approved these changes 2026-10-08 20:32:16 +02:00
Dismissed
Enucatl force-pushed feature/location-messages from 7fcc50ab73
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
to d473402bec
Some checks failed
audit / audit (pull_request) Has been cancelled
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
2026-10-08 22:07:00 +02:00
Compare
hloth requested changes 2026-10-10 15:55:07 +02:00
Dismissed
hloth left a comment

Also:

  • no test preses Send location
  • longitude isn't wrapped, so panning onto a neighbouring copy of the world map lets a longitude outside ±180 be sent
  • misleading commit title
  • panning doesn't move the pin
  • the e2e is the only spec using sharp
  • two untrack calls and two names for one initial value, when plain consts would work
  • centerAt effect tracks GeoMapPicker internals
  • Spinner is imported by file path instead of $lib/components/ui/spinner
  • only the small "Open map" link in a location bubble is tappable, unlike the official app
  • "Locate me" pauses background GPS updates, by marking the GPS fix as fresh without saving it, so background updates of the browse location pause for up to 6 minutes
Also: - no test preses Send location - longitude isn't wrapped, so panning onto a neighbouring copy of the world map lets a longitude outside ±180 be sent - misleading commit title - panning doesn't move the pin - the e2e is the only spec using sharp - two untrack calls and two names for one initial value, when plain consts would work - `centerAt` effect tracks `GeoMapPicker` internals - `Spinner` is imported by file path instead of `$lib/components/ui/spinner` - only the small "Open map" link in a location bubble is tappable, unlike the official app - "Locate me" pauses background GPS updates, by marking the GPS fix as fresh without saving it, so background updates of the browse location pause for up to 6 minutes
@ -0,0 +69,4 @@
}
const initialBounds = (await map.boundingBox())!;
await page.getByPlaceholder("Search places...").fill("Berlin");
// Android resizes the webview while the search keyboard is open.
Owner

no-comments rule: rewrite code so it's self-explanatory and semantic without comments

no-comments rule: rewrite code so it's self-explanatory and semantic without comments
hloth marked this conversation as resolved
@ -0,0 +107,4 @@
.toBuffer();
expect(
[...pixel],
"map tiles must not paint over the send button",
Owner

e2e magenta-pixel check can't see the map, so it doesn't test the overlap it's named for

e2e magenta-pixel check can't see the map, so it doesn't test the overlap it's named for
hloth marked this conversation as resolved
@ -61,0 +61,4 @@
$effect(() => {
if (!map) return;
const instance = map;
// Tabs can mount the map before its container is visible.
Owner

no-comments rule: rewrite code so it's self-explanatory and semantic without comments

no-comments rule: rewrite code so it's self-explanatory and semantic without comments
hloth marked this conversation as resolved
@ -167,8 +176,10 @@
url={"https://tile.openstreetmap.org/{z}/{x}/{y}.png"}
options={{
maxZoom: 19,
// OSM requires a web referrer; omit private paths from it.
Owner

no-comments rule: rewrite code so it's self-explanatory and semantic without comments

no-comments rule: rewrite code so it's self-explanatory and semantic without comments
hloth marked this conversation as resolved
@ -41,3 +37,3 @@
</script>
<MediaSheet bind:open fullsize={isFullsizeTab}>
<MediaSheet bind:open fullsize={selectedTab !== "location"}>
Owner

selectedTab !== "location" written 4 times where isFullsizeTab was. The autoLocation.suspend/resume copied from LocationChooser does nothing useful here.

`selectedTab !== "location"` written 4 times where isFullsizeTab was. The `autoLocation.suspend/resume` copied from LocationChooser does nothing useful here.
hloth marked this conversation as resolved
@ -67,2 +63,2 @@
<Tabs.Content value="location">
<ComposerUnimplementedTab label="Sharing location" issue={35} />
<Tabs.Content value="location" class="pb-12">
<ComposerLocationTab
Owner

The map loads even when the Location tab isn't open, contradicts privacy.md and existing lazy-map precedent. Mount ComposerLocationTab only once the tab is selected.

The map loads even when the Location tab isn't open, contradicts privacy.md and existing lazy-map precedent. Mount ComposerLocationTab only once the tab is selected.
hloth marked this conversation as resolved
@ -0,0 +8,4 @@
let { message }: { message: LocationMessage["body"] } = $props();
const mapUrl = $derived(
`https://www.google.com/maps/search/?api=1&query=${message.lat}%2C${message.lon}`,
Owner

Use geo:lat,lon?q=… URI, as the official app does, never anything locked to Google.

Use `geo:lat,lon?q=…` URI, as the official app does, never anything locked to Google.
hloth marked this conversation as resolved
@ -0,0 +42,5 @@
.querySelector('[data-slot="message-bubble"]')
?.classList.contains(
isOut
? "bg-message-bubble-out"
: "bg-message-bubble-in",
Owner

CONTRIBUTING forbids checking Tailwind classes

CONTRIBUTING forbids checking Tailwind classes
hloth marked this conversation as resolved
Enucatl force-pushed feature/location-messages from d473402bec
Some checks failed
audit / audit (pull_request) Has been cancelled
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
to 5f7fd4e47d
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
ci-orchestrator / provision running on cpx42 in fsn1
audit / audit (pull_request) Successful in 14s
2026-10-10 17:54:00 +02:00
Compare
Author
Contributor
  1. Added an end-to-end test that presses Send location and verifies the sent coordinates.
  2. Wrapped selected longitude into ±180°, including neighboring world copies.
  3. Made panning move the selected pin.
  4. Replaced the misleading pixel check with map/control bounds checks and removed sharp from the test.
  5. Simplified initial coordinates to plain constants and prevented centering from tracking picker internals.
  6. Switched Spinner imports to $lib/components/ui/spinner.
  7. Restored isFullsizeTab and removed unnecessary GPS suspend/resume calls.
  8. Mounted the location picker only when its tab is selected.
  9. Made the whole location bubble tappable and used a platform-neutral geo: URI.
  10. Fixed “Locate me” preventing background browse-location updates from applying fresh GPS coordinates.
  11. Removed added comments and replaced Tailwind-class assertions with behavior checks.
  12. Rebased onto upstream main and squashed everything into one signed commit with an accurate title.
1. Added an end-to-end test that presses Send location and verifies the sent coordinates. 2. Wrapped selected longitude into ±180°, including neighboring world copies. 3. Made panning move the selected pin. 4. Replaced the misleading pixel check with map/control bounds checks and removed sharp from the test. 5. Simplified initial coordinates to plain constants and prevented centering from tracking picker internals. 6. Switched Spinner imports to $lib/components/ui/spinner. 7. Restored isFullsizeTab and removed unnecessary GPS suspend/resume calls. 8. Mounted the location picker only when its tab is selected. 9. Made the whole location bubble tappable and used a platform-neutral geo: URI. 10. Fixed “Locate me” preventing background browse-location updates from applying fresh GPS coordinates. 11. Removed added comments and replaced Tailwind-class assertions with behavior checks. 12. Rebased onto upstream main and squashed everything into one signed commit with an accurate title.
Owner

Closes #459

Closes #459
Enucatl force-pushed feature/location-messages from 5f7fd4e47d
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
ci-orchestrator / provision running on cpx42 in fsn1
audit / audit (pull_request) Successful in 14s
to ac1fe7139c
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
2026-10-13 10:19:47 +02:00
Compare
Enucatl force-pushed feature/location-messages from ac1fe7139c
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
to af125e3097
Some checks failed
credits / credits (pull_request) Failing after 1m40s
ci-orchestrator / provision running on cpx42 in fsn1
check / check (pull_request) Failing after 2m51s
2026-10-13 10:22:40 +02:00
Compare
hloth requested changes 2026-10-24 12:58:05 +02:00
Dismissed
hloth left a comment

Rebase:

  • repositionInputs is now false for every sheet.
  • Main added an identical showCount prop.
  • Main has aboveTabBar, a type-to-label map in previewLabel, an outboundMessageSchema echo in demoSentMessage, and a seedPreferences e2e helper.

Also:

  • If "Locate me" finishes after you leave the Location tab, the app throws an uncaught TypeError on the removed map. The tab never cancels the GPS request.
  • Double-clicking or double-tapping a location bubble opens the map twice, then also replies or reacts. The official app separates single and double tap.
  • aria-label="Open map" hides "Location" and the coordinates from screen readers.
  • Switching away from the Location tab throws away the chosen pin. The other tabs keep their selection.
  • After turning GPS on and then off in the browse chooser, the pin can be drawn one world-width away from the view.
  • The map shrinks to 0 px when the usable screen height is 12rem (192 px) or less.
  • Tests:
    • The e2e search step can't fail, because the stubbed Berlin result is about 19 m from the seeded location.
    • One unit test name claims GPS-off and cached-fix behaviour that the test never exercises.
    • The e2e replaces a whole source module instead of using the existing demo-response stub hook.
    • Three things have no test: pan-moves-pin in the browse chooser, the geo:* permission, and the new cached-GPS-fix branch in auto-location.
  • The selection effect fires on every move frame
  • The lazy-load block is copied from LocationChooser
  • pb-12 and -12rem are hard-coded offsets

Additionally:

  • geo: does nothing on macOS, so fall back to OpenStreetMap web link
  • Mention that the browse-location picker now moves the pin on pan, and add " (closes #459)" suffix.
Rebase: - repositionInputs is now false for every sheet. - Main added an identical showCount prop. - Main has aboveTabBar, a type-to-label map in previewLabel, an outboundMessageSchema echo in demoSentMessage, and a seedPreferences e2e helper. Also: - If "Locate me" finishes after you leave the Location tab, the app throws an uncaught TypeError on the removed map. The tab never cancels the GPS request. - Double-clicking or double-tapping a location bubble opens the map twice, then also replies or reacts. The official app separates single and double tap. - `aria-label="Open map"` hides "Location" and the coordinates from screen readers. - Switching away from the Location tab throws away the chosen pin. The other tabs keep their selection. - After turning GPS on and then off in the browse chooser, the pin can be drawn one world-width away from the view. - The map shrinks to 0 px when the usable screen height is 12rem (192 px) or less. - Tests: - The e2e search step can't fail, because the stubbed Berlin result is about 19 m from the seeded location. - One unit test name claims GPS-off and cached-fix behaviour that the test never exercises. - The e2e replaces a whole source module instead of using the existing demo-response stub hook. - Three things have no test: pan-moves-pin in the browse chooser, the `geo:*` permission, and the new cached-GPS-fix branch in auto-location. - The selection effect fires on every move frame - The lazy-load block is copied from LocationChooser - `pb-12` and `-12rem` are hard-coded offsets Additionally: - `geo:` does nothing on macOS, so fall back to OpenStreetMap web link - Mention that the browse-location picker now moves the pin on pan, and add " (closes #459)" suffix.
@ -60,0 +62,4 @@
$effect(() => {
if (!map) return;
const instance = map;
const observer = new ResizeObserver(() => instance.invalidateSize());
Owner

A resize (keyboard, rotation, window) fires a map move. With no saved location, that turns a pin at Madrid (zoom 2) into something you can send in chat, or save in the first-run location screen.

A resize (keyboard, rotation, window) fires a map move. With no saved location, that turns a pin at Madrid (zoom 2) into something you can send in chat, or save in the first-run location screen.
hloth marked this conversation as resolved
@ -194,0 +218,4 @@
pinPos.lon +
360 *
Math.round(
(centerLongitude - pinPos.lon) / 360,
Owner

GeoMapPicker now has two ways to set the pin: the pin follows the map centre, but it can also still be dragged off-centre. After a drag, the next zoom, pan or resize snaps the pin back to the centre. This affects the chat tab and the browse-location chooser.

GeoMapPicker now has two ways to set the pin: the pin follows the map centre, but it can also still be dragged off-centre. After a drag, the next zoom, pan or resize snaps the pin back to the centre. This affects the chat tab and the browse-location chooser.
hloth marked this conversation as resolved
@ -0,0 +1,30 @@
<script lang="ts">
import { MapPinIcon } from "phosphor-svelte";
Owner

Use phosphor-svelte/lib/MapPinIcon

Use `phosphor-svelte/lib/MapPinIcon`
hloth marked this conversation as resolved
hloth dismissed lildamnbeat00's review 2026-10-24 12:58:32 +02:00
Enucatl force-pushed feature/location-messages from af125e3097
Some checks failed
credits / credits (pull_request) Failing after 1m40s
ci-orchestrator / provision running on cpx42 in fsn1
check / check (pull_request) Failing after 2m51s
to d9aa1c92c3
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
audit / audit (pull_request) Has been cancelled
2026-10-24 14:55:48 +02:00
Compare
Author
Contributor
  1. Kept main’s shared repositionInputs={false} behavior.
  2. Reused the existing showCount prop to hide the location count.
  3. Reused aboveTabBar, the preview-label map, the outbound-schema demo echo, and seedPreferences.
  4. The location picker now cancels its own GPS request when unmounted and ignores late results.
  5. Single-tap map navigation is separated from double-click replies and double-tap reactions.
  6. Removed the overriding accessible label so screen readers announce Location, coordinates, and Open map.
  7. The chosen pin survives tab switches. Reopening the drawer resets both the pin and camera to the browse location.
  8. Camera longitude tracking continues while GPS owns the map, keeping the pin visible after GPS is disabled.
  9. Replaced the shrinking height calculation with bounded map sizing and a scrolling sheet. Added coverage for 192 px of usable height.
  10. The search test now selects Paris from a Berlin starting location and checks the coordinates sent after panning.
  11. Corrected the unit-test description and verified that supplied browse coordinates take precedence over a cached GPS fix.
  12. Replaced the source-module mock with the existing demo-response hook.
  13. Added coverage for browse-map panning, the native geo:* permission, and cached-GPS reuse versus stale-fix requests.
  14. Selection notifications depend on the selected count rather than every movement frame.
  15. Shared the lazy map-loading implementation between both pickers.
  16. Removed the location-specific pb-12 and -12rem offsets and reused shared sheet spacing.
  17. macOS now opens an OpenStreetMap web link; other platforms retain native geo: links.
  18. Rebased onto current main and squashed everything into one signed commit, d9aa1c92. Its title is Share locations in chat (closes #459), and its body describes the browse picker’s new pan behavior.
  19. Switched MapPinIcon to its direct Phosphor import.
  20. Removed independent pin dragging so it cannot conflict with selecting the map center.
  21. Guarded resize events so they preserve the selection without inventing a location. Intentional panning, keyboard movement, and inertial movement still update the pin.
1. Kept main’s shared `repositionInputs={false}` behavior. 2. Reused the existing `showCount` prop to hide the location count. 3. Reused `aboveTabBar`, the preview-label map, the outbound-schema demo echo, and `seedPreferences`. 4. The location picker now cancels its own GPS request when unmounted and ignores late results. 5. Single-tap map navigation is separated from double-click replies and double-tap reactions. 6. Removed the overriding accessible label so screen readers announce Location, coordinates, and Open map. 7. The chosen pin survives tab switches. Reopening the drawer resets both the pin and camera to the browse location. 8. Camera longitude tracking continues while GPS owns the map, keeping the pin visible after GPS is disabled. 9. Replaced the shrinking height calculation with bounded map sizing and a scrolling sheet. Added coverage for 192 px of usable height. 10. The search test now selects Paris from a Berlin starting location and checks the coordinates sent after panning. 11. Corrected the unit-test description and verified that supplied browse coordinates take precedence over a cached GPS fix. 12. Replaced the source-module mock with the existing demo-response hook. 13. Added coverage for browse-map panning, the native `geo:*` permission, and cached-GPS reuse versus stale-fix requests. 14. Selection notifications depend on the selected count rather than every movement frame. 15. Shared the lazy map-loading implementation between both pickers. 16. Removed the location-specific `pb-12` and `-12rem` offsets and reused shared sheet spacing. 17. macOS now opens an OpenStreetMap web link; other platforms retain native `geo:` links. 18. Rebased onto current main and squashed everything into one signed commit, `d9aa1c92`. Its title is `Share locations in chat (closes #459)`, and its body describes the browse picker’s new pan behavior. 19. Switched MapPinIcon to its direct Phosphor import. 20. Removed independent pin dragging so it cannot conflict with selecting the map center. 21. Guarded resize events so they preserve the selection without inventing a location. Intentional panning, keyboard movement, and inertial movement still update the pin.
Enucatl force-pushed feature/location-messages from d9aa1c92c3
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
audit / audit (pull_request) Has been cancelled
to 81e3162493
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
2026-10-24 15:52:24 +02:00
Compare
hloth requested changes 2026-10-26 19:21:08 +01:00
Dismissed
hloth left a comment

Thank you

Thank you
@ -0,0 +169,4 @@
if (!map || locked) return;
const onMapClick: LeafletMouseEventHandlerFn = ({ latlng }) => {
selectLocation(latlng);
map?.panTo(latlng, cameraAnimation);
Owner

The pin follows the pan animation's frames, so a resize during this pan moves the pin by half the height change. On Android: tap the map while the search keyboard is open, and the keyboard hides mid-pan. Same for movePin (search pick, Locate me).

The pin follows the pan animation's frames, so a resize during this pan moves the pin by half the height change. On Android: tap the map while the search keyboard is open, and the keyboard hides mid-pan. Same for movePin (search pick, Locate me).
Author
Contributor

Click, search, and Locate me now move the camera without animation. A resize cannot shift the selected point during that movement. The new tests fail when animation is restored.

Click, search, and Locate me now move the camera without animation. A resize cannot shift the selected point during that movement. The new tests fail when animation is restored.
Enucatl marked this conversation as resolved
Lines 226-247
@ -0,0 +223,25 @@
}}
/>
{:else if pinPos && !covering}
{#key locked}
<Marker
latLng={[
pinPos.lat,
pinPos.lon +
360 *
Math.round(
(centerLongitude - pinPos.lon) / 360,
),
]}
options={{
draggable: false,
title: "Selected location",
icon: divIcon({
html: '<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="40" height="40" fill="#ffba20" stroke="#000000" stroke-width="8px" viewBox="0 0 256 256"><path d="M128,16a88.1,88.1,0,0,0-88,88c0,75.3,80,132.17,83.41,134.55a8,8,0,0,0,9.18,0C136,236.17,216,179.3,216,104A88.1,88.1,0,0,0,128,16Zm0,56a32,32,0,1,1-32,32A32,32,0,0,1,128,72Z"></path></svg>',
iconAnchor: [20, 40],
iconSize: [40, 40],
className: "",
}),
}}
/>
{/key}
Owner

These are leftovers from pin dragging; Leaflet markers aren't draggable by default.

These are leftovers from pin dragging; Leaflet markers aren't draggable by default.
Author
Contributor

Removed draggable: false and the keyed marker block. The marker now uses Leaflet's default behavior.

Removed draggable: false and the keyed marker block. The marker now uses Leaflet's default behavior.
Enucatl marked this conversation as resolved
@ -32,2 +12,3 @@
const gpsAvailable = isMobilePlatform();
let map: GeoMapComponent | null = $state(null);
let pendingCenter: (Coordinates & { zoom: number }) | undefined = $state();
Owner

The initial view now passes through three pending-centre buffers: ComposerLocationTab's picker effect, this one, and GeoMap's. An initial-view prop read once into the Map options would replace them.

The initial view now passes through three pending-centre buffers: ComposerLocationTab's picker effect, this one, and GeoMap's. An initial-view prop read once into the Map options would replace them.
Author
Contributor

Replaced the pending-center buffers with an initialView prop. GeoMap reads it once for the Map options. Tests check the initial center and zoom.

Replaced the pending-center buffers with an initialView prop. GeoMap reads it once for the Map options. Tests check the initial center and zoom.
Enucatl marked this conversation as resolved
@ -111,0 +114,4 @@
vi.unstubAllGlobals();
});
it("saves the map center after keyboard or inertial panning, with a fixed marker", async () => {
Owner

No keyboard or inertial panning here, only setView and panBy. Rename.

No keyboard or inertial panning here, only setView and panBy. Rename.
Author
Contributor

Renamed the test to describe panning. It no longer claims to test keyboard or inertial movement.

Renamed the test to describe panning. It no longer claims to test keyboard or inertial movement.
Enucatl marked this conversation as resolved
@ -111,0 +117,4 @@
it("saves the map center after keyboard or inertial panning, with a fixed marker", async () => {
const setView = vi.spyOn(Map.prototype, "setView");
const onSubmit = open();
await screen.findByRole("button", { name: "Locate me" });
Owner

Times out on every run, see ComposerLocationTab.svelte.test.ts:34

Times out on every run, see ComposerLocationTab.svelte.test.ts:34
Author
Contributor

Added the GeoMap.svelte preload. The map-center test now passes.

Added the GeoMap.svelte preload. The map-center test now passes.
Enucatl marked this conversation as resolved
@ -111,0 +152,4 @@
it("keeps the pin visible after GPS recenters from another world copy", async () => {
const setView = vi.spyOn(Map.prototype, "setView");
const onSubmit = open();
runMock.mockImplementation(() =>
Owner

reportFix runs synchronously inside run(), so the fix lands in the same flush as the lock, which a real GPS fix never does. With the old longitude tracking restored, this test still passes. Resolve the fix after the switch click.

`reportFix` runs synchronously inside `run()`, so the fix lands in the same flush as the lock, which a real GPS fix never does. With the old longitude tracking restored, this test still passes. Resolve the fix after the switch click.
Author
Contributor

The GPS fix now arrives after the switch click completes. The test checks that the pin remains visible after GPS is turned off.

The GPS fix now arrives after the switch click completes. The test checks that the pin remains visible after GPS is turned off.
Enucatl marked this conversation as resolved
@ -162,1 +162,3 @@
{ "min-h-full": fullsize },
{
"min-h-full": fullsize,
"pb-[calc(--spacing(30)+var(--bar-content-gap))]": !fullsize,
Owner

This applies to every short sheet, including stickers sheet's GIF tab before GIPHY consent when it has no Send button — now it gets 40–52 px of empty space under Continue. It also fights pb-20 and repeats line 144's value. Keep it on the Location tab.

This applies to every short sheet, including stickers sheet's GIF tab before GIPHY consent when it has no Send button — now it gets 40–52 px of empty space under Continue. It also fights `pb-20` and repeats line 144's value. Keep it on the Location tab.
Author
Contributor

Removed the padding override from the shared sheet. The extra space now applies only to the Location tab.

Removed the padding override from the shared sheet. The extra space now applies only to the Location tab.
Enucatl marked this conversation as resolved
@ -584,2 +584,3 @@
sticker.success &&
(sticker.data.type === "Giphy" || sticker.data.type === "Gaymoji")
(sticker.data.type === "Giphy" ||
sticker.data.type === "Gaymoji" ||
Owner

Rename sticker, it now covers Location.

Rename `sticker`, it now covers Location.
Author
Contributor

Renamed sticker to attachment because the parsed message can also be a Location.

Renamed sticker to attachment because the parsed message can also be a Location.
Enucatl marked this conversation as resolved
@ -62,6 +62,7 @@ const EXPIRING_VIDEO_TYPES = new Set(["Video", "PrivateVideo"]);
const STICKER_LABELS: Record<string, string> = {
Gaymoji: "Gaymoji",
Giphy: "GIF",
Location: "Location",
Owner

Location isn't a sticker, so rename the map. QUOTE_LABELS.Location (line 90) is now unreachable; delete it like Gaymoji and Giphy.

Location isn't a sticker, so rename the map. `QUOTE_LABELS.Location` (line 90) is now unreachable; delete it like Gaymoji and Giphy.
Author
Contributor

Renamed STICKER_LABELS to ATTACHMENT_LABELS. Removed the unreachable Location entry from QUOTE_LABELS and the duplicate Location fallback.

Renamed STICKER_LABELS to ATTACHMENT_LABELS. Removed the unreachable Location entry from QUOTE_LABELS and the duplicate Location fallback.
Enucatl marked this conversation as resolved
@ -0,0 +11,4 @@
vi.restoreAllMocks();
});
it("allows geo URLs through the native opener capability", () => {
Owner

Capability pins live in Rust: add this to opener_scope_pins in src-tauri/src/lib.rs instead of reading src-tauri JSON from a frontend test.

Capability pins live in Rust: add this to `opener_scope_pins` in src-tauri/src/lib.rs instead of reading src-tauri JSON from a frontend test.
Author
Contributor

Moved the geo:* permission check to opener_scope_pins in src-tauri/src/lib.rs. Removed the frontend test that read the capability JSON.

Moved the geo:* permission check to opener_scope_pins in src-tauri/src/lib.rs. Removed the frontend test that read the capability JSON.
Enucatl marked this conversation as resolved
@ -78,6 +92,7 @@
aboveTabBar
label={selection?.label ?? ""}
count={selection?.count ?? 0}
showCount={isFullsizeTab}
Owner

Whether the count shows has nothing to do with sheet height; key it on the tab.

Whether the count shows has nothing to do with sheet height; key it on the tab.
Author
Contributor

showCount now depends on the selected tab. The Location tab hides the count.

showCount now depends on the selected tab. The Location tab hides the count.
Enucatl marked this conversation as resolved
@ -0,0 +46,4 @@
</script>
<div
class="relative mx-auto aspect-square w-[min(100%,max(12rem,50svh))] overflow-hidden rounded-lg"
Owner

Add the sr-only hint LocationChooser has ("Drag the map to place the pin…"). Screen-reader users aren't told that moving the map moves the pin that gets sent.

Add the sr-only hint LocationChooser has ("Drag the map to place the pin…"). Screen-reader users aren't told that moving the map moves the pin that gets sent.
Author
Contributor

Added a screen-reader hint that tells users to drag the map to place the pin where they want to share their location.

Added a screen-reader hint that tells users to drag the map to place the pin where they want to share their location.
Enucatl marked this conversation as resolved
@ -0,0 +31,4 @@
import ComposerLocationTab from "./ComposerLocationTab.svelte";
await import("$lib/components/location-chooser/GeoMapPicker.svelte");
Owner

Preload GeoMap.svelte in both files. GeoMapPicker is a static import now, so this preloads nothing. The lazy chunk is GeoMap.svelte, and tests that wait the default 1 s for "Locate me" fail on every run: both "sends wrapped longitude" cases here and "saves the map center" in LocationChooser.svelte.test.ts.

Preload GeoMap.svelte in both files. GeoMapPicker is a static import now, so this preloads nothing. The lazy chunk is GeoMap.svelte, and tests that wait the default 1 s for "Locate me" fail on every run: both "sends wrapped longitude" cases here and "saves the map center" in LocationChooser.svelte.test.ts.
Author
Contributor

Both test files now preload GeoMap.svelte. The affected tests pass.

Both test files now preload GeoMap.svelte. The affected tests pass.
Enucatl marked this conversation as resolved
@ -0,0 +63,4 @@
}
describe("location attachment", () => {
it("starts at the supplied browse coordinates rather than the cached GPS fix", () => {
Owner

This submits before the map loads, so it never sees a cached GPS fix. The browse-over-GPS choice lives in ComposerAttachmentsMenu and is untested. Rename the test to what it checks or test the precedence there.

This submits before the map loads, so it never sees a cached GPS fix. The browse-over-GPS choice lives in ComposerAttachmentsMenu and is untested. Rename the test to what it checks or test the precedence there.
Author
Contributor

Renamed the test to state what it checks: sending the supplied coordinates on each mount. It no longer claims to test cached GPS precedence.

Renamed the test to state what it checks: sending the supplied coordinates on each mount. It no longer claims to test cached GPS precedence.
Enucatl marked this conversation as resolved
@ -0,0 +248,4 @@
expect(mocks.abortStale).toHaveBeenCalledExactlyOnceWith(1);
finish({ status: "ok", coords: mocks.lastFix });
await Promise.resolve();
expect(mocks.send).not.toHaveBeenCalled();
Owner

Locate me never reaches sendMessages, so this can't fail. Removing the if (!mounted) return guard keeps the test green.

Locate me never reaches sendMessages, so this can't fail. Removing the `if (!mounted) return` guard keeps the test green.
Author
Contributor

The test now checks the LocateMeButton callback directly. A late GPS result must not call it after unmount. Removing the mounted guard makes the test fail.

The test now checks the LocateMeButton callback directly. A late GPS result must not call it after unmount. Removing the mounted guard makes the test fail.
Enucatl marked this conversation as resolved
@ -0,0 +10,4 @@
let { message }: { message: LocationMessage["body"] } = $props();
const mapUrl = $derived(
isMacosPlatform()
Owner

Name every platform with currentPlatform(), don't add a default arm. Here iOS, Windows and Linux silently get geo:

  • iOS has no geo: handler and the opener still reports success
  • Windows Maps app is retired
  • Linux fails silently without a maps app
  • Use geo: on Android and the OpenStreetMap link on iOS, macOS, Windows and Linux
Name every platform with `currentPlatform()`, don't add a default arm. Here iOS, Windows and Linux silently get `geo:` - iOS has no `geo:` handler and the opener still reports success - Windows Maps app is retired - Linux fails silently without a maps app - Use `geo:` on Android and the OpenStreetMap link on iOS, macOS, Windows and Linux
Author
Contributor

Android uses geo:. iOS, macOS, Windows, and Linux use OpenStreetMap. Each platform has an explicit case. There is no default case.

Android uses geo:. iOS, macOS, Windows, and Linux use OpenStreetMap. Each platform has an explicit case. There is no default case.
Enucatl marked this conversation as resolved
@ -0,0 +30,4 @@
openExternalLink(url);
return;
}
pendingOpen = setTimeout(() => openExternalLink(url), 500);
Owner

Name it as a *_MS constant after $props(). Android's double-tap window is 300 ms, so 500 adds 200 ms to every single tap.

Name it as a `*_MS` constant after `$props()`. Android's double-tap window is 300 ms, so 500 adds 200 ms to every single tap.
Author
Contributor

Added MAP_OPEN_DELAY_MS after $props() and set it to 300 ms.

Added MAP_OPEN_DELAY_MS after $props() and set it to 300 ms.
Enucatl marked this conversation as resolved
@ -0,0 +40,5 @@
<a
href={mapUrl}
onclick={openMap}
onpointerdown={cancelOpen}
ondblclick={cancelOpen}
Owner

Removing either cancel handler keeps every test green, because both double sequences send detail: 2 on the second click. Test click(detail 1), click(detail 1), dblclick.

Removing either cancel handler keeps every test green, because both double sequences send `detail: 2` on the second click. Test click(detail 1), click(detail 1), dblclick.
Author
Contributor

Both double-click and double-tap tests now send click(detail: 1), click(detail: 1), then dblclick. Separate tests check cancellation on the second pointer press.

Both double-click and double-tap tests now send click(detail: 1), click(detail: 1), then dblclick. Separate tests check cancellation on the second pointer press.
Enucatl marked this conversation as resolved
@ -0,0 +42,4 @@
onclick={openMap}
onpointerdown={cancelOpen}
ondblclick={cancelOpen}
class="-mx-3 -my-2 flex items-center gap-3 rounded-xl px-3 py-2 select-none"
Owner

rounded-xl ignores the bubble's square tail corner, so the focus ring on the last bubble of a stack is rounded there.

rounded-xl ignores the bubble's square tail corner, so the focus ring on the last bubble of a stack is rounded there.
Author
Contributor

The link now inherits the bubble's corner radius. The focus ring follows the square corner at the tail.

The link now inherits the bubble's corner radius. The focus ring follows the square corner at the tail.
Enucatl marked this conversation as resolved
Enucatl force-pushed feature/location-messages from 81e3162493
Some checks failed
check / check (pull_request) Has been cancelled
credits / credits (pull_request) Has been cancelled
to 9ac29fa941
Some checks failed
ci-orchestrator / provision running on cx23 in fsn1
audit / audit (pull_request) Failing after 16s
credits / credits (pull_request) Successful in 4m20s
check / check (pull_request) Successful in 32m27s
2026-10-26 20:35:08 +01:00
Compare
claude left a comment
  • Make the commit message one line, no body.
  • docs/content/privacy.md: extend the OpenStreetMap entry to the chat Location tab and to opening a shared location on openstreetmap.org.
- Make the commit message one line, no body. - docs/content/privacy.md: extend the OpenStreetMap entry to the chat Location tab and to opening a shared location on openstreetmap.org.
@ -0,0 +91,4 @@
zoom: number;
}) {
selectLocation(latLng(lat, lon));
// Keep resize events from shifting a programmatic selection mid-animation.
First-time contributor

Remove comment

Remove comment
Author
Contributor

Removed the comment.

Removed the comment.
hloth marked this conversation as resolved
@ -0,0 +143,4 @@
if (!map || locked) return;
const onMapClick: LeafletMouseEventHandlerFn = ({ latlng }) => {
selectLocation(latlng);
map?.panTo(latlng, { animate: false });
First-time contributor

Map taps, search picks and Locate me no longer animate in either picker, and reduced motion is no longer consulted. Keep the animation and stop move from re-selecting during programmatic moves instead.

Map taps, search picks and Locate me no longer animate in either picker, and reduced motion is no longer consulted. Keep the animation and stop `move` from re-selecting during programmatic moves instead.
Author
Contributor

Restored animation for map taps, search results, and Locate me. Reduced motion disables it. Programmatic movement no longer changes the selected pin. The tests cover both motion settings and a resize during movement.

Restored animation for map taps, search results, and Locate me. Reduced motion disables it. Programmatic movement no longer changes the selected pin. The tests cover both motion settings and a resize during movement.
hloth marked this conversation as resolved
@ -120,1 +82,3 @@
{/await}
<GeoMapPicker
bind:pinPos
initialView={pinPos}
First-time contributor

GeoMap writes pinPos back without zoom, so after any pan a remount opens at zoom 2: switching between dialog and drawer at the breakpoint, or reopening from the empty-location screen. Pass { ...pinPos, zoom: PIN_ZOOM } like ComposerLocationTab and drop zoom from pinPos's type.

GeoMap writes `pinPos` back without `zoom`, so after any pan a remount opens at zoom 2: switching between dialog and drawer at the breakpoint, or reopening from the empty-location screen. Pass `{ ...pinPos, zoom: PIN_ZOOM }` like ComposerLocationTab and drop `zoom` from `pinPos`'s type.
Author
Contributor

Removed zoom from the pin state and its caller. Each new map receives the selected coordinates and PIN_ZOOM.

Removed zoom from the pin state and its caller. Each new map receives the selected coordinates and PIN_ZOOM.
hloth marked this conversation as resolved
@ -111,0 +123,4 @@
const map = setView.mock.instances[0];
if (!(map instanceof Map)) throw new Error("Map was not mounted");
flushSync(() => {
map.setView([PARIS.lat, PARIS.lon], 12, { animate: false });
First-time contributor

This setView hides the initial view: deleting initialView={pinPos} keeps every LocationChooser test green. Assert the map opens at Paris instead.

This `setView` hides the initial view: deleting `initialView={pinPos}` keeps every LocationChooser test green. Assert the map opens at Paris instead.
Author
Contributor

Removed the initial setView call. The test now checks that the map opens at Paris with PIN_ZOOM. It fails if initialView is removed.

Removed the initial setView call. The test now checks that the map opens at Paris with PIN_ZOOM. It fails if initialView is removed.
hloth marked this conversation as resolved
@ -144,3 +144,3 @@
"h-full scroll-pb-[calc(--spacing(30)+var(--bar-content-gap))] overflow-y-auto":
fullsize,
"h-fit": !fullsize,
"h-fit max-h-screen-safe overflow-y-auto": !fullsize,
First-time contributor

No effect: overflow-x-hidden already makes overflow-y auto, and Drawer.Content already caps the height. Revert so this file stays untouched.

No effect: `overflow-x-hidden` already makes `overflow-y` auto, and `Drawer.Content` already caps the height. Revert so this file stays untouched.
Author
Contributor

Removed the extra height and overflow classes. The only remaining change in this file uses the shared clearance requested in the other comment.

Removed the extra height and overflow classes. The only remaining change in this file uses the shared clearance requested in the other comment.
hloth marked this conversation as resolved
Lines 10-25
@ -7,6 +7,23 @@ import {
} from "$lib/model/messaging/message-preview";
describe("previewFromMessage", () => {
it("labels location messages in previews and quotes", () => {
const preview = previewFromMessage({
type: "Location",
body: { lat: 51.5074, lon: -0.1278 },
messageId: "location-1",
conversationId: "conversation-1",
senderId: 42,
timestamp: 1_710_000_000_000,
unsent: false,
reactions: [],
dynamic: false,
});
expect(previewLabel(preview)).toBe("Location");
expect(quoteLabel(preview)).toBe("Location");
});
First-time contributor

Duplicates the table row at line 187; delete.

Duplicates the table row at line 187; delete.
Author
Contributor

Removed the duplicate test. The existing table still checks Location previews and quotes.

Removed the duplicate test. The existing table still checks Location previews and quotes.
hloth marked this conversation as resolved
@ -60,3 +60,3 @@
const EXPIRING_VIDEO_TYPES = new Set(["Video", "PrivateVideo"]);
const STICKER_LABELS: Record<string, string> = {
const ATTACHMENT_LABELS: Record<string, string> = {
First-time contributor

GIFs and Gaymoji are stickers, not attachments (ComposerSheet = "attachments" | "stickers"). Use a neutral name, e.g. PREVIEW_LABELS.

GIFs and Gaymoji are stickers, not attachments (`ComposerSheet = "attachments" | "stickers"`). Use a neutral name, e.g. `PREVIEW_LABELS`.
Author
Contributor

Renamed the map to PREVIEW_LABELS.

Renamed the map to PREVIEW_LABELS.
hloth marked this conversation as resolved
@ -34,2 +34,4 @@
let locationPin: Coordinates | undefined = $state();
const selection = $derived(selections[selectedTab]);
const isFullsizeTab = $derived(selectedTab !== "location");
First-time contributor

Keep main's FULLSIZE_TABS; this repeats line 95's expression.

Keep main's `FULLSIZE_TABS`; this repeats line 95's expression.
Author
Contributor

Restored FULLSIZE_TABS and used it for sheet height. showCount still depends on the selected tab.

Restored FULLSIZE_TABS and used it for sheet height. showCount still depends on the selected tab.
hloth marked this conversation as resolved
@ -0,0 +33,6 @@
}
</script>
<p class="sr-only">
Drag the map to place the pin where you want to share your location.
</p>
First-time contributor

Nothing references this hint, so focusing the Location tab announces only "Location". Give it an id and point the Location Tabs.Content's aria-describedby at it. The pin isn't necessarily your location: "Drag the map to place the pin on the location you want to share."

Nothing references this hint, so focusing the Location tab announces only "Location". Give it an id and point the Location `Tabs.Content`'s `aria-describedby` at it. The pin isn't necessarily your location: "Drag the map to place the pin on the location you want to share."
Author
Contributor

Added an ID to the hint and linked the Location panel to it with aria-describedby. The hint now uses your proposed text. The browser test checks the description.

Added an ID to the hint and linked the Location panel to it with aria-describedby. The hint now uses your proposed text. The browser test checks the description.
hloth marked this conversation as resolved
@ -0,0 +37,4 @@
Drag the map to place the pin where you want to share your location.
</p>
<div
class="relative mx-auto mb-[calc(--spacing(10)+var(--bar-content-gap))] aspect-square w-[min(100%,max(12rem,50svh))] overflow-hidden rounded-lg"
First-time contributor

--spacing(10) is worked out by hand from MediaSheetActions' offset, the button height and the panel's pb-20. Name the clearance once and reuse it here and in MediaSheetBody's scroll-pb.

`--spacing(10)` is worked out by hand from MediaSheetActions' offset, the button height and the panel's `pb-20`. Name the clearance once and reuse it here and in MediaSheetBody's `scroll-pb`.
Author
Contributor

Defined --sheet-actions-clearance once in MediaSheet. The Location tab and the sheet scroll padding now use that value.

Defined --sheet-actions-clearance once in MediaSheet. The Location tab and the sheet scroll padding now use that value.
hloth marked this conversation as resolved
@ -0,0 +280,4 @@
}
height = 200;
flushSync(() => resize?.());
await new Promise((resolve) => setTimeout(resolve, 400));
First-time contributor

A real 400 ms sleep per case, and the ResizeObserver stub is now copied three times (lines 212 and 246 here, LocationChooser.svelte.test.ts:202). Share a helper and use fake timers.

A real 400 ms sleep per case, and the ResizeObserver stub is now copied three times (lines 212 and 246 here, LocationChooser.svelte.test.ts:202). Share a helper and use fake timers.
Author
Contributor

Moved the ResizeObserver stub to a shared helper. The resize tests now use fake timers and check that the animation advances before the resize.

Moved the ResizeObserver stub to a shared helper. The resize tests now use fake timers and check that the animation advances before the resize.
hloth marked this conversation as resolved
@ -0,0 +312,4 @@
unmount();
expect(mocks.abortStale).toHaveBeenCalledExactlyOnceWith(1);
finish({ status: "ok", coords: mocks.lastFix });
await Promise.resolve();
First-time contributor

Still passes with the mounted guard removed: in the test build onlocate runs two microtasks after the result, so one await Promise.resolve() checks too early. Wait a macrotask (setTimeout(0)). The test only renders LocateMeButton, so move it to LocateMeButton.svelte.test.ts.

Still passes with the `mounted` guard removed: in the test build `onlocate` runs two microtasks after the result, so one `await Promise.resolve()` checks too early. Wait a macrotask (`setTimeout(0)`). The test only renders LocateMeButton, so move it to LocateMeButton.svelte.test.ts.
Author
Contributor

Moved the test to LocateMeButton.svelte.test.ts. It now waits for a macrotask. I also checked that the test fails when the mounted guard is removed.

Moved the test to LocateMeButton.svelte.test.ts. It now waits for a macrotask. I also checked that the test fails when the mounted guard is removed.
hloth marked this conversation as resolved
@ -0,0 +50,4 @@
async function pointerClick(
target: HTMLElement,
pointerType: "mouse" | "touch",
detail = 1,
First-time contributor

detail is always 1 now; drop the parameter and the , 1 at lines 147 and 167.

`detail` is always 1 now; drop the parameter and the `, 1` at lines 147 and 167.
Author
Contributor

Removed the parameter and both redundant arguments. The helper now always sends detail: 1.

Removed the parameter and both redundant arguments. The helper now always sends detail: 1.
hloth marked this conversation as resolved
Owner

My comment on Claude usage in PR reviews — https://matrix.to/#/!6A0aN28yRLpX1K8aLtfJWm87DXoyyMGjkPeORakOBZg/$9ONFe9id4n5bvR6tSkadFyT3P6acuZjLJLJ04JbJjGU
Please let me know if you have any questions, troubles with this or just want to talk. I'm always open to discussion here as well as in the Dev Matrix chat room. Thank you.

*My comment on Claude usage in PR reviews — https://matrix.to/#/!6A0aN28yRLpX1K8aLtfJWm87DXoyyMGjkPeORakOBZg/$9ONFe9id4n5bvR6tSkadFyT3P6acuZjLJLJ04JbJjGU* Please let me know if you have any questions, troubles with this or just want to talk. I'm always open to discussion here as well as in the Dev Matrix chat room. Thank you.
Enucatl force-pushed feature/location-messages from 9ac29fa941
Some checks failed
ci-orchestrator / provision running on cx23 in fsn1
audit / audit (pull_request) Failing after 16s
credits / credits (pull_request) Successful in 4m20s
check / check (pull_request) Successful in 32m27s
to a129790d43
All checks were successful
credits / credits (pull_request) Successful in 2m36s
ci-orchestrator / provision running on cpx32 in fsn1
check / check (pull_request) Successful in 34m7s
2026-10-27 05:32:40 +01:00
Compare
Author
Contributor

In response to the latest review:

The branch now has one signed commit, a129790d. Its message is one line with no body: Share locations in chat (closes #459).

The OpenStreetMap privacy entry now covers the chat Location tab and opening a shared location on openstreetmap.org.

Validation: 4,173 frontend tests, 804 Rust tests, and 40 layout checks passed. Lint, formatting, configuration, and type checks passed. The first browser run had 18 failures with four workers. All 18 passed when run with one worker. One browser test and three Rust tests were skipped.

In response to [the latest review](https://git.opengrind.org/open-grind/open-grind/pulls/437#issuecomment-4649): The branch now has one signed commit, `a129790d`. Its message is one line with no body: `Share locations in chat (closes #459)`. The OpenStreetMap privacy entry now covers the chat Location tab and opening a shared location on openstreetmap.org. Validation: 4,173 frontend tests, 804 Rust tests, and 40 layout checks passed. Lint, formatting, configuration, and type checks passed. The first browser run had 18 failures with four workers. All 18 passed when run with one worker. One browser test and three Rust tests were skipped.
hloth approved these changes 2026-10-27 13:15:39 +01:00
hloth manually merged commit 703307c2a6 into main 2026-10-27 13:16:51 +01:00
Sign in to join this conversation.
No description provided.