From 1a333aabba759fb68449ead9c47e986f456e8c8c Mon Sep 17 00:00:00 2001
From: Sean King
Date: Tue, 7 Jun 2022 21:31:48 -0600
Subject: [PATCH 01/28] Add edit status functionality
---
CONTRIBUTORS.md | 1 +
src/App.js | 2 +
src/App.vue | 1 +
.../edit_status_modal/edit_status_modal.js | 75 ++++++++++++++++
.../edit_status_modal/edit_status_modal.vue | 48 ++++++++++
src/components/extra_buttons/extra_buttons.js | 13 +++
.../extra_buttons/extra_buttons.vue | 11 +++
.../post_status_form/post_status_form.js | 45 +++++++---
.../post_status_form/post_status_form.vue | 1 +
src/i18n/en.json | 2 +
src/main.js | 3 +
src/modules/api.js | 2 +
src/modules/editStatus.js | 25 ++++++
src/modules/statuses.js | 6 ++
src/services/api/api.service.js | 88 ++++++++++++++++++-
.../entity_normalizer.service.js | 12 +++
.../status_poster/status_poster.service.js | 42 +++++++++
17 files changed, 365 insertions(+), 12 deletions(-)
create mode 100644 src/components/edit_status_modal/edit_status_modal.js
create mode 100644 src/components/edit_status_modal/edit_status_modal.vue
create mode 100644 src/modules/editStatus.js
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index f666a4ef02..18f4a93056 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -10,3 +10,4 @@ Contributors of this project.
- shpuld (shpuld@shitposter.club): CSS and styling
- Vincent Guth (https://unsplash.com/photos/XrwVIFy6rTw): Background images.
- hj (hj@shigusegubu.club): Code
+- Sean King (seanking@freespeechextremist.com): Code
diff --git a/src/App.js b/src/App.js
index f01f878826..6e0e34a8a7 100644
--- a/src/App.js
+++ b/src/App.js
@@ -11,6 +11,7 @@ import MobilePostStatusButton from './components/mobile_post_status_button/mobil
import MobileNav from './components/mobile_nav/mobile_nav.vue'
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 GlobalNoticeList from './components/global_notice_list/global_notice_list.vue'
import { windowWidth, windowHeight } from './services/window_utils/window_utils'
@@ -35,6 +36,7 @@ export default {
SettingsModal,
UserReportingModal,
PostStatusModal,
+ EditStatusModal,
GlobalNoticeList
},
data: () => ({
diff --git a/src/App.vue b/src/App.vue
index 5b4489729a..9484f99350 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -52,6 +52,7 @@
+
diff --git a/src/components/edit_status_modal/edit_status_modal.js b/src/components/edit_status_modal/edit_status_modal.js
new file mode 100644
index 0000000000..14320d2145
--- /dev/null
+++ b/src/components/edit_status_modal/edit_status_modal.js
@@ -0,0 +1,75 @@
+import PostStatusForm from '../post_status_form/post_status_form.vue'
+import Modal from '../modal/modal.vue'
+import statusPosterService from '../../services/status_poster/status_poster.service.js'
+import get from 'lodash/get'
+
+const EditStatusModal = {
+ components: {
+ PostStatusForm,
+ Modal
+ },
+ data () {
+ return {
+ resettingForm: false
+ }
+ },
+ computed: {
+ isLoggedIn () {
+ return !!this.$store.state.users.currentUser
+ },
+ modalActivated () {
+ return this.$store.state.editStatus.modalActivated
+ },
+ isFormVisible () {
+ return this.isLoggedIn && !this.resettingForm && this.modalActivated
+ },
+ params () {
+ return this.$store.state.editStatus.params || {}
+ }
+ },
+ watch: {
+ params (newVal, oldVal) {
+ if (get(newVal, 'repliedUser.id') !== get(oldVal, 'repliedUser.id')) {
+ this.resettingForm = true
+ this.$nextTick(() => {
+ this.resettingForm = false
+ })
+ }
+ },
+ isFormVisible (val) {
+ if (val) {
+ this.$nextTick(() => this.$el && this.$el.querySelector('textarea').focus())
+ }
+ }
+ },
+ methods: {
+ doEditStatus ({ status, spoilerText, sensitive, media, contentType, poll }) {
+ const params = {
+ store: this.$store,
+ statusId: this.$store.state.editStatus.params.statusId,
+ status,
+ spoilerText,
+ sensitive,
+ poll,
+ media,
+ contentType
+ }
+
+ return statusPosterService.editStatus(params)
+ .then((data) => {
+ return data
+ })
+ .catch((err) => {
+ console.error('Error editing status', err)
+ return {
+ error: err.message
+ }
+ })
+ },
+ closeModal () {
+ this.$store.dispatch('closeEditStatusModal')
+ }
+ }
+}
+
+export default EditStatusModal
diff --git a/src/components/edit_status_modal/edit_status_modal.vue b/src/components/edit_status_modal/edit_status_modal.vue
new file mode 100644
index 0000000000..00dde7deed
--- /dev/null
+++ b/src/components/edit_status_modal/edit_status_modal.vue
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js
index dd45b6b9f9..9508a7075a 100644
--- a/src/components/extra_buttons/extra_buttons.js
+++ b/src/components/extra_buttons/extra_buttons.js
@@ -71,6 +71,19 @@ const ExtraButtons = {
},
reportStatus () {
this.$store.dispatch('openUserReportingModal', { userId: this.status.user.id, statusIds: [this.status.id] })
+ },
+ editStatus () {
+ this.$store.dispatch('fetchStatusSource', { id: this.status.id })
+ .then(data => this.$store.dispatch('openEditStatusModal', {
+ statusId: this.status.id,
+ subject: data.spoiler_text,
+ statusText: data.text,
+ statusIsSensitive: this.status.nsfw,
+ statusPoll: this.status.poll,
+ statusFiles: this.status.attachments,
+ visibility: this.status.visibility,
+ statusContentType: data.content_type
+ }))
}
},
computed: {
diff --git a/src/components/extra_buttons/extra_buttons.vue b/src/components/extra_buttons/extra_buttons.vue
index a3c3c767b1..8e90ee27db 100644
--- a/src/components/extra_buttons/extra_buttons.vue
+++ b/src/components/extra_buttons/extra_buttons.vue
@@ -73,6 +73,17 @@
icon="bookmark"
/>{{ $t("status.unbookmark") }}
+
+
+ {{ $t('post_status.edit_remote_warning') }}
+
+ {{ $t('post_status.edit_unsupported_warning') }}
+
Date: Sat, 11 Jun 2022 23:51:13 -0600
Subject: [PATCH 12/28] Clarification on unsupported edit features warning
---
src/i18n/en.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/i18n/en.json b/src/i18n/en.json
index a303c0e822..b7a1dcbf14 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -217,7 +217,7 @@
"direct_warning_to_all": "This post will be visible to all the mentioned users.",
"direct_warning_to_first_only": "This post will only be visible to the mentioned users at the beginning of the message.",
"edit_remote_warning": "Other remote instances may not support editing and unable to receive the latest version of your post.",
- "edit_unsupported_warning": "Pleroma currently does not support editing mentions or polls.",
+ "edit_unsupported_warning": "Pleroma does not support removing mentions or editing polls.",
"posting": "Posting",
"post": "Post",
"preview": "Preview",
From 1b796691b0c396c1780e5520bf285e22923f3b6a Mon Sep 17 00:00:00 2001
From: Sean King
Date: Sun, 12 Jun 2022 10:16:56 -0600
Subject: [PATCH 13/28] Change message on unsupported edit features
---
src/i18n/en.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/i18n/en.json b/src/i18n/en.json
index b7a1dcbf14..7b1bac79ca 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -217,7 +217,7 @@
"direct_warning_to_all": "This post will be visible to all the mentioned users.",
"direct_warning_to_first_only": "This post will only be visible to the mentioned users at the beginning of the message.",
"edit_remote_warning": "Other remote instances may not support editing and unable to receive the latest version of your post.",
- "edit_unsupported_warning": "Pleroma does not support removing mentions or editing polls.",
+ "edit_unsupported_warning": "Pleroma does not support editing mentions or polls.",
"posting": "Posting",
"post": "Post",
"preview": "Preview",
From fa5d35523dd081b6948d38325374cac5707b7868 Mon Sep 17 00:00:00 2001
From: Sean King
Date: Mon, 20 Jun 2022 22:52:08 -0600
Subject: [PATCH 14/28] 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/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.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
diff --git a/src/App.js b/src/App.js
index 6e0e34a8a7..af638a1c99 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 9484f99350..1b513e086c 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -53,6 +53,7 @@
+
diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js
index 8a703953ad..11fe3235d5 100644
--- a/src/components/extra_buttons/extra_buttons.js
+++ b/src/components/extra_buttons/extra_buttons.js
@@ -6,7 +6,8 @@ import {
faEyeSlash,
faThumbtack,
faShareAlt,
- faExternalLinkAlt
+ faExternalLinkAlt,
+ faHistory
} from '@fortawesome/free-solid-svg-icons'
import {
faBookmark as faBookmarkReg,
@@ -21,7 +22,8 @@ library.add(
faThumbtack,
faShareAlt,
faExternalLinkAlt,
- faFlag
+ faFlag,
+ faHistory
)
const ExtraButtons = {
@@ -84,6 +86,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: {
@@ -104,6 +120,9 @@ const ExtraButtons = {
},
statusLink () {
return `${this.$store.state.instance.server}${this.$router.resolve({ name: 'conversation', params: { id: this.status.id } }).href}`
+ },
+ 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 8e90ee27db..877e142495 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") }}
+
{{ $t("status.edit") }}
:first-child {
+ margin-top: 0;
+ }
+
+ > :last-child {
+ margin-bottom: 0;
+ }
+ }
+
.media-upload-icon, .poll-icon, .emoji-icon {
font-size: 1.85em;
line-height: 1.1;
From ed8bc6102290cb50d44c1c7aa5696aac5624d907 Mon Sep 17 00:00:00 2001
From: Tusooa Zhu
Date: Wed, 22 Jun 2022 16:05:27 -0400
Subject: [PATCH 17/28] Add last edited at indicator in status
---
src/components/status/status.js | 6 ++++++
src/components/status/status.scss | 3 ++-
src/components/status/status.vue | 24 ++++++++++++++++++++++++
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/components/status/status.js b/src/components/status/status.js
index a925f30be5..b7f2037470 100644
--- a/src/components/status/status.js
+++ b/src/components/status/status.js
@@ -392,6 +392,12 @@ const Status = {
},
visibilityLocalized () {
return this.$i18n.t('general.scope_in_timeline.' + this.status.visibility)
+ },
+ isEdited () {
+ return this.status.edited_at !== null
+ },
+ editingAvailable () {
+ return this.$store.state.instance.editingAvailable
}
},
methods: {
diff --git a/src/components/status/status.scss b/src/components/status/status.scss
index b3ad3818c6..ada9841e41 100644
--- a/src/components/status/status.scss
+++ b/src/components/status/status.scss
@@ -156,7 +156,8 @@
margin-right: 0.2em;
}
- & .heading-reply-row {
+ & .heading-reply-row,
+ & .heading-edited-row {
position: relative;
align-content: baseline;
font-size: 0.85em;
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index 67ce999a45..a9630a53e9 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -328,6 +328,30 @@
class="mentions-line"
/>
+
+
+
+
+
+
+
+
+
+
+
Date: Wed, 22 Jun 2022 16:05:44 -0400
Subject: [PATCH 18/28] Add English translation for last edited at indicator
---
src/i18n/en.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/i18n/en.json b/src/i18n/en.json
index f125c2496b..c4a044f5d9 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -748,6 +748,7 @@
"repeats": "Repeats",
"delete": "Delete status",
"edit": "Edit status",
+ "edited_at": "(last edited {time})",
"pin": "Pin on profile",
"unpin": "Unpin from profile",
"pinned": "Pinned",
From acd53957e09a499b04c8f901e5829607f7363b57 Mon Sep 17 00:00:00 2001
From: Tusooa Zhu
Date: Wed, 22 Jun 2022 16:14:19 -0400
Subject: [PATCH 19/28] Do not show edited indicator in history items
---
src/components/status/status.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index a9630a53e9..00462f0ae1 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -329,7 +329,7 @@
/>
Date: Sun, 26 Jun 2022 13:25:36 -0600
Subject: [PATCH 20/28] Use watch to change localDescription
---
src/components/attachment/attachment.js | 3 +++
src/components/attachment/attachment.vue | 6 +++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js
index d62a4adc21..5dc5047556 100644
--- a/src/components/attachment/attachment.js
+++ b/src/components/attachment/attachment.js
@@ -129,6 +129,9 @@ const Attachment = {
...mapGetters(['mergedConfig'])
},
watch: {
+ 'attachment.description' (newVal) {
+ this.localDescription = newVal
+ },
localDescription (newVal) {
this.onEdit(newVal)
}
diff --git a/src/components/attachment/attachment.vue b/src/components/attachment/attachment.vue
index 14f6a0ae81..2a89886d7d 100644
--- a/src/components/attachment/attachment.vue
+++ b/src/components/attachment/attachment.vue
@@ -166,7 +166,7 @@
:icon="placeholderIconClass"
/>
- {{ edit ? localDescription : attachment.description }}
+ {{ localDescription }}
@@ -244,7 +244,7 @@
@@ -257,7 +257,7 @@
@keydown.enter.prevent=""
>
- {{ attachment.description }}
+ {{ localDescription }}
From 6f4b57e84559871f8c59f968d5cf17f2971e74c3 Mon Sep 17 00:00:00 2001
From: Sean King
Date: Sun, 26 Jun 2022 17:41:21 -0600
Subject: [PATCH 21/28] Use a better way to clone the original status
---
src/components/extra_buttons/extra_buttons.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js
index 92eb63b047..5ddb7f0feb 100644
--- a/src/components/extra_buttons/extra_buttons.js
+++ b/src/components/extra_buttons/extra_buttons.js
@@ -88,8 +88,7 @@ const ExtraButtons = {
}))
},
showStatusHistory () {
- let originalStatus = {}
- Object.assign(originalStatus, this.status)
+ let originalStatus = { ...this.status }
delete originalStatus.attachments
delete originalStatus.created_at
delete originalStatus.emojis
From 29ff63d1b420d0c36fb16c72389fdccd1294205a Mon Sep 17 00:00:00 2001
From: Sean King
Date: Sun, 26 Jun 2022 18:10:30 -0600
Subject: [PATCH 22/28] Refactor to delete the properties for originalStatus in
showStatusHistory in a better way
---
src/components/extra_buttons/extra_buttons.js | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js
index 5ddb7f0feb..ef040d26ef 100644
--- a/src/components/extra_buttons/extra_buttons.js
+++ b/src/components/extra_buttons/extra_buttons.js
@@ -88,16 +88,9 @@ const ExtraButtons = {
}))
},
showStatusHistory () {
- let 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
+ const originalStatus = { ...this.status }
+ const stripFieldsList = ['attachments', 'created_at', 'emojis', 'text', 'raw_html', 'nsfw', 'poll', 'summary', 'summary_raw_html']
+ stripFieldsList.forEach(p => delete originalStatus[p])
this.$store.dispatch('openStatusHistoryModal', originalStatus)
}
},
From 75216c5feb32b32e24952663ffa4233410585785 Mon Sep 17 00:00:00 2001
From: Sean King
Date: Sun, 10 Jul 2022 21:07:47 -0600
Subject: [PATCH 23/28] Remove guard for raw_html
---
src/components/status_body/status_body.js | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/components/status_body/status_body.js b/src/components/status_body/status_body.js
index 0a3dcf7992..b8f6f9a0b6 100644
--- a/src/components/status_body/status_body.js
+++ b/src/components/status_body/status_body.js
@@ -125,13 +125,6 @@ const StatusContent = {
generateTagLink (tag) {
return `/tag/${tag}`
}
- },
- watch: {
- 'status.raw_html' (newVal, oldVal) {
- if (newVal !== oldVal) {
- this.parseReadyDone = false
- }
- }
}
}
From 232cc72df8352db15ac3e6b11c1f9c5908069771 Mon Sep 17 00:00:00 2001
From: Sean King
Date: Mon, 1 Aug 2022 18:45:52 -0600
Subject: [PATCH 24/28] Fix lint errors and warnings
---
.../edit_status_modal/edit_status_modal.vue | 6 +++---
src/components/status/status.vue | 12 +++++-------
.../status_history_modal/status_history_modal.vue | 4 ++--
src/services/api/api.service.js | 6 +++---
.../entity_normalizer/entity_normalizer.service.js | 2 +-
5 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/components/edit_status_modal/edit_status_modal.vue b/src/components/edit_status_modal/edit_status_modal.vue
index 00dde7deed..1dbacaab46 100644
--- a/src/components/edit_status_modal/edit_status_modal.vue
+++ b/src/components/edit_status_modal/edit_status_modal.vue
@@ -11,10 +11,10 @@
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index a13e5ab03f..5ddb94b411 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 d6680df238..990be35bc9 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 41c1459655..381dd112c7 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 c00e97961c..c1b2ffac7a 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)
}
From b70d50407cef26926635b1b47131c01e597fcfc6 Mon Sep 17 00:00:00 2001
From: Sean King
Date: Mon, 1 Aug 2022 21:25:08 -0600
Subject: [PATCH 25/28] Refresh the relative time object for a Timeago
component if the time changes
---
src/components/timeago/timeago.vue | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/components/timeago/timeago.vue b/src/components/timeago/timeago.vue
index 2b487dfdda..fce9605be8 100644
--- a/src/components/timeago/timeago.vue
+++ b/src/components/timeago/timeago.vue
@@ -34,6 +34,13 @@ export default {
unmounted () {
clearTimeout(this.interval)
},
+ watch: {
+ time (newVal, oldVal) {
+ if (oldVal !== newVal) {
+ this.refreshRelativeTimeObject()
+ }
+ }
+ },
methods: {
refreshRelativeTimeObject () {
const nowThreshold = typeof this.nowThreshold === 'number' ? this.nowThreshold : 1
From 04e62df377fdd2ea563f58dcd23ea8048fc1c140 Mon Sep 17 00:00:00 2001
From: Sean King
Date: Tue, 2 Aug 2022 23:19:25 -0600
Subject: [PATCH 26/28] Allow for template inside Timeago component that shows
unless the time string is 'just now'
---
src/components/status/status.vue | 16 ++++++----------
src/components/timeago/timeago.vue | 26 ++++++++++++++++++--------
2 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/src/components/status/status.vue b/src/components/status/status.vue
index 5ddb94b411..8036ddf422 100644
--- a/src/components/status/status.vue
+++ b/src/components/status/status.vue
@@ -336,16 +336,12 @@
tag="span"
>
-
-
-
+
diff --git a/src/components/timeago/timeago.vue b/src/components/timeago/timeago.vue
index fce9605be8..b5f495154d 100644
--- a/src/components/timeago/timeago.vue
+++ b/src/components/timeago/timeago.vue
@@ -3,7 +3,7 @@
:datetime="time"
:title="localeDateString"
>
- {{ $tc(relativeTime.key, relativeTime.num, [relativeTime.num]) }}
+ {{ relativeTimeString }}
@@ -13,7 +13,7 @@ import localeService from 'src/services/locale/locale.service.js'
export default {
name: 'Timeago',
- props: ['time', 'autoUpdate', 'longFormat', 'nowThreshold'],
+ props: ['time', 'autoUpdate', 'longFormat', 'nowThreshold', 'templateKey'],
data () {
return {
relativeTime: { key: 'time.now', num: 0 },
@@ -26,21 +26,31 @@ export default {
return typeof this.time === 'string'
? new Date(Date.parse(this.time)).toLocaleString(browserLocale)
: this.time.toLocaleString(browserLocale)
+ },
+ relativeTimeString () {
+ const timeString = this.$i18n.tc(this.relativeTime.key, this.relativeTime.num, [this.relativeTime.num])
+
+ if (typeof this.templateKey === 'string' && this.relativeTime.key !== 'time.now') {
+ return this.$i18n.t(this.templateKey, [timeString])
+ }
+
+ return timeString
}
},
- created () {
- this.refreshRelativeTimeObject()
- },
- unmounted () {
- clearTimeout(this.interval)
- },
watch: {
time (newVal, oldVal) {
if (oldVal !== newVal) {
+ clearTimeout(this.interval)
this.refreshRelativeTimeObject()
}
}
},
+ created () {
+ this.refreshRelativeTimeObject()
+ },
+ unmounted () {
+ clearTimeout(this.interval)
+ },
methods: {
refreshRelativeTimeObject () {
const nowThreshold = typeof this.nowThreshold === 'number' ? this.nowThreshold : 1
From 420f29b6a460ead0a5b4d9ff61e3d3ca097bd798 Mon Sep 17 00:00:00 2001
From: Henry Jameson
Date: Tue, 23 Aug 2022 02:01:56 +0300
Subject: [PATCH 27/28] add a mask to load shape to flow text around quicker
---
src/assets/pleromatan_apology_fox_mask.png | Bin 0 -> 2827 bytes
src/assets/pleromatan_apology_mask.png | Bin 0 -> 2366 bytes
.../update_notification/update_notification.js | 5 ++++-
3 files changed, 4 insertions(+), 1 deletion(-)
create mode 100644 src/assets/pleromatan_apology_fox_mask.png
create mode 100644 src/assets/pleromatan_apology_mask.png
diff --git a/src/assets/pleromatan_apology_fox_mask.png b/src/assets/pleromatan_apology_fox_mask.png
new file mode 100644
index 0000000000000000000000000000000000000000..4d1990d52258de84495cd8900f436004d3fe8c03
GIT binary patch
literal 2827
zcmV+m3-t7fP)@L?9}NVgw0Df!3e`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9
zrl}(9d8rO(L3C)dt&OA=T7#H*ZOB^0x=Ztpdwqy@{|BqJr(qn_YE|1i__R
Date: Tue, 23 Aug 2022 02:06:54 +0300
Subject: [PATCH 28/28] fetch text height only after mask has been loaded
---
.../update_notification/update_notification.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/components/update_notification/update_notification.js b/src/components/update_notification/update_notification.js
index 6cfe893c8e..c389750d8a 100644
--- a/src/components/update_notification/update_notification.js
+++ b/src/components/update_notification/update_notification.js
@@ -60,9 +60,14 @@ const UpdateNotification = {
}
},
mounted () {
- setTimeout(() => {
- this.contentHeight = this.$refs.animatedText.scrollHeight
- }, 1000)
+ // Workaround to get the text height only after mask loaded. A bit hacky.
+ const newImg = new Image()
+ newImg.onload = () => {
+ setTimeout(() => {
+ this.contentHeight = this.$refs.animatedText.scrollHeight
+ }, 100)
+ }
+ newImg.src = this.pleromaTanVariant === pleromaTan ? pleromaTanMask : pleromaTanFoxMask
}
}