Skip to content

Commit

Permalink
fix(various): correct issues from PRs rollout
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SabreCat committed Feb 15, 2019
1 parent d932d6d commit 3cbf6ce
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
9 changes: 6 additions & 3 deletions website/client/components/header/menu.vue
Expand Up @@ -3,6 +3,7 @@ div
inbox-modal
creator-intro
profileModal
send-gems-modal
b-navbar.topbar.navbar-inverse.static-top.navbar-expand-lg(type="dark", :class="navbarZIndexClass")
b-navbar-brand.brand
.logo.svg-icon.d-none.d-xl-block(v-html="icons.logo")
Expand Down Expand Up @@ -343,19 +344,21 @@ import syncIcon from 'assets/svg/sync.svg';
import svgHourglasses from 'assets/svg/hourglass.svg';
import logo from 'assets/svg/logo.svg';
import creatorIntro from '../creatorIntro';
import InboxModal from '../userMenu/inbox.vue';
import notificationMenu from './notificationsDropdown';
import creatorIntro from '../creatorIntro';
import profileModal from '../userMenu/profileModal';
import sendGemsModal from 'client/components/payments/sendGemsModal';
import userDropdown from './userDropdown';
export default {
components: {
userDropdown,
creatorIntro,
InboxModal,
notificationMenu,
creatorIntro,
profileModal,
sendGemsModal,
userDropdown,
},
data () {
return {
Expand Down
8 changes: 7 additions & 1 deletion website/client/components/payments/sendGemsModal.vue
Expand Up @@ -91,7 +91,6 @@ import notificationsMixin from 'client/mixins/notifications';
const TECH_ASSISTANCE_EMAIL = 'admin@habitica.com';
export default {
props: ['userReceivingGems'],
mixins: [paymentsMixin, notificationsMixin],
data () {
return {
Expand All @@ -110,6 +109,7 @@ export default {
hrefTechAssistanceEmail: `<a href="mailto:${TECH_ASSISTANCE_EMAIL}">${TECH_ASSISTANCE_EMAIL}</a>`,
},
sendingInProgress: false,
userReceivingGems: null,
};
},
computed: {
Expand Down Expand Up @@ -176,5 +176,11 @@ export default {
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>
2 changes: 1 addition & 1 deletion website/client/components/tasks/taskModal.vue
Expand Up @@ -1009,7 +1009,7 @@ export default {
}
},
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();
}
},
Expand Down
2 changes: 1 addition & 1 deletion website/client/components/userLink.vue
Expand Up @@ -103,7 +103,7 @@
return this.icons[`tier${this.level}`];
},
tierTitle () {
return achievementsLib.getContribText(this.level, this.isNPC) || '';
return achievementsLib.getContribText(this.contributor, this.isNPC) || '';
},
levelStyle () {
return this.userLevelStyleFromLevel(this.level, this.isNPC);
Expand Down
7 changes: 1 addition & 6 deletions website/client/components/userMenu/profile.vue
Expand Up @@ -136,7 +136,6 @@
v-show='selectedPage === "stats"',
:showAllocation='showAllocation()',
v-if='user.preferences')
send-gems-modal(:userReceivingGems='userReceivingGems')
</template>

<style lang="scss" >
Expand Down Expand Up @@ -388,7 +387,6 @@ import { mapState } from 'client/libs/store';
import cloneDeep from 'lodash/cloneDeep';
import MemberDetails from '../memberDetails';
import sendGemsModal from 'client/components/payments/sendGemsModal';
import markdown from 'client/directives/markdown';
import achievementsLib from '../../../common/script/libs/achievements';
// @TODO: EMAILS.COMMUNITY_MANAGER_EMAIL
Expand All @@ -414,7 +412,6 @@ export default {
markdown,
},
components: {
sendGemsModal,
MemberDetails,
profileStats,
},
Expand All @@ -434,7 +431,6 @@ export default {
}),
adminToolsLoaded: false,
userIdToMessage: '',
userReceivingGems: '',
editing: false,
editingProfile: {
name: '',
Expand Down Expand Up @@ -592,8 +588,7 @@ export default {
axios.post(`/api/v4/user/block/${this.user._id}`);
},
openSendGemsModal () {
this.userReceivingGems = this.user;
this.$root.$emit('bv::show::modal', 'send-gems');
this.$root.$emit('habitica::send-gems', this.user);
},
adminRevokeChat () {
if (!this.hero.flags) {
Expand Down
5 changes: 2 additions & 3 deletions website/client/libs/highlightUsers.js
Expand Up @@ -9,15 +9,14 @@ const finalMentionRegEx = new RegExp(`${optionalAnchorTagRegExStr}${mentionRegEx
export function highlightUsers (text, userName, displayName) {
const currentUser = [`@${userName}`, `@${displayName}`].map(escapeRegExp);


text = text.replace(finalMentionRegEx, (fullMatched, preMention, mentionStr, postMention) => {
if (preMention && preMention.includes('<a') || Boolean(postMention)) {
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;
Expand Down

0 comments on commit 3cbf6ce

Please sign in to comment.