Merge pull request #4565 from pixelfed/staging

Staging
pull/4591/head
daniel 2023-07-30 06:03:24 -06:00 zatwierdzone przez GitHub
commit 2cdf8917da
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
28 zmienionych plików z 227 dodań i 90 usunięć

Wyświetl plik

@ -46,6 +46,8 @@
- Update ProfileController, allow albums in atom feed. Closes #4561. Fixes #4526 ([1c105a6c](https://github.com/pixelfed/pixelfed/commit/1c105a6c))
- Update admin users view, fix website value. Closes #4557 ([c469d475](https://github.com/pixelfed/pixelfed/commit/c469d475))
- Update StatusStatelessTransformer, allow unlisted reblogs ([1c13b518](https://github.com/pixelfed/pixelfed/commit/1c13b518))
- Update ApiV1Controller, hydrate reblog state in home timeline ([13bdaa2e](https://github.com/pixelfed/pixelfed/commit/13bdaa2e))
- Update Timeline component, improve reblog support ([29de91e5](https://github.com/pixelfed/pixelfed/commit/29de91e5))
- ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.8 (2023-05-29)](https://github.com/pixelfed/pixelfed/compare/v0.11.7...v0.11.8)

Wyświetl plik

@ -2199,6 +2199,14 @@ class ApiV1Controller extends Controller
->filter(function($status) {
return $status && isset($status['account']);
})
->map(function($status) use($pid) {
if(!empty($status['reblog'])) {
$status['reblog']['favourited'] = (bool) LikeService::liked($pid, $status['reblog']['id']);
$status['reblog']['reblogged'] = (bool) ReblogService::get($pid, $status['reblog']['id']);
}
return $status;
})
->take($limit)
->values();
} else {
@ -2242,6 +2250,14 @@ class ApiV1Controller extends Controller
->filter(function($status) {
return $status && isset($status['account']);
})
->map(function($status) use($pid) {
if(!empty($status['reblog'])) {
$status['reblog']['favourited'] = (bool) LikeService::liked($pid, $status['reblog']['id']);
$status['reblog']['reblogged'] = (bool) ReblogService::get($pid, $status['reblog']['id']);
}
return $status;
})
->take($limit)
->values();
}

Wyświetl plik

@ -49,7 +49,10 @@ class SharePipeline implements ShouldQueue
public function handle()
{
$status = $this->status;
$parent = $this->status->parent();
$parent = Status::find($this->status->reblog_of_id);
if(!$parent) {
return;
}
$actor = $status->profile;
$target = $parent->profile;
@ -84,7 +87,7 @@ class SharePipeline implements ShouldQueue
public function remoteAnnounceDeliver()
{
if(config_cache('federation.activitypub.enabled') == false) {
if(config('app.env') !== 'production' || config_cache('federation.activitypub.enabled') == false) {
return true;
}
$status = $this->status;

Wyświetl plik

@ -61,7 +61,7 @@ class UndoSharePipeline implements ShouldQueue
return;
}
if(config_cache('federation.activitypub.enabled') == false) {
if(config('app.env') !== 'production' || config_cache('federation.activitypub.enabled') == false) {
return $status->delete();
} else {
return $this->remoteAnnounceDeliver();
@ -70,7 +70,8 @@ class UndoSharePipeline implements ShouldQueue
public function remoteAnnounceDeliver()
{
if(config_cache('federation.activitypub.enabled') == false) {
if(config('app.env') !== 'production' || config_cache('federation.activitypub.enabled') == false) {
$status->delete();
return 1;
}

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

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

Wyświetl plik

@ -1 +1 @@
(()=>{"use strict";var e,r,n,o={},t={};function d(e){var r=t[e];if(void 0!==r)return r.exports;var n=t[e]={id:e,loaded:!1,exports:{}};return o[e].call(n.exports,n,n.exports,d),n.loaded=!0,n.exports}d.m=o,e=[],d.O=(r,n,o,t)=>{if(!n){var a=1/0;for(l=0;l<e.length;l++){for(var[n,o,t]=e[l],c=!0,i=0;i<n.length;i++)(!1&t||a>=t)&&Object.keys(d.O).every((e=>d.O[e](n[i])))?n.splice(i--,1):(c=!1,t<a&&(a=t));if(c){e.splice(l--,1);var s=o();void 0!==s&&(r=s)}}return r}t=t||0;for(var l=e.length;l>0&&e[l-1][2]>t;l--)e[l]=e[l-1];e[l]=[n,o,t]},d.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return d.d(r,{a:r}),r},d.d=(e,r)=>{for(var n in r)d.o(r,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce(((r,n)=>(d.f[n](e,r),r)),[])),d.u=e=>"js/"+{1084:"profile~followers.bundle",2470:"home.chunk",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",4958:"discover.chunk",4965:"discover~memories.chunk",5865:"post.chunk",6053:"notifications.chunk",6869:"profile.chunk",7019:"discover~hashtag.bundle",8250:"i18n.bundle",8517:"daci.chunk",8600:"changelog.bundle",8625:"profile~following.bundle",8900:"discover~serverfeed.chunk"}[e]+"."+{1084:"f088062414c3b014",2470:"3be19ae25a42cbd5",2530:"4b413213e12db5b8",2586:"6464688bf5b5ef97",2732:"990c68dfc266b0cf",3351:"491f217e6c54be1e",3365:"98e12cf9137ddd87",3623:"ae74572b77d74920",4028:"182d0aaa2da9ed23",4958:"56d2d8cfbbecc761",4965:"25ef142d12a48a20",5865:"ce42d6040d1683fd",6053:"bf0c641eb1fd9cde",6869:"e30bbdae030833e4",7019:"54f2ac43c55bf328",8250:"4a5ff18de549ac4e",8517:"06d17098233d10d2",8600:"c4c82057f9628c72",8625:"57cbb89efa73e324",8900:"1dace6b026047712"}[e]+".js",d.miniCssF=e=>({138:"css/spa",703:"css/admin",1242:"css/appdark",6170:"css/app",8737:"css/portfolio",9994:"css/landing"}[e]+".css"),d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},n="pixelfed:",d.l=(e,o,t,a)=>{if(r[e])r[e].push(o);else{var c,i;if(void 0!==t)for(var s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var u=s[l];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==n+t){c=u;break}}c||(i=!0,(c=document.createElement("script")).charset="utf-8",c.timeout=120,d.nc&&c.setAttribute("nonce",d.nc),c.setAttribute("data-webpack",n+t),c.src=e),r[e]=[o];var f=(n,o)=>{c.onerror=c.onload=null,clearTimeout(b);var t=r[e];if(delete r[e],c.parentNode&&c.parentNode.removeChild(c),t&&t.forEach((e=>e(o))),n)return n(o)},b=setTimeout(f.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=f.bind(null,c.onerror),c.onload=f.bind(null,c.onload),i&&document.head.appendChild(c)}},d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),d.p="/",(()=>{var e={8929:0,1242:0,6170:0,8737:0,703:0,9994:0,138:0};d.f.j=(r,n)=>{var o=d.o(e,r)?e[r]:void 0;if(0!==o)if(o)n.push(o[2]);else if(/^(1242|138|6170|703|8737|8929|9994)$/.test(r))e[r]=0;else{var t=new Promise(((n,t)=>o=e[r]=[n,t]));n.push(o[2]=t);var a=d.p+d.u(r),c=new Error;d.l(a,(n=>{if(d.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var t=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;c.message="Loading chunk "+r+" failed.\n("+t+": "+a+")",c.name="ChunkLoadError",c.type=t,c.request=a,o[1](c)}}),"chunk-"+r,r)}},d.O.j=r=>0===e[r];var r=(r,n)=>{var o,t,[a,c,i]=n,s=0;if(a.some((r=>0!==e[r]))){for(o in c)d.o(c,o)&&(d.m[o]=c[o]);if(i)var l=i(d)}for(r&&r(n);s<a.length;s++)t=a[s],d.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return d.O(l)},n=self.webpackChunkpixelfed=self.webpackChunkpixelfed||[];n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))})(),d.nc=void 0})();
(()=>{"use strict";var e,r,n,o={},t={};function a(e){var r=t[e];if(void 0!==r)return r.exports;var n=t[e]={id:e,loaded:!1,exports:{}};return o[e].call(n.exports,n,n.exports,a),n.loaded=!0,n.exports}a.m=o,e=[],a.O=(r,n,o,t)=>{if(!n){var c=1/0;for(f=0;f<e.length;f++){for(var[n,o,t]=e[f],d=!0,i=0;i<n.length;i++)(!1&t||c>=t)&&Object.keys(a.O).every((e=>a.O[e](n[i])))?n.splice(i--,1):(d=!1,t<c&&(c=t));if(d){e.splice(f--,1);var s=o();void 0!==s&&(r=s)}}return r}t=t||0;for(var f=e.length;f>0&&e[f-1][2]>t;f--)e[f]=e[f-1];e[f]=[n,o,t]},a.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return a.d(r,{a:r}),r},a.d=(e,r)=>{for(var n in r)a.o(r,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce(((r,n)=>(a.f[n](e,r),r)),[])),a.u=e=>"js/"+{1084:"profile~followers.bundle",2470:"home.chunk",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",4958:"discover.chunk",4965:"discover~memories.chunk",5865:"post.chunk",6053:"notifications.chunk",6869:"profile.chunk",7019:"discover~hashtag.bundle",8250:"i18n.bundle",8517:"daci.chunk",8600:"changelog.bundle",8625:"profile~following.bundle",8900:"discover~serverfeed.chunk"}[e]+"."+{1084:"f088062414c3b014",2470:"e9ae8285416aa78f",2530:"c973b20c8878052f",2586:"6464688bf5b5ef97",2732:"990c68dfc266b0cf",3351:"ef99ab7d5116b492",3365:"98e12cf9137ddd87",3623:"d691be73c68195ac",4028:"182d0aaa2da9ed23",4958:"56d2d8cfbbecc761",4965:"4f59af2dab851399",5865:"741e92852b834d92",6053:"bf0c641eb1fd9cde",6869:"3f076e6eff0c5ede",7019:"54f2ac43c55bf328",8250:"4a5ff18de549ac4e",8517:"b9e8578923bea3c3",8600:"c4c82057f9628c72",8625:"57cbb89efa73e324",8900:"8f3f1aaa21cefc1d"}[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={},n="pixelfed:",a.l=(e,o,t,c)=>{if(r[e])r[e].push(o);else{var d,i;if(void 0!==t)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")==n+t){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",n+t),d.src=e),r[e]=[o];var u=(n,o)=>{d.onerror=d.onload=null,clearTimeout(b);var t=r[e];if(delete r[e],d.parentNode&&d.parentNode.removeChild(d),t&&t.forEach((e=>e(o))),n)return n(o)},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,n)=>{var o=a.o(e,r)?e[r]:void 0;if(0!==o)if(o)n.push(o[2]);else if(/^(1242|138|6170|703|8737|8929|9994)$/.test(r))e[r]=0;else{var t=new Promise(((n,t)=>o=e[r]=[n,t]));n.push(o[2]=t);var c=a.p+a.u(r),d=new Error;a.l(c,(n=>{if(a.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var t=n&&("load"===n.type?"missing":n.type),c=n&&n.target&&n.target.src;d.message="Loading chunk "+r+" failed.\n("+t+": "+c+")",d.name="ChunkLoadError",d.type=t,d.request=c,o[1](d)}}),"chunk-"+r,r)}},a.O.j=r=>0===e[r];var r=(r,n)=>{var o,t,[c,d,i]=n,s=0;if(c.some((r=>0!==e[r]))){for(o in d)a.o(d,o)&&(a.m[o]=d[o]);if(i)var f=i(a)}for(r&&r(n);s<c.length;s++)t=c[s],a.o(e,t)&&e[t]&&e[t][0](),e[t]=0;return a.O(f)},n=self.webpackChunkpixelfed=self.webpackChunkpixelfed||[];n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))})(),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

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -24,17 +24,17 @@
"/js/admin_invite.js": "/js/admin_invite.js?id=307a53250701e3b12164af9495e88447",
"/js/landing.js": "/js/landing.js?id=7e3ab65813c4bf28182f5bdf0825774c",
"/js/remote_auth.js": "/js/remote_auth.js?id=0840f85f648319858b72c299b8c51f9e",
"/js/manifest.js": "/js/manifest.js?id=07b498a33a400be250a88d88bc871fb0",
"/js/home.chunk.3be19ae25a42cbd5.js": "/js/home.chunk.3be19ae25a42cbd5.js?id=b64c0ad91a630c8981ed13e8b3c21a82",
"/js/manifest.js": "/js/manifest.js?id=9d40a00861ba312613ff6015cde6b389",
"/js/home.chunk.e9ae8285416aa78f.js": "/js/home.chunk.e9ae8285416aa78f.js?id=78bf1a789078f0bcc7c60517f04f62a6",
"/js/compose.chunk.6464688bf5b5ef97.js": "/js/compose.chunk.6464688bf5b5ef97.js?id=45753d769a16276c2d3ad8d7d6bf3e88",
"/js/post.chunk.ce42d6040d1683fd.js": "/js/post.chunk.ce42d6040d1683fd.js?id=f172bffa71780cc425820b0c1010577b",
"/js/profile.chunk.e30bbdae030833e4.js": "/js/profile.chunk.e30bbdae030833e4.js?id=97f26374224bf2aa8e4dc3d7f0b7197c",
"/js/discover~memories.chunk.25ef142d12a48a20.js": "/js/discover~memories.chunk.25ef142d12a48a20.js?id=e45f99fb5de80a4cc506f7b4661e6f15",
"/js/discover~myhashtags.chunk.4b413213e12db5b8.js": "/js/discover~myhashtags.chunk.4b413213e12db5b8.js?id=210df99443921eb091e8e895fd50cbf8",
"/js/daci.chunk.06d17098233d10d2.js": "/js/daci.chunk.06d17098233d10d2.js?id=ffb2157c35222c0412cc77c96f016c39",
"/js/discover~findfriends.chunk.ae74572b77d74920.js": "/js/discover~findfriends.chunk.ae74572b77d74920.js?id=316920833fd30ae8dcc908e705e0794d",
"/js/discover~serverfeed.chunk.1dace6b026047712.js": "/js/discover~serverfeed.chunk.1dace6b026047712.js?id=816f2bc0f71c105af9fdc54cbc52241a",
"/js/discover~settings.chunk.491f217e6c54be1e.js": "/js/discover~settings.chunk.491f217e6c54be1e.js?id=34071d5808c937a1ec3551bda24aaa1a",
"/js/post.chunk.741e92852b834d92.js": "/js/post.chunk.741e92852b834d92.js?id=7d3dbcadad5d69074862aa86ad26bfab",
"/js/profile.chunk.3f076e6eff0c5ede.js": "/js/profile.chunk.3f076e6eff0c5ede.js?id=a508e2e49925bf1ff2ac4b1b0ecf7fe8",
"/js/discover~memories.chunk.4f59af2dab851399.js": "/js/discover~memories.chunk.4f59af2dab851399.js?id=e1804e9e921ac7020011565a3dd11585",
"/js/discover~myhashtags.chunk.c973b20c8878052f.js": "/js/discover~myhashtags.chunk.c973b20c8878052f.js?id=c429b40b92105dbadf2e777be840316a",
"/js/daci.chunk.b9e8578923bea3c3.js": "/js/daci.chunk.b9e8578923bea3c3.js?id=eef16249db1d26a6e095a385950cbc29",
"/js/discover~findfriends.chunk.d691be73c68195ac.js": "/js/discover~findfriends.chunk.d691be73c68195ac.js?id=09c0435bdb37b69b6747a1a378cc74d4",
"/js/discover~serverfeed.chunk.8f3f1aaa21cefc1d.js": "/js/discover~serverfeed.chunk.8f3f1aaa21cefc1d.js?id=435cc227886a36267bee25fcb509e5f4",
"/js/discover~settings.chunk.ef99ab7d5116b492.js": "/js/discover~settings.chunk.ef99ab7d5116b492.js?id=078f250def019d1e80000e8b168ef5c5",
"/js/discover.chunk.56d2d8cfbbecc761.js": "/js/discover.chunk.56d2d8cfbbecc761.js?id=25a401188e2fd2a43dec8011d9d62044",
"/js/notifications.chunk.bf0c641eb1fd9cde.js": "/js/notifications.chunk.bf0c641eb1fd9cde.js?id=5a6628e276da9c85244770910f817c0d",
"/js/dms.chunk.98e12cf9137ddd87.js": "/js/dms.chunk.98e12cf9137ddd87.js?id=527795bd736f56ff7d0addb623f0d60b",

Wyświetl plik

@ -3,18 +3,20 @@
<div class="card shadow-sm" style="border-radius: 15px;">
<post-header
:profile="profile"
:status="status"
:status="shadowStatus"
:is-reblog="isReblog"
:reblog-account="reblogAccount"
@menu="openMenu"
@follow="follow"
@unfollow="unfollow" />
<post-content
:profile="profile"
:status="status" />
:status="shadowStatus" />
<post-reactions
v-if="reactionBar"
:status="status"
v-if="reactionBar"
:status="shadowStatus"
:profile="profile"
:admin="admin"
v-on:like="like"
@ -29,7 +31,7 @@
<div v-if="showCommentDrawer" class="card-footer rounded-bottom border-0" style="background: rgba(0,0,0,0.02);z-index: 3;">
<comment-drawer
:status="status"
:status="shadowStatus"
:profile="profile"
v-on:handle-report="handleReport"
v-on:counter-change="counterChange"
@ -58,8 +60,8 @@
},
reactionBar: {
type: Boolean,
default: true
type: Boolean,
default: true
},
useDropdownMenu: {
@ -90,14 +92,14 @@
},
mounted() {
this.license = this.status.media_attachments && this.status.media_attachments.length ?
this.status
this.license = this.shadowStatus.media_attachments && this.shadowStatus.media_attachments.length ?
this.shadowStatus
.media_attachments
.filter(m => m.hasOwnProperty('license') && m.license && m.license.hasOwnProperty('id'))
.map(m => m.license)[0] : false;
this.admin = window._sharedData.user.is_admin;
this.owner = this.status.account.id == window._sharedData.user.id;
if(this.status.reply_count && this.autoloadComments && this.status.comments_disabled === false) {
this.owner = this.shadowStatus.account.id == window._sharedData.user.id;
if(this.shadowStatus.reply_count && this.autoloadComments && this.shadowStatus.comments_disabled === false) {
setTimeout(() => {
this.showCommentDrawer = true;
}, 1000);
@ -127,6 +129,24 @@
get() {
return this.$store.state.newReactions;
},
},
isReblog: {
get() {
return this.status.reblog != null;
}
},
reblogAccount: {
get() {
return this.status.reblog ? this.status.account : null;
}
},
shadowStatus: {
get() {
return this.status.reblog ? this.status.reblog : this.status;
}
}
},
@ -137,7 +157,7 @@
handler: function(o, n) {
this.isBookmarking = false;
}
}
},
},
methods: {

Wyświetl plik

@ -361,17 +361,30 @@
likeStatus(index) {
let status = this.feed[index];
let state = status.favourited;
let count = status.favourites_count;
this.feed[index].favourites_count = count + 1;
this.feed[index].favourited = !status.favourited;
if(status.reblog) {
status = status.reblog;
let state = status.favourited;
let count = status.favourites_count;
this.feed[index].reblog.favourites_count = count + 1;
this.feed[index].reblog.favourited = !status.favourited;
} else {
let state = status.favourited;
let count = status.favourites_count;
this.feed[index].favourites_count = count + 1;
this.feed[index].favourited = !status.favourited;
}
axios.post('/api/v1/statuses/' + status.id + '/favourite')
.then(res => {
//
}).catch(err => {
this.feed[index].favourites_count = count;
this.feed[index].favourited = false;
if(status.reblog) {
this.feed[index].reblog.favourites_count = count;
this.feed[index].reblog.favourited = false;
} else {
this.feed[index].favourites_count = count;
this.feed[index].favourited = false;
}
let el = document.createElement('p');
el.classList.add('text-left');
@ -413,17 +426,30 @@
unlikeStatus(index) {
let status = this.feed[index];
let state = status.favourited;
let count = status.favourites_count;
this.feed[index].favourites_count = count - 1;
this.feed[index].favourited = !status.favourited;
if(status.reblog) {
status = status.reblog;
let state = status.favourited;
let count = status.favourites_count;
this.feed[index].reblog.favourites_count = count - 1;
this.feed[index].reblog.favourited = !status.favourited;
} else {
let state = status.favourited;
let count = status.favourites_count;
this.feed[index].favourites_count = count - 1;
this.feed[index].favourited = !status.favourited;
}
axios.post('/api/v1/statuses/' + status.id + '/unfavourite')
.then(res => {
//
}).catch(err => {
this.feed[index].favourites_count = count;
this.feed[index].favourited = false;
if(status.reblog && status.pf_type == 'share') {
this.feed[index].reblog.favourites_count = count;
this.feed[index].reblog.favourited = false;
} else {
this.feed[index].favourites_count = count;
this.feed[index].favourited = false;
}
})
},
@ -445,7 +471,8 @@
openLikesModal(idx) {
this.postIndex = idx;
this.likesModalPost = this.feed[this.postIndex];
let post = this.feed[this.postIndex];
this.likesModalPost = post.reblog ? post.reblog : post;
this.showLikesModal = true;
this.$nextTick(() => {
this.$refs.likesModal.open();
@ -454,7 +481,8 @@
openSharesModal(idx) {
this.postIndex = idx;
this.sharesModalPost = this.feed[this.postIndex];
let post = this.feed[this.postIndex];
this.sharesModalPost = post.reblog ? post.reblog : post;
this.showSharesModal = true;
this.$nextTick(() => {
this.$refs.sharesModal.open();
@ -492,19 +520,32 @@
},
counterChange(index, type) {
let post = this.feed[index];
switch(type) {
case 'comment-increment':
this.feed[index].reply_count = this.feed[index].reply_count + 1;
if(post.reblog != null) {
this.feed[index].reblog.reply_count = this.feed[index].reblog.reply_count + 1;
} else {
this.feed[index].reply_count = this.feed[index].reply_count + 1;
}
break;
case 'comment-decrement':
this.feed[index].reply_count = this.feed[index].reply_count - 1;
if(post.reblog != null) {
this.feed[index].reblog.reply_count = this.feed[index].reblog.reply_count - 1;
} else {
this.feed[index].reply_count = this.feed[index].reply_count - 1;
}
break;
}
},
openCommentLikesModal(post) {
this.likesModalPost = post;
if(post.reblog != null) {
this.likesModalPost = post.reblog;
} else {
this.likesModalPost = post;
}
this.showLikesModal = true;
this.$nextTick(() => {
this.$refs.likesModal.open();
@ -513,33 +554,59 @@
shareStatus(index) {
let status = this.feed[index];
let state = status.reblogged;
let count = status.reblogs_count;
this.feed[index].reblogs_count = count + 1;
this.feed[index].reblogged = !status.reblogged;
if(status.reblog) {
status = status.reblog;
let state = status.reblogged;
let count = status.reblogs_count;
this.feed[index].reblog.reblogs_count = count + 1;
this.feed[index].reblog.reblogged = !status.reblogged;
} else {
let state = status.reblogged;
let count = status.reblogs_count;
this.feed[index].reblogs_count = count + 1;
this.feed[index].reblogged = !status.reblogged;
}
axios.post('/api/v1/statuses/' + status.id + '/reblog')
.then(res => {
//
}).catch(err => {
this.feed[index].reblogs_count = count;
this.feed[index].reblogged = false;
if(status.reblog) {
this.feed[index].reblog.reblogs_count = count;
this.feed[index].reblog.reblogged = false;
} else {
this.feed[index].reblogs_count = count;
this.feed[index].reblogged = false;
}
})
},
unshareStatus(index) {
let status = this.feed[index];
let state = status.reblogged;
let count = status.reblogs_count;
this.feed[index].reblogs_count = count - 1;
this.feed[index].reblogged = !status.reblogged;
if(status.reblog) {
status = status.reblog;
let state = status.reblogged;
let count = status.reblogs_count;
this.feed[index].reblog.reblogs_count = count - 1;
this.feed[index].reblog.reblogged = !status.reblogged;
} else {
let state = status.reblogged;
let count = status.reblogs_count;
this.feed[index].reblogs_count = count - 1;
this.feed[index].reblogged = !status.reblogged;
}
axios.post('/api/v1/statuses/' + status.id + '/unreblog')
.then(res => {
//
}).catch(err => {
this.feed[index].reblogs_count = count;
this.feed[index].reblogged = false;
if(status.reblog) {
this.feed[index].reblog.reblogs_count = count;
this.feed[index].reblog.reblogged = false;
} else {
this.feed[index].reblogs_count = count;
this.feed[index].reblogged = false;
}
})
},
@ -554,11 +621,19 @@
handleBookmark(index) {
let p = this.feed[index];
if(p.reblog) {
p = p.reblog;
}
axios.post('/i/bookmark', {
item: p.id
})
.then(res => {
this.feed[index].bookmarked = !p.bookmarked;
if(this.feed[index].reblog) {
this.feed[index].reblog.bookmarked = !p.bookmarked;
} else {
this.feed[index].bookmarked = !p.bookmarked;
}
})
.catch(err => {
// this.feed[index].bookmarked = false;
@ -571,31 +646,51 @@
},
follow(index) {
// this.feed[index].relationship.following = true;
axios.post('/api/v1/accounts/' + this.feed[index].account.id + '/follow')
.then(res => {
this.$store.commit('updateRelationship', [res.data]);
this.updateProfile({ following_count: this.profile.following_count + 1 });
this.feed[index].account.followers_count = this.feed[index].account.followers_count + 1;
}).catch(err => {
swal('Oops!', 'An error occured when attempting to follow this account.', 'error');
this.feed[index].relationship.following = false;
});
if(this.feed[index].reblog) {
axios.post('/api/v1/accounts/' + this.feed[index].reblog.account.id + '/follow')
.then(res => {
this.$store.commit('updateRelationship', [res.data]);
this.updateProfile({ following_count: this.profile.following_count + 1 });
this.feed[index].reblog.account.followers_count = this.feed[index].reblog.account.followers_count + 1;
}).catch(err => {
swal('Oops!', 'An error occured when attempting to follow this account.', 'error');
this.feed[index].reblog.relationship.following = false;
});
} else {
axios.post('/api/v1/accounts/' + this.feed[index].account.id + '/follow')
.then(res => {
this.$store.commit('updateRelationship', [res.data]);
this.updateProfile({ following_count: this.profile.following_count + 1 });
this.feed[index].account.followers_count = this.feed[index].account.followers_count + 1;
}).catch(err => {
swal('Oops!', 'An error occured when attempting to follow this account.', 'error');
this.feed[index].relationship.following = false;
});
}
},
unfollow(index) {
// this.feed[index].relationship.following = false;
axios.post('/api/v1/accounts/' + this.feed[index].account.id + '/unfollow')
.then(res => {
this.$store.commit('updateRelationship', [res.data]);
this.updateProfile({ following_count: this.profile.following_count - 1 });
this.feed[index].account.followers_count = this.feed[index].account.followers_count - 1;
}).catch(err => {
swal('Oops!', 'An error occured when attempting to unfollow this account.', 'error');
this.feed[index].relationship.following = true;
});
if(this.feed[index].reblog) {
axios.post('/api/v1/accounts/' + this.feed[index].reblog.account.id + '/unfollow')
.then(res => {
this.$store.commit('updateRelationship', [res.data]);
this.updateProfile({ following_count: this.profile.following_count - 1 });
this.feed[index].reblog.account.followers_count = this.feed[index].reblog.account.followers_count - 1;
}).catch(err => {
swal('Oops!', 'An error occured when attempting to unfollow this account.', 'error');
this.feed[index].reblog.relationship.following = true;
});
} else {
axios.post('/api/v1/accounts/' + this.feed[index].account.id + '/unfollow')
.then(res => {
this.$store.commit('updateRelationship', [res.data]);
this.updateProfile({ following_count: this.profile.following_count - 1 });
this.feed[index].account.followers_count = this.feed[index].account.followers_count - 1;
}).catch(err => {
swal('Oops!', 'An error occured when attempting to unfollow this account.', 'error');
this.feed[index].relationship.following = true;
});
}
},
updateProfile(delta) {