Skip to main content
Topic: Nested quotes depth restriction. (Read 1609 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Nested quotes depth restriction.

This should (I hope) not be all that difficult to code.
By default you can have no nested quotes (ie: top level quotes only) or you can have unrestricted nested quotes (ie: ZOMFG why do muppets just keep hitting the quote button? :P )

The best solution, IMO, would be to have the option of two or thee levels of quotes. That allows for better discussions sometimes, while still keeping muppets under control. This is easy to do in CSS:
Code: [Select]
  .bbc_standard_quote .bbc_standard_quote>.quoteheader,
  .bbc_standard_quote .bbc_standard_quote>.bbc_alternate_quote {
    display: none;
  }
Only catch is that doesn't deal with the database, so all the crud you don't want still comes up in the editor. But if it's this easy to do with CSS, then logically it would be possible with PHP in Sources too, which would solve all the problems nicely. The back end code can already strip out all quotes below the first level, so presumably that can be altered to strip out only levels 3+ or 4+ or whatever.

So, since this is a really clever idea, how do you code it? :D
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Nested quotes depth restriction.

Reply #1

Have had a chat with Arantor about this, and he says it's gnarly.
However, I have found out that it's handled in phpBB by s9e\TextFormatter: specifically the nestingLimit function.
Running a search for that function on the Gihub repo gives these hits:
https://github.com/s9e/TextFormatter/search?q=nestingLimit&unscoped_q=nestingLimit

So when my brain is feeling up to it I'll do some more digging there, and see what I can come up with. :)
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Nested quotes depth restriction.

Reply #2

Doing it (properly) server side, I think, means having to do all the stuff the browser does to render the effect and the strip what is not necessary.
The second most appropriate way could be to loop over the bbcode, identify when inside a quote, keep track of how deep you are in the quoting (1st level/single quote, 2nd level nested quote, etc.) and strip anything above the desired level.
Another option that comes to my mind is, since we ship a markdown interpreter you can bbc -> html -> md -> strip nested quotes [1] -> html -> bbc
likely identified by multiple > at the beginning of the line
Bugs creator.
Features destroyer.
Template killer.