From 5b56b6b9fdd9ad82a8f1c24d03024be0e7902c80 Mon Sep 17 00:00:00 2001 From: tusooa Date: Tue, 17 Jan 2023 19:55:16 -0500 Subject: [PATCH 001/133] Populate user card on receiving chats --- src/modules/chats.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/chats.js b/src/modules/chats.js index f28c2603..0f1540db 100644 --- a/src/modules/chats.js +++ b/src/modules/chats.js @@ -65,6 +65,7 @@ const chats = { const newChatMessageSideEffects = (chat) => { maybeShowChatNotification(store, chat) } + commit('addNewUsers', chats.map(k => k.account).filter(k => k)) commit('addNewChats', { dispatch, chats, rootGetters, newChatMessageSideEffects }) }, updateChat ({ commit }, { chat }) { From d1876503bc560b9c62d03e219021593cb954fcf4 Mon Sep 17 00:00:00 2001 From: tusooa Date: Fri, 20 Jan 2023 12:33:19 -0500 Subject: [PATCH 002/133] Display delete status errors --- src/i18n/en.json | 1 + src/modules/statuses.js | 14 ++++++++++++-- src/services/api/api.service.js | 5 +++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/i18n/en.json b/src/i18n/en.json index 1ee1147a..5e653ad8 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -844,6 +844,7 @@ "favorites": "Favorites", "repeats": "Repeats", "delete": "Delete status", + "delete_error": "Error deleting status: {0}", "edit": "Edit status", "edited_at": "(last edited {time})", "pin": "Pin on profile", diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 77dd7e1c..93a4a957 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -615,9 +615,19 @@ const statuses = { fetchStatusHistory ({ rootState, dispatch }, status) { return apiService.fetchStatusHistory({ status }) }, - deleteStatus ({ rootState, commit }, status) { - commit('setDeleted', { status }) + deleteStatus ({ rootState, commit, dispatch }, status) { apiService.deleteStatus({ id: status.id, credentials: rootState.users.currentUser.credentials }) + .then((_) => { + commit('setDeleted', { status }) + }) + .catch((e) => { + dispatch('pushGlobalNotice', { + level: 'error', + messageKey: 'status.delete_error', + messageArgs: [e.message], + timeout: 5000 + }) + }) }, deleteStatusById ({ rootState, commit }, id) { const status = rootState.statuses.allStatusesObject[id] diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index af12265e..609f6790 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -923,8 +923,9 @@ const editStatus = ({ } const deleteStatus = ({ id, credentials }) => { - return fetch(MASTODON_DELETE_URL(id), { - headers: authHeaders(credentials), + return promisedRequest({ + url: MASTODON_DELETE_URL(id), + credentials, method: 'DELETE' }) } From 4db7f07421a6dc49f07dee9140a024ef5195a934 Mon Sep 17 00:00:00 2001 From: tusooa Date: Thu, 24 Nov 2022 23:26:31 -0500 Subject: [PATCH 003/133] Make autocomplete items buttons --- src/components/emoji_input/emoji_input.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/emoji_input/emoji_input.vue b/src/components/emoji_input/emoji_input.vue index ccba0393..6df2cebe 100644 --- a/src/components/emoji_input/emoji_input.vue +++ b/src/components/emoji_input/emoji_input.vue @@ -53,6 +53,7 @@ v-for="(suggestion, index) in suggestions" :key="index" class="autocomplete-item" + role="button" :class="{ highlighted: index === highlighted }" @click.stop.prevent="onClick($event, suggestion)" > From 6235af4592c52a657415ffae772bd83ec106bc13 Mon Sep 17 00:00:00 2001 From: tusooa Date: Sat, 21 Jan 2023 01:07:07 -0500 Subject: [PATCH 004/133] Make screenreaders read out autocomplete results --- src/components/emoji_input/emoji_input.js | 53 ++++++++++++------- src/components/emoji_input/emoji_input.vue | 19 ++++++- .../post_status_form/post_status_form.vue | 53 +++++++++++-------- .../screen_reader_notice.js | 21 ++++++++ .../screen_reader_notice.vue | 21 ++++++++ src/i18n/en.json | 3 +- 6 files changed, 126 insertions(+), 44 deletions(-) create mode 100644 src/components/screen_reader_notice/screen_reader_notice.js create mode 100644 src/components/screen_reader_notice/screen_reader_notice.vue diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index ba5f7552..020e9fde 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -1,6 +1,7 @@ import Completion from '../../services/completion/completion.js' import EmojiPicker from '../emoji_picker/emoji_picker.vue' import Popover from 'src/components/popover/popover.vue' +import ScreenReaderNotice from 'src/components/screen_reader_notice/screen_reader_notice.vue' import UnicodeDomainIndicator from '../unicode_domain_indicator/unicode_domain_indicator.vue' import { take } from 'lodash' import { findOffset } from '../../services/offset_finder/offset_finder.service.js' @@ -109,9 +110,10 @@ const EmojiInput = { }, data () { return { + randomSeed: `${Math.random()}`.replace('.', '-'), input: undefined, caretEl: undefined, - highlighted: 0, + highlighted: -1, caret: 0, focused: false, blurTimeout: null, @@ -125,7 +127,8 @@ const EmojiInput = { components: { Popover, EmojiPicker, - UnicodeDomainIndicator + UnicodeDomainIndicator, + ScreenReaderNotice }, computed: { padEmoji () { @@ -203,6 +206,12 @@ const EmojiInput = { top: this.input.scrollTop, left: this.input.scrollLeft }) + }, + suggestionListId () { + return `suggestions-${this.randomSeed}` + }, + suggestionItemId () { + return (index) => `suggestion-item-${index}-${this.randomSeed}` } }, mounted () { @@ -278,6 +287,10 @@ const EmojiInput = { ...rest, img: imageUrl || '' })) + this.$refs.screenReaderNotice.announce( + this.$tc('tool_tip.autocomplete_available', + this.suggestions.length, + { number: this.suggestions.length })) } }, methods: { @@ -374,27 +387,24 @@ const EmojiInput = { }, cycleBackward (e) { const len = this.suggestions.length || 0 - if (len > 1) { - this.highlighted -= 1 - if (this.highlighted < 0) { - this.highlighted = this.suggestions.length - 1 - } - e.preventDefault() - } else { - this.highlighted = 0 + + this.highlighted -= 1 + if (this.highlighted === -1) { + this.input.focus() + } else if (this.highlighted < -1) { + this.highlighted = len - 1 } + e.preventDefault() }, cycleForward (e) { const len = this.suggestions.length || 0 - if (len > 1) { - this.highlighted += 1 - if (this.highlighted >= len) { - this.highlighted = 0 - } - e.preventDefault() - } else { - this.highlighted = 0 + + this.highlighted += 1 + if (this.highlighted >= len) { + this.highlighted = -1 + this.input.focus() } + e.preventDefault() }, scrollIntoView () { const rootRef = this.$refs.picker.$el @@ -540,6 +550,13 @@ const EmojiInput = { }) }, resize () { + }, + autoCompleteItemLabel (suggestion) { + if (suggestion.user) { + return suggestion.displayText + ' ' + suggestion.detailText + } else { + return this.maybeLocalizedEmojiName(suggestion) + } } } } diff --git a/src/components/emoji_input/emoji_input.vue b/src/components/emoji_input/emoji_input.vue index 6df2cebe..4a7b0fa8 100644 --- a/src/components/emoji_input/emoji_input.vue +++ b/src/components/emoji_input/emoji_input.vue @@ -4,7 +4,13 @@ class="emoji-input" :class="{ 'with-picker': !hideEmojiButton }" > - +
x {{ postText }}
+