Unverified Commit 014d6144 authored by daniel's avatar daniel Committed by GitHub
Browse files

Merge pull request #2775 from pixelfed/staging

Update liked by, fix remote username urls
parents d230ab9a cbdfb694
......@@ -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)
......
......@@ -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
......
......@@ -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']);
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,15 +21,15 @@
"/js/hashtag.js": "/js/hashtag.js?id=8137c9aeac44cd972dbc",
"/js/loops.js": "/js/loops.js?id=ae34b77c4cfe1824f5a0",
"/js/mode-dot.js": "/js/mode-dot.js?id=dd9c87024fbaa8e75ac4",
"/js/network-timeline.js": "/js/network-timeline.js?id=faf536c65452ec723a66",
"/js/network-timeline.js": "/js/network-timeline.js?id=e9686a2e7cce78524745",
"/js/profile.js": "/js/profile.js?id=96e4d9f069b3d9785906",
"/js/profile-directory.js": "/js/profile-directory.js?id=e63d5f2c6f2d5710a8bd",
"/js/quill.js": "/js/quill.js?id=4769f11fc9a6c32dde50",
"/js/rempos.js": "/js/rempos.js?id=0bbc655fe5c21a01626e",
"/js/rempro.js": "/js/rempro.js?id=d0a0a0cdc8f94bb13171",
"/js/search.js": "/js/search.js?id=33a848ea20efb0c4f71f",
"/js/status.js": "/js/status.js?id=b1fd979f3542ce947370",
"/js/status.js": "/js/status.js?id=ce91385c7214bfa91c29",
"/js/story-compose.js": "/js/story-compose.js?id=a450061c248b4ddb2d63",
"/js/theme-monokai.js": "/js/theme-monokai.js?id=85f0af57479412548223",
"/js/timeline.js": "/js/timeline.js?id=6b21ea5b547844632a83"
"/js/timeline.js": "/js/timeline.js?id=05a110d88209ddb65d1e"
}
......@@ -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>
......
......@@ -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>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment