ContextMenu.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <template>
  2. <div class="modal-stack">
  3. <b-modal ref="ctxModal"
  4. id="ctx-modal"
  5. hide-header
  6. hide-footer
  7. centered
  8. rounded
  9. size="sm"
  10. body-class="list-group-flush p-0 rounded">
  11. <div class="list-group text-center">
  12. <!-- <div v-if="status && status.account.id != profile.id && ctxMenuRelationship && ctxMenuRelationship.following" class="list-group-item rounded cursor-pointer font-weight-bold text-danger" @click="ctxMenuUnfollow()">Unfollow</div>
  13. <div v-if="status && status.account.id != profile.id && ctxMenuRelationship && !ctxMenuRelationship.following" class="list-group-item rounded cursor-pointer font-weight-bold text-primary" @click="ctxMenuFollow()">Follow</div> -->
  14. <div class="list-group-item rounded cursor-pointer" @click="ctxMenuGoToPost()">View Post</div>
  15. <!-- <div v-if="status && status.local == true && !status.in_reply_to_id" class="list-group-item rounded cursor-pointer" @click="ctxMenuEmbed()">Embed</div>
  16. <div class="list-group-item rounded cursor-pointer" @click="ctxMenuCopyLink()">Copy Link</div> -->
  17. <div class="list-group-item rounded cursor-pointer" @click="ctxMenuShare()">Share</div>
  18. <div v-if="status && profile && profile.is_admin == true" class="list-group-item rounded cursor-pointer" @click="ctxModMenuShow()">Moderation Tools</div>
  19. <div v-if="status && status.account.id != profile.id" class="list-group-item rounded cursor-pointer text-danger" @click="ctxMenuReportPost()">Report</div>
  20. <div v-if="status && (profile.is_admin || profile.id == status.account.id)" class="list-group-item rounded cursor-pointer text-danger" @click="deletePost(status)">Delete</div>
  21. <div class="list-group-item rounded cursor-pointer text-lighter" @click="closeCtxMenu()">Cancel</div>
  22. </div>
  23. </b-modal>
  24. <b-modal ref="ctxModModal"
  25. id="ctx-mod-modal"
  26. hide-header
  27. hide-footer
  28. centered
  29. rounded
  30. size="sm"
  31. body-class="list-group-flush p-0 rounded">
  32. <div class="list-group text-center">
  33. <p class="py-2 px-3 mb-0">
  34. <div class="text-center font-weight-bold text-danger">Moderation Tools</div>
  35. <div class="small text-center text-muted">Select one of the following options</div>
  36. </p>
  37. <div class="list-group-item rounded cursor-pointer" @click="moderatePost(status, 'unlist')">Unlist from Timelines</div>
  38. <div v-if="status.sensitive" class="list-group-item rounded cursor-pointer" @click="moderatePost(status, 'remcw')">Remove Content Warning</div>
  39. <div v-else class="list-group-item rounded cursor-pointer" @click="moderatePost(status, 'addcw')">Add Content Warning</div>
  40. <!-- <div class="list-group-item rounded cursor-pointer" @click="ctxModOtherMenuShow()">Other</div> -->
  41. <div class="list-group-item rounded cursor-pointer text-lighter" @click="ctxModMenuClose()">Cancel</div>
  42. </div>
  43. </b-modal>
  44. <b-modal ref="ctxModOtherModal"
  45. id="ctx-mod-other-modal"
  46. hide-header
  47. hide-footer
  48. centered
  49. rounded
  50. size="sm"
  51. body-class="list-group-flush p-0 rounded">
  52. <div class="list-group text-center">
  53. <p class="py-2 px-3 mb-0">
  54. <div class="text-center font-weight-bold text-danger">Moderation Tools</div>
  55. <div class="small text-center text-muted">Select one of the following options</div>
  56. </p>
  57. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="confirmModal()">Unlist Posts</div>
  58. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="confirmModal()">Moderation Log</div>
  59. <div class="list-group-item rounded cursor-pointer text-lighter" @click="ctxModOtherMenuClose()">Cancel</div>
  60. </div>
  61. </b-modal>
  62. <b-modal ref="ctxShareModal"
  63. id="ctx-share-modal"
  64. title="Share"
  65. hide-footer
  66. hide-header
  67. centered
  68. rounded
  69. size="sm"
  70. body-class="list-group-flush p-0 rounded text-center">
  71. <div class="list-group-item rounded cursor-pointer" @click="shareStatus(status, $event)">{{status.reblogged ? 'Unshare' : 'Share'}} to Followers</div>
  72. <div class="list-group-item rounded cursor-pointer" @click="ctxMenuCopyLink()">Copy Link</div>
  73. <div v-if="status && status.local == true && !status.in_reply_to_id" class="list-group-item rounded cursor-pointer" @click="ctxMenuEmbed()">Embed</div>
  74. <!-- <div class="list-group-item rounded cursor-pointer border-top-0">Email</div>
  75. <div class="list-group-item rounded cursor-pointer">Facebook</div>
  76. <div class="list-group-item rounded cursor-pointer">Mastodon</div>
  77. <div class="list-group-item rounded cursor-pointer">Pinterest</div>
  78. <div class="list-group-item rounded cursor-pointer">Pixelfed</div>
  79. <div class="list-group-item rounded cursor-pointer">Twitter</div>
  80. <div class="list-group-item rounded cursor-pointer">VK</div> -->
  81. <div class="list-group-item rounded cursor-pointer text-lighter" @click="closeCtxShareMenu()">Cancel</div>
  82. </b-modal>
  83. <b-modal ref="ctxEmbedModal"
  84. id="ctx-embed-modal"
  85. hide-header
  86. hide-footer
  87. centered
  88. rounded
  89. size="md"
  90. body-class="p-2 rounded">
  91. <div>
  92. <div class="form-group">
  93. <textarea class="form-control disabled text-monospace" rows="8" style="overflow-y:hidden;border: 1px solid #efefef; font-size: 12px; line-height: 18px; margin: 0 0 7px;resize:none;" v-model="ctxEmbedPayload" disabled=""></textarea>
  94. </div>
  95. <div class="form-group pl-2 d-flex justify-content-center">
  96. <div class="form-check mr-3">
  97. <input class="form-check-input" type="checkbox" v-model="ctxEmbedShowCaption" :disabled="ctxEmbedCompactMode == true">
  98. <label class="form-check-label font-weight-light">
  99. Show Caption
  100. </label>
  101. </div>
  102. <div class="form-check mr-3">
  103. <input class="form-check-input" type="checkbox" v-model="ctxEmbedShowLikes" :disabled="ctxEmbedCompactMode == true">
  104. <label class="form-check-label font-weight-light">
  105. Show Likes
  106. </label>
  107. </div>
  108. <div class="form-check">
  109. <input class="form-check-input" type="checkbox" v-model="ctxEmbedCompactMode">
  110. <label class="form-check-label font-weight-light">
  111. Compact Mode
  112. </label>
  113. </div>
  114. </div>
  115. <hr>
  116. <button :class="copiedEmbed ? 'btn btn-primary btn-block btn-sm py-1 font-weight-bold disabed': 'btn btn-primary btn-block btn-sm py-1 font-weight-bold'" @click="ctxCopyEmbed" :disabled="copiedEmbed">{{copiedEmbed ? 'Embed Code Copied!' : 'Copy Embed Code'}}</button>
  117. <p class="mb-0 px-2 small text-muted">By using this embed, you agree to our <a href="/site/terms">Terms of Use</a></p>
  118. </div>
  119. </b-modal>
  120. <b-modal ref="ctxReport"
  121. id="ctx-report"
  122. hide-header
  123. hide-footer
  124. centered
  125. rounded
  126. size="sm"
  127. body-class="list-group-flush p-0 rounded">
  128. <p class="py-2 px-3 mb-0">
  129. <div class="text-center font-weight-bold text-danger">Report</div>
  130. <div class="small text-center text-muted">Select one of the following options</div>
  131. </p>
  132. <div class="list-group text-center">
  133. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="sendReport('spam')">Spam</div>
  134. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="sendReport('sensitive')">Sensitive Content</div>
  135. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="sendReport('abusive')">Abusive or Harmful</div>
  136. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="openCtxReportOtherMenu()">Other</div>
  137. <!-- <div class="list-group-item rounded cursor-pointer" @click="ctxReportMenuGoBack()">Go Back</div> -->
  138. <div class="list-group-item rounded cursor-pointer text-lighter" @click="ctxReportMenuGoBack()">Cancel</div>
  139. </div>
  140. </b-modal>
  141. <b-modal ref="ctxReportOther"
  142. id="ctx-report-other"
  143. hide-header
  144. hide-footer
  145. centered
  146. rounded
  147. size="sm"
  148. body-class="list-group-flush p-0 rounded">
  149. <p class="py-2 px-3 mb-0">
  150. <div class="text-center font-weight-bold text-danger">Report</div>
  151. <div class="small text-center text-muted">Select one of the following options</div>
  152. </p>
  153. <div class="list-group text-center">
  154. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="sendReport('underage')">Underage Account</div>
  155. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="sendReport('copyright')">Copyright Infringement</div>
  156. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="sendReport('impersonation')">Impersonation</div>
  157. <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="sendReport('scam')">Scam or Fraud</div>
  158. <!-- <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="sendReport('terrorism')">Terrorism Related</div> -->
  159. <!-- <div class="list-group-item rounded cursor-pointer font-weight-bold" @click="sendReport('other')">Other or Not listed</div> -->
  160. <!-- <div class="list-group-item rounded cursor-pointer" @click="ctxReportOtherMenuGoBack()">Go Back</div> -->
  161. <div class="list-group-item rounded cursor-pointer text-lighter" @click="ctxReportOtherMenuGoBack()">Cancel</div>
  162. </div>
  163. </b-modal>
  164. <b-modal ref="ctxConfirm"
  165. id="ctx-confirm"
  166. hide-header
  167. hide-footer
  168. centered
  169. rounded
  170. size="sm"
  171. body-class="list-group-flush p-0 rounded">
  172. <div class="d-flex align-items-center justify-content-center py-3">
  173. <div>{{ this.confirmModalTitle }}</div>
  174. </div>
  175. <div class="d-flex border-top btn-group btn-group-block rounded-0" role="group">
  176. <button type="button" class="btn btn-outline-lighter border-left-0 border-top-0 border-bottom-0 border-right py-2" style="color: rgb(0,122,255) !important;" @click.prevent="confirmModalCancel()">Cancel</button>
  177. <button type="button" class="btn btn-outline-lighter border-0" style="color: rgb(0,122,255) !important;" @click.prevent="confirmModalConfirm()">Confirm</button>
  178. </div>
  179. </b-modal>
  180. </div>
  181. </template>
  182. <script type="text/javascript">
  183. export default {
  184. props: [
  185. 'status',
  186. 'profile'
  187. ],
  188. data() {
  189. return {
  190. ctxMenuStatus: false,
  191. ctxMenuRelationship: false,
  192. ctxEmbedPayload: false,
  193. copiedEmbed: false,
  194. replySending: false,
  195. ctxEmbedShowCaption: true,
  196. ctxEmbedShowLikes: false,
  197. ctxEmbedCompactMode: false,
  198. confirmModalTitle: 'Are you sure?',
  199. confirmModalIdentifer: null,
  200. confirmModalType: false,
  201. }
  202. },
  203. watch: {
  204. ctxEmbedShowCaption: function (n,o) {
  205. if(n == true) {
  206. this.ctxEmbedCompactMode = false;
  207. }
  208. let mode = this.ctxEmbedCompactMode ? 'compact' : 'full';
  209. this.ctxEmbedPayload = window.App.util.embed.post(this.ctxMenuStatus.url, this.ctxEmbedShowCaption, this.ctxEmbedShowLikes, mode);
  210. },
  211. ctxEmbedShowLikes: function (n,o) {
  212. if(n == true) {
  213. this.ctxEmbedCompactMode = false;
  214. }
  215. let mode = this.ctxEmbedCompactMode ? 'compact' : 'full';
  216. this.ctxEmbedPayload = window.App.util.embed.post(this.ctxMenuStatus.url, this.ctxEmbedShowCaption, this.ctxEmbedShowLikes, mode);
  217. },
  218. ctxEmbedCompactMode: function (n,o) {
  219. if(n == true) {
  220. this.ctxEmbedShowCaption = false;
  221. this.ctxEmbedShowLikes = false;
  222. }
  223. let mode = this.ctxEmbedCompactMode ? 'compact' : 'full';
  224. this.ctxEmbedPayload = window.App.util.embed.post(this.ctxMenuStatus.url, this.ctxEmbedShowCaption, this.ctxEmbedShowLikes, mode);
  225. }
  226. },
  227. methods: {
  228. open() {
  229. this.ctxMenu();
  230. },
  231. ctxMenu() {
  232. this.ctxMenuStatus = this.status;
  233. this.ctxEmbedPayload = window.App.util.embed.post(this.status.url);
  234. if(this.status.account.id == this.profile.id) {
  235. this.ctxMenuRelationship = false;
  236. this.$refs.ctxModal.show();
  237. } else {
  238. axios.get('/api/pixelfed/v1/accounts/relationships', {
  239. params: {
  240. 'id[]': this.status.account.id
  241. }
  242. }).then(res => {
  243. this.ctxMenuRelationship = res.data[0];
  244. this.$refs.ctxModal.show();
  245. });
  246. }
  247. },
  248. closeCtxMenu() {
  249. this.copiedEmbed = false;
  250. this.ctxMenuStatus = false;
  251. this.ctxMenuRelationship = false;
  252. this.$refs.ctxModal.hide();
  253. this.$refs.ctxReport.hide();
  254. this.$refs.ctxReportOther.hide();
  255. this.closeModals();
  256. },
  257. ctxMenuCopyLink() {
  258. let status = this.ctxMenuStatus;
  259. navigator.clipboard.writeText(status.url);
  260. this.closeModals();
  261. return;
  262. },
  263. ctxMenuGoToPost() {
  264. let status = this.ctxMenuStatus;
  265. window.location.href = this.statusUrl(status);
  266. this.closeCtxMenu();
  267. return;
  268. },
  269. ctxMenuFollow() {
  270. let id = this.ctxMenuStatus.account.id;
  271. axios.post('/i/follow', {
  272. item: id
  273. }).then(res => {
  274. let username = this.ctxMenuStatus.account.acct;
  275. this.closeCtxMenu();
  276. setTimeout(function() {
  277. swal('Follow successful!', 'You are now following ' + username, 'success');
  278. }, 500);
  279. });
  280. },
  281. ctxMenuUnfollow() {
  282. let id = this.ctxMenuStatus.account.id;
  283. axios.post('/i/follow', {
  284. item: id
  285. }).then(res => {
  286. let username = this.ctxMenuStatus.account.acct;
  287. if(this.scope == 'home') {
  288. this.feed = this.feed.filter(s => {
  289. return s.account.id != this.ctxMenuStatus.account.id;
  290. });
  291. }
  292. this.closeCtxMenu();
  293. setTimeout(function() {
  294. swal('Unfollow successful!', 'You are no longer following ' + username, 'success');
  295. }, 500);
  296. });
  297. },
  298. ctxMenuReportPost() {
  299. this.$refs.ctxModal.hide();
  300. this.$refs.ctxReport.show();
  301. return;
  302. },
  303. ctxMenuEmbed() {
  304. this.closeModals();
  305. this.$refs.ctxEmbedModal.show();
  306. },
  307. ctxMenuShare() {
  308. this.$refs.ctxModal.hide();
  309. this.$refs.ctxShareModal.show();
  310. },
  311. closeCtxShareMenu() {
  312. this.$refs.ctxShareModal.hide();
  313. this.$refs.ctxModal.show();
  314. },
  315. ctxCopyEmbed() {
  316. navigator.clipboard.writeText(this.ctxEmbedPayload);
  317. this.ctxEmbedShowCaption = true;
  318. this.ctxEmbedShowLikes = false;
  319. this.ctxEmbedCompactMode = false;
  320. this.$refs.ctxEmbedModal.hide();
  321. },
  322. ctxModMenuShow() {
  323. this.$refs.ctxModal.hide();
  324. this.$refs.ctxModModal.show();
  325. },
  326. ctxModOtherMenuShow() {
  327. this.$refs.ctxModal.hide();
  328. this.$refs.ctxModModal.hide();
  329. this.$refs.ctxModOtherModal.show();
  330. },
  331. ctxModMenu() {
  332. this.$refs.ctxModal.hide();
  333. },
  334. ctxModMenuClose() {
  335. this.closeModals();
  336. this.$refs.ctxModal.show();
  337. },
  338. ctxModOtherMenuClose() {
  339. this.closeModals();
  340. this.$refs.ctxModModal.show();
  341. },
  342. formatCount(count) {
  343. return App.util.format.count(count);
  344. },
  345. openCtxReportOtherMenu() {
  346. let s = this.ctxMenuStatus;
  347. this.closeCtxMenu();
  348. this.ctxMenuStatus = s;
  349. this.$refs.ctxReportOther.show();
  350. },
  351. ctxReportMenuGoBack() {
  352. this.$refs.ctxReportOther.hide();
  353. this.$refs.ctxReport.hide();
  354. this.$refs.ctxModal.show();
  355. },
  356. ctxReportOtherMenuGoBack() {
  357. this.$refs.ctxReportOther.hide();
  358. this.$refs.ctxModal.hide();
  359. this.$refs.ctxReport.show();
  360. },
  361. sendReport(type) {
  362. let id = this.ctxMenuStatus.id;
  363. swal({
  364. 'title': 'Confirm Report',
  365. 'text': 'Are you sure you want to report this post?',
  366. 'icon': 'warning',
  367. 'buttons': true,
  368. 'dangerMode': true
  369. }).then((res) => {
  370. if(res) {
  371. axios.post('/i/report/', {
  372. 'report': type,
  373. 'type': 'post',
  374. 'id': id,
  375. }).then(res => {
  376. this.closeCtxMenu();
  377. swal('Report Sent!', 'We have successfully received your report.', 'success');
  378. }).catch(err => {
  379. swal('Oops!', 'There was an issue reporting this post.', 'error');
  380. })
  381. } else {
  382. this.closeCtxMenu();
  383. }
  384. });
  385. },
  386. closeModals() {
  387. this.$refs.ctxModal.hide();
  388. this.$refs.ctxModModal.hide();
  389. this.$refs.ctxModOtherModal.hide();
  390. this.$refs.ctxShareModal.hide();
  391. this.$refs.ctxEmbedModal.hide();
  392. this.$refs.ctxReport.hide();
  393. this.$refs.ctxReportOther.hide();
  394. this.$refs.ctxConfirm.hide();
  395. },
  396. openCtxStatusModal() {
  397. this.closeModals();
  398. this.$refs.ctxStatusModal.show();
  399. },
  400. openConfirmModal() {
  401. this.closeModals();
  402. this.$refs.ctxConfirm.show();
  403. },
  404. closeConfirmModal() {
  405. this.closeModals();
  406. this.confirmModalTitle = 'Are you sure?';
  407. this.confirmModalType = false;
  408. this.confirmModalIdentifer = null;
  409. },
  410. confirmModalConfirm() {
  411. switch(this.confirmModalType) {
  412. case 'post.delete':
  413. axios.post('/i/delete', {
  414. type: 'status',
  415. item: this.confirmModalIdentifer
  416. }).then(res => {
  417. this.feed = this.feed.filter(s => {
  418. return s.id != this.confirmModalIdentifer;
  419. });
  420. this.closeConfirmModal();
  421. }).catch(err => {
  422. this.closeConfirmModal();
  423. swal('Error', 'Something went wrong. Please try again later.', 'error');
  424. });
  425. break;
  426. }
  427. this.closeConfirmModal();
  428. },
  429. confirmModalCancel() {
  430. this.closeConfirmModal();
  431. },
  432. moderatePost(status, action, $event) {
  433. let username = status.account.username;
  434. let msg = '';
  435. let self = this;
  436. switch(action) {
  437. case 'addcw':
  438. msg = 'Are you sure you want to add a content warning to this post?';
  439. swal({
  440. title: 'Confirm',
  441. text: msg,
  442. icon: 'warning',
  443. buttons: true,
  444. dangerMode: true
  445. }).then(res => {
  446. if(res) {
  447. axios.post('/api/v2/moderator/action', {
  448. action: action,
  449. item_id: status.id,
  450. item_type: 'status'
  451. }).then(res => {
  452. swal('Success', 'Successfully added content warning', 'success');
  453. status.sensitive = true;
  454. self.ctxModMenuClose();
  455. }).catch(err => {
  456. swal(
  457. 'Error',
  458. 'Something went wrong, please try again later.',
  459. 'error'
  460. );
  461. self.ctxModMenuClose();
  462. });
  463. }
  464. });
  465. break;
  466. case 'remcw':
  467. msg = 'Are you sure you want to remove the content warning on this post?';
  468. swal({
  469. title: 'Confirm',
  470. text: msg,
  471. icon: 'warning',
  472. buttons: true,
  473. dangerMode: true
  474. }).then(res => {
  475. if(res) {
  476. axios.post('/api/v2/moderator/action', {
  477. action: action,
  478. item_id: status.id,
  479. item_type: 'status'
  480. }).then(res => {
  481. swal('Success', 'Successfully added content warning', 'success');
  482. status.sensitive = false;
  483. self.ctxModMenuClose();
  484. }).catch(err => {
  485. swal(
  486. 'Error',
  487. 'Something went wrong, please try again later.',
  488. 'error'
  489. );
  490. self.ctxModMenuClose();
  491. });
  492. }
  493. });
  494. break;
  495. case 'unlist':
  496. msg = 'Are you sure you want to unlist this post?';
  497. swal({
  498. title: 'Confirm',
  499. text: msg,
  500. icon: 'warning',
  501. buttons: true,
  502. dangerMode: true
  503. }).then(res => {
  504. if(res) {
  505. axios.post('/api/v2/moderator/action', {
  506. action: action,
  507. item_id: status.id,
  508. item_type: 'status'
  509. }).then(res => {
  510. this.feed = this.feed.filter(f => {
  511. return f.id != status.id;
  512. });
  513. swal('Success', 'Successfully unlisted post', 'success');
  514. self.ctxModMenuClose();
  515. }).catch(err => {
  516. self.ctxModMenuClose();
  517. swal(
  518. 'Error',
  519. 'Something went wrong, please try again later.',
  520. 'error'
  521. );
  522. });
  523. }
  524. });
  525. break;
  526. }
  527. },
  528. shareStatus(status, $event) {
  529. if($('body').hasClass('loggedIn') == false) {
  530. return;
  531. }
  532. this.closeModals();
  533. axios.post('/i/share', {
  534. item: status.id
  535. }).then(res => {
  536. status.reblogs_count = res.data.count;
  537. status.reblogged = !status.reblogged;
  538. if(status.reblogged) {
  539. swal('Success', 'You shared this post', 'success');
  540. } else {
  541. swal('Success', 'You unshared this post', 'success');
  542. }
  543. }).catch(err => {
  544. swal('Error', 'Something went wrong, please try again later.', 'error');
  545. });
  546. },
  547. }
  548. }
  549. </script>