Skip to content

Keep a description that says %%LK0%% from stopping its calendar event from opening - #2083

Closed
svaka2000 wants to merge 2 commits into
Open-Coding-Society:mainfrom
svaka2000:fix/calendar-slack-placeholders
Closed

svaka2000 wants to merge 2 commits into
Open-Coding-Society:mainfrom
svaka2000:fix/calendar-slack-placeholders

Conversation

@svaka2000

Copy link
Copy Markdown
Contributor

This branch starts from #2079's branch, which makes slackToHtml's link regex fast. This PR changes the same function and its test file, so please merge #2079 first. Until then this PR also shows #2079's commit.

Main: clicking Room change, whose description is Room %%LK0%% today, threw Cannot read properties of undefined (reading 'url'), and no window opened.

The calendar on main after clicking the Room change event: no window opened

This branch: the window opens and the description shows as typed.

The Room change event's window on this branch, with the description Room %%LK0%% today

slackToHtml on the calendar page (_projects/systems/calendar/index.md) turns an event description's Slack-style text into HTML when you open the event. While it formats the text, it swaps code and links out for numbered placeholders (%%CB0%% for a code block, %%IC0%% for inline code, %%LK0%% for a link) and saves them in lists, then puts each one back at the end. A description can have that text in it too, and any signed-in account can write one.

  • If a description said %%LK0%% and had no link, putting the links back looked up link 0, found nothing saved and threw an error, so the event's window never opened. Edit and Delete are only in that window, so nobody could open, edit or delete that event on the calendar page.
  • %%CB0%% or %%IC0%% with no code saved turned into an empty code block or inline code, and that could hide real links. Inside the function, <https://a.b|x>IC1<https://c.d|y> became %%LK0%%IC1%%LK1%%. The %%IC1%% in the middle turned into empty inline code and used up the %% both link placeholders needed, leaving %%LK0<code></code>LK1%%, so neither link showed.
  • Now a placeholder whose number has nothing saved stays as typed.

Other notes:

  • A description like Room %%LK0%% <https://a.b|map> still shows the map link twice, the same as on main: the typed %%LK0%% matches the map link's placeholder, so the map link goes in both spots. Fixing that needs a way to mark code and links that a description can't contain, which is a bigger change for a link that shows up twice.
  • The screenshots are the live calendar page in Chrome, with the Spring backend's replies faked in Playwright.
  • I compared Keep the ticker and the calendar page fast on titles and descriptions full of "<" #2079's version and this one on 200,000 random descriptions built from words, line breaks, links, code, formatting marks, %, LK0, IC1 and typed placeholders. This one never threw (Keep the ticker and the calendar page fast on titles and descriptions full of "<" #2079's threw on 67,503), and every description whose output changed had CB, IC or LK followed by a number in it.
  • The new test in _projects/systems/calendar/tests/slack_text.test.mjs (tests/calendar_slack_text.test.mjs runs it) failed with that error before the change.

How to try it:

  1. Check out fix/calendar-slack-placeholders from svaka2000/Pages-JJ.
  2. Run node --test tests/calendar_slack_text.test.mjs.

@svaka2000

Copy link
Copy Markdown
Contributor Author

Combined into #2089 with the same commits.

@svaka2000 svaka2000 closed this Nov 26, 2026
jm1021 pushed a commit that referenced this pull request Nov 26, 2026
…vent from opening

Branch fix/calendar-slack-placeholders, head 0fa22e1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant