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

Fixes issues with moving boards #8228

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading