[3.0] Theme split (wave 4, part 9) — share the board index's board helpers with the message index - #9403
Open
albertlast wants to merge 2 commits into
Conversation
The board index was drawn by a template layer whose two halves each called one function: template_boardindex_outer_above() called template_newsfader(), and template_boardindex_outer_below() called template_info_center(). A layer says that something wraps around the middle of the page, which is not what is happening here. The news fader, the board list and the info centre are three things one after another. Theme::loadSubTemplates() already walks a sub_templates array, so the three can be named directly and the layer and its two forwarding functions go. The board list is renamed from template_main() to template_boardindex() to be nameable. Output is unchanged. Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
BoardIndex.template.php and MessageIndex.template.php both defined template_bi_board_icon(), _redirect_icon(), _board_info(), _board_stats(), _redirect_stats(), _board_lastpost() and _board_children(). Five of the seven were identical; the message index kept the child board rows drawing themselves from a second copy that nobody was keeping in step. The message index now loads BoardIndex as well and uses the one set. That is only possible now the board index no longer has a template_main() of its own, which is why this sits on top of that change rather than beside it. The two that had drifted: - template_bi_board_info() guarded the moderator line on !empty($board['moderators']) || !empty($board['moderator_groups']) here, against !empty($board['link_moderators']) on the board index. Both then count() and list link_moderators, so the board index has the guard that matches what the body reads, and that is the one that survives. - template_bi_board_children() differed only in the docblock of the function after it, which the split picked up. Board index and message index both render byte for byte as before, on a board with a child board. Signed-off-by: Mathias Papenbrock <mathiaspapealbert@hotmail.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
BoardIndex.template.phpandMessageIndex.template.phpeach defined the same seven functions:Five of the seven were byte for byte identical. The message index drew its child board rows from a second copy that nothing was keeping in step with the first.
It now loads
BoardIndexalongside its own template and uses the one set, dropping 136 lines. That is only possible because #9385 tooktemplate_main()out ofBoardIndex.template.php— with it still there,loadTemplate('BoardIndex')from the message index would fatal on the redeclaration. Hence the stacking.The two that had drifted
template_bi_board_info()guarded the moderator line differently:Both bodies then
count()and list$board['link_moderators']. The board index has the guard that matches what the body actually reads, so that is the one that survives. The message index version would have counted and listed an empty array had the two ever disagreed.template_bi_board_children()differed only in the docblock of the next function, which the comparison picked up. No code difference.Checked
Board index and message index both render byte for byte as before — diffed with a child board present, only the clock and the cron timestamp move:
Actions/Unread.phpalso loadsMessageIndex, but its sub-templates live inRecent.template.phpand never call these helpers, so it does not needBoardIndexand does not get it.Part of the #7933 split. Numbering restarts each wave.
Issues References (Fixes|Related|Closes)
Related to #7933