Closed sknebel closed 6 years ago
Is this on chat.indieweb.org, or indieweb.org/irc?
chat.indieweb.org
Some more poking results in the following observations:
Permalinks and day-pages show the same issue.
format_line is called in all paths (searching for it shows the expected 4 hits)
copy-pasting a wiki-edit log line into my IRC client (as done here) provides a correctly formatted wiki edit, which again goes away if loaded from the database. (it also doesn't show that I did that, apparently wiki edit formatting doen'ts care if they come from Loqi or a random user. Worthy an issue or not?)
This means that a whatever comes out of the database, processed by inc.php/filtertext() and my browser is correctly formatted to be accepted as a wiki line.
I see two theories right now I can't really verify without more data:
a) Whatever is returned by db_row_to_new_log is not an acceptable wiki line (does not match the regex), but roundtripping it through filtertext somehow corrects this. Not debuggable from the outside.
b) format_wiki_line begins with a check of if(!Config::wiki_base($channel))
, which would prevent wiki formatting after regex matched. Config::wiki_base
is not shown in config.template.php, so I don't know what it does, and without knowing how the data submitted to log.php looks like it is possible that the value of $channel
in log.php is different from the value in day.php or permalink.php (where it seems to be #indieweb-dev
). Checking Config::wiki_base
is probably the fastest way to identify this.
I just updated config.template.php
, it was missing a lot :-/
https://github.com/indieweb/chat.indieweb.org/blob/master/lib/config.template.php
The issue is related to the naming for the channels, but differently than I thought.
The issue is that you pass two different values for $channel
to format_line
$channel = '#'.$_GET['channel'];
, resulting in #dev
for the dev channel. This is correct for format_line (which uses it e.g. to generate links via Config::base_url_for_channel
), but Config::wiki_base
does not know this name and causes the wiki formatter to abort.#indieweb-dev
for the dev channel. This causes wrong permalinks for live-loaded lines to be generated (again via Config::base_url_for_channel
), but gets accepted in Config::wiki_base
, making the wiki formatting work(In the main channel it is #indieweb
in both cases, causing wiki edits there (where they never appear) to work correctly)
Change it so that Config::wiki_base
accepts #dev
instead (fixing functionality on permalinks.php/day.php).
Then have log.php pass #dev
instead to format_line, fixing the permalinks generated there and matching the changed wiki_base
. How to make this transformation from #indieweb-dev
to #dev
I'll leave to you, since it introduces a new mapping somewhere.
In general, cleaning up channel names and the logic around them would help improve the code. E.g. code dealing with the #indiewebcamp->#indieweb transition exists in more than one place, channel names and slugs are transformed into each other locally (e.g. by prepending #
). Permalink.php has 3 different labels for aspects of a channel, maybe try to use these 3 labels everywhere and map between them centrally.
Compare: and
The second line was dynamically loaded after I opened the page, and has nicer formatting for the wiki edit. If I reload the page, it looses this. Presumably, it should look the same in both cases.