From 1a333aabba759fb68449ead9c47e986f456e8c8c Mon Sep 17 00:00:00 2001 From: Sean King Date: Tue, 7 Jun 2022 21:31:48 -0600 Subject: Add edit status functionality --- src/services/entity_normalizer/entity_normalizer.service.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/services/entity_normalizer/entity_normalizer.service.js') diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index f219c161..82c19655 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -244,6 +244,16 @@ export const parseAttachment = (data) => { return output } +export const parseSource = (data) => { + const output = {} + + output.text = data.text + output.spoiler_text = data.spoiler_text + output.content_type = data.content_type + + return output +} + export const parseStatus = (data) => { const output = {} const masto = data.hasOwnProperty('account') @@ -265,6 +275,8 @@ export const parseStatus = (data) => { output.tags = data.tags + output.is_edited = data.edited_at !== null + if (data.pleroma) { const { pleroma } = data output.text = pleroma.content ? data.pleroma.content['text/plain'] : data.content -- cgit v1.2.3-70-g09d2 From fa5d35523dd081b6948d38325374cac5707b7868 Mon Sep 17 00:00:00 2001 From: Sean King Date: Mon, 20 Jun 2022 22:52:08 -0600 Subject: Add ability to view status history for edited statuses --- src/App.js | 2 + src/App.vue | 1 + src/components/extra_buttons/extra_buttons.js | 23 ++++++++- src/components/extra_buttons/extra_buttons.vue | 11 ++++ .../status_history_modal/status_history_modal.js | 60 ++++++++++++++++++++++ .../status_history_modal/status_history_modal.vue | 46 +++++++++++++++++ src/i18n/en.json | 3 +- src/main.js | 2 + src/modules/statusHistory.js | 25 +++++++++ src/modules/statuses.js | 3 ++ src/services/api/api.service.js | 17 +++--- .../entity_normalizer/entity_normalizer.service.js | 6 ++- 12 files changed, 186 insertions(+), 13 deletions(-) create mode 100644 src/components/status_history_modal/status_history_modal.js create mode 100644 src/components/status_history_modal/status_history_modal.vue create mode 100644 src/modules/statusHistory.js (limited to 'src/services/entity_normalizer/entity_normalizer.service.js') diff --git a/src/App.js b/src/App.js index 6e0e34a8..af638a1c 100644 --- a/src/App.js +++ b/src/App.js @@ -13,6 +13,7 @@ import DesktopNav from './components/desktop_nav/desktop_nav.vue' import UserReportingModal from './components/user_reporting_modal/user_reporting_modal.vue' import EditStatusModal from './components/edit_status_modal/edit_status_modal.vue' import PostStatusModal from './components/post_status_modal/post_status_modal.vue' +import StatusHistoryModal from './components/status_history_modal/status_history_modal.vue' import GlobalNoticeList from './components/global_notice_list/global_notice_list.vue' import { windowWidth, windowHeight } from './services/window_utils/window_utils' import { mapGetters } from 'vuex' @@ -37,6 +38,7 @@ export default { UserReportingModal, PostStatusModal, EditStatusModal, + StatusHistoryModal, GlobalNoticeList }, data: () => ({ diff --git a/src/App.vue b/src/App.vue index 9484f993..1b513e08 100644 --- a/src/App.vue +++ b/src/App.vue @@ -53,6 +53,7 @@ + diff --git a/src/components/status/status.vue b/src/components/status/status.vue index a13e5ab0..5ddb94b4 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -340,13 +340,11 @@ keypath="time.in_past" tag="span" > - + diff --git a/src/components/status_history_modal/status_history_modal.vue b/src/components/status_history_modal/status_history_modal.vue index d6680df2..990be35b 100644 --- a/src/components/status_history_modal/status_history_modal.vue +++ b/src/components/status_history_modal/status_history_modal.vue @@ -17,9 +17,9 @@ v-for="status in history" :key="status.id" :statusoid="status" - :isPreview="true" + :is-preview="true" class="conversation-status status-fadein panel-body" - /> + /> diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 41c14596..381dd112 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -417,7 +417,7 @@ const fetchStatus = ({ id, credentials }) => { } const fetchStatusSource = ({ id, credentials }) => { - let url = MASTODON_STATUS_SOURCE_URL(id) + const url = MASTODON_STATUS_SOURCE_URL(id) return fetch(url, { headers: authHeaders(credentials) }) .then((data) => { if (data.ok) { @@ -430,7 +430,7 @@ const fetchStatusSource = ({ id, credentials }) => { } const fetchStatusHistory = ({ status, credentials }) => { - let url = MASTODON_STATUS_HISTORY_URL(status.id) + const url = MASTODON_STATUS_HISTORY_URL(status.id) return promisedRequest({ url, credentials }) .then((data) => { data.reverse() @@ -767,7 +767,7 @@ const editStatus = ({ }) } - let putHeaders = authHeaders(credentials) + const putHeaders = authHeaders(credentials) return fetch(MASTODON_STATUS_URL(id), { body: form, diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index c00e9796..c1b2ffac 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -378,7 +378,7 @@ export const parseStatus = (data) => { output.favoritedBy = [] output.rebloggedBy = [] - if (data.hasOwnProperty('originalStatus')) { + if (Object.prototype.hasOwnProperty.call(data, 'originalStatus')) { Object.assign(output, data.originalStatus) } -- cgit v1.2.3-70-g09d2