Merge pull request #2775 from pixelfed/staging

Update liked by, fix remote username urls
This commit is contained in:
daniel 2021-05-31 22:46:15 -06:00 committed by GitHub
commit 014d6144f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 5 deletions

View file

@ -101,6 +101,7 @@
- Updated NotificationCard component, fix default value. ([78ad4e77](https://github.com/pixelfed/pixelfed/commit/78ad4e77))
- Updated Timeline component, show counts and make sidebar footer lighter. ([0788bffa](https://github.com/pixelfed/pixelfed/commit/0788bffa))
- Updated AuthServiceProvider, increase default token + refresh token lifetime. ([178ed63d](https://github.com/pixelfed/pixelfed/commit/178ed63d))
- Updated liked by, fix remote username urls. ([f767d99a](https://github.com/pixelfed/pixelfed/commit/f767d99a))
- ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10)

View file

@ -199,8 +199,15 @@ class PublicApiController extends Controller
public function statusLikes(Request $request, $username, $id)
{
abort_if(!$request->user(), 404);
$status = Status::findOrFail($id);
$this->scopeCheck($status->profile, $status);
$page = $request->input('page');
if($page && $page >= 3 && $request->user()->profile_id != $status->profile_id) {
return response()->json([
'data' => []
]);
}
$likes = $this->getLikes($status);
return response()->json([
'data' => $likes
@ -209,9 +216,16 @@ class PublicApiController extends Controller
public function statusShares(Request $request, $username, $id)
{
abort_if(!$request->user(), 404);
$profile = Profile::whereUsername($username)->whereNull('status')->firstOrFail();
$status = Status::whereProfileId($profile->id)->findOrFail($id);
$this->scopeCheck($profile, $status);
$page = $request->input('page');
if($page && $page >= 3 && $request->user()->profile_id != $status->profile_id) {
return response()->json([
'data' => []
]);
}
$shares = $this->getShares($status);
return response()->json([
'data' => $shares

View file

@ -71,13 +71,16 @@ class LikeService {
$id = $like->profile_id;
$profile = ProfileService::get($id);
$profileUrl = $profile['local'] ? $profile['url'] : '/i/web/profile/_/' . $profile['id'];
$res = [
'username' => ProfileService::get($id)['username'],
'others' => $status->likes_count >= 5,
'username' => $profile['username'],
'url' => $profileUrl,
'others' => $status->likes_count >= 3,
];
if(request()->user() && request()->user()->profile_id == $status->profile_id) {
$res['total_count'] = $status->likes_count;
$res['total_count'] = ($status->likes_count - 1);
$res['total_count_pretty'] = number_format($res['total_count']);
}

Binary file not shown.

BIN
public/js/status.js vendored

Binary file not shown.

BIN
public/js/timeline.js vendored

Binary file not shown.

Binary file not shown.

View file

@ -223,7 +223,7 @@
<div class="reaction-counts mb-0">
<div v-if="status.liked_by.username && status.liked_by.username !== user.username" class="likes mb-1">
<span class="like-count">Liked by
<a class="font-weight-bold text-dark" :href="'/'+status.liked_by.username">{{status.liked_by.username}}</a>
<a class="font-weight-bold text-dark" :href="status.liked_by.url">{{status.liked_by.username}}</a>
<span v-if="status.liked_by.others == true">
and <span class="font-weight-bold text-dark cursor-pointer" @click="likesModal"><span v-if="status.liked_by.total_count_pretty">{{status.liked_by.total_count_pretty}}</span> others</span>
</span>

View file

@ -226,7 +226,7 @@
<div v-if="status.liked_by.username && status.liked_by.username !== profile.username" class="likes mb-1">
<span class="like-count">Liked by
<a class="font-weight-bold text-dark" :href="'/'+status.liked_by.username">{{status.liked_by.username}}</a>
<a class="font-weight-bold text-dark" :href="status.liked_by.url">{{status.liked_by.username}}</a>
<span v-if="status.liked_by.others == true">
and <span class="font-weight-bold" v-if="status.liked_by.total_count_pretty">{{status.liked_by.total_count_pretty}}</span> <span class="font-weight-bold">others</span>
</span>