From 44dea9f3646a5c27083dfe6cd6b1522e11c7dc69 Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 9 Feb 2020 17:25:24 -0500 Subject: Allow emoji suggestions based on a match anywhere in the emoji name, but improve sorting --- src/components/emoji_input/suggestor.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/components') diff --git a/src/components/emoji_input/suggestor.js b/src/components/emoji_input/suggestor.js index aec5c39d..9e437ccc 100644 --- a/src/components/emoji_input/suggestor.js +++ b/src/components/emoji_input/suggestor.js @@ -29,17 +29,21 @@ export default data => input => { export const suggestEmoji = emojis => input => { const noPrefix = input.toLowerCase().substr(1) return emojis - .filter(({ displayText }) => displayText.toLowerCase().startsWith(noPrefix)) + .filter(({ displayText }) => displayText.toLowerCase().match(noPrefix)) .sort((a, b) => { let aScore = 0 let bScore = 0 - // Make custom emojis a priority - aScore += a.imageUrl ? 10 : 0 - bScore += b.imageUrl ? 10 : 0 + // Prioritize emoji that start with the input string + aScore += a.displayText.toLowerCase().startsWith(noPrefix) ? 10 : 0 + bScore += b.displayText.toLowerCase().startsWith(noPrefix) ? 10 : 0 - // Sort alphabetically - const alphabetically = a.displayText > b.displayText ? 1 : -1 + // Sort by length + aScore -= a.displayText.length + bScore -= b.displayText.length + + // Break ties alphabetically + const alphabetically = a.displayText > b.displayText ? 0.5 : -0.5 return bScore - aScore + alphabetically }) -- cgit v1.2.3-70-g09d2 From 02864bc07b2ab2f08232ba1c4c27079454dc87ef Mon Sep 17 00:00:00 2001 From: xenofem Date: Mon, 10 Feb 2020 09:32:07 -0500 Subject: Prioritize custom emoji a lot and boost exact matches to the top --- src/components/emoji_input/suggestor.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/components') diff --git a/src/components/emoji_input/suggestor.js b/src/components/emoji_input/suggestor.js index 9e437ccc..15a71eff 100644 --- a/src/components/emoji_input/suggestor.js +++ b/src/components/emoji_input/suggestor.js @@ -34,7 +34,15 @@ export const suggestEmoji = emojis => input => { let aScore = 0 let bScore = 0 - // Prioritize emoji that start with the input string + // An exact match always wins + aScore += a.displayText.toLowerCase() === noPrefix ? 200 : 0 + bScore += b.displayText.toLowerCase() === noPrefix ? 200 : 0 + + // Prioritize custom emoji a lot + aScore += a.imageUrl ? 100 : 0 + bScore += b.imageUrl ? 100 : 0 + + // Prioritize prefix matches somewhat aScore += a.displayText.toLowerCase().startsWith(noPrefix) ? 10 : 0 bScore += b.displayText.toLowerCase().startsWith(noPrefix) ? 10 : 0 -- cgit v1.2.3-70-g09d2 From 23e0ce59e610a1f3f49f3f53e0a1015530110120 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Sat, 22 Feb 2020 09:42:22 -0600 Subject: Fix captcha input and disable ALL the helpers --- src/components/registration/registration.vue | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/components') diff --git a/src/components/registration/registration.vue b/src/components/registration/registration.vue index fdbda007..a83ca1e5 100644 --- a/src/components/registration/registration.vue +++ b/src/components/registration/registration.vue @@ -187,6 +187,9 @@ class="form-control" type="text" autocomplete="off" + autocorrect="off" + autocapitalize="off" + spellcheck="false" > -- cgit v1.2.3-70-g09d2 From 86561592d002b08d6b2cd9549e8057a4ffd091cb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 24 Feb 2020 11:19:00 -0600 Subject: First attempt at not requiring email address for registration --- src/boot/after_store.js | 3 +++ src/components/registration/registration.js | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/boot/after_store.js b/src/boot/after_store.js index d70e1058..9fb9a853 100644 --- a/src/boot/after_store.js +++ b/src/boot/after_store.js @@ -241,6 +241,9 @@ const getNodeInfo = async ({ store }) => { : federation.enabled }) + const accountActivationRequired = metadata.accountActivationRequired + store.dispatch('setInstanceOption', { name: 'accountActivationRequired', value: accountActivationRequired }) + const accounts = metadata.staffAccounts resolveStaffAccounts({ store, accounts }) } else { diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index ace8cc7c..fd2942a5 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -1,5 +1,5 @@ import { validationMixin } from 'vuelidate' -import { required, sameAs } from 'vuelidate/lib/validators' +import { required, requiredIf, sameAs } from 'vuelidate/lib/validators' import { mapActions, mapState } from 'vuex' const registration = { @@ -16,7 +16,7 @@ const registration = { }), validations: { user: { - email: { required }, + email: requiredIf('accountActivationRequired'), username: { required }, fullname: { required }, password: { required }, @@ -24,6 +24,11 @@ const registration = { required, sameAsPassword: sameAs('password') } + }, + nested: { + required: requiredIf(function (nestedModel) { + return this.accountActivationRequired + }) } }, created () { -- cgit v1.2.3-70-g09d2 From 39e3917118293912b2af09f509457d718f0207c9 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 24 Feb 2020 11:23:16 -0600 Subject: Remove unneccessary nested --- src/components/registration/registration.js | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/components') diff --git a/src/components/registration/registration.js b/src/components/registration/registration.js index fd2942a5..1d8109e4 100644 --- a/src/components/registration/registration.js +++ b/src/components/registration/registration.js @@ -24,11 +24,6 @@ const registration = { required, sameAsPassword: sameAs('password') } - }, - nested: { - required: requiredIf(function (nestedModel) { - return this.accountActivationRequired - }) } }, created () { -- cgit v1.2.3-70-g09d2 From 7fa5eb07ddeb6d8c2b572e869d82a27bdd7a7fbf Mon Sep 17 00:00:00 2001 From: xenofem Date: Mon, 24 Feb 2020 18:10:15 -0500 Subject: Refactor status showing/hiding code for better handling of edge cases and easier comprehension --- src/components/status/status.js | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'src/components') diff --git a/src/components/status/status.js b/src/components/status/status.js index fc5956ec..61d66301 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -188,23 +188,22 @@ const Status = { } return this.status.attentions.length > 0 }, + + // When a status has a subject and is also tall, we should only have one show more/less button. If the default is to collapse statuses with subjects, we just treat it like a status with a subject; otherwise, we just treat it like a tall status. + mightHideBecauseSubject () { + return this.status.summary && (!this.tallStatus || this.localCollapseSubjectDefault) + }, + mightHideBecauseTall () { + return this.tallStatus && (!this.status.summary || !this.localCollapseSubjectDefault) + }, hideSubjectStatus () { - if (this.tallStatus && !this.localCollapseSubjectDefault) { - return false - } - return !this.expandingSubject && this.status.summary + return this.mightHideBecauseSubject && !this.expandingSubject }, hideTallStatus () { - if (this.status.summary && this.localCollapseSubjectDefault) { - return false - } - if (this.showingTall) { - return false - } - return this.tallStatus + return this.mightHideBecauseTall && !this.showingTall }, showingMore () { - return (this.tallStatus && this.showingTall) || (this.status.summary && this.expandingSubject) + return (this.mightHideBecauseTall && this.showingTall) || (this.mightHideBecauseSubject && this.expandingSubject) }, nsfwClickthrough () { if (!this.status.nsfw) { @@ -408,14 +407,10 @@ const Status = { this.userExpanded = !this.userExpanded }, toggleShowMore () { - if (this.showingTall) { - this.showingTall = false - } else if (this.expandingSubject && this.status.summary) { - this.expandingSubject = false - } else if (this.hideTallStatus) { - this.showingTall = true - } else if (this.hideSubjectStatus && this.status.summary) { - this.expandingSubject = true + if (this.mightHideBecauseTall) { + this.showingTall = !this.showingTall + } else if (this.mightHideBecauseSubject) { + this.expandingSubject = !this.expandingSubject } }, generateUserProfileLink (id, name) { -- cgit v1.2.3-70-g09d2 From ab4005add57f36cc78b774971f9942c5894362dc Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Mon, 2 Mar 2020 08:35:57 +0200 Subject: add status unavailable message when status can't be loaded in status preview --- src/components/status_popover/status_popover.js | 7 +++++++ src/components/status_popover/status_popover.vue | 10 ++++++++-- src/i18n/en.json | 3 ++- src/i18n/fi.json | 3 ++- src/modules/statuses.js | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) (limited to 'src/components') diff --git a/src/components/status_popover/status_popover.js b/src/components/status_popover/status_popover.js index cb55f67e..159132a9 100644 --- a/src/components/status_popover/status_popover.js +++ b/src/components/status_popover/status_popover.js @@ -5,6 +5,11 @@ const StatusPopover = { props: [ 'statusId' ], + data () { + return { + error: false + } + }, computed: { status () { return find(this.$store.state.statuses.allStatuses, { id: this.statusId }) @@ -18,6 +23,8 @@ const StatusPopover = { enter () { if (!this.status) { this.$store.dispatch('fetchStatus', this.statusId) + .then(data => (this.error = false)) + .catch(e => (this.error = true)) } } } diff --git a/src/components/status_popover/status_popover.vue b/src/components/status_popover/status_popover.vue index 11f6cb5a..f5948207 100644 --- a/src/components/status_popover/status_popover.vue +++ b/src/components/status_popover/status_popover.vue @@ -17,9 +17,15 @@ :statusoid="status" :compact="true" /> +
+ {{ $t('status.status_unavailable') }} +
@@ -50,7 +56,7 @@ border: none; } - .status-preview-loading { + .status-preview-no-content { padding: 1em; text-align: center; diff --git a/src/i18n/en.json b/src/i18n/en.json index 82acc1ab..54d0608e 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -615,7 +615,8 @@ "reply_to": "Reply to", "replies_list": "Replies:", "mute_conversation": "Mute conversation", - "unmute_conversation": "Unmute conversation" + "unmute_conversation": "Unmute conversation", + "status_unavailable": "Status unavailable" }, "user_card": { "approve": "Approve", diff --git a/src/i18n/fi.json b/src/i18n/fi.json index ac8b2ac9..926e6087 100644 --- a/src/i18n/fi.json +++ b/src/i18n/fi.json @@ -289,7 +289,8 @@ "reply_to": "Vastaus", "replies_list": "Vastaukset:", "mute_conversation": "Hiljennรค keskustelu", - "unmute_conversation": "Poista hiljennys" + "unmute_conversation": "Poista hiljennys", + "status_unavailable": "Viesti ei saatavissa" }, "user_card": { "approve": "Hyvรคksy", diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 25b62ac7..f1b7dcbd 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -616,7 +616,7 @@ const statuses = { commit('setNotificationsSilence', { value }) }, fetchStatus ({ rootState, dispatch }, id) { - rootState.api.backendInteractor.fetchStatus({ id }) + return rootState.api.backendInteractor.fetchStatus({ id }) .then((status) => dispatch('addNewStatuses', { statuses: [status] })) }, deleteStatus ({ rootState, commit }, status) { -- cgit v1.2.3-70-g09d2 From b9820b84a14119f3a7a4e1f663927b1ad455a5c2 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 14 Mar 2020 19:41:38 +0000 Subject: Prevent overflow for long usernames/domains --- src/components/notifications/notifications.scss | 1 + 1 file changed, 1 insertion(+) (limited to 'src/components') diff --git a/src/components/notifications/notifications.scss b/src/components/notifications/notifications.scss index f5b13322..a8f4430f 100644 --- a/src/components/notifications/notifications.scss +++ b/src/components/notifications/notifications.scss @@ -81,6 +81,7 @@ .follow-text, .move-text { padding: 0.5em 0; + overflow-wrap: break-word; } .status-el { -- cgit v1.2.3-70-g09d2 From 8c5946b72881c38ce43a4b25bda8a38d4f08aac3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 30 Mar 2020 12:39:28 -0500 Subject: Add button in 3dot menu to copy status link to clipboard --- src/components/extra_buttons/extra_buttons.js | 10 ++++++++++ src/components/extra_buttons/extra_buttons.vue | 8 +++++++- src/i18n/en.json | 3 ++- static/fontello.json | 8 +++++++- 4 files changed, 26 insertions(+), 3 deletions(-) (limited to 'src/components') diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js index 37485383..2dd77c66 100644 --- a/src/components/extra_buttons/extra_buttons.js +++ b/src/components/extra_buttons/extra_buttons.js @@ -3,6 +3,11 @@ import Popover from '../popover/popover.vue' const ExtraButtons = { props: [ 'status' ], components: { Popover }, + data: function () { + return { + statusLink: `https://${this.$store.state.instance.name}${this.$router.resolve({ name: 'conversation', params: { id: this.status.id } }).href}` + } + }, methods: { deleteStatus () { const confirmed = window.confirm(this.$t('status.delete_confirm')) @@ -29,6 +34,11 @@ const ExtraButtons = { this.$store.dispatch('unmuteConversation', this.status.id) .then(() => this.$emit('onSuccess')) .catch(err => this.$emit('onError', err.error.error)) + }, + copyLink () { + navigator.clipboard.writeText(this.statusLink) + .then(() => this.$emit('onSuccess')) + .catch(err => this.$emit('onError', err.error.error)) } }, computed: { diff --git a/src/components/extra_buttons/extra_buttons.vue b/src/components/extra_buttons/extra_buttons.vue index 3a7f1283..c785a180 100644 --- a/src/components/extra_buttons/extra_buttons.vue +++ b/src/components/extra_buttons/extra_buttons.vue @@ -1,6 +1,5 @@