Merge pull request #3626 from pixelfed/staging

Staging
This commit is contained in:
daniel 2022-08-17 23:12:47 -06:00 committed by GitHub
commit 018d4a1149
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View file

@ -62,6 +62,7 @@
- Set Last-Modified header for atom feeds, fixes #2988 ([c18dcde3](https://github.com/pixelfed/pixelfed/commit/c18dcde3)) - Set Last-Modified header for atom feeds, fixes #2988 ([c18dcde3](https://github.com/pixelfed/pixelfed/commit/c18dcde3))
- Add instance post/profile embed config setting ([7734dc03](https://github.com/pixelfed/pixelfed/commit/7734dc03)) - Add instance post/profile embed config setting ([7734dc03](https://github.com/pixelfed/pixelfed/commit/7734dc03))
- Remove remote posts from NetworkTimelineService when processing Tombstones ([2e4f2377](https://github.com/pixelfed/pixelfed/commit/2e4f2377)) - Remove remote posts from NetworkTimelineService when processing Tombstones ([2e4f2377](https://github.com/pixelfed/pixelfed/commit/2e4f2377))
- Limit NotificationService to 400 items ([f6ed560e](https://github.com/pixelfed/pixelfed/commit/f6ed560e))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3) ## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3)

View file

@ -2449,7 +2449,7 @@ class ApiV1Controller extends Controller
'media_ids' => 'sometimes|array|max:' . config_cache('pixelfed.max_album_length'), 'media_ids' => 'sometimes|array|max:' . config_cache('pixelfed.max_album_length'),
'sensitive' => 'nullable', 'sensitive' => 'nullable',
'visibility' => 'string|in:private,unlisted,public', 'visibility' => 'string|in:private,unlisted,public',
'spoiler_text' => 'sometimes|string|max:140', 'spoiler_text' => 'sometimes|max:140',
]); ]);
if(config('costar.enabled') == true) { if(config('costar.enabled') == true) {

View file

@ -194,6 +194,9 @@ class NotificationService {
public static function set($id, $val) public static function set($id, $val)
{ {
if(self::count($id) > 400) {
Redis::zpopmin(self::CACHE_KEY . $id);
}
return Redis::zadd(self::CACHE_KEY . $id, $val, $val); return Redis::zadd(self::CACHE_KEY . $id, $val, $val);
} }
@ -220,7 +223,7 @@ class NotificationService {
public static function getNotification($id) public static function getNotification($id)
{ {
return Cache::remember('service:notification:'.$id, 86400, function() use($id) { $notification = Cache::remember('service:notification:'.$id, 86400, function() use($id) {
$n = Notification::with('item')->find($id); $n = Notification::with('item')->find($id);
if(!$n) { if(!$n) {
@ -238,6 +241,16 @@ class NotificationService {
$resource = new Fractal\Resource\Item($n, new NotificationTransformer()); $resource = new Fractal\Resource\Item($n, new NotificationTransformer());
return $fractal->createData($resource)->toArray(); return $fractal->createData($resource)->toArray();
}); });
if(!$notification) {
return;
}
if(isset($notification['account'])) {
$notification['account'] = AccountService::get($notification['account']['id'], true);
}
return $notification;
} }
public static function setNotification(Notification $notification) public static function setNotification(Notification $notification)