mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
Hotfix: correct issues from PRs rollout (#10993)
* fix(various): correct issues from PRs rollout 1. Send Gems modal opens from profiles again 2. Contributor titles appear on hover again 3. Tags dropdown in tasks appears again 4. Only user's own @mentions get highlighted again * fix(test): correct order of css classes in expect
This commit is contained in:
@@ -7,14 +7,14 @@ describe('highlightUserAndEmail', () => {
|
|||||||
|
|
||||||
const result = highlightUsers(text, 'user', 'displayedUser');
|
const result = highlightUsers(text, 'user', 'displayedUser');
|
||||||
|
|
||||||
expect(result).to.contain('<span class="at-highlight at-text">@displayedUser</span>');
|
expect(result).to.contain('<span class="at-text at-highlight">@displayedUser</span>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('highlights username', () => {
|
it('highlights username', () => {
|
||||||
const text = 'hello @user';
|
const text = 'hello @user';
|
||||||
|
|
||||||
const result = highlightUsers(text, 'user', 'displayedUser');
|
const result = highlightUsers(text, 'user', 'displayedUser');
|
||||||
expect(result).to.contain('<span class="at-highlight at-text">@user</span>');
|
expect(result).to.contain('<span class="at-text at-highlight">@user</span>');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('not highlights any email', () => {
|
it('not highlights any email', () => {
|
||||||
@@ -32,8 +32,8 @@ describe('highlightUserAndEmail', () => {
|
|||||||
|
|
||||||
const result = highlightUsers(text, 'use', 'mentions');
|
const result = highlightUsers(text, 'use', 'mentions');
|
||||||
|
|
||||||
expect(result).to.contain('<span class="at-highlight at-text">@mentions</span>');
|
expect(result).to.contain('<span class="at-text at-highlight">@mentions</span>');
|
||||||
expect(result).to.contain('<span class="at-highlight at-text">@use</span>');
|
expect(result).to.contain('<span class="at-text at-highlight">@use</span>');
|
||||||
expect(result).to.not.contain('<span class="at-highlight at-text">@mentions</span>.com');
|
expect(result).to.not.contain('<span class="at-text at-highlight">@mentions</span>.com');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ div
|
|||||||
inbox-modal
|
inbox-modal
|
||||||
creator-intro
|
creator-intro
|
||||||
profileModal
|
profileModal
|
||||||
|
send-gems-modal
|
||||||
b-navbar.topbar.navbar-inverse.static-top.navbar-expand-lg(type="dark", :class="navbarZIndexClass")
|
b-navbar.topbar.navbar-inverse.static-top.navbar-expand-lg(type="dark", :class="navbarZIndexClass")
|
||||||
b-navbar-brand.brand
|
b-navbar-brand.brand
|
||||||
.logo.svg-icon.d-none.d-xl-block(v-html="icons.logo")
|
.logo.svg-icon.d-none.d-xl-block(v-html="icons.logo")
|
||||||
@@ -343,19 +344,21 @@ import syncIcon from 'assets/svg/sync.svg';
|
|||||||
import svgHourglasses from 'assets/svg/hourglass.svg';
|
import svgHourglasses from 'assets/svg/hourglass.svg';
|
||||||
import logo from 'assets/svg/logo.svg';
|
import logo from 'assets/svg/logo.svg';
|
||||||
|
|
||||||
|
import creatorIntro from '../creatorIntro';
|
||||||
import InboxModal from '../userMenu/inbox.vue';
|
import InboxModal from '../userMenu/inbox.vue';
|
||||||
import notificationMenu from './notificationsDropdown';
|
import notificationMenu from './notificationsDropdown';
|
||||||
import creatorIntro from '../creatorIntro';
|
|
||||||
import profileModal from '../userMenu/profileModal';
|
import profileModal from '../userMenu/profileModal';
|
||||||
|
import sendGemsModal from 'client/components/payments/sendGemsModal';
|
||||||
import userDropdown from './userDropdown';
|
import userDropdown from './userDropdown';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
userDropdown,
|
creatorIntro,
|
||||||
InboxModal,
|
InboxModal,
|
||||||
notificationMenu,
|
notificationMenu,
|
||||||
creatorIntro,
|
|
||||||
profileModal,
|
profileModal,
|
||||||
|
sendGemsModal,
|
||||||
|
userDropdown,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ import notificationsMixin from 'client/mixins/notifications';
|
|||||||
const TECH_ASSISTANCE_EMAIL = 'admin@habitica.com';
|
const TECH_ASSISTANCE_EMAIL = 'admin@habitica.com';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['userReceivingGems'],
|
|
||||||
mixins: [paymentsMixin, notificationsMixin],
|
mixins: [paymentsMixin, notificationsMixin],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
@@ -110,6 +109,7 @@ export default {
|
|||||||
hrefTechAssistanceEmail: `<a href="mailto:${TECH_ASSISTANCE_EMAIL}">${TECH_ASSISTANCE_EMAIL}</a>`,
|
hrefTechAssistanceEmail: `<a href="mailto:${TECH_ASSISTANCE_EMAIL}">${TECH_ASSISTANCE_EMAIL}</a>`,
|
||||||
},
|
},
|
||||||
sendingInProgress: false,
|
sendingInProgress: false,
|
||||||
|
userReceivingGems: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -176,5 +176,11 @@ export default {
|
|||||||
this.$root.$emit('bv::hide::modal', 'send-gems');
|
this.$root.$emit('bv::hide::modal', 'send-gems');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
this.$root.$on('habitica::send-gems', (data) => {
|
||||||
|
this.userReceivingGems = data;
|
||||||
|
this.$root.$emit('bv::show::modal', 'send-gems');
|
||||||
|
});
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1009,7 +1009,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleClick (e) {
|
handleClick (e) {
|
||||||
if (this.$refs.popup && !this.$refs.popup.$el.contains(e.target)) {
|
if (this.$refs.popup && !this.$refs.popup.$el.parentNode.contains(e.target)) {
|
||||||
this.closeTagsPopup();
|
this.closeTagsPopup();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
return this.icons[`tier${this.level}`];
|
return this.icons[`tier${this.level}`];
|
||||||
},
|
},
|
||||||
tierTitle () {
|
tierTitle () {
|
||||||
return achievementsLib.getContribText(this.level, this.isNPC) || '';
|
return achievementsLib.getContribText(this.contributor, this.isNPC) || '';
|
||||||
},
|
},
|
||||||
levelStyle () {
|
levelStyle () {
|
||||||
return this.userLevelStyleFromLevel(this.level, this.isNPC);
|
return this.userLevelStyleFromLevel(this.level, this.isNPC);
|
||||||
|
|||||||
@@ -136,7 +136,6 @@
|
|||||||
v-show='selectedPage === "stats"',
|
v-show='selectedPage === "stats"',
|
||||||
:showAllocation='showAllocation()',
|
:showAllocation='showAllocation()',
|
||||||
v-if='user.preferences')
|
v-if='user.preferences')
|
||||||
send-gems-modal(:userReceivingGems='userReceivingGems')
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" >
|
<style lang="scss" >
|
||||||
@@ -388,7 +387,6 @@ import { mapState } from 'client/libs/store';
|
|||||||
import cloneDeep from 'lodash/cloneDeep';
|
import cloneDeep from 'lodash/cloneDeep';
|
||||||
|
|
||||||
import MemberDetails from '../memberDetails';
|
import MemberDetails from '../memberDetails';
|
||||||
import sendGemsModal from 'client/components/payments/sendGemsModal';
|
|
||||||
import markdown from 'client/directives/markdown';
|
import markdown from 'client/directives/markdown';
|
||||||
import achievementsLib from '../../../common/script/libs/achievements';
|
import achievementsLib from '../../../common/script/libs/achievements';
|
||||||
// @TODO: EMAILS.COMMUNITY_MANAGER_EMAIL
|
// @TODO: EMAILS.COMMUNITY_MANAGER_EMAIL
|
||||||
@@ -414,7 +412,6 @@ export default {
|
|||||||
markdown,
|
markdown,
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
sendGemsModal,
|
|
||||||
MemberDetails,
|
MemberDetails,
|
||||||
profileStats,
|
profileStats,
|
||||||
},
|
},
|
||||||
@@ -434,7 +431,6 @@ export default {
|
|||||||
}),
|
}),
|
||||||
adminToolsLoaded: false,
|
adminToolsLoaded: false,
|
||||||
userIdToMessage: '',
|
userIdToMessage: '',
|
||||||
userReceivingGems: '',
|
|
||||||
editing: false,
|
editing: false,
|
||||||
editingProfile: {
|
editingProfile: {
|
||||||
name: '',
|
name: '',
|
||||||
@@ -592,8 +588,7 @@ export default {
|
|||||||
axios.post(`/api/v4/user/block/${this.user._id}`);
|
axios.post(`/api/v4/user/block/${this.user._id}`);
|
||||||
},
|
},
|
||||||
openSendGemsModal () {
|
openSendGemsModal () {
|
||||||
this.userReceivingGems = this.user;
|
this.$root.$emit('habitica::send-gems', this.user);
|
||||||
this.$root.$emit('bv::show::modal', 'send-gems');
|
|
||||||
},
|
},
|
||||||
adminRevokeChat () {
|
adminRevokeChat () {
|
||||||
if (!this.hero.flags) {
|
if (!this.hero.flags) {
|
||||||
|
|||||||
@@ -9,15 +9,14 @@ const finalMentionRegEx = new RegExp(`${optionalAnchorTagRegExStr}${mentionRegEx
|
|||||||
export function highlightUsers (text, userName, displayName) {
|
export function highlightUsers (text, userName, displayName) {
|
||||||
const currentUser = [`@${userName}`, `@${displayName}`].map(escapeRegExp);
|
const currentUser = [`@${userName}`, `@${displayName}`].map(escapeRegExp);
|
||||||
|
|
||||||
|
|
||||||
text = text.replace(finalMentionRegEx, (fullMatched, preMention, mentionStr, postMention) => {
|
text = text.replace(finalMentionRegEx, (fullMatched, preMention, mentionStr, postMention) => {
|
||||||
if (preMention && preMention.includes('<a') || Boolean(postMention)) {
|
if (preMention && preMention.includes('<a') || Boolean(postMention)) {
|
||||||
return fullMatched;
|
return fullMatched;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isUserMention = currentUser.includes(mentionStr) ? 'at-text' : '';
|
const isUserMention = currentUser.includes(mentionStr) ? 'at-highlight' : '';
|
||||||
|
|
||||||
return fullMatched.replace(mentionStr, `<span class="at-highlight ${isUserMention}">${mentionStr}</span>`);
|
return fullMatched.replace(mentionStr, `<span class="at-text ${isUserMention}">${mentionStr}</span>`);
|
||||||
});
|
});
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
|
|||||||
Reference in New Issue
Block a user