1
0
Fork 0

Merge pull request #2535 from pixelfed/staging

Staging
This commit is contained in:
daniel 2020-12-27 18:16:19 -07:00 committed by GitHub
commit 9b141d95e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 13 deletions

View File

@ -148,6 +148,9 @@
- 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))
- 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)
### Added

View File

@ -10,7 +10,7 @@ class Follower extends Model
protected $fillable = ['profile_id', 'following_id', 'local_profile'];
const MAX_FOLLOWING = 7500;
const FOLLOW_PER_HOUR = 30;
const FOLLOW_PER_HOUR = 150;
public function actor()
{

View File

@ -1446,7 +1446,7 @@ class ApiV1Controller extends Controller
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
->with('profile', 'hashtags', 'mentions')
->where('id', $dir, $id)
->whereVisibility('public')
->whereScope('public')
->latest()
->limit($limit)
->get();
@ -1473,7 +1473,7 @@ class ApiV1Controller extends Controller
)->whereNull('uri')
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album'])
->with('profile', 'hashtags', 'mentions')
->whereVisibility('public')
->whereScope('public')
->latest()
->simplePaginate($limit);
}

View File

@ -133,6 +133,7 @@ class BaseApiController extends Controller
$statuses = $account->statuses()->getQuery();
if($only_media == true) {
$statuses = $statuses
->whereIn('scope', ['public','unlisted'])
->whereHas('media')
->whereNull('in_reply_to_id')
->whereNull('reblog_of_id');
@ -153,7 +154,7 @@ class BaseApiController extends Controller
->orderBy('id', 'DESC')
->paginate($limit);
} 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());
$res = $this->fractal->createData($resource)->toArray();

View File

@ -181,14 +181,14 @@ class DiscoverController extends Controller
$ttl = now()->addHours(2);
$res = Cache::remember($key, $ttl, function() use($range) {
if($range == '-1') {
$res = Status::whereVisibility('public')
$res = Status::whereScope('public')
->whereType('photo')
->whereIsNsfw(false)
->orderBy('likes_count','desc')
->take(12)
->get();
} else {
$res = Status::whereVisibility('public')
$res = Status::whereScope('public')
->whereType('photo')
->whereIsNsfw(false)
->orderBy('likes_count','desc')

View File

@ -304,7 +304,7 @@ class PublicApiController extends Controller
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
->whereNotIn('profile_id', $filtered)
->whereLocal(true)
->whereVisibility('public')
->whereScope('public')
->orderBy('created_at', 'desc')
->limit($limit)
->get();
@ -332,7 +332,7 @@ class PublicApiController extends Controller
->whereNotIn('profile_id', $filtered)
->with('profile', 'hashtags', 'mentions')
->whereLocal(true)
->whereVisibility('public')
->whereScope('public')
->orderBy('created_at', 'desc')
->simplePaginate($limit);
}

View File

@ -33,7 +33,7 @@ class StatusController extends Controller
$status = Status::whereProfileId($user->id)
->whereNull('reblog_of_id')
->whereNotIn('visibility',['draft','direct'])
->whereIn('scope', ['public','unlisted'])
->findOrFail($id);
if($status->uri || $status->url) {

View File

@ -17,12 +17,12 @@ class StatusService {
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)
{
$status = Status::findOrFail($id);
$status = Status::whereScope('public')->findOrFail($id);
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer());

View File

@ -27,7 +27,7 @@ class ProfileOutbox extends Fractal\TransformerAbstract
$statuses = $profile
->statuses()
->with('media')
->whereVisibility('public')
->whereScope('public')
->orderBy('created_at', 'desc')
->paginate(10);

View File

@ -26,7 +26,7 @@ class Outbox {
$timeline = $profile
->statuses()
->whereVisibility('public')
->whereScope('public')
->orderBy('created_at', 'desc')
->take(10)
->get();