mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-14 02:02:19 +00:00
fix(usernames): various
Disappearing input fields Text replacement in @mentions UUID visibility in profiles Purple dot for @mentioned usernames TypeError preventing RYA Group Plan member list error
This commit is contained in:
parent
7484ecf729
commit
34e7690c38
6 changed files with 21 additions and 22 deletions
|
|
@ -108,11 +108,11 @@ export default {
|
|||
searchResults () {
|
||||
if (!this.searchActive) return [];
|
||||
if (!this.atRegex.exec(this.text)) return [];
|
||||
let currentSearch = this.atRegex.exec(this.text)[0];
|
||||
currentSearch = currentSearch.substring(1, currentSearch.length);
|
||||
this.currentSearch = this.atRegex.exec(this.text)[0];
|
||||
this.currentSearch = this.currentSearch.substring(1, this.currentSearch.length);
|
||||
|
||||
return this.tmpSelections.filter((option) => {
|
||||
return option.displayName.toLowerCase().indexOf(currentSearch.toLowerCase()) !== -1 || option.username && option.username.toLowerCase().indexOf(currentSearch.toLowerCase()) !== -1;
|
||||
return option.displayName.toLowerCase().indexOf(this.currentSearch.toLowerCase()) !== -1 || option.username && option.username.toLowerCase().indexOf(this.currentSearch.toLowerCase()) !== -1;
|
||||
}).slice(0, 4);
|
||||
},
|
||||
|
||||
|
|
@ -186,11 +186,8 @@ export default {
|
|||
},
|
||||
select (result) {
|
||||
let newText = this.text;
|
||||
if (result.username) {
|
||||
newText = `${newText}${result.username} `;
|
||||
} else {
|
||||
newText = `${newText}${result.displayName} `;
|
||||
}
|
||||
const targetName = `${result.username || result.displayName} `;
|
||||
newText = newText.replace(new RegExp(`${this.currentSearch}$`), targetName);
|
||||
this.$emit('select', newText);
|
||||
},
|
||||
handleEsc (e) {
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ import axios from 'axios';
|
|||
import moment from 'moment';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import escapeRegExp from 'lodash/escapeRegExp';
|
||||
import max from 'lodash/max';
|
||||
|
||||
import habiticaMarkdown from 'habitica-markdown';
|
||||
import { mapState } from 'client/libs/store';
|
||||
|
|
@ -197,23 +198,24 @@ export default {
|
|||
...mapState({user: 'user.data'}),
|
||||
isUserMentioned () {
|
||||
const message = this.msg;
|
||||
let user = this.user;
|
||||
const user = this.user;
|
||||
|
||||
if (message.hasOwnProperty('highlight')) return message.highlight;
|
||||
|
||||
message.highlight = false;
|
||||
let messagetext = message.text.toLowerCase();
|
||||
let username = user.profile.name;
|
||||
let mentioned = messagetext.indexOf(username.toLowerCase());
|
||||
let escapedUsername = escapeRegExp(username);
|
||||
let pattern = `@${escapedUsername}([^\w]|$){1}`;
|
||||
|
||||
const messageText = message.text.toLowerCase();
|
||||
const displayName = user.profile.name;
|
||||
const username = user.auth.local && user.auth.local.username;
|
||||
const mentioned = max([messageText.indexOf(username.toLowerCase()), messageText.indexOf(displayName.toLowerCase())]);
|
||||
if (mentioned === -1) return message.highlight;
|
||||
|
||||
let preceedingchar = messagetext.substring(mentioned - 1, mentioned);
|
||||
if (mentioned === 0 || preceedingchar.trim() === '' || preceedingchar === '@') {
|
||||
const escapedDisplayName = escapeRegExp(displayName);
|
||||
const escapedUsername = escapeRegExp(username);
|
||||
const pattern = `@(${escapedUsername}|${escapedDisplayName})([^\w]|$)`;
|
||||
const precedingChar = messageText.substring(mentioned - 1, mentioned);
|
||||
if (mentioned === 0 || precedingChar.trim() === '' || precedingChar === '@') {
|
||||
let regex = new RegExp(pattern, 'i');
|
||||
message.highlight = regex.test(messagetext);
|
||||
message.highlight = regex.test(messageText);
|
||||
}
|
||||
|
||||
return message.highlight;
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@
|
|||
this.invites = filter(this.invites, (invite) => {
|
||||
return invite.text.length > 0;
|
||||
});
|
||||
while (this.invites.length < 2) this.invites.push(clone(INVITE_DEFAULTS));
|
||||
if (this.invites[this.invites.length - 1].text.length > 0) this.invites.push(clone(INVITE_DEFAULTS));
|
||||
forEach(this.invites, (value, index) => {
|
||||
if (value.text.length < 1) return this.invites[index].valid = null;
|
||||
|
|
|
|||
|
|
@ -453,8 +453,7 @@ export default {
|
|||
Promise.all([
|
||||
this.$store.dispatch('user:fetch', {forceLoad: true}),
|
||||
this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true}),
|
||||
]).then(() => this.forceVerifyUsername())
|
||||
.then(() => this.runYesterDailies());
|
||||
]).then(() => this.runYesterDailies());
|
||||
}
|
||||
}, 1000),
|
||||
scheduleNextCron () {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ div
|
|||
div
|
||||
.name(v-if='user.auth && user.auth.local && user.auth.local.username') @{{ user.auth.local.username }}
|
||||
div
|
||||
.name(v-if='this.userLoggedIn.contributor.admin') {{ user._id }}
|
||||
.name {{ user._id }}
|
||||
.col-12.col-md-4
|
||||
button.btn.btn-secondary(v-if='user._id === userLoggedIn._id', @click='editing = !editing') {{ $t('edit') }}
|
||||
.row(v-if='!editing')
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export let publicFields = `preferences.size preferences.hair preferences.skin pr
|
|||
flags.verifiedUsername auth.local.username`;
|
||||
|
||||
// The minimum amount of data needed when populating multiple users
|
||||
export let nameFields = 'profile.name';
|
||||
export let nameFields = 'profile.name auth.local.username flags.verifiedUsername';
|
||||
|
||||
export { schema };
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue