Update AP helpers, import Emoji tags
This commit is contained in:
parent
ca79e26d3a
commit
01798daf56
2 changed files with 17 additions and 3 deletions
|
@ -8,12 +8,12 @@ use App\Models\CustomEmoji;
|
||||||
|
|
||||||
class CustomEmojiService
|
class CustomEmojiService
|
||||||
{
|
{
|
||||||
public static function getByShortcode($shortcode)
|
public static function get($shortcode)
|
||||||
{
|
{
|
||||||
return CustomEmoji::whereShortcode($shortcode)->first();
|
return CustomEmoji::whereShortcode($shortcode)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getByUrl($url)
|
public static function import($url)
|
||||||
{
|
{
|
||||||
if(Helpers::validateUrl($url) == false) {
|
if(Helpers::validateUrl($url) == false) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -27,6 +27,7 @@ use App\Util\ActivityPub\HttpSignature;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use App\Services\ActivityPubFetchService;
|
use App\Services\ActivityPubFetchService;
|
||||||
use App\Services\ActivityPubDeliveryService;
|
use App\Services\ActivityPubDeliveryService;
|
||||||
|
use App\Services\CustomEmojiService;
|
||||||
use App\Services\InstanceService;
|
use App\Services\InstanceService;
|
||||||
use App\Services\MediaPathService;
|
use App\Services\MediaPathService;
|
||||||
use App\Services\MediaStorageService;
|
use App\Services\MediaStorageService;
|
||||||
|
@ -368,7 +369,6 @@ class Helpers {
|
||||||
$cw = true;
|
$cw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$statusLockKey = 'helpers:status-lock:' . hash('sha256', $res['id']);
|
$statusLockKey = 'helpers:status-lock:' . hash('sha256', $res['id']);
|
||||||
$status = Cache::lock($statusLockKey)
|
$status = Cache::lock($statusLockKey)
|
||||||
->get(function () use(
|
->get(function () use(
|
||||||
|
@ -381,6 +381,20 @@ class Helpers {
|
||||||
$scope,
|
$scope,
|
||||||
$id
|
$id
|
||||||
) {
|
) {
|
||||||
|
if(isset($res['tag']) && is_array($res['tag']) && !empty($res['tag'])) {
|
||||||
|
collect($res['tag'])
|
||||||
|
->filter(function($tag) {
|
||||||
|
// todo: finish hashtag + mention import
|
||||||
|
// return in_array($tag['type'], ['Emoji', 'Hashtag', 'Mention']);
|
||||||
|
return in_array($tag['type'], ['Emoji']);
|
||||||
|
})
|
||||||
|
->each(function($tag) {
|
||||||
|
if(isset($tag['id'])) {
|
||||||
|
CustomEmojiService::import($tag['id']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if($res['type'] === 'Question') {
|
if($res['type'] === 'Question') {
|
||||||
$status = self::storePoll(
|
$status = self::storePoll(
|
||||||
$profile,
|
$profile,
|
||||||
|
|
Loading…
Reference in a new issue