Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
Reopen the new-meeting form when Back pops its address
Guido Boykebbed86d74fbb
diff --git a/app/javascript/lib/lane/history.js b/app/javascript/lib/lane/history.jsindex 703f9b2..d6484bd 100644--- a/app/javascript/lib/lane/history.js+++ b/app/javascript/lib/lane/history.js@@ -16,6 +16,14 @@// the whole page (list, filter bar and lane from the server, replacing the// entry, pushing nothing); a moved lane part alone means the frame, or the// closed lane when there is no selection.+//+// A form state (the form group, new=meeting) is part of the list part, so a+// popped form state over a list the page did not render with it restores the+// page, and the server renders the form. But the page can remember its list+// part WITH a form state the lane no longer shows: a list reload while the+// form was open (a search beside it) records it, and Escape or the cancel link+// close the form without reloading the list. A form state in the popped+// address therefore always restores the page, never the closed lane.import { listPart, lanePart } from "lane/params"// An entry of ANOTHER page (its path is not the one this page shows) is no state of this@@ -29,8 +37,8 @@ export function restoration({ shownPath, shownListQuery, address, groups, turboEif (shownPath && address.pathname !== shownPath) return turboEntry ? { kind: "turbo" } : { kind: "page" }if (listPart(address.search, groups) !== (shownListQuery || "")) return { kind: "page" }const lane = lanePart(address.search, groups)- if (!lane.selection) return { kind: "close" }- return { kind: "frame", selection: lane.selection, preview: lane.preview }+ if (lane.selection) return { kind: "frame", selection: lane.selection, preview: lane.preview }+ return (groups.form || []).some((name) => address.searchParams.has(name)) ? { kind: "page" } : { kind: "close" }}// The frame address of a preview state. The page wrapper carries the previewdiff --git a/spec/javascript/lib/lane/history.test.js b/spec/javascript/lib/lane/history.test.jsindex 035e565..8192e0d 100644--- a/spec/javascript/lib/lane/history.test.js+++ b/spec/javascript/lib/lane/history.test.js@@ -75,3 +75,21 @@ test("this page's own entries restore as before, Turbo's included", () => {assert.equal(restoration({ shownPath: "/org/o1/projects/p1/knowledge", shownListQuery: list, address: own, groups, turboEntry: true }).kind, "frame")assert.equal(restoration({ shownListQuery: list, address: own, groups }).kind, "frame")})++// "+" on "Alle Meetings" (new=meeting), then a search while the form is open: the list reload+// remembers its list part WITH the form state. Escape closes the lane and takes new out of the+// address, and nothing reloads the list. Back then pops new=meeting with that very list part,+// and the restorer took it for the closed lane: the address said "form", the lane stayed shut.+test("a form state over the list the page shows restores the page, so the form opens again", () => {+ const meetings = parseLaneParams(JSON.stringify({ selection: ["meeting_id"], form: ["new"], ignore: ["viewport"] }))+ const overview = (query) => new URL(`http://x.test/org/o1/meetings${query}`)+ const reloadedWithForm = listPart("?search=Alpha&new=meeting", meetings)++ assert.deepEqual(restoration({ shownListQuery: reloadedWithForm, address: overview("?search=Alpha&new=meeting"), groups: meetings }),+ { kind: "page" })+ assert.deepEqual(restoration({ shownListQuery: listPart("?search=Alpha", meetings), address: overview("?search=Alpha&new=meeting"), groups: meetings }),+ { kind: "page" })+ // No form in the address, the same list: the closed lane, as before.+ assert.deepEqual(restoration({ shownListQuery: listPart("?search=Alpha", meetings), address: overview("?search=Alpha"), groups: meetings }),+ { kind: "close" })+})diff --git a/spec/system/meetings_overview_spec.rb b/spec/system/meetings_overview_spec.rbindex 2ea749c..03e96ef 100644--- a/spec/system/meetings_overview_spec.rb+++ b/spec/system/meetings_overview_spec.rb@@ -182,6 +182,34 @@ RSpec.describe 'Meetings overview', type: :system doexpect_titles('Alpha Kickoff')end+ # The list reload of the search remembers its list part with new=meeting in+ # it, and Escape reloads no list. Back pops new=meeting over that very list+ # part, which the restorer took for the closed lane (lib/lane/history).+ it 'opens the form again on Back after a search beside it and Escape' do+ page.driver.browser.manage.window.resize_to(1440, 1000)+ # A search value keeps the field open, as in the keyboard example below.+ visit organisation_meetings_path(organisation, search: 'a', search_mode: 'title_only')+ expect_titles('Alpha Kickoff', 'Beta Retro')++ open_new_meeting+ find('input[name="search"]').fill_in(with: 'Alpha')+ expect_titles('Alpha Kickoff')+ expect(page).to have_current_path(/search=Alpha/, wait: 5)+ expect(page).to have_current_path(/new=meeting/)+ expect(page).to have_css('#meeting_display_frame #meeting-new-project')++ find('#meeting_display_frame h2').click+ page.send_keys(:escape)+ expect(page).to have_no_css('#meeting-new-project', wait: 5)+ expect(page).to have_no_current_path(/new=meeting/, wait: 5)++ page.go_back+ expect(page).to have_current_path(/new=meeting/, wait: 5)+ expect(page).to have_css('#meeting_display_frame #meeting-new-project', wait: 5)+ expect(page).to have_css('.labor-layout-view.show-content')+ expect_titles('Alpha Kickoff')+ end+it 'opens the select on a full visit with ?new=meeting' dopage.driver.browser.manage.window.resize_to(1440, 1000)visit organisation_meetings_path(organisation, new: 'meeting', search: 'Alpha')