diff --git a/website/client/components/groups/tavern.vue b/website/client/components/groups/tavern.vue index 9f8fbeff67..7666533358 100644 --- a/website/client/components/groups/tavern.vue +++ b/website/client/components/groups/tavern.vue @@ -133,6 +133,8 @@ .svg-icon(v-html="icons.downIcon") .section.row(v-if="sections.helpfulLinks") ul + li + a(href='', @click.prevent='modForm()') {{ $t('contactForm') }} li router-link(to='/static/community-guidelines', v-once) {{ $t('communityGuidelinesLink') }} li @@ -510,12 +512,12 @@ padding: 1em; cursor: pointer; } - diff --git a/website/client/libs/modform.js b/website/client/libs/modform.js new file mode 100644 index 0000000000..ce6b1d3376 --- /dev/null +++ b/website/client/libs/modform.js @@ -0,0 +1,38 @@ +// @TODO: I have abstracted this in another PR. Use that function when merged +function getApiKey () { + let AUTH_SETTINGS = localStorage.getItem('habit-mobile-settings'); + + if (AUTH_SETTINGS) { + AUTH_SETTINGS = JSON.parse(AUTH_SETTINGS); + + if (AUTH_SETTINGS.auth && AUTH_SETTINGS.auth.apiId && AUTH_SETTINGS.auth.apiToken) { + return AUTH_SETTINGS.auth.apiToken; + } + } +} + +export function goToModForm (user) { + if (!user) return; + + const apiKey = getApiKey(); + if (!apiKey) return; + + const tenMins = 10 * 60 * 1000; + let dateTime; + dateTime = new Date(); + dateTime.setTime(dateTime.getTime() + tenMins); + const expires = `expires=${dateTime.toGMTString()}`; + + const email = encodeURIComponent(user.auth.local.email); + + const userData = { + email, + profileName: user.profile.name, + uuid: user._id, + apiKey, + }; + + document.cookie = `habiticauserdata=${JSON.stringify(userData)};${expires};domain=.habitica.com;path=/`; + + window.location.href = 'http://contact.habitica.com'; +} diff --git a/website/common/locales/en/front.json b/website/common/locales/en/front.json index 298b1c429f..8a0b8917c7 100644 --- a/website/common/locales/en/front.json +++ b/website/common/locales/en/front.json @@ -221,7 +221,7 @@ "reportCommunityIssues": "Report Community Issues", "subscriptionPaymentIssues": "Subscription and Payment Issues", "generalQuestionsSite": "General Questions about the Site", - "businessInquiries": "Business Inquiries", + "businessInquiries": "Business/Marketing Inquiries", "merchandiseInquiries": "Physical Merchandise (T-Shirts, Stickers) Inquiries", "marketingInquiries": "Marketing/Social Media Inquiries", "tweet": "Tweet", diff --git a/website/common/locales/en/generic.json b/website/common/locales/en/generic.json index 7a864adaeb..260ace67a4 100644 --- a/website/common/locales/en/generic.json +++ b/website/common/locales/en/generic.json @@ -293,5 +293,6 @@ "letsgo": "Let's Go!", "selected": "Selected", "howManyToBuy": "How many would you like to buy?", - "habiticaHasUpdated": "There is a new Habitica update. Refresh to get the latest version!" + "habiticaHasUpdated": "There is a new Habitica update. Refresh to get the latest version!", + "contactForm": "Contact the Moderation Team" }