From affbe8700ec85cf39afd4c4cdf978a9a579e57c7 Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 4 Apr 2019 11:27:02 -0400 Subject: #468 - integrate endpoints --- src/services/api/api.service.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/services/api/api.service.js') diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index b7a602b8..65cebe78 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -51,6 +51,8 @@ const MASTODON_STATUS_FAVORITEDBY_URL = id => `/api/v1/statuses/${id}/favourited const MASTODON_STATUS_REBLOGGEDBY_URL = id => `/api/v1/statuses/${id}/reblogged_by` const MASTODON_PROFILE_UPDATE_URL = '/api/v1/accounts/update_credentials' const MASTODON_REPORT_USER_URL = '/api/v1/reports' +const MASTODON_PIN_OWN_STATUS = id => `/api/v1/statuses/${id}/pin` +const MASTODON_UNPIN_OWN_STATUS = id => `/api/v1/statuses/${id}/unpin` import { each, map, concat, last } from 'lodash' import { parseStatus, parseUser, parseNotification, parseAttachment } from '../entity_normalizer/entity_normalizer.service.js' @@ -210,6 +212,22 @@ const unfollowUser = ({id, credentials}) => { }).then((data) => data.json()) } +const pinOwnStatus = ({ id, credentials }) => { + let url = MASTODON_PIN_OWN_STATUS(id) + return fetch(url, { + headers: authHeaders(credentials), + method: 'POST' + }).then((data) => data.json()) +} + +const unpinOwnStatus = ({ id, credentials }) => { + let url = MASTODON_UNPIN_OWN_STATUS(id) + return fetch(url, { + headers: authHeaders(credentials), + method: 'POST' + }).then((data) => data.json()) +} + const blockUser = ({id, credentials}) => { return fetch(MASTODON_BLOCK_USER_URL(id), { headers: authHeaders(credentials), @@ -715,6 +733,8 @@ const apiService = { fetchFollowers, followUser, unfollowUser, + pinOwnStatus, + unpinOwnStatus, blockUser, unblockUser, fetchUser, -- cgit v1.2.3-70-g09d2 From 2c89d49a3d22ed2813a6a57fb6049341fa8624ba Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 4 Apr 2019 15:10:34 -0400 Subject: #468 - show pinned timeline and add pinned label to the status --- src/components/conversation/conversation.js | 3 ++- src/components/conversation/conversation.vue | 1 + src/components/status/status.js | 3 ++- src/components/status/status.vue | 17 ++++++++++--- src/components/timeline/timeline.js | 3 ++- src/components/timeline/timeline.vue | 3 ++- src/components/user_profile/user_profile.js | 5 ++++ src/components/user_profile/user_profile.vue | 29 ++++++++++++++-------- src/modules/statuses.js | 3 ++- src/services/api/api.service.js | 14 +++++++++++ .../timeline_fetcher/timeline_fetcher.service.js | 6 +++++ 11 files changed, 69 insertions(+), 18 deletions(-) (limited to 'src/services/api/api.service.js') diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js index ffeb7244..fc239ee9 100644 --- a/src/components/conversation/conversation.js +++ b/src/components/conversation/conversation.js @@ -41,7 +41,8 @@ const conversation = { props: [ 'statusoid', 'collapsable', - 'isPage' + 'isPage', + 'pinned' ], created () { if (this.isPage) { diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue index d04ff722..40011113 100644 --- a/src/components/conversation/conversation.vue +++ b/src/components/conversation/conversation.vue @@ -13,6 +13,7 @@ :key="status.id" :inlineExpanded="collapsable && isExpanded" :statusoid="status" + :pinned="pinned" :expandable='!isExpanded' :focused="focused(status.id)" :inConversation="isExpanded" diff --git a/src/components/status/status.js b/src/components/status/status.js index a3596b69..f2881742 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -26,7 +26,8 @@ const Status = { 'replies', 'isPreview', 'noHeading', - 'inlineExpanded' + 'inlineExpanded', + 'pinned' ], data () { return { diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 0443e758..a5614f59 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -12,6 +12,13 @@