mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 13:17:24 +01:00
fix(usernames): various
Partial fixage for autocomplete @ing Don't add username to chat message if user is unverified Fix flying pets Fix console error about avatar intro
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
|
||||
.avatar {
|
||||
width: 140px;
|
||||
height: 147px;
|
||||
image-rendering: pixelated;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -68,7 +68,7 @@ export default {
|
||||
props: ['selections', 'text', 'caretPosition', 'coords', 'chat', 'textbox'],
|
||||
data () {
|
||||
return {
|
||||
atRegex: new RegExp(/@[\w-]+$/),
|
||||
atRegex: /(?!\b)@[\w-]*$/,
|
||||
currentSearch: '',
|
||||
searchActive: false,
|
||||
searchEscaped: false,
|
||||
@@ -134,7 +134,6 @@ export default {
|
||||
return;
|
||||
}
|
||||
if (newText[newText.length - 1] === '@') {
|
||||
this.searchActive = false;
|
||||
this.searchEscaped = false;
|
||||
}
|
||||
if (this.searchEscaped) return;
|
||||
@@ -142,7 +141,6 @@ export default {
|
||||
if (!this.atRegex.test(newText)) return;
|
||||
|
||||
this.searchActive = true;
|
||||
this.currentSearchPosition = newText.lastIndexOf('@', this.caretPosition);
|
||||
},
|
||||
chat () {
|
||||
this.resetDefaults();
|
||||
@@ -153,10 +151,8 @@ export default {
|
||||
resetDefaults () {
|
||||
// Mounted is not called when switching between group pages because they have the
|
||||
// the same parent component. So, reset the data
|
||||
this.currentSearch = '';
|
||||
this.searchActive = false;
|
||||
this.searchEscaped = false;
|
||||
this.currentSearchPosition = 0;
|
||||
this.tmpSelections = [];
|
||||
},
|
||||
grabUserNames () {
|
||||
@@ -189,13 +185,12 @@ export default {
|
||||
return this.icons[`tier${message.contributor.level}`];
|
||||
},
|
||||
select (result) {
|
||||
let newText = this.text.slice(0, this.currentSearchPosition + 1);
|
||||
let newText = this.text;
|
||||
if (result.username) {
|
||||
newText = newText.concat(result.username);
|
||||
newText = `${newText}${result.username} `;
|
||||
} else {
|
||||
newText = newText.concat(result.displayName);
|
||||
newText = `${newText}${result.displayName} `;
|
||||
}
|
||||
this.searchActive = false;
|
||||
this.$emit('select', newText);
|
||||
},
|
||||
handleEsc (e) {
|
||||
|
||||
@@ -292,7 +292,7 @@ export default {
|
||||
this.$emit('show-member-modal', memberId);
|
||||
},
|
||||
atHighlight (text) {
|
||||
return text.replace(new RegExp(/@[\w-]+/g), match => {
|
||||
return text.replace(new RegExp(/(?!\b)@[\w-]+/g), match => {
|
||||
return `<span class="at-highlight">${match}</span>`;
|
||||
});
|
||||
},
|
||||
|
||||
@@ -373,7 +373,7 @@ b-modal#avatar-modal(title="", :size='editing ? "lg" : "md"', :hide-header='true
|
||||
p(v-once) {{ $t('justinIntroMessage3') }}
|
||||
.npc-justin-textbox
|
||||
.section.mr-5.ml-5(v-if='modalPage === 1')
|
||||
username-form(@usernameConfirmed='modalPage += 1', :avatarIntro='"true"')
|
||||
username-form(@usernameConfirmed='modalPage += 1', :avatarIntro='true')
|
||||
.small.text-center(v-html="$t('usernameTOSRequirements')")
|
||||
|
||||
.section.container.footer
|
||||
|
||||
@@ -118,7 +118,7 @@ export function messageDefaults (msg, user) {
|
||||
contributor: user.contributor && user.contributor.toObject(),
|
||||
backer: user.backer && user.backer.toObject(),
|
||||
user: user.profile.name,
|
||||
username: user.auth && user.auth.local && user.auth.local.username,
|
||||
username: user.flags.verifiedUsername && user.auth && user.auth.local && user.auth.local.username,
|
||||
});
|
||||
} else {
|
||||
message.uuid = 'system';
|
||||
|
||||
Reference in New Issue
Block a user