Skip to content

Commit

Permalink
GH-224 Move ignore entry creator to an util
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Jun 14, 2022
1 parent 1f4ace5 commit 3373363
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/settings/_includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
include($includePath . './utils/helpers/tryIgnoreUser.helper.php');

include($includePath . './utils/queries/createEmailChangeProcessEntry.query.php');
include($includePath . './utils/queries/createUserIgnoreEntry.query.php');
include($includePath . './utils/queries/getMovingFleetsCount.query.php');
include($includePath . './utils/queries/getUserWithEmailAddress.query.php');

Expand Down
25 changes: 25 additions & 0 deletions modules/settings/utils/queries/createUserIgnoreEntry.query.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace UniEngine\Engine\Modules\Settings\Utils\Queries;

/**
* @param array $params
* @param string $params['entryOwnerId']
* @param string $params['ignoredUserId']
*/
function createUserIgnoreEntry($params) {
$entryOwnerId = $params['entryOwnerId'];
$ignoredUserId = $params['ignoredUserId'];

$query = (
"INSERT INTO {{table}} " .
"(`OwnerID`, `IgnoredID`)" .
"VALUES " .
"({$entryOwnerId}, {$ignoredUserId})" .
"; -- UniEngine\Engine\Modules\Settings\Utils\Queries\createUserIgnoreEntry"
);

doquery($query, 'ignoresystem');
}

?>
6 changes: 5 additions & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,11 @@
$ignoreUser = $tryIgnoreUserResult['payload']['ignoreUser'];

$_User['IgnoredUsers'][$ignoreUser['id']] = $ignoreUser['username'];
doquery("INSERT INTO {{table}} (`OwnerID`, `IgnoredID`) VALUES ({$_User['id']}, {$ignoreUser['id']}); -- settings.php|IgnoreSystem|Insert", 'ignoresystem');

Settings\Utils\Queries\createUserIgnoreEntry([
'entryOwnerId' => $_User['id'],
'ignoredUserId' => $ignoreUser['id'],
]);

$InfoMsgs[] = $_Lang['Ignore_UserAdded'];
}
Expand Down

0 comments on commit 3373363

Please sign in to comment.