From 44dea9f3646a5c27083dfe6cd6b1522e11c7dc69 Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 9 Feb 2020 17:25:24 -0500 Subject: [PATCH 01/37] 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(-) 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 }) From 02864bc07b2ab2f08232ba1c4c27079454dc87ef Mon Sep 17 00:00:00 2001 From: xenofem Date: Mon, 10 Feb 2020 09:32:07 -0500 Subject: [PATCH 02/37] 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(-) 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 From 86561592d002b08d6b2cd9549e8057a4ffd091cb Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 24 Feb 2020 11:19:00 -0600 Subject: [PATCH 03/37] 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(-) 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 () { From 39e3917118293912b2af09f509457d718f0207c9 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 24 Feb 2020 11:23:16 -0600 Subject: [PATCH 04/37] Remove unneccessary nested --- src/components/registration/registration.js | 5 ----- 1 file changed, 5 deletions(-) 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 () { From 7fa5eb07ddeb6d8c2b572e869d82a27bdd7a7fbf Mon Sep 17 00:00:00 2001 From: xenofem Date: Mon, 24 Feb 2020 18:10:15 -0500 Subject: [PATCH 05/37] 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(-) 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) { From 8c5946b72881c38ce43a4b25bda8a38d4f08aac3 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Mon, 30 Mar 2020 12:39:28 -0500 Subject: [PATCH 06/37] 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(-) 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 @@