From 40ca0b394ea066dea95c672eb0a42a35c9e65317 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Sun, 6 Sep 2020 15:28:09 +0300 Subject: [PATCH 01/13] add basic deletes support that works with masto WS --- src/components/status/status.js | 2 +- src/components/status/status.scss | 11 +++++++++ src/components/status/status.vue | 26 ++++++++++++++++++++++ src/components/user_avatar/user_avatar.vue | 11 +++++++++ src/i18n/en.json | 3 ++- src/modules/api.js | 2 ++ src/modules/statuses.js | 4 ++++ 7 files changed, 57 insertions(+), 2 deletions(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index d263da682e..5a6110c176 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -157,7 +157,7 @@ const Status = { return this.mergedConfig.hideFilteredStatuses }, hideStatus () { - return this.deleted || (this.muted && this.hideFilteredStatuses) + return (this.muted && this.hideFilteredStatuses) }, isFocused () { // retweet or root of an expanded conversation diff --git a/src/components/status/status.scss b/src/components/status/status.scss index 8d292d3f7a..02ce3ffac0 100644 --- a/src/components/status/status.scss +++ b/src/components/status/status.scss @@ -25,6 +25,17 @@ $status-margin: 0.75em; --icon: var(--selectedPostIcon, $fallback--icon); } + .deleted { + padding: $status-margin; + color: $fallback--faint; + color: var(--faint, $fallback--faint); + display: flex; + .deleted-text { + margin: 0.5em 0; + align-items: center; + } + } + .status-container { display: flex; padding: $status-margin; diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 282ad37dd6..d7dfc0ab8c 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -95,6 +95,7 @@
+
+
+ +
+
+
+ {{ $t('status.status_deleted') }} +
+
+ +
+
+
+
@@ -42,5 +48,10 @@ border-radius: $fallback--avatarAltRadius; border-radius: var(--avatarAltRadius, $fallback--avatarAltRadius); } + + &.-placeholder { + background-color: $fallback--fg; + background-color: var(--fg, $fallback--fg); + } } diff --git a/src/i18n/en.json b/src/i18n/en.json index 8540f551fc..850dc4ccfd 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -659,7 +659,8 @@ "show_full_subject": "Show full subject", "hide_full_subject": "Hide full subject", "show_content": "Show content", - "hide_content": "Hide content" + "hide_content": "Hide content", + "status_deleted": "The post was deleted" }, "user_card": { "approve": "Approve", diff --git a/src/modules/api.js b/src/modules/api.js index 5e213f0db2..de415981e2 100644 --- a/src/modules/api.js +++ b/src/modules/api.js @@ -72,6 +72,8 @@ const api = { showImmediately: timelineData.visibleStatuses.length === 0, timeline: 'friends' }) + } else if (message.event === 'delete') { + dispatch('deleteStatusById', message.id) } else if (message.event === 'pleroma:chat_update') { dispatch('addChatMessages', { chatId: message.chatUpdate.id, diff --git a/src/modules/statuses.js b/src/modules/statuses.js index e108b2a799..d38684ba99 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -608,6 +608,10 @@ const statuses = { commit('setDeleted', { status }) apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials }) }, + deleteStatusById ({ rootState, commit }, id) { + const status = rootState.statuses.allStatusesObject[id] + commit('setDeleted', { status }) + }, markStatusesAsDeleted ({ commit }, condition) { commit('setManyDeleted', condition) }, From f9ac23b9a94dd35ba623814a59f4df83895acb42 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 7 Sep 2020 10:35:49 +0300 Subject: [PATCH 02/13] separate reply button to its own component, add changelog entry --- CHANGELOG.md | 3 ++ src/components/reply_button/reply_button.js | 12 +++++++ src/components/reply_button/reply_button.vue | 21 +++++++++++ src/components/status/status.js | 2 ++ src/components/status/status.vue | 37 ++++++-------------- 5 files changed, 48 insertions(+), 27 deletions(-) create mode 100644 src/components/reply_button/reply_button.js create mode 100644 src/components/reply_button/reply_button.vue diff --git a/CHANGELOG.md b/CHANGELOG.md index 18dafa8e26..f07856df21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ## [Unreleased patch] +### Added +- Proper handling of deletes when using websocket streaming + ### Changed - Polls will be hidden with status content if "Collapse posts with subjects" is enabled and the post is collapsed. diff --git a/src/components/reply_button/reply_button.js b/src/components/reply_button/reply_button.js new file mode 100644 index 0000000000..2295765040 --- /dev/null +++ b/src/components/reply_button/reply_button.js @@ -0,0 +1,12 @@ + +const ReplyButton = { + name: 'ReplyButton', + props: ['status', 'replying'], + computed: { + loggedIn () { + return !!this.$store.state.users.currentUser + } + } +} + +export default ReplyButton diff --git a/src/components/reply_button/reply_button.vue b/src/components/reply_button/reply_button.vue new file mode 100644 index 0000000000..b2904b5c4a --- /dev/null +++ b/src/components/reply_button/reply_button.vue @@ -0,0 +1,21 @@ + + + diff --git a/src/components/status/status.js b/src/components/status/status.js index 5a6110c176..cb39fd6e81 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -1,3 +1,4 @@ +import ReplyButton from '../reply_button/reply_button.vue' import FavoriteButton from '../favorite_button/favorite_button.vue' import ReactButton from '../react_button/react_button.vue' import RetweetButton from '../retweet_button/retweet_button.vue' @@ -20,6 +21,7 @@ import { mapGetters, mapState } from 'vuex' const Status = { name: 'Status', components: { + ReplyButton, FavoriteButton, ReactButton, RetweetButton, diff --git a/src/components/status/status.vue b/src/components/status/status.vue index d7dfc0ab8c..cb81b14e0a 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -321,21 +321,11 @@ v-if="!noHeading && !isPreview" class="status-actions" > -
- - - {{ status.replies_count }} -
+ {{ $t('status.status_deleted') }}
-
- -
+
Date: Mon, 7 Sep 2020 10:39:30 +0300 Subject: [PATCH 03/13] change i18n phrasing --- src/i18n/en.json | 2 +- src/i18n/fi.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/i18n/en.json b/src/i18n/en.json index 850dc4ccfd..adf171e858 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -660,7 +660,7 @@ "hide_full_subject": "Hide full subject", "show_content": "Show content", "hide_content": "Hide content", - "status_deleted": "The post was deleted" + "status_deleted": "This post was deleted" }, "user_card": { "approve": "Approve", diff --git a/src/i18n/fi.json b/src/i18n/fi.json index 3832dcaa88..2524f2788a 100644 --- a/src/i18n/fi.json +++ b/src/i18n/fi.json @@ -578,7 +578,8 @@ "show_full_subject": "Näytä koko otsikko", "hide_full_subject": "Piilota koko otsikko", "show_content": "Näytä sisältö", - "hide_content": "Piilota sisältö" + "hide_content": "Piilota sisältö", + "status_deleted": "Poistettu viesti" }, "user_card": { "approve": "Hyväksy", From 1ec9cde9638b3fb285185072532547b4a4d32158 Mon Sep 17 00:00:00 2001 From: Shpuld Shpludson Date: Tue, 8 Sep 2020 06:31:02 +0000 Subject: [PATCH 04/13] Apply 1 suggestion(s) to 1 file(s) --- src/components/status/status.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/status/status.scss b/src/components/status/status.scss index 02ce3ffac0..2717c0ba5a 100644 --- a/src/components/status/status.scss +++ b/src/components/status/status.scss @@ -30,6 +30,7 @@ $status-margin: 0.75em; color: $fallback--faint; color: var(--faint, $fallback--faint); display: flex; + .deleted-text { margin: 0.5em 0; align-items: center; From fa9176651952468ee996abe0e67d62d9a72d5a69 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Tue, 8 Sep 2020 09:32:43 +0300 Subject: [PATCH 05/13] rename to gravestone --- src/components/status/status.scss | 2 +- src/components/status/status.vue | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/status/status.scss b/src/components/status/status.scss index 2717c0ba5a..bd23157ff9 100644 --- a/src/components/status/status.scss +++ b/src/components/status/status.scss @@ -25,7 +25,7 @@ $status-margin: 0.75em; --icon: var(--selectedPostIcon, $fallback--icon); } - .deleted { + .gravestone { padding: $status-margin; color: $fallback--faint; color: var(--faint, $fallback--faint); diff --git a/src/components/status/status.vue b/src/components/status/status.vue index cb81b14e0a..75142250c9 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -349,7 +349,7 @@
@@ -359,6 +359,7 @@ {{ $t('status.status_deleted') }}
Date: Mon, 21 Sep 2020 17:29:36 +0200 Subject: [PATCH 06/13] feat/reorder-emojis-by-position-of-keyword --- src/components/emoji_picker/emoji_picker.js | 13 ++++++++++--- src/components/react_button/react_button.js | 11 ++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 5c09f6ca7b..713ecd8bb4 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -8,10 +8,17 @@ const LOAD_EMOJI_BY = 60 const LOAD_EMOJI_MARGIN = 64 const filterByKeyword = (list, keyword = '') => { + if (keyword === '') return list + const keywordLowercase = keyword.toLowerCase() - return list.filter(emoji => - emoji.displayText.toLowerCase().includes(keywordLowercase) - ) + const orderedEmojiList = [] + for (const emoji of list) { + const indexOfKeyword = emoji.displayText.toLowerCase().indexOf( keywordLowercase ) + if ( indexOfKeyword > -1 ) { + orderedEmojiList.splice(indexOfKeyword, 0, emoji) + } + } + return orderedEmojiList } const EmojiPicker = { diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js index abcf04555c..473a2506d4 100644 --- a/src/components/react_button/react_button.js +++ b/src/components/react_button/react_button.js @@ -29,9 +29,14 @@ const ReactButton = { emojis () { if (this.filterWord !== '') { const filterWordLowercase = this.filterWord.toLowerCase() - return this.$store.state.instance.emoji.filter(emoji => - emoji.displayText.toLowerCase().includes(filterWordLowercase) - ) + const orderedEmojiList = [] + for (const emoji of this.$store.state.instance.emoji) { + const indexOfFilterWord = emoji.displayText.toLowerCase().indexOf( filterWordLowercase ) + if ( indexOfFilterWord > -1 ) { + orderedEmojiList.splice(indexOfFilterWord, 0, emoji) + } + } + return orderedEmojiList } return this.$store.state.instance.emoji || [] }, From f1e1f20a8d89abf7920997c12d5c7b48cdb2d628 Mon Sep 17 00:00:00 2001 From: Dym Sohin Date: Mon, 21 Sep 2020 17:42:17 +0200 Subject: [PATCH 07/13] fix 8x spaces inside this paren --- src/components/emoji_picker/emoji_picker.js | 4 ++-- src/components/react_button/react_button.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 713ecd8bb4..28ab037696 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -13,8 +13,8 @@ const filterByKeyword = (list, keyword = '') => { const keywordLowercase = keyword.toLowerCase() const orderedEmojiList = [] for (const emoji of list) { - const indexOfKeyword = emoji.displayText.toLowerCase().indexOf( keywordLowercase ) - if ( indexOfKeyword > -1 ) { + const indexOfKeyword = emoji.displayText.toLowerCase().indexOf(keywordLowercase) + if (indexOfKeyword > -1) { orderedEmojiList.splice(indexOfKeyword, 0, emoji) } } diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js index 473a2506d4..28ce884a88 100644 --- a/src/components/react_button/react_button.js +++ b/src/components/react_button/react_button.js @@ -31,8 +31,8 @@ const ReactButton = { const filterWordLowercase = this.filterWord.toLowerCase() const orderedEmojiList = [] for (const emoji of this.$store.state.instance.emoji) { - const indexOfFilterWord = emoji.displayText.toLowerCase().indexOf( filterWordLowercase ) - if ( indexOfFilterWord > -1 ) { + const indexOfFilterWord = emoji.displayText.toLowerCase().indexOf(filterWordLowercase) + if (indexOfFilterWord > -1) { orderedEmojiList.splice(indexOfFilterWord, 0, emoji) } } From cff202241b6eff8f6b381866e00a0392080d05a2 Mon Sep 17 00:00:00 2001 From: Dym Sohin Date: Mon, 21 Sep 2020 18:10:55 +0200 Subject: [PATCH 08/13] improved algorithm, possibly speed too --- src/components/emoji_picker/emoji_picker.js | 9 ++++++--- src/components/react_button/react_button.js | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 28ab037696..29c559dfe7 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -11,14 +11,17 @@ const filterByKeyword = (list, keyword = '') => { if (keyword === '') return list const keywordLowercase = keyword.toLowerCase() - const orderedEmojiList = [] + let orderedEmojiList = [] for (const emoji of list) { const indexOfKeyword = emoji.displayText.toLowerCase().indexOf(keywordLowercase) if (indexOfKeyword > -1) { - orderedEmojiList.splice(indexOfKeyword, 0, emoji) + if (!Array.isArray(orderedEmojiList[keywordLowercase])) { + orderedEmojiList[keywordLowercase] = [] + } + orderedEmojiList[keywordLowercase].push(emoji) } } - return orderedEmojiList + return orderedEmojiList.flat() } const EmojiPicker = { diff --git a/src/components/react_button/react_button.js b/src/components/react_button/react_button.js index 28ce884a88..16014405c3 100644 --- a/src/components/react_button/react_button.js +++ b/src/components/react_button/react_button.js @@ -29,14 +29,17 @@ const ReactButton = { emojis () { if (this.filterWord !== '') { const filterWordLowercase = this.filterWord.toLowerCase() - const orderedEmojiList = [] + let orderedEmojiList = [] for (const emoji of this.$store.state.instance.emoji) { const indexOfFilterWord = emoji.displayText.toLowerCase().indexOf(filterWordLowercase) if (indexOfFilterWord > -1) { - orderedEmojiList.splice(indexOfFilterWord, 0, emoji) + if (!Array.isArray(orderedEmojiList[indexOfFilterWord])) { + orderedEmojiList[indexOfFilterWord] = [] + } + orderedEmojiList[indexOfFilterWord].push(emoji) } } - return orderedEmojiList + return orderedEmojiList.flat() } return this.$store.state.instance.emoji || [] }, From bb59b8ee56f8c5c89720c9a42037a730caba4d11 Mon Sep 17 00:00:00 2001 From: Dym Sohin Date: Mon, 21 Sep 2020 18:13:31 +0200 Subject: [PATCH 09/13] fixed copy-pasting leftovers --- src/components/emoji_picker/emoji_picker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/emoji_picker/emoji_picker.js b/src/components/emoji_picker/emoji_picker.js index 29c559dfe7..3ad80df33e 100644 --- a/src/components/emoji_picker/emoji_picker.js +++ b/src/components/emoji_picker/emoji_picker.js @@ -15,10 +15,10 @@ const filterByKeyword = (list, keyword = '') => { for (const emoji of list) { const indexOfKeyword = emoji.displayText.toLowerCase().indexOf(keywordLowercase) if (indexOfKeyword > -1) { - if (!Array.isArray(orderedEmojiList[keywordLowercase])) { - orderedEmojiList[keywordLowercase] = [] + if (!Array.isArray(orderedEmojiList[indexOfKeyword])) { + orderedEmojiList[indexOfKeyword] = [] } - orderedEmojiList[keywordLowercase].push(emoji) + orderedEmojiList[indexOfKeyword].push(emoji) } } return orderedEmojiList.flat() From 414558665f8370390cf4c6dc3c79745217d8d522 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 1 Oct 2020 16:01:57 +0300 Subject: [PATCH 10/13] lint fix --- src/components/status/status.scss | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/status/status.scss b/src/components/status/status.scss index ecca288f02..66a91c1ee4 100644 --- a/src/components/status/status.scss +++ b/src/components/status/status.scss @@ -25,6 +25,11 @@ $status-margin: 0.75em; --icon: var(--selectedPostIcon, $fallback--icon); } + &.-conversation { + border-left-width: 4px; + border-left-style: solid; + } + .gravestone { padding: $status-margin; color: $fallback--faint; @@ -36,11 +41,6 @@ $status-margin: 0.75em; align-items: center; } } - - &.-conversation { - border-left-width: 4px; - border-left-style: solid; - } .status-container { display: flex; From def04380da53763379b0dd1eec1073b9796d07a0 Mon Sep 17 00:00:00 2001 From: Ben Is Date: Fri, 16 Oct 2020 19:02:14 +0000 Subject: [PATCH 11/13] Translated using Weblate (Italian) Currently translated at 100.0% (669 of 669 strings) Translation: Pleroma/Pleroma-FE Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-fe/it/ --- src/i18n/it.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/i18n/it.json b/src/i18n/it.json index 4d09600411..ce50863091 100644 --- a/src/i18n/it.json +++ b/src/i18n/it.json @@ -702,7 +702,8 @@ "reply_to": "Rispondi a", "delete_confirm": "Vuoi veramente eliminare questo messaggio?", "unbookmark": "Rimuovi segnalibro", - "bookmark": "Aggiungi segnalibro" + "bookmark": "Aggiungi segnalibro", + "status_deleted": "Questo messagio è stato cancellato" }, "time": { "years_short": "{0}a", From 85326ee9e273f94ffd8e0b33fd099c98921ff8f0 Mon Sep 17 00:00:00 2001 From: Anonymous Date: Fri, 16 Oct 2020 19:23:54 +0000 Subject: [PATCH 12/13] Translated using Weblate (Russian) Currently translated at 55.0% (368 of 669 strings) Translation: Pleroma/Pleroma-FE Translate-URL: https://translate.pleroma.social/projects/pleroma/pleroma-fe/ru/ --- src/i18n/ru.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/i18n/ru.json b/src/i18n/ru.json index 3444a26d48..8f421b50de 100644 --- a/src/i18n/ru.json +++ b/src/i18n/ru.json @@ -473,5 +473,10 @@ "tool_tip": { "accept_follow_request": "Принять запрос на чтение", "reject_follow_request": "Отклонить запрос на чтение" + }, + "image_cropper": { + "save_without_cropping": "Сохранить не обрезая", + "save": "Сохранить", + "crop_picture": "Обрезать картинку" } } From c7dddb1ec30d59ab1673fdee04db12b9266edf4a Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sat, 17 Oct 2020 21:09:51 +0300 Subject: [PATCH 13/13] fix fontello --- build/webpack.base.conf.js | 1 + 1 file changed, 1 insertion(+) diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js index dfef37a636..ef40333ce4 100644 --- a/build/webpack.base.conf.js +++ b/build/webpack.base.conf.js @@ -97,6 +97,7 @@ module.exports = { }), new FontelloPlugin({ config: require('../static/fontello.json'), + host: 'https://fontello.com', name: 'fontello', output: { css: 'static/[name].' + now + '.css', // [hash] is not supported. Use the current timestamp instead for versioning.