From 3117623f3000eed03ec7828c3ed112bd67366620 Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Mon, 16 Aug 2021 21:30:07 +0300 Subject: [PATCH 01/34] Implement loading more statuses when searching --- src/components/search/search.js | 20 ++++++++++++---- src/components/search/search.vue | 40 ++++++++++++++++++++++++++------ src/i18n/en.json | 3 ++- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/src/components/search/search.js b/src/components/search/search.js index b62bc2c50e..6347febff1 100644 --- a/src/components/search/search.js +++ b/src/components/search/search.js @@ -30,7 +30,11 @@ const Search = { userIds: [], statuses: [], hashtags: [], - currenResultTab: 'statuses' + currenResultTab: 'statuses', + + statusesOffset: 0, + lastStatusFetchCount: 0, + lastQuery: '' } }, computed: { @@ -67,18 +71,26 @@ const Search = { this.loading = true this.userIds = [] - this.statuses = [] this.hashtags = [] this.$refs.searchInput.blur() + if (this.lastQuery !== query) { + this.statuses = [] + this.statusesOffset = 0 + this.lastStatusFetchCount = 0 + } - this.$store.dispatch('search', { q: query, resolve: true }) + this.$store.dispatch('search', { q: query, resolve: true, offset: this.statusesOffset }) .then(data => { this.loading = false this.userIds = map(data.accounts, 'id') - this.statuses = data.statuses + this.statuses = this.statuses.concat(data.statuses) this.hashtags = data.hashtags this.currenResultTab = this.getActiveTab() this.loaded = true + + this.statusesOffset += data.statuses.length + this.lastStatusFetchCount = data.statuses.length + this.lastQuery = query }) }, resultCount (tabName) { diff --git a/src/components/search/search.vue b/src/components/search/search.vue index b7bfc1f395..5d8a6715c1 100644 --- a/src/components/search/search.vue +++ b/src/components/search/search.vue @@ -55,12 +55,6 @@
-
-

{{ $t('search.no_results') }}

-
+ +
+ +
+
+

+ {{ $t('search.no_results') }} +

+
diff --git a/src/i18n/en.json b/src/i18n/en.json index b31e488083..6026b33eed 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -827,7 +827,8 @@ "hashtags": "Hashtags", "person_talking": "{count} person talking", "people_talking": "{count} people talking", - "no_results": "No results" + "no_results": "No results", + "load_more": "Load more results" }, "password_reset": { "forgot_password": "Forgot password?", From ca7fa67997de81710f96944ccdbd080dcd3b0bf9 Mon Sep 17 00:00:00 2001 From: Ekaterina Vaartis Date: Sun, 22 Aug 2021 15:36:03 +0300 Subject: [PATCH 02/34] Amend status search results, and introduce searchType Use searchType to only search for statuses when searching for more results --- src/components/search/search.js | 16 ++++++++++------ src/components/search/search.vue | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/search/search.js b/src/components/search/search.js index 6347febff1..751a9c37ed 100644 --- a/src/components/search/search.js +++ b/src/components/search/search.js @@ -63,28 +63,32 @@ const Search = { this.$router.push({ name: 'search', query: { query } }) this.$refs.searchInput.focus() }, - search (query) { + search (query, searchType = null) { if (!query) { this.loading = false return } this.loading = true - this.userIds = [] - this.hashtags = [] this.$refs.searchInput.blur() if (this.lastQuery !== query) { + this.userIds = [] + this.hashtags = [] this.statuses = [] + this.statusesOffset = 0 this.lastStatusFetchCount = 0 } - this.$store.dispatch('search', { q: query, resolve: true, offset: this.statusesOffset }) + this.$store.dispatch('search', { q: query, resolve: true, offset: this.statusesOffset, 'type': searchType }) .then(data => { this.loading = false - this.userIds = map(data.accounts, 'id') + + // Always append to old results. If new results are empty, this doesn't change anything + this.userIds = this.userIds.concat(map(data.accounts, 'id')) this.statuses = this.statuses.concat(data.statuses) - this.hashtags = data.hashtags + this.hashtags = this.hashtags.concat(data.hashtags) + this.currenResultTab = this.getActiveTab() this.loaded = true diff --git a/src/components/search/search.vue b/src/components/search/search.vue index 5d8a6715c1..f3076f65ac 100644 --- a/src/components/search/search.vue +++ b/src/components/search/search.vue @@ -68,7 +68,7 @@
Date: Tue, 28 Dec 2021 18:30:34 -0500 Subject: [PATCH 04/34] Enable anonymous users to interact with statuses remotely --- src/components/favorite_button/favorite_button.js | 5 ++++- src/components/favorite_button/favorite_button.vue | 10 ++++++++-- src/components/reply_button/reply_button.js | 3 +++ src/components/reply_button/reply_button.vue | 10 ++++++++-- src/components/retweet_button/retweet_button.js | 3 +++ src/components/retweet_button/retweet_button.vue | 10 ++++++++-- src/modules/instance.js | 14 ++++++++++++++ 7 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/components/favorite_button/favorite_button.js b/src/components/favorite_button/favorite_button.js index 5cd05f73eb..d15699f71e 100644 --- a/src/components/favorite_button/favorite_button.js +++ b/src/components/favorite_button/favorite_button.js @@ -31,7 +31,10 @@ const FavoriteButton = { } }, computed: { - ...mapGetters(['mergedConfig']) + ...mapGetters(['mergedConfig']), + remoteInteractionLink () { + return this.$store.getters.remoteInteractionLink({ statusId: this.status.id }) + } } } diff --git a/src/components/favorite_button/favorite_button.vue b/src/components/favorite_button/favorite_button.vue index dce25e2484..7d23572eca 100644 --- a/src/components/favorite_button/favorite_button.vue +++ b/src/components/favorite_button/favorite_button.vue @@ -13,13 +13,19 @@ :spin="animated" /> - + - + - + - + - + - + { + if (statusId) { + return `${link}?status_id=${statusId}` + } else { + return `${link}?nickname=${nickname}` + } + } } }, actions: { From d30e39ca32caf33ccaef7ec1b1c2756456bdb0e0 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Tue, 28 Dec 2021 18:31:42 -0500 Subject: [PATCH 05/34] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fac68ac04d..59e6789d21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Ability to rearrange order of attachments when uploading - Enabled users to zoom and pan images in media viewer with mouse and touch - Added frontend ui for account migration +- Implemented remote interaction with statuses ## [2.4.2] - 2022-01-09 From b11ac221923af4df015c886850592ecf2330cc26 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Fri, 15 Jul 2022 20:22:39 -0400 Subject: [PATCH 06/34] Fix search() not honouring type param --- src/modules/statuses.js | 4 ++-- src/services/api/api.service.js | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/statuses.js b/src/modules/statuses.js index ac5d25c4ca..69f8af3a50 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -747,8 +747,8 @@ const statuses = { rootState.api.backendInteractor.fetchRebloggedByUsers({ id }) .then(rebloggedByUsers => commit('addRepeats', { id, rebloggedByUsers, currentUser: rootState.users.currentUser })) }, - search (store, { q, resolve, limit, offset, following }) { - return store.rootState.api.backendInteractor.search2({ q, resolve, limit, offset, following }) + search (store, { q, resolve, limit, offset, following, type }) { + return store.rootState.api.backendInteractor.search2({ q, resolve, limit, offset, following, type }) .then((data) => { store.commit('addNewUsers', data.accounts) store.commit('addNewStatuses', { statuses: data.statuses }) diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 436b8b0a0e..8341112b2f 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -1002,7 +1002,7 @@ const searchUsers = ({ credentials, query }) => { .then((data) => data.map(parseUser)) } -const search2 = ({ credentials, q, resolve, limit, offset, following }) => { +const search2 = ({ credentials, q, resolve, limit, offset, following, type }) => { let url = MASTODON_SEARCH_2 let params = [] @@ -1026,6 +1026,10 @@ const search2 = ({ credentials, q, resolve, limit, offset, following }) => { params.push(['following', true]) } + if (type) { + params.push(['following', type]) + } + params.push(['with_relationships', true]) let queryString = map(params, (param) => `${param[0]}=${param[1]}`).join('&') From b09912d2f91a410a3b50ee408dd4a0621eba2ff4 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Fri, 15 Jul 2022 20:26:05 -0400 Subject: [PATCH 07/34] Make search say No more results when there are current results --- src/components/search/search.vue | 2 +- src/i18n/en.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/search/search.vue b/src/components/search/search.vue index 4373a94bd6..6fc6a0dea6 100644 --- a/src/components/search/search.vue +++ b/src/components/search/search.vue @@ -89,7 +89,7 @@ class="search-result-heading" >

- {{ $t('search.no_results') }} + {{ visibleStatuses.length === 0 ? $t('search.no_results') : $t('search.no_more_results') }}

diff --git a/src/i18n/en.json b/src/i18n/en.json index 6026b33eed..167a3e0ff3 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -828,6 +828,7 @@ "person_talking": "{count} person talking", "people_talking": "{count} people talking", "no_results": "No results", + "no_more_results": "No more results", "load_more": "Load more results" }, "password_reset": { From dd1abc9f5d9cedf3eccb286764692e3d5a19d7a9 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 31 Jul 2022 17:04:48 +0300 Subject: [PATCH 08/34] add gitlab templates --- .gitlab/issue_templates/Bug.md | 25 ++++++++++++++++++++++ .gitlab/issue_templates/Suggestion.md | 11 ++++++++++ .gitlab/issue_templates/default.md | 7 ++++++ .gitlab/merge_request_templates/default.md | 22 +++++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 .gitlab/issue_templates/Bug.md create mode 100644 .gitlab/issue_templates/Suggestion.md create mode 100644 .gitlab/issue_templates/default.md create mode 100644 .gitlab/merge_request_templates/default.md diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md new file mode 100644 index 0000000000..bfd5e7b41c --- /dev/null +++ b/.gitlab/issue_templates/Bug.md @@ -0,0 +1,25 @@ +# Environment info + + +* Browser, version, OS, platform: +* Instance URL: +* Frontend version (see settings -> about): +* Backend version (see settings -> about): +* Browser extensions (ublock, rikaichamp etc): +* Known instance/user customizations (i.e. pleromafe mods/forks, instance styles etc) + +# Bug description & reproduction steps + + + + + +# Bug seriousness + + +* How annoying it is: +* How often does it happen: +* How many people does it affect: +* Is there a workaround for it: + +/label ~Bug diff --git a/.gitlab/issue_templates/Suggestion.md b/.gitlab/issue_templates/Suggestion.md new file mode 100644 index 0000000000..7472981a79 --- /dev/null +++ b/.gitlab/issue_templates/Suggestion.md @@ -0,0 +1,11 @@ +# Behavior suggestion/Feature request + + +/label ~suggestion + diff --git a/.gitlab/issue_templates/default.md b/.gitlab/issue_templates/default.md new file mode 100644 index 0000000000..4ada070202 --- /dev/null +++ b/.gitlab/issue_templates/default.md @@ -0,0 +1,7 @@ + + +/label ~needs-triage + diff --git a/.gitlab/merge_request_templates/default.md b/.gitlab/merge_request_templates/default.md new file mode 100644 index 0000000000..b93d6e4618 --- /dev/null +++ b/.gitlab/merge_request_templates/default.md @@ -0,0 +1,22 @@ +# Changes + +* +* +* + + + + + + From 32718016e1749ddecbaad0a04d44a0b457b67625 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 31 Jul 2022 17:07:07 +0300 Subject: [PATCH 09/34] label, info on WIPs --- .gitlab/merge_request_templates/default.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab/merge_request_templates/default.md b/.gitlab/merge_request_templates/default.md index b93d6e4618..ed9d54cb01 100644 --- a/.gitlab/merge_request_templates/default.md +++ b/.gitlab/merge_request_templates/default.md @@ -1,3 +1,9 @@ + # Changes * @@ -20,3 +26,5 @@ If merge request adds some new feature that depends on backend: 2. Link related BE merge request here --> + +/label ~needs-review From 0d714f07ecda00a54392f47fe0054e37e269a7d3 Mon Sep 17 00:00:00 2001 From: Ilja Date: Sat, 6 Aug 2022 11:43:06 +0200 Subject: [PATCH 10/34] Add priviliges We can now check what priviliges someone has besides only the role. On older back-ends, privileges aren't provided, so we have a fall-back to list the privileges corresponding to what mods/admins are allowed on older BE's. --- .../entity_normalizer.service.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index 7f831ed905..1be19cf1bc 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -119,6 +119,33 @@ export const parseUser = (data) => { } else { output.role = 'member' } + + if (data.pleroma.privileges) { + output.privileges = data.pleroma.privileges + } else if (data.pleroma.is_admin) { + output.privileges = [ + 'users_read', + 'users_manage_invites', + 'users_manage_activation_state', + 'users_manage_tags', + 'users_manage_credentials', + 'users_delete', + 'messages_read', + 'messages_delete', + 'instances_delete', + 'reports_manage_reports', + 'moderation_log_read', + 'announcements_manage_announcements', + 'emoji_manage_emoji', + 'statistics_read' + ] + } else if (data.pleroma.is_moderator) { + output.privileges = [ + 'messages_delete' + ] + } else { + output.privileges = [] + } } if (data.source) { From 6c9768b8e2ffb0d1a992689f309020ff3da199d7 Mon Sep 17 00:00:00 2001 From: Ilja Date: Sat, 6 Aug 2022 14:00:29 +0200 Subject: [PATCH 11/34] Option to delete a post is shown when privileged with messages_delete --- 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 22ffb65aeb..345402b734 100644 --- a/src/components/extra_buttons/extra_buttons.js +++ b/src/components/extra_buttons/extra_buttons.js @@ -77,8 +77,7 @@ const ExtraButtons = { currentUser () { return this.$store.state.users.currentUser }, canDelete () { if (!this.currentUser) { return } - const superuser = this.currentUser.rights.moderator || this.currentUser.rights.admin - return superuser || this.status.user.id === this.currentUser.id + return this.currentUser.privileges.includes('messages_delete') || this.status.user.id === this.currentUser.id }, ownStatus () { return this.status.user.id === this.currentUser.id From 56d1232588cac825b960782868e2ea3148371f33 Mon Sep 17 00:00:00 2001 From: Ilja Date: Sat, 6 Aug 2022 22:33:38 +0200 Subject: [PATCH 12/34] Show moderation drop down menu and items based on privileges There's a seperator between certain blocks of items. I show/hide the seperator together with the block under it. When a block with a seperator is at the top, the seperator doesn't show, keeping a consistent look with seperators only between blocks. I also hide granting roles for deactivated accounts because that doesn't make much sense to me. For the rest the items are hidden when you're not privileged. When there's no privileges that show items, the menu isn't shown either. --- .../moderation_tools/moderation_tools.js | 16 ++++++++++++++-- .../moderation_tools/moderation_tools.vue | 9 ++++++--- src/components/user_card/user_card.js | 4 ++++ src/components/user_card/user_card.vue | 2 +- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/components/moderation_tools/moderation_tools.js b/src/components/moderation_tools/moderation_tools.js index 2469327afe..a5ce865604 100644 --- a/src/components/moderation_tools/moderation_tools.js +++ b/src/components/moderation_tools/moderation_tools.js @@ -41,14 +41,26 @@ const ModerationTools = { tagsSet () { return new Set(this.user.tags) }, - hasTagPolicy () { - return this.$store.state.instance.tagPolicyAvailable + canGrantRole () { + return this.user.is_local && !this.user.deactivated && this.$store.state.users.currentUser.role === 'admin' + }, + canChangeActivationState () { + return this.privileged('users_manage_activation_state') + }, + canDeleteAccount () { + return this.privileged('users_delete') + }, + canUseTagPolicy () { + return this.$store.state.instance.tagPolicyAvailable && this.privileged('users_manage_tags') } }, methods: { hasTag (tagName) { return this.tagsSet.has(tagName) }, + privileged (privilege) { + return this.$store.state.users.currentUser.privileges.includes(privilege) + }, toggleTag (tag) { const store = this.$store if (this.tagsSet.has(tag)) { diff --git a/src/components/moderation_tools/moderation_tools.vue b/src/components/moderation_tools/moderation_tools.vue index 34fe2e7c09..8535ef273f 100644 --- a/src/components/moderation_tools/moderation_tools.vue +++ b/src/components/moderation_tools/moderation_tools.vue @@ -10,7 +10,7 @@ > @@ -102,6 +110,7 @@ color: var(--text, $fallback--text); } } + .emoji-picker-panel { position: absolute; z-index: 20; @@ -115,31 +124,6 @@ .autocomplete { &-panel { position: absolute; - z-index: 20; - margin-top: 2px; - - &.hide { - display: none - } - - &-body { - margin: 0 0.5em 0 0.5em; - border-radius: $fallback--tooltipRadius; - border-radius: var(--tooltipRadius, $fallback--tooltipRadius); - box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.5); - box-shadow: var(--popupShadow); - min-width: 75%; - background-color: $fallback--bg; - background-color: var(--popover, $fallback--bg); - color: $fallback--link; - color: var(--popoverText, $fallback--link); - --faint: var(--popoverFaintText, $fallback--faint); - --faintLink: var(--popoverFaintLink, $fallback--faint); - --lightText: var(--popoverLightText, $fallback--lightText); - --postLink: var(--popoverPostLink, $fallback--link); - --postFaintLink: var(--popoverPostFaintLink, $fallback--link); - --icon: var(--popoverIcon, $fallback--icon); - } } &-item { @@ -196,5 +180,25 @@ input, textarea { flex: 1 0 auto; } + + .hidden-overlay { + opacity: 0; + pointer-events: none; + position: absolute; + top: 0; + bottom: 0; + right: 0; + left: 0; + overflow: hidden; + /* DEBUG STUFF */ + color: red; + /* set opacity to non-zero to see the overlay */ + + .caret { + width: 0; + margin-right: calc(-1ch - 1px); + border: 1px solid red; + } + } } diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js index dd332c35a5..60c42f0f4b 100644 --- a/src/components/popover/popover.js +++ b/src/components/popover/popover.js @@ -51,6 +51,10 @@ const Popover = { // lockReEntry is a flag that is set when mouse cursor is leaving the popover's content // so that if mouse goes back into popover it won't be re-shown again to prevent annoyance // with popovers refusing to be hidden when user wants to interact with something in below popover + anchorEl: null, + // There's an issue where having teleport enabled by default causes things just... + // not render at all, i.e. main post status form and its emoji inputs + teleport: false, lockReEntry: false, hidden: true, styles: {}, @@ -63,6 +67,10 @@ const Popover = { } }, methods: { + setAnchorEl (el) { + this.anchorEl = el + this.updateStyles() + }, containerBoundingClientRect () { const container = this.boundToSelector ? this.$el.closest(this.boundToSelector) : this.$el.offsetParent return container.getBoundingClientRect() @@ -75,7 +83,7 @@ const Popover = { // Popover will be anchored around this element, trigger ref is the container, so // its children are what are inside the slot. Expect only one v-slot:trigger. - const anchorEl = (this.$refs.trigger && this.$refs.trigger.children[0]) || this.$el + const anchorEl = this.anchorEl || (this.$refs.trigger && this.$refs.trigger.children[0]) || this.$el // SVGs don't have offsetWidth/Height, use fallback const anchorHeight = anchorEl.offsetHeight || anchorEl.clientHeight const anchorWidth = anchorEl.offsetWidth || anchorEl.clientWidth @@ -319,6 +327,7 @@ const Popover = { } }, mounted () { + this.teleport = true let scrollable = this.$refs.trigger.closest('.column.-scrollable') || this.$refs.trigger.closest('.mobile-notifications') if (!scrollable) scrollable = window diff --git a/src/components/popover/popover.vue b/src/components/popover/popover.vue index 623af8d2a5..217eba7c9b 100644 --- a/src/components/popover/popover.vue +++ b/src/components/popover/popover.vue @@ -11,7 +11,7 @@ > - +
Date: Sun, 9 Oct 2022 23:01:49 +0300 Subject: [PATCH 16/34] moved popovers space outside app because otherwise it causes weird issues A LOT --- index.html | 1 + src/App.vue | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index ba072edab5..4af84a5940 100644 --- a/index.html +++ b/index.html @@ -10,5 +10,6 @@
+
diff --git a/src/App.vue b/src/App.vue index e0d709f75e..060fa70aff 100644 --- a/src/App.vue +++ b/src/App.vue @@ -73,7 +73,6 @@
Date: Mon, 10 Oct 2022 20:26:32 +0300 Subject: [PATCH 24/34] better autocomplete handling, fix leak --- src/components/emoji_input/emoji_input.js | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index 92c10f0994..144b7c729d 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -145,7 +145,7 @@ const EmojiInput = { !this.temporarilyHideSuggestions }, textAtCaret () { - return (this.wordAtCaret || {}).word || '' + return this.wordAtCaret?.word }, wordAtCaret () { if (this.modelValue && this.caret) { @@ -197,6 +197,12 @@ const EmojiInput = { return emoji.displayText } + }, + onInputScroll () { + this.$refs.hiddenOverlay.scrollTo({ + top: this.input.scrollTop, + left: this.input.scrollLeft + }) } }, mounted () { @@ -225,13 +231,7 @@ const EmojiInput = { input.addEventListener('click', this.onClickInput) input.addEventListener('transitionend', this.onTransition) input.addEventListener('input', this.onInput) - // FIXME LEAK - input.addEventListener('scroll', (e) => { - this.$refs.hiddenOverlay.scrollTo({ - top: this.input.scrollTop, - left: this.input.scrollLeft - }) - }) + input.addEventListener('scroll', this.onInputScroll) }, unmounted () { const { input } = this @@ -244,6 +244,7 @@ const EmojiInput = { input.removeEventListener('click', this.onClickInput) input.removeEventListener('transitionend', this.onTransition) input.removeEventListener('input', this.onInput) + input.removeEventListener('scroll', this.onInputScroll) } }, watch: { @@ -256,11 +257,10 @@ const EmojiInput = { } }, textAtCaret: async function (newWord) { + if (newWord === undefined) return const firstchar = newWord.charAt(0) if (newWord === firstchar) { - if (firstchar === ' ') { - this.suggestions = [] - } + this.suggestions = [] return } const matchedSuggestions = await this.suggest(newWord, this.maybeLocalizedEmojiNamesAndKeywords) @@ -292,10 +292,8 @@ const EmojiInput = { }, 0) }, togglePicker () { - console.log('piick') this.input.focus() if (!this.pickerShown) { - console.log('pick') this.scrollIntoView() this.$refs.picker.showPicker() this.$refs.picker.startEmojiLoad() From 4a1ffced44c41be5c4ba60c5b8678b200c328a40 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 10 Oct 2022 22:04:49 +0300 Subject: [PATCH 25/34] fix unit tests --- src/components/emoji_input/emoji_input.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index 144b7c729d..3d3c58ac74 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -211,8 +211,12 @@ const EmojiInput = { if (!input) return this.input = input this.caretEl = hiddenOverlayCaret - suggestorPopover.setAnchorEl(this.caretEl) - this.$refs.picker.setAnchorEl(this.caretEl) + if (suggestorPopover.setAnchorEl) { + suggestorPopover.setAnchorEl(this.caretEl) // unit test compat + this.$refs.picker.setAnchorEl(this.caretEl) + } else { + console.warn('setAnchorEl not found, are we in a unit test?') + } const style = getComputedStyle(this.input) this.overlayStyle.padding = style.padding this.overlayStyle.border = style.border From 11f9a7ba2719ff4ddb84be39d9e83519c1d0f534 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 17 Oct 2022 21:23:25 +0300 Subject: [PATCH 26/34] update popover styles when caret updates --- src/components/emoji_input/emoji_input.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/emoji_input/emoji_input.js b/src/components/emoji_input/emoji_input.js index 3d3c58ac74..ba5f7552e1 100644 --- a/src/components/emoji_input/emoji_input.js +++ b/src/components/emoji_input/emoji_input.js @@ -278,7 +278,6 @@ const EmojiInput = { ...rest, img: imageUrl || '' })) - this.$refs.suggestorPopover.updateStyles() } }, methods: { @@ -536,6 +535,9 @@ const EmojiInput = { }, setCaret ({ target: { selectionStart } }) { this.caret = selectionStart + this.$nextTick(() => { + this.$refs.suggestorPopover.updateStyles() + }) }, resize () { } From eba5d3f4d7cc41b5f33d8e22704c418927dee105 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 17 Oct 2022 22:08:52 +0300 Subject: [PATCH 27/34] fix staff panel #1192 --- src/components/staff_panel/staff_panel.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/staff_panel/staff_panel.js b/src/components/staff_panel/staff_panel.js index a7fbc718f2..91f5e910f7 100644 --- a/src/components/staff_panel/staff_panel.js +++ b/src/components/staff_panel/staff_panel.js @@ -13,7 +13,8 @@ const StaffPanel = { }, computed: { groupedStaffAccounts () { - const staffAccounts = map(this.staffAccounts, this.findUser).filter(_ => _) + const staffAccounts = map(this.staffAccounts, this.findUserByName).filter(_ => _) + console.log(staffAccounts) const groupedStaffAccounts = groupBy(staffAccounts, 'role') return [ @@ -22,7 +23,7 @@ const StaffPanel = { ].filter(group => group.users) }, ...mapGetters([ - 'findUser' + 'findUserByName' ]), ...mapState({ staffAccounts: state => state.instance.staffAccounts From 8f55cae5151d13266ff7a577dea3fcb531a0c86a Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 17 Oct 2022 22:11:07 +0300 Subject: [PATCH 28/34] fix picked emoji not being highlighted #1196 + updated its CSS structure --- .../emoji_reactions/emoji_reactions.vue | 82 ++++++++++--------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue index 4ea8b6a25c..4eb22a65ae 100644 --- a/src/components/emoji_reactions/emoji_reactions.vue +++ b/src/components/emoji_reactions/emoji_reactions.vue @@ -1,5 +1,5 @@