mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 05:23:17 +00:00
commit
9b141d95e4
10 changed files with 17 additions and 13 deletions
|
@ -148,6 +148,9 @@
|
||||||
- Update migrations, fix broken oauth change. ([4a885c88](https://github.com/pixelfed/pixelfed/commit/4a885c88))
|
- Update migrations, fix broken oauth change. ([4a885c88](https://github.com/pixelfed/pixelfed/commit/4a885c88))
|
||||||
- Update LikeController, store status_profile_id and is_comment attributes. ([799a4cba](https://github.com/pixelfed/pixelfed/commit/799a4cba))
|
- Update LikeController, store status_profile_id and is_comment attributes. ([799a4cba](https://github.com/pixelfed/pixelfed/commit/799a4cba))
|
||||||
- Updated Profile, fix status count. ([6dcd472b](https://github.com/pixelfed/pixelfed/commit/6dcd472b))
|
- Updated Profile, fix status count. ([6dcd472b](https://github.com/pixelfed/pixelfed/commit/6dcd472b))
|
||||||
|
- Updated StatusService, cast response to array. ([0fbde91e](https://github.com/pixelfed/pixelfed/commit/0fbde91e))
|
||||||
|
- Updated status model, use scope over deprecated visibility attribute. ([f70826e1](https://github.com/pixelfed/pixelfed/commit/f70826e1))
|
||||||
|
- Updated Follower model, increase hourly limit from 30 to 150. ([b9b84e6f](https://github.com/pixelfed/pixelfed/commit/b9b84e6f))
|
||||||
|
|
||||||
## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
|
## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Follower extends Model
|
||||||
protected $fillable = ['profile_id', 'following_id', 'local_profile'];
|
protected $fillable = ['profile_id', 'following_id', 'local_profile'];
|
||||||
|
|
||||||
const MAX_FOLLOWING = 7500;
|
const MAX_FOLLOWING = 7500;
|
||||||
const FOLLOW_PER_HOUR = 30;
|
const FOLLOW_PER_HOUR = 150;
|
||||||
|
|
||||||
public function actor()
|
public function actor()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1446,7 +1446,7 @@ class ApiV1Controller extends Controller
|
||||||
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
|
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
|
||||||
->with('profile', 'hashtags', 'mentions')
|
->with('profile', 'hashtags', 'mentions')
|
||||||
->where('id', $dir, $id)
|
->where('id', $dir, $id)
|
||||||
->whereVisibility('public')
|
->whereScope('public')
|
||||||
->latest()
|
->latest()
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->get();
|
->get();
|
||||||
|
@ -1473,7 +1473,7 @@ class ApiV1Controller extends Controller
|
||||||
)->whereNull('uri')
|
)->whereNull('uri')
|
||||||
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
|
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
|
||||||
->with('profile', 'hashtags', 'mentions')
|
->with('profile', 'hashtags', 'mentions')
|
||||||
->whereVisibility('public')
|
->whereScope('public')
|
||||||
->latest()
|
->latest()
|
||||||
->simplePaginate($limit);
|
->simplePaginate($limit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,7 @@ class BaseApiController extends Controller
|
||||||
$statuses = $account->statuses()->getQuery();
|
$statuses = $account->statuses()->getQuery();
|
||||||
if($only_media == true) {
|
if($only_media == true) {
|
||||||
$statuses = $statuses
|
$statuses = $statuses
|
||||||
|
->whereIn('scope', ['public','unlisted'])
|
||||||
->whereHas('media')
|
->whereHas('media')
|
||||||
->whereNull('in_reply_to_id')
|
->whereNull('in_reply_to_id')
|
||||||
->whereNull('reblog_of_id');
|
->whereNull('reblog_of_id');
|
||||||
|
@ -153,7 +154,7 @@ class BaseApiController extends Controller
|
||||||
->orderBy('id', 'DESC')
|
->orderBy('id', 'DESC')
|
||||||
->paginate($limit);
|
->paginate($limit);
|
||||||
} else {
|
} else {
|
||||||
$statuses = $statuses->whereVisibility('public')->orderBy('id', 'desc')->paginate($limit);
|
$statuses = $statuses->whereScope('public')->orderBy('id', 'desc')->paginate($limit);
|
||||||
}
|
}
|
||||||
$resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
|
$resource = new Fractal\Resource\Collection($statuses, new StatusTransformer());
|
||||||
$res = $this->fractal->createData($resource)->toArray();
|
$res = $this->fractal->createData($resource)->toArray();
|
||||||
|
|
|
@ -181,14 +181,14 @@ class DiscoverController extends Controller
|
||||||
$ttl = now()->addHours(2);
|
$ttl = now()->addHours(2);
|
||||||
$res = Cache::remember($key, $ttl, function() use($range) {
|
$res = Cache::remember($key, $ttl, function() use($range) {
|
||||||
if($range == '-1') {
|
if($range == '-1') {
|
||||||
$res = Status::whereVisibility('public')
|
$res = Status::whereScope('public')
|
||||||
->whereType('photo')
|
->whereType('photo')
|
||||||
->whereIsNsfw(false)
|
->whereIsNsfw(false)
|
||||||
->orderBy('likes_count','desc')
|
->orderBy('likes_count','desc')
|
||||||
->take(12)
|
->take(12)
|
||||||
->get();
|
->get();
|
||||||
} else {
|
} else {
|
||||||
$res = Status::whereVisibility('public')
|
$res = Status::whereScope('public')
|
||||||
->whereType('photo')
|
->whereType('photo')
|
||||||
->whereIsNsfw(false)
|
->whereIsNsfw(false)
|
||||||
->orderBy('likes_count','desc')
|
->orderBy('likes_count','desc')
|
||||||
|
|
|
@ -304,7 +304,7 @@ class PublicApiController extends Controller
|
||||||
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
||||||
->whereNotIn('profile_id', $filtered)
|
->whereNotIn('profile_id', $filtered)
|
||||||
->whereLocal(true)
|
->whereLocal(true)
|
||||||
->whereVisibility('public')
|
->whereScope('public')
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->limit($limit)
|
->limit($limit)
|
||||||
->get();
|
->get();
|
||||||
|
@ -332,7 +332,7 @@ class PublicApiController extends Controller
|
||||||
->whereNotIn('profile_id', $filtered)
|
->whereNotIn('profile_id', $filtered)
|
||||||
->with('profile', 'hashtags', 'mentions')
|
->with('profile', 'hashtags', 'mentions')
|
||||||
->whereLocal(true)
|
->whereLocal(true)
|
||||||
->whereVisibility('public')
|
->whereScope('public')
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->simplePaginate($limit);
|
->simplePaginate($limit);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class StatusController extends Controller
|
||||||
|
|
||||||
$status = Status::whereProfileId($user->id)
|
$status = Status::whereProfileId($user->id)
|
||||||
->whereNull('reblog_of_id')
|
->whereNull('reblog_of_id')
|
||||||
->whereNotIn('visibility',['draft','direct'])
|
->whereIn('scope', ['public','unlisted'])
|
||||||
->findOrFail($id);
|
->findOrFail($id);
|
||||||
|
|
||||||
if($status->uri || $status->url) {
|
if($status->uri || $status->url) {
|
||||||
|
|
|
@ -17,12 +17,12 @@ class StatusService {
|
||||||
|
|
||||||
public static function get($id)
|
public static function get($id)
|
||||||
{
|
{
|
||||||
return json_decode(Redis::get(self::CACHE_KEY . $id) ?? self::coldGet($id));
|
return json_decode(Redis::get(self::CACHE_KEY . $id) ?? self::coldGet($id), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function coldGet($id)
|
public static function coldGet($id)
|
||||||
{
|
{
|
||||||
$status = Status::findOrFail($id);
|
$status = Status::whereScope('public')->findOrFail($id);
|
||||||
$fractal = new Fractal\Manager();
|
$fractal = new Fractal\Manager();
|
||||||
$fractal->setSerializer(new ArraySerializer());
|
$fractal->setSerializer(new ArraySerializer());
|
||||||
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer());
|
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer());
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ProfileOutbox extends Fractal\TransformerAbstract
|
||||||
$statuses = $profile
|
$statuses = $profile
|
||||||
->statuses()
|
->statuses()
|
||||||
->with('media')
|
->with('media')
|
||||||
->whereVisibility('public')
|
->whereScope('public')
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->paginate(10);
|
->paginate(10);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Outbox {
|
||||||
|
|
||||||
$timeline = $profile
|
$timeline = $profile
|
||||||
->statuses()
|
->statuses()
|
||||||
->whereVisibility('public')
|
->whereScope('public')
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->take(10)
|
->take(10)
|
||||||
->get();
|
->get();
|
||||||
|
|
Loading…
Reference in a new issue