indieweb / chat.indieweb.org

https://chat.indieweb.org
Apache License 2.0
15 stars 7 forks source link

Different styling for Loqi posts in original vs live fetched lines #31

Closed sknebel closed 6 years ago

sknebel commented 7 years ago

Compare: image and image

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.

aaronpk commented 7 years ago

Is this on chat.indieweb.org, or indieweb.org/irc?

sknebel commented 7 years ago

chat.indieweb.org

sknebel commented 7 years ago

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.

aaronpk commented 7 years ago

I just updated config.template.php, it was missing a lot :-/

https://github.com/indieweb/chat.indieweb.org/blob/master/lib/config.template.php

sknebel commented 7 years ago

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

(In the main channel it is #indieweb in both cases, causing wiki edits there (where they never appear) to work correctly)

Suggestions for fixing it

Change it so that Config::wiki_base accepts #devinstead (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.