Skip to content

Commit

Permalink
Merge pull request SimpleMachines#8228 from Sesquipedalian/3.0/board_…
Browse files Browse the repository at this point in the history
…order

Fixes issues with moving boards
  • Loading branch information
Sesquipedalian committed May 17, 2024
2 parents 4b43091 + 75842f0 commit 5fb34f5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Languages/en_US/ManageBoards.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
$txt['mboards_current_redirects'] = 'Currently: {0, number, integer}';

$txt['mboards_order_first'] = 'In first place';
$txt['mboards_order_before'] = 'Before "{0}"';
$txt['mboards_order_after'] = 'After "{0}"';
$txt['mboards_order_child_of'] = 'Sub-board of "{0}"';
$txt['mboards_order_before'] = 'Before';
$txt['mboards_order_after'] = 'After';
$txt['mboards_order_child_of'] = 'Sub-board of';
$txt['mboards_order_in_category'] = 'In category';
$txt['mboards_current_position'] = 'Current Position';
$txt['no_valid_parent'] = 'Board {name} does not have a valid parent. Use the "find and repair errors" function to fix this.';
Expand Down
8 changes: 4 additions & 4 deletions Sources/Board.php
Original file line number Diff line number Diff line change
Expand Up @@ -1600,16 +1600,16 @@ public static function modify(int $board_id, array &$boardOptions): void
$board->member_groups = $boardOptions['access_groups'] ?? $board->member_groups;
$board->deny_groups = $boardOptions['deny_groups'] ?? $board->deny_groups;

// We're ready to save the changes now.
$board->save($boardOptions);

// If we moved any boards, save their changes too.
// If we moved any boards, save their changes first.
if (!empty($moved_boards)) {
foreach (array_diff($moved_boards, [$board->id]) as $moved) {
self::$loaded[$moved]->save();
}
}

// We're ready to save the changes now.
$board->save($boardOptions);

// Log the changes unless told otherwise.
if (empty($boardOptions['dont_log'])) {
Logging::logAction('edit_board', ['board' => $board->id], 'admin');
Expand Down
3 changes: 3 additions & 0 deletions Sources/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,8 @@ public static function getTreeOrder(): array
*/
public static function getTree(): void
{
self::$loaded = [];

$selects = [
'COALESCE(b.id_board, 0) AS id_board', 'b.name', 'b.description',
'b.id_parent', 'b.child_level', 'b.board_order', 'b.redirect',
Expand Down Expand Up @@ -708,6 +710,7 @@ public static function getTree(): void
$row['deny_member_groups'] = explode(',', $row['deny_member_groups']);
$row['prev_board'] = $prevBoard;

unset(Board::$loaded[(int) $row['id_board']]);
Board::init((int) $row['id_board'], $row);

$prevBoard = $row['id_board'];
Expand Down

0 comments on commit 5fb34f5

Please sign in to comment.