From 94e7edc366b73b060060995ddc27a0bf0d4f568b Mon Sep 17 00:00:00 2001 From: Sean King Date: Mon, 20 Jun 2022 22:52:08 -0600 Subject: [PATCH] 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 ++++++- .../extra_buttons/extra_buttons.vue | 11 ++++ .../status_history_modal.js | 60 +++++++++++++++++++ .../status_history_modal.vue | 46 ++++++++++++++ src/main.js | 4 +- src/modules/statusHistory.js | 25 ++++++++ src/modules/statuses.js | 3 + src/services/api/api.service.js | 17 +++--- .../entity_normalizer.service.js | 6 +- 11 files changed, 185 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 diff --git a/src/App.js b/src/App.js index 6637a08e..5310d504 100644 --- a/src/App.js +++ b/src/App.js @@ -12,6 +12,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' @@ -35,6 +36,7 @@ export default { UserReportingModal, PostStatusModal, EditStatusModal, + StatusHistoryModal, GlobalNoticeList }, data: () => ({ diff --git a/src/App.vue b/src/App.vue index 1e2cd343..7aad1a65 100644 --- a/src/App.vue +++ b/src/App.vue @@ -59,6 +59,7 @@ + diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js index 2a375a80..27b9b7c9 100644 --- a/src/components/extra_buttons/extra_buttons.js +++ b/src/components/extra_buttons/extra_buttons.js @@ -7,7 +7,8 @@ import { faEyeSlash, faThumbtack, faShareAlt, - faExternalLinkAlt + faExternalLinkAlt, + faHistory } from '@fortawesome/free-solid-svg-icons' import { faBookmark as faBookmarkReg, @@ -22,7 +23,8 @@ library.add( faThumbtack, faShareAlt, faExternalLinkAlt, - faFlag + faFlag, + faHistory ) const ExtraButtons = { @@ -114,6 +116,20 @@ const ExtraButtons = { visibility: this.status.visibility, statusContentType: data.content_type })) + }, + showStatusHistory () { + let originalStatus = {} + Object.assign(originalStatus, this.status) + delete originalStatus.attachments + delete originalStatus.created_at + delete originalStatus.emojis + delete originalStatus.text + delete originalStatus.raw_html + delete originalStatus.nsfw + delete originalStatus.poll + delete originalStatus.summary + delete originalStatus.summary_raw_html + this.$store.dispatch('openStatusHistoryModal', originalStatus) } }, computed: { @@ -147,6 +163,9 @@ const ExtraButtons = { }, shouldConfirmDelete () { return this.$store.getters.mergedConfig.modalOnDelete + }, + isEdited () { + return this.status.edited_at !== null } } } diff --git a/src/components/extra_buttons/extra_buttons.vue b/src/components/extra_buttons/extra_buttons.vue index b3ccb370..b10ceb2b 100644 --- a/src/components/extra_buttons/extra_buttons.vue +++ b/src/components/extra_buttons/extra_buttons.vue @@ -84,6 +84,17 @@ icon="pen" />{{ $t("status.edit") }} +