kopia lustrzana https://github.com/pixelfed/pixelfed
commit
a3fb4d24c3
|
@ -2,6 +2,7 @@ root = true
|
|||
|
||||
[*]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
|
|
|
@ -104,6 +104,11 @@
|
|||
- Update notifications component, improve UX with exponential retry and loading state ([937e6d07](https://github.com/pixelfed/pixelfed/commit/937e6d07))
|
||||
- Update likeModal and shareModal components, use new pagination logic and re-add Follow/Unfollow buttons ([b565ead6](https://github.com/pixelfed/pixelfed/commit/b565ead6))
|
||||
- Update profileFeed component, fix pagination ([7cf41628](https://github.com/pixelfed/pixelfed/commit/7cf41628))
|
||||
- Update ApiV1Controller, add BookmarkService logic to bookmark endpoints ([29b1af10](https://github.com/pixelfed/pixelfed/commit/29b1af10))
|
||||
- Update ApiV1Controller, filter conversations without last_status ([e8a6a8c7](https://github.com/pixelfed/pixelfed/commit/e8a6a8c7))
|
||||
- Update ApiV1Controller and BookmarkController, fix api differences and allow unbookmarking regardless of relationship ([e343061a](https://github.com/pixelfed/pixelfed/commit/e343061a))
|
||||
- Update ApiV1Controller, add pixelfed entity support to bookmarks endpoint ([94069db9](https://github.com/pixelfed/pixelfed/commit/94069db9))
|
||||
- Update PostReactions, reduce bookmark timeout to 2s from 5s ([a8094e6c](https://github.com/pixelfed/pixelfed/commit/a8094e6c))
|
||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||
|
||||
## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4)
|
||||
|
|
|
@ -2335,7 +2335,7 @@ class ApiV1Controller extends Controller
|
|||
return $res;
|
||||
})
|
||||
->filter(function($dm) {
|
||||
return isset($dm['accounts']) && count($dm['accounts']);
|
||||
return isset($dm['accounts']) && count($dm['accounts']) && !empty($dm['last_status']);
|
||||
})
|
||||
->unique(function($item, $key) {
|
||||
return $item['accounts'][0]['id'];
|
||||
|
@ -2376,6 +2376,7 @@ class ApiV1Controller extends Controller
|
|||
|
||||
$res['favourited'] = LikeService::liked($user->profile_id, $res['id']);
|
||||
$res['reblogged'] = ReblogService::get($user->profile_id, $res['id']);
|
||||
$res['bookmarked'] = BookmarkService::get($user->profile_id, $res['id']);
|
||||
|
||||
return $this->json($res);
|
||||
}
|
||||
|
@ -3004,6 +3005,7 @@ class ApiV1Controller extends Controller
|
|||
'min_id' => 'nullable|integer|min:0'
|
||||
]);
|
||||
|
||||
$pe = $request->has('_pe');
|
||||
$pid = $request->user()->profile_id;
|
||||
$limit = $request->input('limit') ?? 20;
|
||||
$max_id = $request->input('max_id');
|
||||
|
@ -3017,8 +3019,15 @@ class ApiV1Controller extends Controller
|
|||
->orderByDesc('id')
|
||||
->cursorPaginate($limit);
|
||||
|
||||
$bookmarks = $bookmarkQuery->map(function($bookmark) {
|
||||
return \App\Services\StatusService::getMastodon($bookmark->status_id);
|
||||
$bookmarks = $bookmarkQuery->map(function($bookmark) use($pid, $pe) {
|
||||
$status = $pe ? StatusService::get($bookmark->status_id, false) : StatusService::getMastodon($bookmark->status_id, false);
|
||||
|
||||
if($status) {
|
||||
$status['bookmarked'] = true;
|
||||
$status['favourited'] = LikeService::liked($pid, $status['id']);
|
||||
$status['reblogged'] = ReblogService::get($pid, $status['id']);
|
||||
}
|
||||
return $status;
|
||||
})
|
||||
->filter()
|
||||
->values()
|
||||
|
@ -3056,15 +3065,30 @@ class ApiV1Controller extends Controller
|
|||
{
|
||||
abort_if(!$request->user(), 403);
|
||||
|
||||
$status = Status::whereNull('uri')
|
||||
->whereScope('public')
|
||||
->findOrFail($id);
|
||||
$status = Status::findOrFail($id);
|
||||
$pid = $request->user()->profile_id;
|
||||
|
||||
abort_if($status->in_reply_to_id || $status->reblog_of_id, 404);
|
||||
abort_if(!in_array($status->scope, ['public', 'unlisted', 'private']), 404);
|
||||
abort_if(!in_array($status->type, ['photo','photo:album', 'video', 'video:album', 'photo:video:album']), 404);
|
||||
|
||||
if($status->scope == 'private') {
|
||||
abort_if(
|
||||
$pid !== $status->profile_id && !FollowerService::follows($pid, $status->profile_id),
|
||||
404,
|
||||
'Error: You cannot bookmark private posts from accounts you do not follow.'
|
||||
);
|
||||
}
|
||||
|
||||
Bookmark::firstOrCreate([
|
||||
'status_id' => $status->id,
|
||||
'profile_id' => $request->user()->profile_id
|
||||
'profile_id' => $pid
|
||||
]);
|
||||
$res = StatusService::getMastodon($status->id);
|
||||
|
||||
BookmarkService::add($pid, $status->id);
|
||||
|
||||
$res = StatusService::getMastodon($status->id, false);
|
||||
$res['bookmarked'] = true;
|
||||
|
||||
return $this->json($res);
|
||||
}
|
||||
|
@ -3080,15 +3104,23 @@ class ApiV1Controller extends Controller
|
|||
{
|
||||
abort_if(!$request->user(), 403);
|
||||
|
||||
$status = Status::whereNull('uri')
|
||||
->whereScope('public')
|
||||
->findOrFail($id);
|
||||
$status = Status::findOrFail($id);
|
||||
$pid = $request->user()->profile_id;
|
||||
|
||||
abort_if($status->in_reply_to_id || $status->reblog_of_id, 404);
|
||||
abort_if(!in_array($status->scope, ['public', 'unlisted', 'private']), 404);
|
||||
abort_if(!in_array($status->type, ['photo','photo:album', 'video', 'video:album', 'photo:video:album']), 404);
|
||||
|
||||
$bookmark = Bookmark::whereStatusId($status->id)
|
||||
->whereProfileId($request->user()->profile_id)
|
||||
->firstOrFail();
|
||||
$bookmark->delete();
|
||||
$res = StatusService::getMastodon($status->id);
|
||||
->whereProfileId($pid)
|
||||
->first();
|
||||
|
||||
if($bookmark) {
|
||||
BookmarkService::del($pid, $status->id);
|
||||
$bookmark->delete();
|
||||
}
|
||||
$res = StatusService::getMastodon($status->id, false);
|
||||
$res['bookmarked'] = false;
|
||||
|
||||
return $this->json($res);
|
||||
}
|
||||
|
|
|
@ -11,47 +11,57 @@ use App\Services\FollowerService;
|
|||
|
||||
class BookmarkController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'item' => 'required|integer|min:1',
|
||||
]);
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'item' => 'required|integer|min:1',
|
||||
]);
|
||||
|
||||
$profile = Auth::user()->profile;
|
||||
$status = Status::findOrFail($request->input('item'));
|
||||
$profile = Auth::user()->profile;
|
||||
$status = Status::findOrFail($request->input('item'));
|
||||
|
||||
abort_if(!in_array($status->scope, ['public', 'unlisted', 'private']), 404);
|
||||
abort_if($status->in_reply_to_id || $status->reblog_of_id, 404);
|
||||
abort_if(!in_array($status->scope, ['public', 'unlisted', 'private']), 404);
|
||||
abort_if(!in_array($status->type, ['photo','photo:album', 'video', 'video:album', 'photo:video:album']), 404);
|
||||
|
||||
if($status->scope == 'private') {
|
||||
abort_if(
|
||||
$profile->id !== $status->profile_id && !FollowerService::follows($profile->id, $status->profile_id),
|
||||
404,
|
||||
'Error: You cannot bookmark private posts from accounts you do not follow.'
|
||||
);
|
||||
}
|
||||
if($status->scope == 'private') {
|
||||
if($profile->id !== $status->profile_id && !FollowerService::follows($profile->id, $status->profile_id)) {
|
||||
if($exists = Bookmark::whereStatusId($status->id)->whereProfileId($profile->id)->first()) {
|
||||
BookmarkService::del($profile->id, $status->id);
|
||||
$exists->delete();
|
||||
|
||||
$bookmark = Bookmark::firstOrCreate(
|
||||
['status_id' => $status->id], ['profile_id' => $profile->id]
|
||||
);
|
||||
if ($request->ajax()) {
|
||||
return ['code' => 200, 'msg' => 'Bookmark removed!'];
|
||||
} else {
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
abort(404, 'Error: You cannot bookmark private posts from accounts you do not follow.');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$bookmark->wasRecentlyCreated) {
|
||||
BookmarkService::del($profile->id, $status->id);
|
||||
$bookmark->delete();
|
||||
} else {
|
||||
BookmarkService::add($profile->id, $status->id);
|
||||
}
|
||||
$bookmark = Bookmark::firstOrCreate(
|
||||
['status_id' => $status->id], ['profile_id' => $profile->id]
|
||||
);
|
||||
|
||||
if ($request->ajax()) {
|
||||
$response = ['code' => 200, 'msg' => 'Bookmark saved!'];
|
||||
} else {
|
||||
$response = redirect()->back();
|
||||
}
|
||||
if (!$bookmark->wasRecentlyCreated) {
|
||||
BookmarkService::del($profile->id, $status->id);
|
||||
$bookmark->delete();
|
||||
} else {
|
||||
BookmarkService::add($profile->id, $status->id);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
if ($request->ajax()) {
|
||||
$response = ['code' => 200, 'msg' => 'Bookmark saved!'];
|
||||
} else {
|
||||
$response = redirect()->back();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
(()=>{"use strict";var e,r,t,n={},c={};function o(e){var r=c[e];if(void 0!==r)return r.exports;var t=c[e]={id:e,loaded:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.loaded=!0,t.exports}o.m=n,e=[],o.O=(r,t,n,c)=>{if(!t){var a=1/0;for(f=0;f<e.length;f++){for(var[t,n,c]=e[f],d=!0,i=0;i<t.length;i++)(!1&c||a>=c)&&Object.keys(o.O).every((e=>o.O[e](t[i])))?t.splice(i--,1):(d=!1,c<a&&(a=c));if(d){e.splice(f--,1);var s=n();void 0!==s&&(r=s)}}return r}c=c||0;for(var f=e.length;f>0&&e[f-1][2]>c;f--)e[f]=e[f-1];e[f]=[t,n,c]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((r,t)=>(o.f[t](e,r),r)),[])),o.u=e=>"js/"+{1084:"profile~followers.bundle",1983:"kb.bundle",2470:"home.chunk",2521:"about.bundle",2530:"discover~myhashtags.chunk",2586:"compose.chunk",2732:"dms~message.chunk",3351:"discover~settings.chunk",3365:"dms.chunk",3623:"discover~findfriends.chunk",4028:"error404.bundle",4509:"static~privacy.bundle",4958:"discover.chunk",4965:"discover~memories.chunk",5865:"post.chunk",6053:"notifications.chunk",6869:"profile.chunk",7004:"help.bundle",7019:"discover~hashtag.bundle",8021:"contact.bundle",8250:"i18n.bundle",8517:"daci.chunk",8600:"changelog.bundle",8625:"profile~following.bundle",8900:"discover~serverfeed.chunk",9144:"static~tos.bundle"}[e]+"."+{1084:"f18a24d3924b651a",1983:"e5709245effd8e20",2470:"294faaa69171455b",2521:"a0398e8c630f7036",2530:"075cc9fe49783f65",2586:"f335df0cd85ea00b",2732:"848e25098152c821",3351:"ddc15c2d10514bf9",3365:"37131c41fc288259",3623:"e3a7e0813bc9e3ec",4028:"6f43a867cb75b343",4509:"c647cbc1674cfea8",4958:"b33cd1cc42853828",4965:"487c14a0180fbf85",5865:"dffb139831cf2ae9",6053:"a310984a7cefe091",6869:"99838eb369862e91",7004:"4157e6be875557da",7019:"7c5f7f5c21a1d88c",8021:"3c0833e75a8155f2",8250:"c5c5f4ddf5b18688",8517:"232f6f724c527858",8600:"9ac9432f209bde4e",8625:"8a269b2c4fd0722c",8900:"c37e8a7a49d49297",9144:"fc0a2c6ff6297f24"}[e]+".js",o.miniCssF=e=>({138:"css/spa",703:"css/admin",1242:"css/appdark",6170:"css/app",8737:"css/portfolio",9994:"css/landing"}[e]+".css"),o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="pixelfed:",o.l=(e,n,c,a)=>{if(r[e])r[e].push(n);else{var d,i;if(void 0!==c)for(var s=document.getElementsByTagName("script"),f=0;f<s.length;f++){var l=s[f];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==t+c){d=l;break}}d||(i=!0,(d=document.createElement("script")).charset="utf-8",d.timeout=120,o.nc&&d.setAttribute("nonce",o.nc),d.setAttribute("data-webpack",t+c),d.src=e),r[e]=[n];var u=(t,n)=>{d.onerror=d.onload=null,clearTimeout(b);var c=r[e];if(delete r[e],d.parentNode&&d.parentNode.removeChild(d),c&&c.forEach((e=>e(n))),t)return t(n)},b=setTimeout(u.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=u.bind(null,d.onerror),d.onload=u.bind(null,d.onload),i&&document.head.appendChild(d)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),o.p="/",(()=>{var e={8929:0,1242:0,6170:0,8737:0,703:0,9994:0,138:0};o.f.j=(r,t)=>{var n=o.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(1242|138|6170|703|8737|8929|9994)$/.test(r))e[r]=0;else{var c=new Promise(((t,c)=>n=e[r]=[t,c]));t.push(n[2]=c);var a=o.p+o.u(r),d=new Error;o.l(a,(t=>{if(o.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var c=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;d.message="Loading chunk "+r+" failed.\n("+c+": "+a+")",d.name="ChunkLoadError",d.type=c,d.request=a,n[1](d)}}),"chunk-"+r,r)}},o.O.j=r=>0===e[r];var r=(r,t)=>{var n,c,[a,d,i]=t,s=0;if(a.some((r=>0!==e[r]))){for(n in d)o.o(d,n)&&(o.m[n]=d[n]);if(i)var f=i(o)}for(r&&r(t);s<a.length;s++)c=a[s],o.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return o.O(f)},t=self.webpackChunkpixelfed=self.webpackChunkpixelfed||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),o.nc=void 0})();
|
||||
(()=>{"use strict";var e,r,t,n={},o={};function a(e){var r=o[e];if(void 0!==r)return r.exports;var t=o[e]={id:e,loaded:!1,exports:{}};return n[e].call(t.exports,t,t.exports,a),t.loaded=!0,t.exports}a.m=n,e=[],a.O=(r,t,n,o)=>{if(!t){var c=1/0;for(f=0;f<e.length;f++){for(var[t,n,o]=e[f],d=!0,i=0;i<t.length;i++)(!1&o||c>=o)&&Object.keys(a.O).every((e=>a.O[e](t[i])))?t.splice(i--,1):(d=!1,o<c&&(c=o));if(d){e.splice(f--,1);var s=n();void 0!==s&&(r=s)}}return r}o=o||0;for(var f=e.length;f>0&&e[f-1][2]>o;f--)e[f]=e[f-1];e[f]=[t,n,o]},a.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return a.d(r,{a:r}),r},a.d=(e,r)=>{for(var t in r)a.o(r,t)&&!a.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((r,t)=>(a.f[t](e,r),r)),[])),a.u=e=>"js/"+{1084:"profile~followers.bundle",1983:"kb.bundle",2470:"home.chunk",2521:"about.bundle",2530:"discover~myhashtags.chunk",2586:"compose.chunk",2732:"dms~message.chunk",3351:"discover~settings.chunk",3365:"dms.chunk",3623:"discover~findfriends.chunk",4028:"error404.bundle",4509:"static~privacy.bundle",4958:"discover.chunk",4965:"discover~memories.chunk",5865:"post.chunk",6053:"notifications.chunk",6869:"profile.chunk",7004:"help.bundle",7019:"discover~hashtag.bundle",8021:"contact.bundle",8250:"i18n.bundle",8517:"daci.chunk",8600:"changelog.bundle",8625:"profile~following.bundle",8900:"discover~serverfeed.chunk",9144:"static~tos.bundle"}[e]+"."+{1084:"f18a24d3924b651a",1983:"e5709245effd8e20",2470:"64a8f34f10a4fa8b",2521:"a0398e8c630f7036",2530:"ec2c96b72899819b",2586:"f335df0cd85ea00b",2732:"848e25098152c821",3351:"9bac38bba3619276",3365:"37131c41fc288259",3623:"f9f303e4742d4d0e",4028:"6f43a867cb75b343",4509:"c647cbc1674cfea8",4958:"b33cd1cc42853828",4965:"b6fd5951cd01560a",5865:"d7408f11b67053fd",6053:"a310984a7cefe091",6869:"e6ac60336120dcd5",7004:"4157e6be875557da",7019:"7c5f7f5c21a1d88c",8021:"3c0833e75a8155f2",8250:"c5c5f4ddf5b18688",8517:"289add6be0f9f34f",8600:"9ac9432f209bde4e",8625:"8a269b2c4fd0722c",8900:"556f2541edd05a9c",9144:"fc0a2c6ff6297f24"}[e]+".js",a.miniCssF=e=>({138:"css/spa",703:"css/admin",1242:"css/appdark",6170:"css/app",8737:"css/portfolio",9994:"css/landing"}[e]+".css"),a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="pixelfed:",a.l=(e,n,o,c)=>{if(r[e])r[e].push(n);else{var d,i;if(void 0!==o)for(var s=document.getElementsByTagName("script"),f=0;f<s.length;f++){var l=s[f];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")==t+o){d=l;break}}d||(i=!0,(d=document.createElement("script")).charset="utf-8",d.timeout=120,a.nc&&d.setAttribute("nonce",a.nc),d.setAttribute("data-webpack",t+o),d.src=e),r[e]=[n];var u=(t,n)=>{d.onerror=d.onload=null,clearTimeout(b);var o=r[e];if(delete r[e],d.parentNode&&d.parentNode.removeChild(d),o&&o.forEach((e=>e(n))),t)return t(n)},b=setTimeout(u.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=u.bind(null,d.onerror),d.onload=u.bind(null,d.onload),i&&document.head.appendChild(d)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),a.p="/",(()=>{var e={8929:0,1242:0,6170:0,8737:0,703:0,9994:0,138:0};a.f.j=(r,t)=>{var n=a.o(e,r)?e[r]:void 0;if(0!==n)if(n)t.push(n[2]);else if(/^(1242|138|6170|703|8737|8929|9994)$/.test(r))e[r]=0;else{var o=new Promise(((t,o)=>n=e[r]=[t,o]));t.push(n[2]=o);var c=a.p+a.u(r),d=new Error;a.l(c,(t=>{if(a.o(e,r)&&(0!==(n=e[r])&&(e[r]=void 0),n)){var o=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;d.message="Loading chunk "+r+" failed.\n("+o+": "+c+")",d.name="ChunkLoadError",d.type=o,d.request=c,n[1](d)}}),"chunk-"+r,r)}},a.O.j=r=>0===e[r];var r=(r,t)=>{var n,o,[c,d,i]=t,s=0;if(c.some((r=>0!==e[r]))){for(n in d)a.o(d,n)&&(a.m[n]=d[n]);if(i)var f=i(a)}for(r&&r(t);s<c.length;s++)o=c[s],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return a.O(f)},t=self.webpackChunkpixelfed=self.webpackChunkpixelfed||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})(),a.nc=void 0})();
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -25,17 +25,17 @@
|
|||
"/js/portfolio.js": "/js/portfolio.js?id=4fb6929e78830b1bb71410180b8b2772",
|
||||
"/js/installer.js": "/js/installer.js?id=cd240ae970947b76ac49032ba95e0922",
|
||||
"/js/admin_invite.js": "/js/admin_invite.js?id=307a53250701e3b12164af9495e88447",
|
||||
"/js/manifest.js": "/js/manifest.js?id=0283672b157947b75e090fa2424de5c3",
|
||||
"/js/home.chunk.294faaa69171455b.js": "/js/home.chunk.294faaa69171455b.js?id=7c19952a1cdde06b50141b2f379344d3",
|
||||
"/js/manifest.js": "/js/manifest.js?id=7e732abc8a08ae60bb4c853378beac9d",
|
||||
"/js/home.chunk.64a8f34f10a4fa8b.js": "/js/home.chunk.64a8f34f10a4fa8b.js?id=22be6b9b89134a72225e7b1e2fd08927",
|
||||
"/js/compose.chunk.f335df0cd85ea00b.js": "/js/compose.chunk.f335df0cd85ea00b.js?id=6389b021170bc21b58fc5bc28920f9af",
|
||||
"/js/post.chunk.dffb139831cf2ae9.js": "/js/post.chunk.dffb139831cf2ae9.js?id=ba38a86bfafa7948fe208b72681693b0",
|
||||
"/js/profile.chunk.99838eb369862e91.js": "/js/profile.chunk.99838eb369862e91.js?id=9ea61618bb8aee5eb1c2139a4ee81288",
|
||||
"/js/discover~memories.chunk.487c14a0180fbf85.js": "/js/discover~memories.chunk.487c14a0180fbf85.js?id=96bdb1a740731edeb504c5bb06b56f89",
|
||||
"/js/discover~myhashtags.chunk.075cc9fe49783f65.js": "/js/discover~myhashtags.chunk.075cc9fe49783f65.js?id=2c7a5243ef1dccabe13b4e415934a901",
|
||||
"/js/daci.chunk.232f6f724c527858.js": "/js/daci.chunk.232f6f724c527858.js?id=58f6648c4bded7ee0588c712c970e214",
|
||||
"/js/discover~findfriends.chunk.e3a7e0813bc9e3ec.js": "/js/discover~findfriends.chunk.e3a7e0813bc9e3ec.js?id=e38eee0338a0068ec0e92d3b62feaed1",
|
||||
"/js/discover~serverfeed.chunk.c37e8a7a49d49297.js": "/js/discover~serverfeed.chunk.c37e8a7a49d49297.js?id=296835c4551a1acbb8320fd296047751",
|
||||
"/js/discover~settings.chunk.ddc15c2d10514bf9.js": "/js/discover~settings.chunk.ddc15c2d10514bf9.js?id=467f69345d83ac1fa6330da9d57b69fa",
|
||||
"/js/post.chunk.d7408f11b67053fd.js": "/js/post.chunk.d7408f11b67053fd.js?id=654ed8ff06ef863ac47d57d002fac5d5",
|
||||
"/js/profile.chunk.e6ac60336120dcd5.js": "/js/profile.chunk.e6ac60336120dcd5.js?id=056ff539475910f8596d168ee759cf48",
|
||||
"/js/discover~memories.chunk.b6fd5951cd01560a.js": "/js/discover~memories.chunk.b6fd5951cd01560a.js?id=8d6c5c36a70eff8f3afb25307f603bd7",
|
||||
"/js/discover~myhashtags.chunk.ec2c96b72899819b.js": "/js/discover~myhashtags.chunk.ec2c96b72899819b.js?id=73544cfa7b526a2ad9563bfdc7fe4c6e",
|
||||
"/js/daci.chunk.289add6be0f9f34f.js": "/js/daci.chunk.289add6be0f9f34f.js?id=1c2f0afcb80dc9b627c7900499d5c149",
|
||||
"/js/discover~findfriends.chunk.f9f303e4742d4d0e.js": "/js/discover~findfriends.chunk.f9f303e4742d4d0e.js?id=45b25ef713a9f2d775bf6b32ca0b56a3",
|
||||
"/js/discover~serverfeed.chunk.556f2541edd05a9c.js": "/js/discover~serverfeed.chunk.556f2541edd05a9c.js?id=4f8f6e174ca565a61b3b2bbe69965861",
|
||||
"/js/discover~settings.chunk.9bac38bba3619276.js": "/js/discover~settings.chunk.9bac38bba3619276.js?id=0af79e7702cd1fba672daea02771aed4",
|
||||
"/js/discover.chunk.b33cd1cc42853828.js": "/js/discover.chunk.b33cd1cc42853828.js?id=6dcffad6c504442e374de397cc711eb6",
|
||||
"/js/notifications.chunk.a310984a7cefe091.js": "/js/notifications.chunk.a310984a7cefe091.js?id=4b058bc04867e65daa3ca296a05f9797",
|
||||
"/js/dms.chunk.37131c41fc288259.js": "/js/dms.chunk.37131c41fc288259.js?id=752e3b061c1e76baa73b5d38657bf93e",
|
||||
|
|
|
@ -0,0 +1,251 @@
|
|||
<template>
|
||||
<div class="px-3 my-3" style="z-index:3;">
|
||||
<div v-if="(status.favourites_count || status.reblogs_count) && ((status.hasOwnProperty('liked_by') && status.liked_by.url) || (status.hasOwnProperty('reblogs_count') && status.reblogs_count))" class="mb-0 d-flex justify-content-between">
|
||||
<p v-if="!hideCounts && status.favourites_count" class="mb-2 reaction-liked-by">
|
||||
Liked by
|
||||
<span v-if="status.favourites_count == 1 && status.favourited == true" class="font-weight-bold">me</span>
|
||||
<span v-else>
|
||||
<router-link :to="'/i/web/profile/' + status.liked_by.id" class="primary font-weight-bold"">@{{ status.liked_by.username}}</router-link>
|
||||
<span v-if="status.liked_by.others || status.favourites_count > 1">
|
||||
and <a href="#" class="primary font-weight-bold" @click.prevent="showLikes()">{{ count(status.favourites_count - 1) }} others</a>
|
||||
</span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p v-if="!hideCounts && status.reblogs_count" class="mb-2 reaction-liked-by">
|
||||
Shared by
|
||||
<span v-if="status.reblogs_count == 1 && status.reblogged == true" class="font-weight-bold">me</span>
|
||||
<a v-else class="primary font-weight-bold" href="#" @click.prevent="showShares()">
|
||||
{{ count(status.reblogs_count) }} {{ status.reblogs_count > 1 ? 'others' : 'other' }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between" style="font-size: 14px !important;">
|
||||
<div>
|
||||
<button type="button" class="btn btn-light font-weight-bold rounded-pill mr-2" @click.prevent="like()">
|
||||
<span v-if="status.favourited" class="primary">
|
||||
<i class="fas fa-heart mr-md-1 text-danger fa-lg"></i>
|
||||
</span>
|
||||
<span v-else>
|
||||
<i class="far fa-heart mr-md-2"></i>
|
||||
</span>
|
||||
<span v-if="likesCount && !hideCounts">
|
||||
{{ count(likesCount)}}
|
||||
<span class="d-none d-md-inline">{{ likesCount == 1 ? $t('common.like') : $t('common.likes') }}</span>
|
||||
</span>
|
||||
<span v-else>
|
||||
<span class="d-none d-md-inline">{{ $t('common.like') }}</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button v-if="!status.comments_disabled" type="button" class="btn btn-light font-weight-bold rounded-pill mr-2 px-3" @click="showComments()">
|
||||
<i class="far fa-comment mr-md-2"></i>
|
||||
<span v-if="replyCount && !hideCounts">
|
||||
{{ count(replyCount) }}
|
||||
<span class="d-none d-md-inline">{{ replyCount == 1 ? $t('common.comment') : $t('common.comments') }}</span>
|
||||
</span>
|
||||
<span v-else>
|
||||
<span class="d-none d-md-inline">{{ $t('common.comment') }}</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-light font-weight-bold rounded-pill"
|
||||
:disabled="isReblogging"
|
||||
@click="handleReblog()">
|
||||
<span v-if="isReblogging">
|
||||
<b-spinner variant="warning" small />
|
||||
</span>
|
||||
<span v-else>
|
||||
<i v-if="status.reblogged == true" class="fas fa-retweet fa-lg text-warning"></i>
|
||||
<i v-else class="far fa-retweet"></i>
|
||||
|
||||
<span v-if="status.reblogs_count && !hideCounts" class="ml-md-2">
|
||||
{{ count(status.reblogs_count) }}
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="!status.in_reply_to_id && !status.reblog_of_id"
|
||||
type="button"
|
||||
class="btn btn-light font-weight-bold rounded-pill ml-3"
|
||||
:disabled="isBookmarking"
|
||||
@click="handleBookmark()">
|
||||
<span v-if="isBookmarking">
|
||||
<b-spinner variant="warning" small />
|
||||
</span>
|
||||
<span v-else>
|
||||
<i v-if="status.hasOwnProperty('bookmarked_at') || (status.hasOwnProperty('bookmarked') && status.bookmarked == true)" class="fas fa-bookmark fa-lg text-warning"></i>
|
||||
<i v-else class="far fa-bookmark"></i>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button v-if="admin" type="button" class="ml-3 btn btn-light font-weight-bold rounded-pill" v-b-tooltip.hover title="Moderation Tools" @click="openModTools()">
|
||||
<i class="far fa-user-crown"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script type="text/javascript">
|
||||
import CommentDrawer from './CommentDrawer.vue';
|
||||
import ProfileHoverCard from './../profile/ProfileHoverCard.vue';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
status: {
|
||||
type: Object
|
||||
},
|
||||
|
||||
profile: {
|
||||
type: Object
|
||||
},
|
||||
|
||||
admin: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
|
||||
components: {
|
||||
"comment-drawer": CommentDrawer,
|
||||
"profile-hover-card": ProfileHoverCard
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
key: 1,
|
||||
menuLoading: true,
|
||||
sensitive: false,
|
||||
isReblogging: false,
|
||||
isBookmarking: false,
|
||||
owner: false,
|
||||
license: false
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
hideCounts: {
|
||||
get() {
|
||||
return this.$store.state.hideCounts == true;
|
||||
}
|
||||
},
|
||||
|
||||
autoloadComments: {
|
||||
get() {
|
||||
return this.$store.state.autoloadComments == true;
|
||||
}
|
||||
},
|
||||
|
||||
newReactions: {
|
||||
get() {
|
||||
return this.$store.state.newReactions;
|
||||
},
|
||||
},
|
||||
|
||||
likesCount: function() {
|
||||
return this.status.favourites_count;
|
||||
},
|
||||
|
||||
replyCount: function() {
|
||||
return this.status.reply_count;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
count(val) {
|
||||
return App.util.format.count(val);
|
||||
},
|
||||
|
||||
like() {
|
||||
event.currentTarget.blur();
|
||||
if(this.status.favourited) {
|
||||
this.$emit('unlike');
|
||||
} else {
|
||||
this.$emit('like');
|
||||
}
|
||||
},
|
||||
|
||||
showLikes() {
|
||||
event.currentTarget.blur();
|
||||
this.$emit('likes-modal');
|
||||
},
|
||||
|
||||
showShares() {
|
||||
event.currentTarget.blur();
|
||||
this.$emit('shares-modal');
|
||||
},
|
||||
|
||||
showComments() {
|
||||
event.currentTarget.blur();
|
||||
this.$emit('toggle-comments');
|
||||
},
|
||||
|
||||
copyLink() {
|
||||
event.currentTarget.blur();
|
||||
App.util.clipboard(this.status.url);
|
||||
},
|
||||
|
||||
shareToOther() {
|
||||
if (navigator.canShare) {
|
||||
navigator.share({
|
||||
url: this.status.url
|
||||
})
|
||||
.then(() => console.log('Share was successful.'))
|
||||
.catch((error) => console.log('Sharing failed', error));
|
||||
} else {
|
||||
swal('Not supported', 'Your current device does not support native sharing.', 'error');
|
||||
}
|
||||
},
|
||||
|
||||
counterChange(type) {
|
||||
this.$emit('counter-change', type);
|
||||
},
|
||||
|
||||
showCommentLikes(post) {
|
||||
this.$emit('comment-likes-modal', post);
|
||||
},
|
||||
|
||||
handleReblog() {
|
||||
this.isReblogging = true;
|
||||
if(this.status.reblogged) {
|
||||
this.$emit('unshare');
|
||||
} else {
|
||||
this.$emit('share');
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.isReblogging = false;
|
||||
}, 5000);
|
||||
},
|
||||
|
||||
handleBookmark() {
|
||||
event.currentTarget.blur();
|
||||
this.isBookmarking = true;
|
||||
this.$emit('bookmark');
|
||||
|
||||
setTimeout(() => {
|
||||
this.isBookmarking = false;
|
||||
}, 2000);
|
||||
},
|
||||
|
||||
getStatusAvatar() {
|
||||
if(window._sharedData.user.id == this.status.account.id) {
|
||||
return window._sharedData.user.avatar;
|
||||
}
|
||||
|
||||
return this.status.account.avatar;
|
||||
},
|
||||
|
||||
openModTools() {
|
||||
this.$emit('mod-tools');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
Plik diff jest za duży
Load Diff
Ładowanie…
Reference in New Issue