Merge pull request #3302 from pixelfed/staging

Update ReblogService
This commit is contained in:
daniel 2022-03-10 23:59:02 -07:00 committed by GitHub
commit 4d99ffcff3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,8 +9,8 @@ use App\Status;
class ReblogService class ReblogService
{ {
const CACHE_KEY = 'pf:services:reblogs:'; const CACHE_KEY = 'pf:services:reblogs:';
const REBLOGS_KEY = 'pf:services:reblogs:post:'; const REBLOGS_KEY = 'pf:services:reblogs:v1:post:';
const COLDBOOT_KEY = 'pf:services:reblogs:post_:'; const COLDBOOT_KEY = 'pf:services:reblogs:v1:post_:';
public static function get($profileId, $statusId) public static function get($profileId, $statusId)
{ {
@ -50,11 +50,19 @@ class ReblogService
public static function addPostReblog($parentId, $reblogId) public static function addPostReblog($parentId, $reblogId)
{ {
return Redis::zadd(self::REBLOGS_KEY . $parentId, $reblogId); $pid = intval($parentId);
$id = intval($reblogId);
if($pid && $id) {
return Redis::zadd(self::REBLOGS_KEY . $pid, $id);
}
} }
public static function removePostReblog($parentId, $reblogId) public static function removePostReblog($parentId, $reblogId)
{ {
return Redis::zrem(self::REBLOGS_KEY . $parentId, $reblogId); $pid = intval($parentId);
$id = intval($reblogId);
if($pid && $id) {
return Redis::zrem(self::REBLOGS_KEY . $pid, $id);
}
} }
} }