mirror of
https://github.com/friendica/friendica
synced 2024-12-22 18:40:17 +00:00
Blocked users need to be blocked
This commit is contained in:
parent
eb2a8e47b0
commit
b61cfd193f
5 changed files with 21 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 2024.06-dev (Yellow Archangel)
|
-- Friendica 2024.06-dev (Yellow Archangel)
|
||||||
-- DB_UPDATE_VERSION 1563
|
-- DB_UPDATE_VERSION 1564
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -626,11 +626,8 @@ class Contact
|
||||||
*/
|
*/
|
||||||
public static function getPublicIdByUserId(int $uid)
|
public static function getPublicIdByUserId(int $uid)
|
||||||
{
|
{
|
||||||
$self = DBA::selectFirst('contact', ['url'], ['self' => true, 'uid' => $uid]);
|
$self = self::selectFirstAccountUser(['pid'], ['self' => true, 'uid' => $uid]);
|
||||||
if (!DBA::isResult($self)) {
|
return $self['pid'] ?? false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return self::getIdForURL($self['url']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1492,6 +1492,12 @@ class User
|
||||||
*/
|
*/
|
||||||
public static function block(int $uid, bool $block = true): bool
|
public static function block(int $uid, bool $block = true): bool
|
||||||
{
|
{
|
||||||
|
$self = Contact::getPublicIdByUserId($uid);
|
||||||
|
if ($block) {
|
||||||
|
Contact::block($self['id']);
|
||||||
|
} else {
|
||||||
|
Contact::unblock($self['id']);
|
||||||
|
}
|
||||||
return DBA::update('user', ['blocked' => $block], ['uid' => $uid]);
|
return DBA::update('user', ['blocked' => $block], ['uid' => $uid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ use Friendica\Database\DBA;
|
||||||
|
|
||||||
// This file is required several times during the test in DbaDefinition which justifies this condition
|
// This file is required several times during the test in DbaDefinition which justifies this condition
|
||||||
if (!defined('DB_UPDATE_VERSION')) {
|
if (!defined('DB_UPDATE_VERSION')) {
|
||||||
define('DB_UPDATE_VERSION', 1563);
|
define('DB_UPDATE_VERSION', 1564);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
11
update.php
11
update.php
|
@ -1466,4 +1466,15 @@ function update_1560()
|
||||||
SELECT `id`, `uri-id`, `uid`, `parent-uri-id`, `thr-parent-id`, `created`, `received`, `gravity`, `vid`, `private`, `wall` FROM `post-user` WHERE `post-user`.`origin` AND `post-user`.`uid` != ?", 0)) {
|
SELECT `id`, `uri-id`, `uid`, `parent-uri-id`, `thr-parent-id`, `created`, `received`, `gravity`, `vid`, `private`, `wall` FROM `post-user` WHERE `post-user`.`origin` AND `post-user`.`uid` != ?", 0)) {
|
||||||
return Update::FAILED;
|
return Update::FAILED;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_1564()
|
||||||
|
{
|
||||||
|
$users = DBA::select('user', ['uid'], ['blocked' => true]);
|
||||||
|
while ($user = DBA::fetch($users)) {
|
||||||
|
User::block($user['uid']);
|
||||||
|
}
|
||||||
|
DBA::close($users);
|
||||||
|
|
||||||
|
return Update::SUCCESS;
|
||||||
}
|
}
|
Loading…
Reference in a new issue