Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sknebel opened this issue Mar 24, 2017 · 5 comments
Closed

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

sknebel opened this issue Mar 24, 2017 · 5 comments

Comments

@sknebel
Copy link
Member

sknebel commented Mar 24, 2017

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
Copy link
Member

aaronpk commented Mar 24, 2017

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

@sknebel
Copy link
Member Author

sknebel commented Mar 24, 2017

chat.indieweb.org

@sknebel
Copy link
Member Author

sknebel commented Mar 27, 2017

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
Copy link
Member

aaronpk commented Mar 27, 2017

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
Copy link
Member Author

sknebel commented Mar 27, 2017

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 permalink.php and day.php it is derived from the slug via $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.

  • in log.php it is taken from the channel name from the external input, resulting in #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)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants