Compare commits

...

611 Commits

Author SHA1 Message Date
Sabe Jones
0ffd3e5883 4.0.6 2017-09-29 20:35:02 +00:00
Sabe Jones
900bc8dfc1 Merge branch 'develop' into release 2017-09-29 20:34:52 +00:00
Keith Holliday
ec260016d3 Task sort payment fixes (#9104)
* Added sorting to dated filter

* Validated payment data type
2017-09-29 15:30:28 -05:00
Sabe Jones
ec770fb29e 4.0.5 2017-09-29 16:19:02 +00:00
Matteo Pagliazzi
c1079e4eae Client Tasks Length (#9101)
* change tasks column height

* stack columns on smaller screens
2017-09-29 18:17:58 +02:00
Sabe Jones
3cb5637fd5 Merge branch 'release' into develop 2017-09-29 15:21:10 +00:00
Matteo Pagliazzi
cf3a0118c9 fix typo 2017-09-29 12:39:18 +02:00
Matteo Pagliazzi
895a383089 cache what is cacheable (because hashed) in the new client, should fix the broken navigation while using the site before and after a deploy 2017-09-29 12:37:03 +02:00
Matteo Pagliazzi
f730e7b345 fix password reset (setting a new one) 2017-09-29 12:15:31 +02:00
Alys
d8f3d99d59 fix footer link to Report a Bug guild 2017-09-29 18:57:33 +10:00
Sabe Jones
99fb1f6116 4.0.4 2017-09-29 01:56:18 +00:00
Alys
7c6dce2124 change link in Bailey from G docs to wiki 2017-09-29 11:51:50 +10:00
Sabe Jones
c757a3f52d 4.0.3 2017-09-28 23:50:44 +00:00
Sabe Jones
ffb318fe8d fix(news): sprite path 2017-09-28 23:50:29 +00:00
Sabe Jones
19cd15ed62 4.0.2 2017-09-28 23:37:16 +00:00
Sabe Jones
3495662196 fix(redesign): Bailey and debug 2017-09-28 23:37:00 +00:00
SabreCat
908a1340a4 4.0.1 2017-09-28 22:59:07 +00:00
Keith Holliday
31f4610b20 Sabrecat/redesign launch bailey (#9094)
* chore(news): Bailey

* chore(news): Bailey on old client

* Fixed seasonal images

* Fixed footer and images for bailey
2017-09-28 15:36:48 -05:00
Sabe Jones
5eac2a6697 4.0.0 2017-09-28 17:50:11 +00:00
Sabe Jones
4495539e8c Merge branch 'develop' into release 2017-09-28 17:39:35 +00:00
Alys
42e6f10b08 remove non-working difficulty tooltip (#9092) 2017-09-28 12:19:29 -05:00
Matteo Pagliazzi
66750e77d1 Client 404 Page (#9093)
* fix z-index of footer

* 404 page

* fixes
2017-09-28 12:19:15 -05:00
SabreCat
1eb31a4fec Merge branch 'develop' into release 2017-09-28 16:02:47 +00:00
SabreCat
fdf2dd1f1a chore(guilds): migration to rearrange fields 2017-09-28 15:24:59 +00:00
SabreCat
f098fbcc80 chore(sprites): compile 2017-09-28 14:40:53 +00:00
Sabe Jones
5c429d0328 chore(i18n): update locales 2017-09-28 01:07:43 +00:00
Sabe Jones
08a84ce13d Redesign: Veteran Pet migration (#9090)
* feat(migration): add Veteran pets
Also refactor pinned items query to fetch less data

* refactor(migration): rename/move, not duplicate
2017-09-27 19:47:04 -05:00
negue
f4bf2df4a9 fortify potion + fix pinning check (#9089) 2017-09-27 18:06:07 -05:00
negue
ee6ceecc35 check pinning for unknow item type and path (#9087) 2017-09-27 23:25:34 +02:00
negue
76c3e51660 sep 25 fixes (#9075)
* on class change: remove owned gear from pinned items

* move dragging item-info closer to the cursor (food / hatching potion)

* remove v-once at attributesPopover (if the parent component is recycled the old data stays active)

* prevent popover to show data of an item that was removed - but the popover stays opened
2017-09-27 21:07:42 +02:00
Matteo Pagliazzi
d40543f4ca Paglias Client Fixes (#9086)
* fix login background on bigger screens

* redirect to correct page after login / signup

* fix mountains in background
2017-09-27 20:59:49 +02:00
Matteo Pagliazzi
e1ad19c216 Client: Port Reset Password Page (#9057)
* start work on porting the reset password page

* add new api route for setting a new password after a reset

* wip client page

* port tests

* wip

* fix linting

* skip tests
2017-09-27 18:57:52 +02:00
Alys
a03c6184b3 fix link to Data Display Tool (#9085) 2017-09-27 22:24:57 +10:00
Keith Holliday
526d0b1a23 Cloned correctly (#9084)
Fixed cloning values during fix custom values
2017-09-26 23:02:58 -05:00
Sabe Jones
f523bd424f 3.116.1 2017-09-27 00:18:34 +00:00
Sabe Jones
eda76efd28 fix(hooks): remove default tasks from content instead 2017-09-26 23:29:39 +00:00
Sabe Jones
08323f307c fix(new-client): display tweaks (#9080) 2017-09-26 18:24:57 -05:00
Sabe Jones
1c301f8328 fix(test): update expectations on mobile tasks 2017-09-26 22:45:20 +00:00
Sabe Jones
a515168766 fix(mobile): let mobile reg handle default tasks and tags 2017-09-26 21:40:06 +00:00
Keith Holliday
927a08defd Small payment fixes (#9082)
* Fixed some parameter passing and computed placements

* reset edit when user change

* Lint fix
2017-09-26 16:05:54 -05:00
Sabe Jones
c8d5eb9689 3.116.0 2017-09-26 20:58:49 +00:00
SabreCat
ec298291d4 feat(event): Fall Hatching Potions
and important announcements
2017-09-26 20:55:12 +00:00
Keith Holliday
356f2c7b7f Sept 26 fixes (#9081)
* Fixed layering of avatar

* Fixed navbar padding on small screens

* Dropdowns go left

* Adjusted member details styles

* Fixed task tag display

* Added toggle to buy gems

* Began moving presskit

* Fixed easing and validating immediately

* Added hover state to login and fixed transitions for social buttons

* Fixed more style issues

* Fixed overflow

* Added email warning

* Show login button on mobile

* Some column adjustments for mobile

* Fixed email/username confusion
2017-09-26 15:04:29 -05:00
Matteo Pagliazzi
b12bf773f1 Payments Fixes (#9079)
* fix stripe checkout

* fix amazon pay on firefox

* add comment
2017-09-26 19:30:04 +02:00
Alys
d70ff4e5a3 new client various fixes: all users now see challenge progress, changes to create strings, etc (#9078)
* adjust how User > Profile is referred to

* change "Create" to "Add Task" in a Challenge's page

* remove commented-out code for making a Group Plan cost Gems (there should be no Gem cost)

* split 'create' locales string into multiple strings for different purposes

- Allows text to be changed individually for each purpose.
- Assists translators in determining the best translation.
- Makes it easier to find locations in code for each string.

* remove "public" option for Group Plan creation modal

* allow all users to see challenge participant progress
2017-09-26 22:44:49 +10:00
Alys
a68b02d403 new client various fixes: flagging; non-Public Challenges can have 0 gem prize; etc (#9072)
* allow a user (admin or non-admin) to flag their own message

Initially implemented in https://github.com/HabitRPG/habitica/issues/8005

Use case for a non-admin needing to flag their own message:
- a new user posts a question
- a socialite answers
- the user posts again and reveals that they're under 13
- the socialite flags all of the user's messages and all replies to the user including the socialite's own reply (it's a requirement that all messages to and from under-aged users be hidden and some socialites know this)

* change NPC message for Tavern: "Rest in the Inn" > "Pause Damage"

* prevent a chat message being hidden until it's been flagged more than once

* allow non-Tavern (non-"Public") challenges to have zero gem prize

Also changes message about gem prize to say "Public Challenges" instead of "Tavern Challenges"

* finish committing merge conflict
2017-09-26 09:33:46 +10:00
Keith Holliday
2db5ab2352 Sept 25 fixes (#9076)
* Fixed amazon config

* Added breakpoint for fixed footer

* Fixed some minor sorting bugs
2017-09-25 17:26:23 -05:00
negue
2a43df34c0 multiple fixes sep 24 (#9073)
* pin purchase-gems + orb of rebirth

* show questInfo in items inventory and reward column

* un-equip gear using the star / clicking on the drawer
2017-09-25 20:12:49 +02:00
Keith Holliday
a317b351be Sept 23 fixes (#9074)
* Discover challenges

* Fixed hero loading

* Moved add task button

* Fixed bailey showing

* Added logs for bad sub data

* Fixed blurb editing

* Added confirmation for deleteing message

* Reset invite modals on invite

* fixed group member sorting

* Fixed chat time styles

* Fixed hover on liked

* Fixed like count

* Added reverse

* Fixed editing party

* Added leader conditions

* Added search

* Added loading

* Reset members when leaving party

* Rounded pending

* Fixed overflow on collecting quests

* Added to invite friends

* Hid summary from party

* Fixed button styles

* Fixed button class

* Removed okay button

* Fixed renav for profile modal

* Added subscription back to menu

* Fixed static link

* Added daily due setting

* Added local auth adding

* Fixed centering of text

* Removed message locally

* Added count for new message

* Added style fix for profile pet

* Fixed achievement popovers

* Fixed white boxes

* Added plain color backgrounds

* fixed challenge mutability

* Fixed challenge editing

* Added notation for large numbers

* Add color text to guild sizes

* Removed membership filters from discover challenges

* Added invites to group

* Cmd + enter send message

* Made leader clickable

* Updated group validation

* Added cancelling autocomplete

* Added mention icon

* Added removing member

* Removed extra string
2017-09-25 13:02:12 -05:00
negue
4759764e61 NPC Flavors (#9066)
* use scss variables to chose the seasonal images instead of replacing them + added fall festival npc images

* hide spooky sparkles until needed
2017-09-24 22:10:54 +02:00
Alys
5aea8def3b new client various fixes: Hall of Heroes is visible, Sort gear by Perception, etc (#9070)
* adjust wording and time format for Custom Day Start time confirmation

- explains that this is the EARLIEST possible time for cron
- allows user to see the exact earliest time

* remove unnecessary hyphen from login date in Profile; added whitespace after colons

* allow Hall of Heroes to be seen by non-admin users (except for admin interface)

Also removes a level of code indentation that seemed to be incorrect.

* clarify that Orb of Rebirth costs 0 gems after level 100

Previously, the modal showed just a gem icon with no number, which was misleading.
Now it shows explicitly 0 gems.

* fix spelling mistake (Challeges > Challenges)

* allow equipment to be sorted by Perception

Also change Con > CON, Per > PER, etc for consistency with abbreviations used in other locations.
2017-09-24 20:06:17 +10:00
Sabe Jones
dde63b619f Redesign: Fixes 09/21 (#9062)
* fix(notifications): click to clear

* fix(chat): no italic/gray typing in Tavern

* fix(tutorial): tighter Justin modal

* fix(modal): revert changes to avatar editing

* fix(avatar): let edit modal be big
2017-09-22 22:27:00 -05:00
Keith Holliday
cbdb0bc3e3 Sept 22 2 (#9067)
* Added show member modal when hero is clicked

* Added drag for checklist and fixed display system messages

* Fixed party modal showing from group page

* Delete new message key

* Adjusted column sizes for chat

* Fixed key
2017-09-22 19:30:37 -05:00
Keith Holliday
6edd1a1fa5 Sept 22 fixes (#9065)
* Removed lingering checklist

* Added another party data check

* Added move cursor on hover

* Removed task locally

* Prevented user from being able to delete an active challenge task

* Reset tasks when viewing member progress

* Prevented challenge owners from adding checklists

* Hide challenges columns with no tasks

* Add error translations

* Added markdown to challenge description

* Allowed leader to rejoin challenge

* Replaced description with summary

* Fixed delete logic

* Added author

* Added loading message

* Added load more

* Added default sub

* Fixed remove all

* Added lint
2017-09-22 16:47:16 -05:00
negue
6fcf739c89 sep 21 fixes (#9060)
* remove `classSelected` on adding new pinned gear

* use show::modal on buyModal / selectMembersModal instead of v-if=item

* show::modal for buyQuestModal - fix bundles class

* fix buy potion

* fix open selectMembersModal (after changing to shop::modal)
2017-09-22 13:34:00 +02:00
Matteo Pagliazzi
f128f3d3cd Client Fixes (#9064)
* fix loading of payments scripts

* improve loading times
2017-09-22 13:29:08 +02:00
Keith Holliday
744090e652 Sept 21 fixes (#9061)
* Fixed analytics when party is not defined:

* Waited to set Stripe

* Added popovers to danger zone

* Added date format to next cron

* Redirect user back to home for static

* Removed old settings

* Fixed show bailey

* Fixed close button on inbox

* Fixed sending blank message

* Changed input to text area in inbox

* Fixed deleting messages in inbox

* Allowed user to delete other user message in inbox

* Fixed joined date

* Fixed count styling

* Fixed display of pet and mount

* Removed white box when using base_0 items

* Fixed your profile to show when clicking from menu

* Prevented user from pinning already purchased backgroud

* Added user last log in

* Added date refresh for yesterdailies modal

* Updatd eyewear

* Fixed start a quest button

* Fixed styles on home page footer

* Added checklist sorting

* Added support for if card type is missing computed field

* Fixed linting
2017-09-21 18:53:45 -05:00
Sabe Jones
9c3b367b29 3.115.0 2017-09-21 18:44:14 +00:00
Sabe Jones
90451fbec8 chore(i18n): update locales 2017-09-21 18:42:09 +00:00
SabreCat
64addcf847 fix(news): add'l art credit 2017-09-21 18:34:17 +00:00
Sabe Jones
5263b5e42f Fall Festival 2017 (#9058)
* feat(event): Fall Festival 2017

* chore(sprites): compile

* fix(sanity): remove duplicate locale file
2017-09-21 13:33:43 -05:00
Matteo Pagliazzi
81fc727d41 Client Fixes (#9056)
* remove console.log calls used for debugging

* open member modal when clicking on user name or avatar in chat

* misc fixes to strings, payments, ...

* simplify code

* secure statsComputed
2017-09-21 19:49:27 +02:00
Matteo Pagliazzi
7a74d4c296 Client: update urls (#9025)
* start to update urls

* ability to unsubscribe from emails
2017-09-21 16:00:52 +02:00
Matteo Pagliazzi
b6a5efc524 client: add logging around bug 2017-09-21 15:43:35 +02:00
Keith Holliday
1e1220d0f9 Sept 20 fixes 2 (#9055)
* Added cards reading

* Updated nav items

* Replaced logos with svgs

* Updated mobile preview image
2017-09-20 19:35:03 -05:00
negue
0a691ffb4f [WIP] new client - seasonal-shop (#9018)
* extract seasonal-shop config - use summer season items (to work on)

* add suggested border to shopItems

* refactor getOfficialPinnedItems (now includes the seasonal gear)

* refactor shops.getSeasonalShop - add featured items to result - add the set to special equipment items

* feat(content): Fall 2017 seasonal gear
Also adds set keys for all prior seasonal gear.

* show item limited time (buyModal & shopItem)

* select seasonal fall sets

* WIP(seasonal-shop): placeholder Fall 2017 items

* fix lint

* sprites

* styling + fix purchase of seasonal spells

* compile sprites

* fixes: check isPinned with officialItems

* enable purchase of seasonal items for testing

* fix shop apis

* add featuredItems to market

* quest shop: add featuredItems to api

* tiem travelers shop: add featuredItems to api

* fix gear types filter

* feat(content): Fall 2017 compleat

* chore(sprites): compile

* show opened shop state (npc+background)

* add opened seasonal npc

* current seasonal users class set = purchase by gold - lock other sets of the current season

* hide event badge in seasonal shop - dot only for suggested items - cursor: pointer on shopItems

* refresh rewards column list (seasonal gear won't refresh it on purchase)

* fix duplicate seasonal gear -> remove special items from the old reward gear (which is used to reset the pinned gears)

* every current season gear is purchased by gold - prevent buyModal on locked items

* use the current event date range

* list seasonal sets by event date

* use custom method instead of updateStore to list the pinnable gear

* change daterange to 10-31

* fix start quest modal from items - disable invite quest button if a quest is already active

* toggle pin in buy-dialogs

* check if the item is not undefined/null - renamed the watch function
2017-09-20 19:28:11 -05:00
Sabe Jones
746fb982a7 3.114.1 2017-09-20 21:28:13 +00:00
Sabe Jones
5cd467d5b0 chore(news): subscription reminder 2017-09-20 21:27:59 +00:00
Sabe Jones
6df91e35c8 chore(i18n): update locales 2017-09-20 21:23:53 +00:00
SabreCat
837713f2b7 chore(news): bolg Baliey 2017-09-20 21:09:22 +00:00
Matteo Pagliazzi
cd0222e208 fix: client: allow tags selection for user tasks 2017-09-20 21:47:19 +02:00
Keith Holliday
7812e14898 Sept 20 fixes (#9054)
* Fixed start quest from items

* More style fixes

* Changed gem modal to 20

* Removed unused image

* Added initial header styles for home page
2017-09-20 09:56:26 -05:00
Matteo Pagliazzi
c0f159a8a5 Client Fixes (#9050)
* reset yesterdailies array after cron has run

* start to fix gifting

* remove unused code, move encodegift

* wip

* fix styles and bugs

* fix error if amazon is slow to load its script

* fix error notifications not showing up
2017-09-20 15:04:35 +02:00
Keith Holliday
dd0c95f051 Fixed selecting and sending messages (#9052) 2017-09-19 18:05:30 -05:00
Sabe Jones
6d93bcf4ff 3.114.0 2017-09-19 21:22:17 +00:00
Sabe Jones
05e9f9693a chore(i18n): update locales 2017-09-19 21:16:58 +00:00
SabreCat
136947169b chore(sprites): redesign updates 2017-09-19 21:06:58 +00:00
SabreCat
1379140cf6 Merge branch 'release' into develop 2017-09-19 21:00:19 +00:00
negue
2cb9228a7c misc fixes - sep 17 (#9045)
* not locking pre-owned gear - pin removed gear on revive

* fix createAnimal (check for function) - hide pet-popover while dragging food

* fix dragging popover text color

* fix drop toasts

* selectMembersModal: load members on item change
2017-09-19 22:45:28 +02:00
Keith Holliday
b1652ddd97 Sept 18 fixes (#9051)
* Added hover state to buy buttons

* Translated profile

* Fixed sending private message from member modal

* Added payment functions

* Added translation to home page

* Fixed translation

* Some front page styles

* Fixed inbox sorting and searching

* Added seasonals

* Fixed buy gem modal conflict

* Fixed paypal link

* Fixed footer style crossover

* Fixed quest update

* Fixed sanity
2017-09-19 15:35:32 -05:00
SabreCat
c9f68e2466 chore(sprites): compile 2017-09-19 20:24:23 +00:00
SabreCat
70aabd8b11 feat(content): Subscriber Items September 2017 2017-09-19 20:23:27 +00:00
Alys
0a69c7a08d allow customised text and translations for notifications for gaining/losing gold/xp/mana/health (#9049) 2017-09-19 21:44:45 +10:00
Alys
e784ae21ea new client 2017 09 19 various fixes: subscriptions, streaks, etc (#9047)
* remove excess brace on settings > subscription screen

* prevent User icon > Settings > Subscription page from crashing when subscription has termination date

* stop subscription modal from pitching subscription to a subscriber

* change placeholder text from Username to Login Name for consistency with other login/register forms

* fix test for POST-tasks_user -- streak and dateCompleted weren't being tested correctly

* prevent tag selector from appearing in edit screen for a challenge's own tasks

* restore Restore Streak when editing a user's Dailies (including their own copies of Challenge and Group Plan Dailies)

* remove failing streak test
2017-09-19 16:39:39 +10:00
Sabe Jones
68a438f3d4 3.113.2 2017-09-18 23:08:55 +00:00
Sabe Jones
32fa49191e fix(sprites): put back pixel paw (#9046) 2017-09-18 18:05:13 -05:00
Sabe Jones
ce5372647a chore(i18n): update locales 2017-09-18 23:04:56 +00:00
Sabe Jones
36b4190f23 chore(strings): mobile-related NPC updates 2017-09-18 22:57:40 +00:00
Keith Holliday
ccc862f82a Sept 15 fixes (#9044)
* Adjusted styles and added loading for private messages

* Allowed for assigning during group task creation

* Fixed white logos and start overflow

* Added state styles to home

* Fixed position

* Updated avatar purchasing
2017-09-18 11:54:25 -05:00
Matteo Pagliazzi
ff92f14a5b remove old console.logs 2017-09-17 22:08:30 +02:00
negue
0b0baf2195 new client misc fixes (#9033)
* show quests and open quest dialog on click

* extract questDialogContent/Drops to separate components & use those in startQuestModal & buyQuestModal

* fix market search

* remove & readd pinned gear on revive

* remove listener once destroyed
2017-09-16 23:09:31 +02:00
Alys
8ccec0ed9d New client 2017 09 16 - Fox_town, adjust URLs in links, etc (#9042)
New client 2017 09 16 - Fox_town, adjust URLs in links, etc
2017-09-16 22:19:07 +10:00
Sabe Jones
46b42c8441 Redesign: More Sprites (#9040)
* fix(sprites): various cleanup

* chore(sprites): compile

* fix(sprites): more resizing
2017-09-15 18:04:50 -05:00
Sabe Jones
381f652c08 Redesign: Static Pages Wrapper (#9027)
* refactor(static-pages): wrapper

* refactor(statics): use router-view
2017-09-15 13:59:15 -05:00
Sabe Jones
5c5e117da0 Redesign: Subscribe/Buy Gems modal style (#9038)
* feat(gems): User menu Gems prompt

* feat(purchases): Gems modal

* feat(purchasing): Subscription side of modal

* fix(modals): analytics and dropdown styling
2017-09-15 13:11:58 -05:00
Michael Hibbs
79b3b26ab2 [client fix] Level-100 stats message (#9039)
* Fix formatting for level 100 cap message

* Fix position for attribute points counter
* Fix text overflow in points box by increasing column width from 8 to 12

* Fix tests: Add userV to expected response in response middleware
2017-09-15 15:33:05 +02:00
Matteo Pagliazzi
89f8f047ae fix api unit tests 2017-09-15 12:33:36 +02:00
Sabe Jones
a23d44347e 3.113.1 2017-09-15 00:22:34 +00:00
Sabe Jones
fb872a5b59 chore(i18n): update locales 2017-09-15 00:21:06 +00:00
SabreCat
04d3f084e2 chore(news): Bailey 2017-09-15 00:15:04 +00:00
Keith Holliday
a5dfb499b3 Sept 14 2017 (#9037)
* Added new message count

* Added route change for group plan

* Added fix for quest value of 0

* Fixed guild summary limit, guild and challenge height

* Added task sorting

* Added api buy armoire

* Fixed linting
2017-09-14 14:53:27 -05:00
Matteo Pagliazzi
5b1530b216 remove console .log 2017-09-14 18:57:31 +02:00
Matteo Pagliazzi
c6881c5e30 More Client Fixes (#9036)
* add automatic user syncing when user._v does not match with server

* fix google signup

* fixes to user sync

* check for next cron on activity

* add comment
2017-09-14 18:55:17 +02:00
Keith Holliday
2f913666cd Sept 13 fixes (#9035)
* Fixed tavern message sending

* Added markdown to sumary

* Added color to inputs

* Added new breakpoint

* Added canown

* Added styles for tutorial popups

* Added background image to home page header
2017-09-13 13:31:23 -05:00
Sabe Jones
5ba3e3ce5b Merge branch 'release' into develop 2017-09-12 20:34:03 +00:00
Sabe Jones
cb825106af 3.113.0 2017-09-12 20:29:52 +00:00
Sabe Jones
39bc25b0b7 chore(i18n): update locales 2017-09-12 20:26:41 +00:00
SabreCat
9e38cec769 chore(sprites): compile 2017-09-12 20:19:08 +00:00
SabreCat
099eadeafc feat(content): Farm Friends bundle
Also tweaks some gear text to avoid multiple items being referred to as "battle-axes".
2017-09-12 20:17:49 +00:00
Keith Holliday
e29c393629 Client sept 12 (#9032)
* Removed load all members from challengs

* Fixed chalenge member modal loading

* Fixed party setting

* Fixed chat showing

* Fixed armoire drops

* Ignored lint issue

* Fixed buying old armoir items

* Fixed hatching

* Fixed pending damage
2017-09-12 12:56:06 -05:00
SabreCat
0c6540e6d8 Merge branch 'release' into develop 2017-09-12 16:57:30 +00:00
Matteo Pagliazzi
3c2cad43d0 fix linting 2017-09-12 18:53:49 +02:00
Matteo Pagliazzi
de67c130fa Client Fixes Sept 11th (#9030)
* fix issues with loading screen on static pages

* another try at timezone issue

* interval -> timeout

* remove references to user.fns
2017-09-12 18:39:33 +02:00
Keith Holliday
55e62cdc79 Sept 8 fixes (#9028)
* Added task sync after joining challenge

* Added gem purchasing

* Updated member modal style

* Added community guidelines to all groups

* Added group plans redirect

* Began add new front page design

* Fixed challenge loading on mount

* Fixed upgrade

* Added default summary

* Fixed small nav bar styles

* Added more unlock options to avatar editor

* Added more home page finishes
2017-09-11 23:00:34 -05:00
Matteo Pagliazzi
eee41142b1 Client Fixes (#9026)
* loading screen

* debug yesterdailies modal
2017-09-12 01:06:14 +02:00
Sabe Jones
176a4a0962 3.112.2 2017-09-11 20:59:49 +00:00
Sabe Jones
32ca3d5dfe chore(i18n): update locales 2017-09-11 20:59:24 +00:00
SabreCat
e87a10513d chore(news): T-Shirt Bailey 2017-09-11 20:52:48 +00:00
Matteo Pagliazzi
d2832b7169 fix typo in chat component 2017-09-10 23:55:35 +02:00
Matteo Pagliazzi
daca2c7fff fix store tests (analytics created store before it existed) 2017-09-09 15:05:26 +02:00
Sabe Jones
eb52f73cac 3.112.1 2017-09-08 19:30:58 +00:00
Sabe Jones
5c4d08336c chore(i18n): update locales 2017-09-08 19:30:29 +00:00
Matteo Pagliazzi
861b78ce8a remove old code 2017-09-08 21:26:01 +02:00
Matteo Pagliazzi
1dc1923d7b Client Analytics (#9023)
* start to refactor analytics and some mixins

* wip

* wip

* wip

* more analytics

* more analytics

* more anlytics

* fix analytics module

* finish analytics

* fix env

* vue casing
2017-09-08 21:23:58 +02:00
SabreCat
7872336820 chore(news): Use Case Bailey 2017-09-08 19:20:48 +00:00
Keith Holliday
6e70f27bc6 Removed guidelines testing (#9024) 2017-09-07 15:51:02 -06:00
Matteo Pagliazzi
ad5decc285 fix unit tests 2017-09-07 21:35:09 +02:00
Keith Holliday
3e1c128600 Sept 7 fixes (#9022)
* Fixed login incentives header

* Added achievement hover

* Removed grassy background from editing modal

* Fixed loading of other user equipment

* Prevented non admins from using habitica official

* Fixed challenge loading and leader changing on group reload

* Added community guidlines link

* Added challenge cloning

* Fixed heroes editing
2017-09-07 13:26:53 -06:00
Matteo Pagliazzi
d9817be8f3 remove unused param 2017-09-07 14:35:47 +02:00
Matteo Pagliazzi
e54dcd2859 sync before showing yesterdailies modal 2017-09-07 14:21:05 +02:00
Matteo Pagliazzi
5ec7815cfe Client Fixes (#9021)
* pass the timezoneoffset to the server

* implement yesterdaily modal timer

* fix typos

* todo

* task editing: checklist should not overlay the tags box

* make tags selector use two columns

* show all tags

* do not allow users to go to /login and /register if logged in
2017-09-07 14:16:39 +02:00
Keith Holliday
adeee244e3 New client sept 6 (#9020)
* Added flagging to show to admins

* Fixed filters in my guilds

* Fixed login incentives style

* Added inital rage bar

* Added categoires to get group

* Updated profile stats page

* Added stat allocation

* Updated tests to include categoires

* Fixed lint issue

* Added another lint fix
2017-09-06 17:28:52 -06:00
Sabe Jones
fe8a44b8c4 Merge branch 'release' into develop 2017-09-05 19:50:08 +00:00
Sabe Jones
80ae9c3e82 3.112.0 2017-09-05 19:45:39 +00:00
Sabe Jones
88fbcd5f8c chore(i18n): update locales 2017-09-05 19:44:54 +00:00
Matteo Pagliazzi
2b912b354d disable adding local auth until code is fixed 2017-09-05 21:42:28 +02:00
SabreCat
52eb2deb62 chore(sprites): compile 2017-09-05 19:35:47 +00:00
SabreCat
1812d1ba61 feat(content): BGs and Armoire 201709 2017-09-05 19:34:48 +00:00
Matteo Pagliazzi
5f65be98df remove metatag 2017-09-05 21:27:27 +02:00
Matteo Pagliazzi
56c32d9691 client: add meta tag for webmaster tools 2017-09-05 21:23:14 +02:00
Keith Holliday
36a933d0c4 Client fixed sept 4 (#9019)
* Fixed background purchasing

* Added challenge export

* Fixed is leader filter

* Fixed staff icon

* Add block to profile modal

* Added initial send gems modal

* Added modal stack

* Fixed lint issues

* Updated notification styles

* Updated level up styles

* Fixed many achievement styles

* Fixed notification navigate to same route with different param

* Added mark chat seen and remove new messages

* Added scroll to notifications

* Updated hall loading
2017-09-05 12:34:00 -06:00
negue
d051bdf2c9 [WIP] Play Sounds in the new Client (#9012)
* move audioThemes to content - add audio settings

* copy audioFiles to website/static/audio - playSounds on $emit()

* Play Sounds for Rewards, Purchasing Items / Quests

* remove shop http-api calls

* play reward sound when buying gem

* fix lint / always show mysterybox
2017-09-02 20:24:53 +02:00
Matteo Pagliazzi
0424d214c5 Client Fixed (#9017)
* fix spacing between rewards and items

* fix rewards description

* rewards cost in bold

* fix gp notifications

* fix dailies gray text

* fix cancel in task edit modal

* tags: use AND not OR for filtering

* fix tasksDefaults so that monthlies can be created correctly

* tags: usable if no task selected, saving checklist and tags saved the one being added without requiting to press enter

* remove tags from tasks when they are deleted

* fix tags removal when multiple tags are deleted and fix tags editing
2017-09-02 18:08:32 +02:00
Keith Holliday
c2aaa9b592 Fixes sept 1 (#9016)
* Added avatars to inbox

* Added ordering of inbox messages

* Fixed blurb not converting to string

* Added message to member modal

* Added quest invites

* Moved filters to server
2017-09-01 15:26:10 -06:00
SabreCat
e450e52836 chore(news): Bailey announcement 2017-09-01 20:31:34 +00:00
SabreCat
e2ecec03e8 Merge branch 'release' into develop 2017-09-01 20:25:05 +00:00
Sabe Jones
5a92ced288 3.111.6 2017-09-01 20:14:35 +00:00
Sabe Jones
658b96c5ac chore(i18n): update locales 2017-09-01 20:11:54 +00:00
Sabe Jones
76b6806db1 chore(news): Take This Bailey
Also disables Ember Hatching Potions for purchase.
2017-09-01 20:05:14 +00:00
Matteo Pagliazzi
318482d3ff docker: fix npm5 installation 2017-09-01 20:22:55 +02:00
Matteo Pagliazzi
2e4f665fa5 NPM@5 (2nd try) (#9013)
* second try at using npm5

* use npm 5 in travis

* build client only in production
2017-09-01 20:21:40 +02:00
Matteo Pagliazzi
3d9738ac2f client: remove extra code 2017-09-01 15:27:53 +02:00
Matteo Pagliazzi
666cc855c1 Client: fix popovers and tooltips (#9014)
* rebuild shrinkwrap

* upgrade tooltips and popovers
2017-09-01 15:15:54 +02:00
Sabe Jones
3a059f6aca Redesign: Sabe fixes 08/31 (#9011)
* fix(modules): datepicker dist

* fix(strings): Tumblr typo

* fix(default-tasks): remove "ADD Notes"

* fix(homepage): working header
2017-08-31 18:37:09 -05:00
Keith Holliday
cdd3bc3cd6 Client fixes aug 31 (#9010)
* Separated private message model

* Added markdown to profile

* Add color backgrounds

* Added broken challenge flow

* Added summary field to getgroups

* Fixed group form information loading

* Updated autocomplete to use chat

* Fixed npc styles

* Fixed onload mentions
2017-08-31 16:14:09 -06:00
negue
87d57dab13 Backgrounds / BuyModal / misc (#9009)
* remove buyModal from all views / move to app.vue - show party member selection if card was bought

* add .btn style to 'show more' / 'show less'

* prevent adding duplicate pinned items - reset pinned gear on rebirth

* remove hourglass in items

* fix unequip gear from drawer

* fix bought item notification

* fix background in avatar - avatar position in buyModal
2017-08-31 22:56:53 +02:00
Matteo Pagliazzi
19789eb7ab Client Fixes (#9003)
* fix strings on login and register pages

* back to older styles for placeholder

* scope->scoped

* remove old css
2017-08-31 15:15:17 +02:00
Sabe Jones
395385f3e2 Redesign: Static and Modal Fixes (#9007)
* fix(static-page): Community Manager links

* feat(modals): Bailey news

* feat(footer): link to Hall of Heroes
Also makes a number of strings translatable instead of hardcoded.

* fix(notifications): simplify drop messages
2017-08-30 17:59:31 -05:00
Keith Holliday
65aabc8333 More fixes (#9006)
* Reset user when clicking profile nav

* Added editprofile

* Add scroll to conversations and scroll to bottom on messages

* Fixed profile click

* Added notification mixin

* Fixed challenge edit assignment

* Guild list item now returns summary

* Fixed tier icons

* Fixed quest invitaion check

* Fixed extra loading of party members in modals

* Removed background from avatar in tutorial

* Changed port back

* Fixed task adding
2017-08-30 15:19:17 -06:00
Sabe Jones
5c16600b25 Merge branch 'release' into develop 2017-08-30 17:44:19 +00:00
Sabe Jones
809960b3c0 3.111.5 2017-08-30 17:43:51 +00:00
Sabe Jones
e8841d275d chore(i18n): update locales 2017-08-30 17:43:36 +00:00
SabreCat
6ba42332f9 chore(news): Last Chance Bailey 2017-08-30 17:36:37 +00:00
Sabe Jones
32fd4e33c8 feat(dates): Clear and Today buttons (#9005) 2017-08-30 12:15:24 -05:00
Keith Holliday
560d247c9b Miscing groups (#9004)
* Fixed party invite accepting

* Fixed message sending and scrolling

* Fixed profile clicking

* Hids needs work

* Added group plan page images

* Added category to editing groups

* Added quest box fix

* Added tier styles

* Changed port back to 8080

* Fixed npc style
2017-08-29 14:23:09 -06:00
Matteo Pagliazzi
40567fc8d0 More Client Fixes (#9002)
* logout should entirely clear localstorage

* fix logout, fix social login, remove duplicate home page
2017-08-29 16:18:26 +02:00
Keith Holliday
9fc7bae13e Quick group fixes (#9001)
* Added tavern background and fixed notification key

* Fixed notification on error response

* Fixed group plans header

* Updated images/icons in tavern
2017-08-28 18:39:32 -06:00
negue
515fd62dd8 Client/negue multiplefixes6 (#9000)
* use store action to purchase gem by gold

* only show party members in header if enough width available / use overflow hidden

* fix featuredItems buyModals

* fix special items listing - open modal on special spells

* don't open the buymodal on locked items

* fix lint
2017-08-28 18:17:45 -06:00
Sabe Jones
d0d319316b 3.111.4 2017-08-28 22:36:13 +00:00
Keith Holliday
5ce80c71b9 Changed var to let (#8999)
* Changed var to let

* fixed karma test
2017-08-28 15:45:51 -06:00
Sabe Jones
0e2e8616d1 chore(abuse): flag phishing link as slur 2017-08-28 19:46:46 +00:00
Matteo Pagliazzi
170f901d86 fix avatar positions in the header 2017-08-28 20:58:00 +02:00
Matteo Pagliazzi
d1fbe98379 client: fix rewards top margin 2017-08-28 20:00:06 +02:00
Matteo Pagliazzi
fb1808d85a misc client fixes (#8998)
* color selected difficulty icon

* misc fixes
2017-08-28 19:37:22 +02:00
Sabe Jones
4094ca99dd Merge branch 'release' into develop 2017-08-28 17:22:03 +00:00
Sabe Jones
10d4b8b7c7 3.111.3 2017-08-28 17:15:52 +00:00
Sabe Jones
e221983bdb chore(i18n): update locales 2017-08-28 17:13:24 +00:00
Keith Holliday
d2e7485dba Added loadmore and limited challenge members (#8997)
* Added loadmore and limited challenge members

* Added load more to translatables
2017-08-28 10:45:55 -06:00
Alys
fd05286e1a add header, footer, etc to various static pages for the new client (#8996) 2017-08-28 08:05:37 +10:00
Alys
9436c83919 prevent skills/spells being cast on rewards and group plan tasks (#8995) 2017-08-28 07:39:18 +10:00
Alys
4f636d3d2c new client static Overview and FAQ: wording and formatting changes (#8993)
* improve formatting for Help > Overview page

* change wording on Help > Overview page

* change FAQ text for new client
2017-08-27 14:45:30 +10:00
Sabe Jones
1a056be637 Merge branch 'release' into develop 2017-08-26 23:23:16 +00:00
Sabe Jones
c75d47c71a 3.111.2 2017-08-26 23:22:12 +00:00
Sabe Jones
693ba5a426 chore(i18n): update locales 2017-08-26 23:21:47 +00:00
Sabe Jones
ad50aeb096 chore(news): misc Bailey 2017-08-26 23:13:51 +00:00
Alys
f38e184434 new client: move translatable strings to appropriate locales files (#8992)
* move translatable strings from newClient.json to appropriate locales files

* whitespace changes

* whitespace changes
2017-08-26 18:53:10 +02:00
Sabe Jones
d24eb67fa2 Redesign: Static Pages (#8989)
* feat(pages): static Features

* feat(static-pages): add header

* feat(static-pages): Community Guidelines

* fix(strings): tweaks
2017-08-26 16:03:43 +02:00
negue
c35e4f5750 Items/Market/Quests/misc fixes (#8987)
* use countBadge instead of class

* generic purchase action from buyModal to handle all kind of purchases - able to purchase backgrounds - return backgrounds as flat array

* List MysteryItem & Hourglass in Inventory/Items

* add Subscribers Gem Item (purchase by gold)

* fix mysterybox

* sort unlocked gear first

* add orb of rebirth to market

* remove old quest scroll + class of the quest items

* more padding on countBadge

* use the generic purchase on quests
2017-08-26 12:18:55 +02:00
Keith Holliday
0233f7b486 More fixes (#8988)
* Links stay white on hover

* Fixed task icon color

* Disabled plus button when needed

* Fixed difficulty color

* Fixed task reward color

* Updated create styles

* Fixed group plan link

* Fixed second group test modal

* Added login incentives

* Fixed group notification clear

* Show baily correctly

* Styled armoire notification

* Fixed contributor achievement styles

* Fixed death

* Fixed drop styles

* Fixed invited friend modal

* Fixed joined challenge achievement style

* Fixed joined guild style

* Fixed level up styles

* Updated low health styles

* Fixed bailey styles

* Updated quest completed

* Added soem conditionals to hide modals

* Added rebirth styles

* Fixed rebirth enable styles

* Fixed streak styles

* Fixed testing modals

* Fixed ultimate gear achievement

* Fixed won challenge

* Set user to welcomed if created on mobile

* Removed old default tasks

* Began adding more options to avatar

* Added change class

* Inbox to messages

* Moved profile to menu

* Added user modal for viewing a user and send message

* Fixed conversations

* Fixed lint

* Fixed challenges sending to server

* Added challenge progress view

* Fixed group sync after pay

* Fixed some group accepting features

* Fixed initial chat loading

* Fixed some exitence errors

* Added user names to assigned

* Added upgrade link

* Began adding new payment flow

* Added default tasks

* Updated avatar styles

* Updated tutorial styles

* Rebuilt notifications and styles

* Updated upload script

* Fixed lint

* Added default tasks back to mobile and added updated tests

* More test fixes
2017-08-25 20:56:21 -06:00
Matteo Pagliazzi
c129c38631 Paglias/client fixes (#8990)
* correct buttons for reset modal

* correct buttons for delete account modal

* fix first party member not showing up
2017-08-25 23:54:50 +02:00
negue
748ce8a23f fix isPinned : check if pinnedItems-array exists 2017-08-24 18:49:14 +02:00
Matteo Pagliazzi
a86166742f docs(client): add a note to specify how the new client is served 2017-08-24 18:24:47 +02:00
Matteo Pagliazzi
82c912237b fix hard links for new client (#8986) 2017-08-24 18:19:31 +02:00
Matteo Pagliazzi
5c89451985 Client Fixes (#8985)
* fix typos

* tasks created immediately

* fix page scroll when cancelling task edit

* fix cheklist editing + misc fixes to tasks modal

* remove console.log
2017-08-24 16:48:52 +02:00
negue
2624b06729 [WIP] shops + market gear api (#8980)
* lock other classes gear

* fix avatar in equip-gear-modal

* fix seasonal shop

* seasonal : new gear type order

* fix pin gear (and get new gear on buying)

* API: /shops/market-gear  - refactoring pinnedGearUtils - move _isPinned to common/libs

* use shops.getMarketGearCategories to list the marketGear

* use shops.getMarketCategories instead of API-call

* mark gear reward items as locked

* purchase time-travelers stuff + update view + use method instead of http-api + add missing mammoth shop image

* Time Travelers Shop: open/closed state

* time travelers: show gear preview + hide sidebar if closed

* update resized images

* fix lint
2017-08-24 07:16:18 +02:00
Sabe Jones
7b7f5c09fd Merge branch 'release' into develop 2017-08-23 22:16:47 +00:00
Sabe Jones
ae02b8ef5a 3.111.1 2017-08-23 22:16:03 +00:00
Sabe Jones
b1ecd265e4 chore(news): Bailey 2017-08-23 22:15:51 +00:00
Sabe Jones
ad621e7208 Redesign: Misc fixes (#8984)
* fix(checklists): parse Markdown

* fix(Guilds): Markdown in descriptions
2017-08-23 14:36:43 -05:00
Matteo Pagliazzi
034f18c419 Client Misc Fixes (#8983)
* fixes party header button

* fix some svg icons
2017-08-23 17:32:20 +02:00
Alys
7a6bf8b870 new client - various fixes: Earnable Quests removed, equipment type names and sort order changed (#8977)
* remove Earnable Quests from quests shop

Earnable Quests could be put back later but with an explanation
for how you can earn them. The Quest Shop isn't well set up for
that at the moment.

* change names of some equipment items

NOTE: The `...Capitalized` strings all have lower-case versions
(e.g., "weapon" and "weaponCapitalized"). I suspect we should
change or (perhaps better) get rid of the uncapitalized version
but I'm not sure what other effects that might have (e.g., haven't
searched for exactly where it's used; don't know what it would do
to the mobile apps). Suggest looking into that after launch. If
the old, uncapitalized strings appear elsewhere during our site
testing, we should probably change them to the Capitalized version
then, or if lowercase is essential, create new strings (e.g.,
"weaponUncapitalized" - that will be much easier later than just
"weapon" for searching for where it's used!)

* change order of Equipment types on the inventory page

http://i.imgur.com/64D5jEk.png
2017-08-23 15:17:11 +10:00
Keith Holliday
f529a5c64c New client many fixes (#8981)
* Footer style fixes

* Limited string display

* Fixed background reload

* Began adding more avatar items

* Fixed challenge updated cats and official to be seen by admins

* Fixed min prize

* Fixed required fields

* Added my challenges and find challenges to menu

* Removed nav to party page when have no party

* Updated user and notifications icon

* Added accept, reject and messages

* Added selfcare

* Underline links

* Added forgot password

* Fixed task adding

* Disabled habit options that should be

* Added markdown to tags

* Added confirm to delete

* Fixed cancel/delete style

* Fixed rounding

* Added gold icon

* Fixed task icon styles

* Fixed margin botton

* Fixed some repeat styles

* Fixed custom reward style

* Hide like count 0

* Added new tavern images

* Redirect to party page after create

* Hid leader options from non leaders

* Removed manager options from non group plan

* Fixed some nav styles

* Fixed overlay color

* Prevented edit data from being transfered to create

* Added hover state for spells

* Add performance fixes for chat avatars

* Fixed merge conflicts

* Updated fron navigation

* Fixed reg gryphon logo

* Began adding gem modal functionality

* Added purchase gems with gold

* Fixed restore

* Replaced description with summary

* Spells that target tasks fix

* Added initial challenge task load

* Fixed lint issue
2017-08-22 21:58:13 -06:00
Sabe Jones
69662f84df Choose Class modal (#8976)
* feat(modals): near-complete Choose Class modal
Also fixes avatar alignment in the Equip modal.

* feat(classes): send API requests from choose modal

* feat(classes): full functionality on choose modal

* WIP(classes): refactor class functions

* refactor(avatar): more intelligible sprites margin

* fix(imports): correct import syntax
2017-08-22 17:59:18 -05:00
Alys
7d0ab1ba25 add summary field to challenges and guilds (#8960)
* create new summary field for challenges

* finish implementating summary for challenges, add some support for guilds

* make small improvements to challenges code

* fix lint errors

* add more code to support summaries for guilds (still more needed)

* fix existing tests by adding summary field

* make existing tests pass

* WIP make "Public Challenges" text translatable

* change "leader" locale key to "guildOrPartyLeader" to make searches for it easier

* remove v-once from h2 headings

* remove failed attempt to localise text in <script>

* add quick-and-dirty error checking for guild not having categories

* make "Public Challenges" text translatable

* rename final ...PlaceHolder strings to ...Placeholder (lower-case "h") for consistency with existing Placeholder strings
2017-08-23 06:39:45 +10:00
Matteo Pagliazzi
bd46e3e195 Client: i18n (#8972)
* wip: client: i18n

* remove maxAge from cookies to get same expiration ad localStorage

* set cookies expiration to 10 years

* moment: load translations in browser, moment: only load necessary data, remove jquery, remove bluebird

* ability to change language

* fix logout

* add some requiresLogin: false to static pages

* fix tests
2017-08-22 18:26:53 +02:00
Alys
e5a92f64c0 adjust wording on new client's register and login screens (#8958) 2017-08-22 23:56:56 +10:00
Keith Holliday
798d0ab82b New client spell fixes (#8974)
* Prevented spells menu from apearing below lvl 11

* Expanding clickable casting area

* Persisted spell drawer close

* Added edit form modal to party

* Added spell toggle

* Added markdown notification

* Prevented casting on challenge and group tasks locally

* Quick fix for self cast

* Fixed lint issue
2017-08-21 23:04:56 -06:00
SabreCat
acaed1ef0e chore(sprites): compile 2017-08-21 22:59:12 +00:00
Sabe Jones
78f94e365c Redesign: Bulk Image Edits (#8975)
* refactor(sprites): recanvas quest scrolls

* refactor(sprites): recanvas gear icons

* refactor(sprites): resize reward items to 2/3 and recanvas

* feat(sprites): add icons for backgrounds
2017-08-21 17:54:07 -05:00
Alys
11379f150c new and old client: change text for skills, avatar transformation buffs, and antidotes (#8969)
* change text for skills, avatar transformation buffs, and antidotes

* minor fixes
2017-08-22 08:26:50 +10:00
Alys
41da55921c new client various fixes: Equipment shop empty; Skills not Spells; no Saddles message (#8959)
* shows message in Equipment shop when you've bought all class gear

* change Spells to Skills in visible text

* show correct message in stable when you don't have any Saddles
2017-08-21 23:45:25 +02:00
Keith Holliday
e9141ff5c9 New client flurry of fixes (#8973)
* Fixed login/reg styles and on submit

* Fixed duedate display in yesterdailiy modal

* Prevented tutorial from showing after logged in has past created

* Hide premium shirts from creating

* Fixed level up notification

* Updated categoires

* Updated justin message

* Fixed notification changes

* Fixed guild nav in join guild modal

* Added buygems modal

* Removed avatar page click

* Fixed group plan nav

* Fixed death issue

* Fixed party header styles
2017-08-21 13:28:27 -06:00
Matteo Pagliazzi
2760de7951 try to disable possible cause of too many redirects 2017-08-21 19:48:08 +02:00
Keith Holliday
203d6d3ac2 New client party tutorial (#8968)
* Adjusted intro tutorial

* Added images to create party modal

* Fixed shared button styles

* Added method to start a party

* various style fixes
2017-08-21 09:36:31 -06:00
Alys
2a2192e196 new client router changes: rename guild.vue to group.vue and GuildPage to GroupPage (#8957)
* change challenge creation button to "Add Challenge Tasks"

* router changes: rename guild.vue to group.vue and GuildPage to GroupPage
2017-08-21 08:49:47 +10:00
negue
876552b922 multiplefixes quest (#8964)
* add hourglass to header

* multiple quest fixes - show quest info in popover/modal

* pin backgrounds

* unpin gem-purchable items / change pinType of quest to quests

* check if hatching potion is allowed on egg - wide hatching info

* fix (perf): items - request text()/notes() only once

* change items margin to 23px

* list cards + open modal to choose a target + add space between market items

* buy card from task-list

* fix tests - unpin items on purchasing eggs / hatchingPotions
2017-08-21 00:32:32 +02:00
Alys
24cc88400f remove Mead from banned words because it's a legit surname. TRIGGER / CONTENT WARNING: assault, slurs, swearwords, etc 2017-08-19 21:12:08 +10:00
Keith Holliday
2b922508c5 New client group fixes (#8965)
* Fixed gem styles

* Fixed party challenge logic

* Fixed category sending

* Filtered habitrpg

* Fixed updating group

* Added new empty state badge

* Added information to create group

* Fixed large icons

* Fixed name collision
2017-08-18 14:29:49 -06:00
Keith Holliday
cbee0542ad New client tavern fixes (#8967)
* Load chat on sent

* Removed report own message

* Fixed some minor styles

* Removed extra mods

* Hide class badge

* Fixed chat alignment

* Fixed taven autocomplete
2017-08-18 12:30:39 -06:00
Sabe Jones
bc499bcfbf Merge branch 'release' into develop 2017-08-18 17:26:42 +00:00
Sabe Jones
161eb8a03d fix(strings): subscriber set typo 2017-08-18 17:25:52 +00:00
Sabe Jones
861c85f099 Merge branch 'release' into develop 2017-08-17 20:40:36 +00:00
Sabe Jones
ecd55b6f5c 3.111.0 2017-08-17 20:39:31 +00:00
Sabe Jones
31e7882c51 chore(i18n): update locales 2017-08-17 20:37:05 +00:00
SabreCat
c831a05b9b feat(content): Mystery Items August 2017 2017-08-17 20:27:48 +00:00
Keith Holliday
4929a2dd79 Remove catch from cron (#8963)
* Removed extra logging

* Removed second extra logger

* Removed extra import
2017-08-17 13:42:41 -06:00
Keith Holliday
de63622cdd Challenges plus misc fixes (#8961)
* Forced full refresh after deletE

* Fixed styles on firefox

* Removed instagram link

* Added information to modal

* Fixed deleteing and task keeping

* Added redirect to challenge detail after created

* Updated challenge item styles

* Added new limit option to challenges
2017-08-17 11:03:32 -06:00
negue
f5cf27a79e [WIP] Client/multiple fixes shops (#8956)
* reposition FlyingPigs and Hydra

* hide count-badge if 0

* fix sortBy hatchable (ignore already hatched pets)

* always show animal name

* featuredItems, use shopItem objects

* fix egg / potion names in market

* buyModals: check for price, mark it if not enough available / change buy-button opacity / show purchaseGems button

* save itemRows open/collapsed state during session, refactor itemRows for some more performance

* pin featured items

* show bordered items in market buyModal

* fix popover margins / paddings

* position pinned items popovers to the left
2017-08-16 16:34:25 -06:00
SabreCat
88e6cf7d8a feat(RYA): style Yesterdailies MODAL 2017-08-16 21:56:10 +00:00
Keith Holliday
0d28e663e4 New client edit avatar (#8955)
* Fixed some purchasing issues with backgrounds

* Added more background styles

* Fixed some menu styles

* Initial old client removal

* Added cross-env

* removed bower and fixed lint

* Made interceptor errors use notify

* Removed old client tests and fixed lint
2017-08-16 15:51:48 -06:00
Alys
716695e11e Various fixes for new client (WIP) (#8953)
* sort equipment by stats: highest first

* spelling fix: excercise > exercise

*     change wording for login link on register screen

* remove incorrect Items heading from Quests Shop

*     fix missing "Recovery + Support Groups" guild category text and remove whitespace from keys

* fix text for guildInformationPlaceHolder
2017-08-16 22:03:07 +02:00
Alys
2770650340 add an Earnable Quests group for Basi-List and Dust Bunnnies (new client fix) (#8952)
* add an Earnable Quests group for Basi-List and Dust Bunnnies

This allows Basi-List and Dust Bunnies to be automatically placed
in their own group on the Quests Shop page in the new client.

* adjust name of Vice and Recidivate quest groups
2017-08-16 22:02:20 +02:00
Keith Holliday
0bff37b600 New client footer (#8954)
* Minor footer style fixes

* Added initial gem modal

* Fixed some heroe stuff.

* Preventing system member loading

* Added social delete
2017-08-16 10:05:33 -06:00
Pavel Pletenev
8614f11a31 Refactor api description with @apiParam groups to make it more explicit (#8919)
* Refactor api description for auth.js with @apiParam groups

* Refactor apiDoc toward better consistency

* Fix missing groups for get requests

* Fix missing groups for other request methods
2017-08-15 18:06:19 -05:00
Brian Murray
b27319313d Fix spelling of received. (#8937) 2017-08-15 18:02:49 -05:00
John Montgomery
1f1c7826a4 Add the relevant attribute to the Stealth tooltip (#8941) 2017-08-15 17:59:30 -05:00
Sabe Jones
d8736c17e6 Merge branch 'release' into develop 2017-08-15 22:42:35 +00:00
Sabe Jones
1a99380a53 3.110.3 2017-08-15 22:41:34 +00:00
Sabe Jones
3a28aba986 chore(i18n): update locales 2017-08-15 22:41:17 +00:00
SabreCat
42f86ff62b chore(news): Bailey 2017-08-15 22:33:54 +00:00
SabreCat
00d72fe555 fix(dropdowns): fewer bottom borders 2017-08-15 22:25:22 +00:00
SabreCat
9943a94108 fix(Stable): weird Matt wording 2017-08-15 21:18:41 +00:00
SabreCat
7a1b7b3291 fix(tags): only show trashcan on hover 2017-08-15 21:09:03 +00:00
SabreCat
832106dc86 fix(stats): show decimals between 0-1 2017-08-15 18:42:29 +00:00
Keith Holliday
24b9bd6ccc New client spells (#8950)
* Added initial spell casting

* added casting

* Added spells style

* Fixed linting issues

* Added escape

* Added casting

* Added task drag style
2017-08-15 12:28:30 -06:00
Keith Holliday
bd19b83db4 Added avatars to chat (#8949) 2017-08-14 15:44:09 -06:00
Keith Holliday
eb43f83c71 New client group plan (#8948)
* Added stripe payment for group plan

* Began adding amazon

* Added amazon payments for group

* Added get group plans route

* Added group plan nav

* Added initial task page

* Added create and edit group plans

* Added initial approval header and footer

* Added assignment and approved requirement

* Added minor text fixes

* Added inital approval flow

* Added approval modal

* Removed always true

* Added more styles for filters

* Added search

* Added env vars

* Fixed router issues

* Added env to social login

* Fixed merge conflict
2017-08-14 13:19:41 -06:00
Sabe Jones
6e89197b3f fix(stats): floor HP/MP/XP values (#8947) 2017-08-14 12:20:21 -05:00
Sabe Jones
51739a4dfe Redesign: Display weekdays in correct order (#8945)
* fix(dailies): display weekdays in correct order

* fix(style): display weekday checkboxes inline
2017-08-14 12:20:03 -05:00
negue
87f39b4273 item pinning (#8918)
* toggle pinned state of items server + client

* pin quests / add pin src

* add officially pinned items and api to get in app rewards

* update schema and get items deatils

* update pin actions to the new logic

* show countBadge only with a number

* extract getPinKey - pin seasonal items

* togglePinned in buy-dialogs

* add pinKey to shop items

* wip

* wip

* fix path

* togglePinnedItem as common.op / use in client

* fix linting

* pinning: getItemInfo and save in db path and type

* make api more consistent, fix bugs

* updates

* fix bugs

* update actions to current api

* marketGear

* change to pinType

* add mystery_set to getItemInfo

* fix isPinned

* ignore animals

* list shopItems (initial)

* shopItem now has default popoverconent, itemclass and price / currency - list pinned items as rewards - attributes to gear

* show buyModal for the rewards

* show mystery_set icon

* add info whether item is suggested

* write migration, fix style issues

* pin potion and armoire

* make potion, armoire not unpinnable

* show notes for armoire and potion, add default items for new users

* show unpin notification

* add/remove pinned gear on class-change

* remove pinned & add new gear on purchase - refactoring pinning methods - fixes

* always allow to purchase armoire

* highlight item if suggested
2017-08-14 19:15:32 +02:00
negue
fcea1ecbc2 [WIP] multiplefixes for items / equipment / stable (#8938)
* highlight egg on dragging a potion - hide popover while dragging - flat show more button

* Show EquipGearModal on Item-Click - misc fixes

* disable dragging

* hide egg notes while dragging

* rename headgear to helm

* sort equipment by name & attributes

* set welcome-dialog flag

* show feeding notification

* select animals on click

* add hatchable popover back

* fix stable sortby A-Z

* remove property brackets
2017-08-13 18:18:46 +02:00
SabreCat
7b9ebc3465 fix(avatars): line up correctly 2017-08-12 16:14:46 +00:00
SabreCat
40ebaefac9 fix(lists): remove borky gradient
Left the SCSS for it in, for ease of playing with to get it to work in v2.
2017-08-12 15:29:20 +00:00
Sabe Jones
4ba97755a5 3.110.2 2017-08-11 20:03:14 +00:00
Sabe Jones
779ac3d4ab chore(i18n): update locales 2017-08-11 20:00:00 +00:00
Sabe Jones
32c3a3886f Merge branch 'develop' into release 2017-08-11 19:53:40 +00:00
SabreCat
99465d5995 chore(sprites): compile 2017-08-11 16:09:11 +00:00
Sabe Jones
df0dbaba63 feat(sprites): icons for backgrounds (#8939) 2017-08-11 10:07:17 -05:00
Sabe Jones
d1e9a6a74a fix(style): background different from color (#8942) 2017-08-11 15:08:24 +02:00
Sabe Jones
60a5599db4 fix(pets): better adjectives 2017-08-10 23:20:01 +00:00
Sabe Jones
68b19c931b 3.110.1 2017-08-10 23:18:37 +00:00
Sabe Jones
07d2699898 fix(quest): correct hippo egg unlock condition 2017-08-10 23:18:19 +00:00
Sabe Jones
f5ea24b4e6 fix(subscriptions): Wording change for Gold:Gems 2017-08-10 22:59:25 +00:00
Sabe Jones
9507f0758d Merge branch 'release' into develop 2017-08-10 19:59:24 +00:00
Sabe Jones
58694f46e0 3.110.0 2017-08-10 19:56:00 +00:00
Sabe Jones
a7351b0082 fix(Bailey): missing credits 2017-08-10 19:55:44 +00:00
Sabe Jones
2881566aed chore(i18n): update locales 2017-08-10 19:54:04 +00:00
SabreCat
6d350d5974 chore(sprites): compile 2017-08-10 19:46:17 +00:00
SabreCat
2e8da50b3e feat(content): Hippo Pet Quest 2017-08-10 19:45:30 +00:00
SabreCat
1985d04bcf fix(stable): missing label on standard pets 2017-08-09 21:12:08 +00:00
Sabe Jones
8d040873a1 fix(columns): task heading grammer (#8932) 2017-08-09 13:58:59 -07:00
Keith Holliday
5995dd235d New client more updates (#8934)
* Added api token to page

* Fixed wiki link

* Added categoires

* Removed extra create challenge button. Add prize model and user balance deduction

* Added pending filter

* Added member sort

* Added confirmation for leaving

* Filtered tavern

* Added redirect to newly created guild

* Made guild links routerlinks

* Fixed wiki link and added fetch recent messages

* Show backgrounds only on edit. Fixed glasses equip

* Added link to register page

* Added yesterdailies

* Added achievement footer

* Update guild badges

* Added avatar to achievement avatar component

* More guild crests updates

* Achievement footer and avatar added

* Added notification read

* Removed duplicate string
2017-08-09 10:56:48 -06:00
Matteo Pagliazzi
f57c647e21 Client Tasks v3 (#8926)
* tasks hover state

* hide column background if task too close

* wip edit tasks

* wip: replace tags

* upgrade bootstrap-vue and fix creare btn for tasks

* difficulty options colors and active label fixes

* fix tags
2017-08-09 17:13:40 +02:00
Sabe Jones
8d82566654 Merge branch 'release' into develop 2017-08-08 20:59:11 +00:00
Sabe Jones
7ff4a72d77 3.109.0 2017-08-08 20:58:38 +00:00
Sabe Jones
41d04b0f18 chore(i18n): update locales 2017-08-08 20:58:18 +00:00
SabreCat
c7c1ff816c chore(sprites): compile 2017-08-08 20:49:57 +00:00
SabreCat
b018f9cf90 feat(content): Ember Hatching Potions 2017-08-08 20:48:59 +00:00
negue
a380090013 [WIP] multiple fixes (#8916)
* change quest banner backgrond

* itemRows in inventory

* use itemRows in inventory/items - showLess/showMore as default labels - extend white space if theres no button available

* hide popover if dragging is active - show dragging info on first click (without to move)

* use itemRows in inventory/stable

* fix some strings

* highlight currently dragging item in inventory/items - auto attach info on click - z-index

* fix shopItem label color

* fix floating npcs in banner

* hatched-pet-dialog in items / stable

* change all ctx to context
2017-08-07 19:04:46 -06:00
Keith Holliday
0b076311df New client misc with some more misc (#8929)
* Added markdown

* Added styles and option for debug menu

* Added sm icons

* Began styling autocomplete

* Added autocomplete styles

* Added more challenge categories

* Updated challenge participants modal

* Fixed challenge list updating without reload

* Added close and delete challenge

* Fixed form placeholder, adjusted desc style and fixed create button style

* Fixed faq collapsing and style

* Fixed repeating ending

* Fixed delete account

* Fixed party fetch issue

* Fixed scope issue

* Added member count filters

* Fixed create button style

* Fixed badge color display

* Updated tavern styles

* Fixed some party styles

* Updated login styles

* Fixed login redirect

* Fixed initial login process

* Added done local
2017-08-07 14:26:17 -06:00
Alys
1896984777 adjust banned words. TRIGGER / CONTENT WARNING: assault, slurs, swearwords, etc 2017-08-05 17:19:15 +10:00
Matteo Pagliazzi
c3ba70f5d6 Tasks scoring and misc fixes (#8925)
* wip: add task scoring and persist checklist items

* remove unused files, fix checklist scoring and start adding support for groups tasks

* amke group and challenge tasks not scoreable
2017-08-04 23:27:11 +02:00
Sabe Jones
ac800a94f9 Merge branch 'release' into develop 2017-08-03 21:46:41 +00:00
Sabe Jones
9b2b9ef54d 3.108.0 2017-08-03 21:46:15 +00:00
Sabe Jones
3785a87221 chore(i18n): update locales 2017-08-03 21:43:16 +00:00
SabreCat
8c5d4ca190 chore(sprites): compile 2017-08-03 21:22:24 +00:00
SabreCat
ab6e77dd9a feat(content): Armoire and BGs 2017-08
Also ends the Summer Splash event.
2017-08-03 21:21:12 +00:00
Keith Holliday
75913842bc New client misc for days (#8924)
* Removed sticky header

* Fixed group desc and information

* Add flag modal

* Fixed chat sync errors

* Fixed balance display

* Fixed key and close issue

* Updated tavern placeholder

* Added and fixed links

* Removed open user modal from clicking menu

* Added better app loading check

* Removed banner from party

* Allowed for nav when clicking the card

* Fixed member display

* Updated create challenge modal to populate list and to create party/public

* Display members modal

* Added fetch recent messages
2017-08-03 14:04:03 -06:00
Keith Holliday
e61884ed08 New client tour (#8921)
* Linted tour. Added intro tour

* Added initial tours

* Fixed page number for intro

* Lint fix

* Updated shrinkwrap

* Removed bootstrap tour

* Lint fix
2017-08-02 20:15:00 -06:00
borisabramovich86
026014b8d6 lists banned words in the chat error message - fixes https://github.com/HabitRPG/habitica/issues/8812 (#8858)
* issue 8812 - added the list of bad words matched to the postChat error message.

* issue 8812 - added the list of bad words matched to the postChat error message.

* issue 8812 - some refactoring, fixed relevant tests, and lint rules refactor

* small fix for unnecessary empty array

* added test and did some small refactoring

* lint error fix

* issue 8812 - added the list of bad words matched to the postChat error message.

* issue 8812 - some refactoring, fixed relevant tests, and lint rules refactor

* small fix for unnecessary empty array

* added test and did some small refactoring

* lint error fix

* add test to check the error message contains the banned words used

* improve banned words test

* issue 8812 - added the list of bad words matched to the postChat error message.

* issue 8812 - some refactoring, fixed relevant tests, and lint rules refactor

* small fix for unnecessary empty array

* added test and did some small refactoring

* lint error fix

* issue 8812 - added the list of bad words matched to the postChat error message.

* issue 8812 - some refactoring, fixed relevant tests, and lint rules refactor

* add test to check the error message contains the banned words used

* improve banned words test

* merge with develop - aligned banned slurs check with banned words check
2017-08-02 12:43:22 -07:00
MathWhiz
014a7197f0 Update Website's Task Page image (#8791)
* Update Website's Task Page image

* update zip
2017-08-02 12:27:21 -07:00
Andrew Levenson
1ad3292f18 Cleaned up variable test/initialization (#8904) 2017-08-02 12:22:35 -07:00
Ben Harvill
add2743772 fix dockerfiles to not require entering container to run app (#8911) 2017-08-02 12:11:25 -07:00
Keith Holliday
cf0ce90968 New client challenge tasks (#8915)
* Added get and create challenge tasks

* Added challenge task edit
2017-08-02 10:57:57 -06:00
Imtiaz Ahmed
e3b10cdc2a Updated tip #27 (#8895)
* Updated tip #27

* fix(locales): leave non-base locales for Transifex
2017-08-02 08:41:10 -07:00
Sabe Jones
3ab4c4114b fix(groups): bail if group not passed to canEdit (#8897) 2017-08-02 08:38:30 -07:00
Sabe Jones
576285c004 fix(habits): reset counters when sleeping (#8898) 2017-08-02 08:35:20 -07:00
Keith Holliday
d3967d6567 Removed unneeded tests (#8912) 2017-08-01 20:19:51 -06:00
Keith Holliday
ea25a4bf04 Updated shrinkwrap (#8908)
* Updated shrinkwrap

* Updated shrinkwrap
2017-08-01 18:10:33 -06:00
Sabe Jones
4f26ac66ac Merge branch 'release' into develop 2017-08-01 22:06:57 +00:00
Sabe Jones
f01ca1f9be 3.107.1 2017-08-01 22:02:46 +00:00
Sabe Jones
b51f622c52 chore(event): end Aquatic Potions 2017-08-01 22:02:31 +00:00
Keith Holliday
0dba37008f New client popups profile andmore (#8907)
* Added more styles to user profile modal and replaced memberDetail

* Added notify library

* Added edit avator

* Added notification menu updates

* Fixed lint issues

* Added group invite functionality

* Added many achievement modals

* Added initial quest modals

* Added guild, drops, and rebirth modals

* Added the reset of the achievement modals and fixed lint
2017-08-01 12:52:49 -06:00
Matteo Pagliazzi
bca52cb6fa Client Tasks (#8894)
* fix filter button style

* display completed todos

* fix reward control position

* begin to add edit modal

* start adding settings to edit modal

* add task saving, creating and deleting

* fixes

* add tags and repeat frequency for habits

* clicking on links should not open the edit modal

* checklist editing

* repeatables and checklists

* delete checklist items

* add rewards price

* update shrinkwrap

* pin cwait
2017-08-01 14:30:17 +02:00
negue
ade6d9689f new client - quest / seasonal / time travelers shops (#8903)
* initial quests.vue - refactorings - add group to quests

* shows quests by quest-group

* buyQuestModal with rewards sidebar

* store / actions to load seasonal/time-travelers shop data

* buyModal buyPressed instead of buyAction - seasonal shop categories now with specialClass property - seasonal shop

* time travelers vue - show hourglass in shopItem / buyDialog - fix banners

* cleanup

* show amount of already owned quests

* show html notes in popovers / dialog

* extract purchase-api to common.ops.purchaseWithSpell to call the same in the store / update the UI on purchases

* add time-travelers sprites

* fix lint

* add last mystery set images

* remove unused Page

* remove equipment from newClient.json
2017-07-31 17:04:40 -06:00
Sabe Jones
90f7390f84 Merge branch 'release' into develop 2017-07-31 20:35:25 +00:00
Sabe Jones
5d6e8c8729 3.107.0 2017-07-31 20:34:57 +00:00
Sabe Jones
4659b1cc5c chore(i18n): update locales 2017-07-31 20:33:55 +00:00
SabreCat
06c58bfae2 chore(sprites): compile 2017-07-31 20:23:19 +00:00
SabreCat
568e8840ed feat(event): Naming Day 2017 2017-07-31 20:22:09 +00:00
Keith Holliday
ffe46c0f07 Many updates on our large list (#8905)
* Many updates on our large list

* Added footer debug functions
2017-07-31 13:54:52 -06:00
Sabe Jones
aad6130b21 3.106.1 2017-07-30 20:37:17 +00:00
Alys
88d48f1e5d adjust slurs / banned words. TRIGGER / CONTENT WARNING: assault, slurs, swearwords, etc 2017-07-31 06:26:16 +10:00
Sabe Jones
413626a971 3.106.0 2017-07-30 16:15:45 +00:00
Sabe Jones
26f39c9db6 chore(news): Last Chance Bailey 2017-07-30 16:13:58 +00:00
Keith Holliday
c5e0bcfb0e New client more misc (#8902)
* View party now opens member modal

* Clicking member in header opens member detail modal

* Began sticky header

* Added sleep

* Removed extra inbox and added name styles

* Lint fixes

* Added member filter

* Added task counts

* Updated quest start modal

* Updated members modal style

* Fixed editing party

* Updated tavern

* Updated my guilds

* More guild styles

* Many challenge styles and fixes

* Fixed notification menu display

* Added initial styles to groupplans

* Added syncing with inbox

* Fixed lint

* Added new edit profile layout

* Added initial achievement layout

* Began adding new stats layout

* Removed duplicate:

* fix(CI): attempt to address Travis Mongo connection issue

* fix(CI): don't strand us in Mongo shell

* Travis updates

* Try percise
2017-07-29 16:08:36 -06:00
Sabe Jones
c6c0e3660b Merge branch 'release' into develop 2017-07-27 21:13:43 +00:00
Sabe Jones
d00131fc4a 3.105.2 2017-07-27 21:12:40 +00:00
Sabe Jones
f7220e7e8c feat(locales): add Turkish language 2017-07-27 21:12:20 +00:00
Sabe Jones
bf6dde6e63 3.105.1 2017-07-27 21:08:46 +00:00
Sabe Jones
c3024e5e58 chore(i18n): update locales 2017-07-27 21:06:15 +00:00
SabreCat
ca8b7f6b67 fix(sprites): jellyfish arms
Also adds a Bailey announcement.
2017-07-27 20:58:49 +00:00
Sabe Jones
521077ed4f Explicitly configure HTTP request for PayPal (#8896)
* fix(payments): explicitly configure HTTP request

* refactor(req): return $http call

* fix(payments): inject and open $window
2017-07-27 11:31:58 -07:00
negue
f72f71fd32 [WIP] New Client - Shops/Market (#8884)
* initial market - routing - store - load market data

* move drawer/drawerSlider / count/star badge to components/ui

* filter market categories

* shopItem with gem / gold

* show count of purchable items

* show count of purchable itemsshow drawer with currently owned items + DrawerHeaderTabs-Component

* show featured gear

* show Gear - filter by class - sort by (type, price, stats) - sort market items

* Component: ItemRows - shows only the max items in one row (depending on the available width)

* Sell Dialog + Balance Component

* generic buy-dialog / attributes grid with highlight

* buyItem - hide already owned gear

* filter: hide locked/pinned - lock items if not enough gold

* API: Sell multiple items

* show avatar in buy-equipment-dialog with changed gear

* market banner

* misc fixes

* filter by text

* pin/unpin gear store actions

* Sell API: amount as query-parameter

* Update user.js

* fixes

* fix sell api amount test

* add back stroke/fill currentColor

* use scss variables
2017-07-27 19:41:23 +02:00
Matteo Pagliazzi
18b04e713e Revert "chore(i18n): update locales"
This reverts commit 6754c43317.
2017-07-27 17:41:23 +02:00
Matteo Pagliazzi
6754c43317 chore(i18n): update locales 2017-07-27 17:35:14 +02:00
Keith Holliday
0b13ba822e New client group finishes (#8899)
* Added challenges section

* Added public fields to guilds

* Added suggestion for habitica help guild

* Added categoires to group

* Added guild category filters

* Added guild filter by member count

* Removed console.log

* Updated group count in tests to account for newly created groups
2017-07-26 09:05:13 -06:00
Sabe Jones
9071fa0073 Merge branch 'release' into develop 2017-07-25 23:25:11 +00:00
Sabe Jones
7a5f01d516 3.105.0 2017-07-25 23:24:48 +00:00
Sabe Jones
0f3f54548d chore(i18n): update locales 2017-07-25 23:22:54 +00:00
SabreCat
c84dc40c7d feat(content): Subscriber items 2017-07 2017-07-25 23:15:06 +00:00
Keith Holliday
16b244d5c6 New client random catchup (#8891)
* Added initial challenge pages

* Added challenge item and find guilds page

* Added challenge detail

* Added challenge modals

* Ported over challenge service code

* Ported over challenge ctrl code

* Added styles and column

* Minor modal updates

* Removed duplicate keys

* Fixed casing

* Added initial chat component

* Added copy as todo modal

* Added sync

* Added chat to groups

* Fixed lint

* Added notification service

* Added tag services

* Added notifications

* Added hall

* Added analytics

* Added http interceptor

* Added initial autocomplete

* Added initial footer component

* Began coding and designing footer

* Added inital hall

* Ported over inital group plan ctrl code

* Added initial invite modal

* Added initial member detail modal

* Added initial notification menu

* Ported over inital notification code

* Fixed import line

* Fixed autocomplete import casing
2017-07-25 08:24:40 -06:00
Matteo Pagliazzi
86a07a4949 fix missing comma in json 2017-07-22 20:38:55 +02:00
Matteo Pagliazzi
31bbac1751 Client Tasks (#8889)
* tasks: markdown style, checkboxes. Misc fixes

* add filtering to tasks

* client tasks: complete filtering
2017-07-22 20:30:08 +02:00
Sabe Jones
e6dd0d5e82 Delete Account with Social Auth (#8796)
* feat(accounts): delete social accts

* test(integration): social auth delete
2017-07-21 10:55:53 -07:00
Alys
88fece1422 change Contact Us page to specify the Report a Bug guild instead of GitHub (#8877) 2017-07-21 10:49:00 -07:00
Keith Holliday
ecc18fc093 New client chat (#8890)
* Added initial challenge pages

* Added challenge item and find guilds page

* Added challenge detail

* Added challenge modals

* Ported over challenge service code

* Ported over challenge ctrl code

* Added styles and column

* Minor modal updates

* Removed duplicate keys

* Fixed casing

* Added initial chat component

* Added copy as todo modal

* Added sync

* Added chat to groups

* Fixed lint
2017-07-21 11:00:36 -06:00
Keith Holliday
0a59b8e85b [WIP] New client challenges (#8842)
* Added initial challenge pages

* Added challenge item and find guilds page

* Added challenge detail

* Added challenge modals

* Ported over challenge service code

* Ported over challenge ctrl code

* Added styles and column

* Minor modal updates

* Removed duplicate keys

* Fixed casing
2017-07-20 14:52:46 -06:00
Keith Holliday
d677f5cfc7 New client statics (#8885)
* Moved static files over to new client

* Added statics, fixed translations and update styles

* More style and vue fixes

* Fixed line endings

* Fixed new stuff converasion and help links
2017-07-20 12:20:53 -06:00
Keith Holliday
88f872ed50 New client settings (#8886)
* Added initial settings page

* Initial cleanup and translations

* Ported api settings

* Ported promocode settings

* POrted notifications code

* Fixed styles and translatins for site page

* Ported over rest of settings functions

* Ported payments over

* Initial lint clean up

* Added amazon modal

* Added stripe

* Added site settings
2017-07-20 12:01:00 -06:00
CJ
605391e4e7 Fixes #7958 - do not remove Battle Gear equipment when changing class (#8064)
* Changed files to fix Bug 7958:
 - website/client-old/.../userCtrl.js#38: removed to keep inventory constant
 - website/common/.../changeClass.js#33:  removed to stop 'classes' introduction

* Adjustments following Bug Review
 - Removed remaining 'foundKey' logic
 - Adjusted test logic to reflect feature change

* Reverting userCtrl.js to development version
 - Reintroduces "classes" Guide tour

* New version of Fixes #7958
 - Changed logic to only notify user the first time they choose a class
 - Changed message to represent this change in logic
 - #LINT: Cleaned interface for changing class
    - New method: enableClasses() -- because, really, should we be calling User.changeClass({}) from the UX?
    - New method: payForNewClass() -- handles prompting the user to confirm that they want to change class

* Remove new User Flag, use flags.tour.classes

* Whoopsie. Fix PR conflict.

* Changed files to fix Bug 7958:
 - website/client-old/.../userCtrl.js#38: removed to keep inventory constant
 - website/common/.../changeClass.js#33:  removed to stop 'classes' introduction

* Adjustments following Bug Review
 - Removed remaining 'foundKey' logic
 - Adjusted test logic to reflect feature change

* Reverting userCtrl.js to development version
 - Reintroduces "classes" Guide tour

* New version of Fixes #7958
 - Changed logic to only notify user the first time they choose a class
 - Changed message to represent this change in logic
 - #LINT: Cleaned interface for changing class
    - New method: enableClasses() -- because, really, should we be calling User.changeClass({}) from the UX?
    - New method: payForNewClass() -- handles prompting the user to confirm that they want to change class

* Remove new User Flag, use flags.tour.classes

* Whoopsie. Fix PR conflict.

* Removed Extraneous Flag

* Removed Extraneous Flag

* Changed files to fix Bug 7958:
 - website/client-old/.../userCtrl.js#38: removed to keep inventory constant
 - website/common/.../changeClass.js#33:  removed to stop 'classes' introduction

* New version of Fixes #7958
 - Changed logic to only notify user the first time they choose a class
 - Changed message to represent this change in logic
 - #LINT: Cleaned interface for changing class
    - New method: enableClasses() -- because, really, should we be calling User.changeClass({}) from the UX?
    - New method: payForNewClass() -- handles prompting the user to confirm that they want to change class

Remove new User Flag, use flags.tour.classes

Whoopsie. Fix PR conflict.

Removed Extraneous Flag

* Fixes handling architecture change

* Updates following Review 20170418-0602

* Remove cause of mocha/no-exclusive-tests lint failure
2017-07-20 10:28:53 -07:00
Sabe Jones
ca90d88289 Merge branch 'release' into develop 2017-07-20 16:10:12 +00:00
Sabe Jones
a4951c6478 3.104.1 2017-07-20 16:08:27 +00:00
Matteo Pagliazzi
95285cd85a do not send password to loggly (#8887) 2017-07-20 15:07:38 +02:00
Andrew Schultz
1a03f8d7ae 3 typos plus a question (#8866) 2017-07-19 18:51:39 -07:00
Andrew Schultz
5d0cbd2456 Stoikalm was missing umlaut in 2 game text places (#8867) 2017-07-19 18:50:31 -07:00
Mateus Etto
cdc8473f60 Allow Multiple Invites to Party (#8683)
* (server) Add parties array to store invites

* (server) Lint files

* Update joinGroup, rejectGroupInvite, _inviteByUUID, and remove clearPartyInvitation.js

* Update user schema: detailed 'invitations.parties' attributes

* Code improvement and do not let invite twice

* Check if the user is already invited earlier in the code

* Added message to invitation page, and show all invitations

* Added join party confirmation alert

* Small fixes

* Created test: allow inviting a user to 2 different parties

* Updated tests

* Update invitations.parties on more places

* Small adjustments

* Updates on invitations.party references

* Show all invitations when user is already in a party

* Fixed notifications counter

* Update both 'party' and 'parties' at _handleGroupInvitation

* Updated a test

* Fixed small mistake at _handleGroupInvitation

* More test update

* Update invitation.party when removing single invite and small adjust at view
2017-07-19 18:45:28 -07:00
Kevin Smith
11a4c1c95d Implemented new Achievement and Badge: Invited a Friend (Fixes #8615) (#8819)
* Added text to locale

* Added achievement to content and libs

* Added achievement modal

* Added achievement to notification model and controller

* Added achievement to user schema

* Grant achievement to inviter when user registers using emailed link

* Fix icon name

* Added integration test

* Fix linting

* Added sprite
2017-07-19 18:39:39 -07:00
SabreCat
625b159880 Merge branch 'sabrecat/travis-mongodb' into develop 2017-07-19 23:14:00 +00:00
SabreCat
bf8b2db6b3 fix(Travis): explicitly start Mongo 2017-07-19 22:50:57 +00:00
SabreCat
83a1b9c34e chore(words): reclassify some words as slurs
Also moves bannedSlurs.js to the same directory as bannedWords.js.
2017-07-19 21:41:08 +00:00
Alyssa Batula
c350665076 Automatically mute users who attempt to post a slur, fixes #8062 (#8177)
* Initial psuedo-code for checking for slurs in messages

* Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check.

* Permanently revoke chat privileges when attempting to post a slur.

* Removed console logs

* Fixing rebase

* Do not moderate private groups

* Moved slur check to a generic check for banned words function

* Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function

* Slurs are blocked in both public and private groups

* Added code to send a slack message for slurs

* Fixed formatting issues

* Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check

* Added initial tests for blocking slurs and revoking chat priviliges

* Uncommented line to save revoked privileges

* Check that privileges are revoked in private groups

* Moved code to email/slack mods to chat api file

* Switched to BadRequest instead of NotFound error

* Restore chat privileges after test

* Using official placeholder slur

* Fixed line to export sendSubscriptionNotification function for slack

* Replaced muteUser function in user methods with a single line in the chat controller file

* Reset chatRevoked flag to false in a single line

* Switched method of setting chatRevoked flag so that it is updated locally and in the database

* First attempt at the muteUser function: revokes user's chat privileges and notifies moderators

* Manual merge for cherry-pick

* Initial working prototype for blocking posting of slurs. Moved check from group.js to the chat api. Still needs: to permanently revoke chat privileges, to notify the moderators, a better method for checking for the blacklisted words, and a way to get the real list of words to check.

* Permanently revoke chat privileges when attempting to post a slur.

* Removed console logs

* Created report to be sent to moderators via email

* Do not moderate private groups

* Moved slur check to a generic check for banned words function

* Moved list of slurs to a separate file, fixed misplacement of return in ContainsBannedWords() function

* Slurs are blocked in both public and private groups

* Added code to send a slack message for slurs

* Fixed formatting issues

* Incorporated tectContainsBannedWords() function from PR 8197, added an argument to specify the list of banned words to check

* Added initial tests for blocking slurs and revoking chat priviliges

* Uncommented line to save revoked privileges

* Check that privileges are revoked in private groups

* Moved code to email/slack mods to chat api file

* Switched to BadRequest instead of NotFound error

* Restore chat privileges after test

* Using official placeholder slur

* Fixed line to export sendSubscriptionNotification function for slack

* Replaced muteUser function in user methods with a single line in the chat controller file

* Reset chatRevoked flag to false in a single line

* Switched method of setting chatRevoked flag so that it is updated locally and in the database

* Removed some code that got re-added after rebase

* Tests for automatic slur muting pass but are incomplete (do not check that chatRevoked flag is true)

* Moved list of banned slurs to server side

* Added warning to bannedSlurs file

* Test chat privileges revoked when posting slur in public chat

* Fix issues left over after rebase (I hope)

* Added code to test for revoked chat privileges after posting a slur in a private group

* Moved banned slur message into locales message

* Added new code to check for banned slurs (parallels banned words code)

* Fixed AUTHOR_MOTAL_URL in sendTxn for slur blocking

* Added tests that email sent on attempted slur in chat post

* Created context for slur-related-tests, fixed sandboxing of email. Successfully tests that email.sendTxn is called, but the email content test fails

* commented out slack (for now) and cleaned up tests of sending email

* Successfully tests that slur-report-to-mods email is sent

* Slack message is sent, and testing works, but some user variables seem to only work when found in chat.js and passed to slack

* Made some fixes for lint, but not sure what to do about the camel case requirement fail, since that's how they're defined in other slack calls

* Slack tests pass, skipped camelcase check around those code blocks

* Fixed InternalServerError caused by slack messaging

* Updated chat privileges revoked error

* fix(locale): typo correction
2017-07-19 14:06:15 -07:00
Matteo Pagliazzi
89ee8b1648 Client Tasks (#8883)
* client tasks: fix styles and add markdown rendering

* more style fixes

* client: tasks fixes
2017-07-19 21:02:40 +02:00
Sabe Jones
75680ab6aa Merge branch 'release' into develop 2017-07-19 18:41:13 +00:00
Sabe Jones
116ec0f9d9 3.104.0 2017-07-19 18:38:43 +00:00
Sabe Jones
a89633d17b chore(i18n): update locales 2017-07-19 18:37:11 +00:00
SabreCat
2e3dd27414 chore(sprites): compile 2017-07-19 18:25:14 +00:00
SabreCat
3af756a90d feat(cards): Good Luck card and achievement 2017-07-19 18:24:10 +00:00
jerellmendoodoo
a9195f0d96 Fixed release pets mounts (#8545)
* Fixed release pets/mounts achievements when fully earned and added unit tests for these changes

* Fixed release pets/mounts achievements to award only when fully earned and added unit tests for these changes, also fixed linting issues

* Updated variable assignments to make more readable

* Revised releaseBoth/Pets/Mounts to include null or undefined checks, also updated unit tests

* fixed integration tests
2017-07-18 13:34:54 -07:00
Oscar Rendón
ab777f7006 Restrict users from getting back from death (#8808)
* Add test to prevent death users recovering health

* Add check for buying potions with zero health

* Validate hp <= 0 to take boss damage into account
2017-07-18 13:26:10 -07:00
Grayson Gilmore
d918bc9f56 Add tests to increase coverage on /website/server/controllers/api-v3/auth.js (#8809)
* Add tests covering branches in _handleGroupInvitation

* Remove .only from latest test
2017-07-18 13:21:34 -07:00
Sabe Jones
4a89ca3e11 Merge branch 'develop' into fix-leave-challenges 2017-07-18 20:14:47 +00:00
joe-salomon
cdbbf93b74 Weekly/Monthly Habit reset counters resetting early - fixes #8570 (#8749)
* For habit reset logic, changed day check calculation to use user’s timezone instead of server time.
Added unit tests to check following cases:
- Weekly habit reset: Server tz is Sunday, User tz is Monday
- Weekly habit reset: Server tz is Monday, User tz is Sunday
- Monthly habit reset: Server tz is 1st of month, User tz is 2nd of month
- Monthly habit reset: Server tz is end of prev month, User tz is 1st of month

* use moment().zone() instead of utcOffset()

* typo

* Fixed check for daysMissed, added logic for CDS
Added test for CDS, fixed previous tests
2017-07-18 12:53:39 -07:00
Keith Holliday
d822843bbf [WIP] New client userpages (#8868)
* Added background page

* Added stats

* Added achievements

* Added profile
2017-07-17 22:18:17 -06:00
negue
ea3ed26f42 Stable minor fixes (#8861)
* fix dialog text + close after hatching

* Update newClient.json
2017-07-18 01:04:34 +02:00
Pavel Pletenev
0da1144635 Make responce codes uniform (#8865)
* Fix 201 responce wrong documentation

* Fix 201 in challenges

* Fix 201 in groups.js

* Fix 201 in tags.js

* Fix 201 in webhooks.js
2017-07-17 14:28:25 -07:00
Alys
5f3539da19 make Bailey correctly explain about Aquatic Friends achievement badge (#8853)
* make Bailey correctly explain about Aquatic Friends achievement badge

It's this error again: https://github.com/HabitRPG/habitica/issues/8658

From katzalina in the Report a Bug guild:
"not a priority: Re:Bailey's news 07/05/ it says: both you and you
friend get the aquatic friends badge - I splashed a party member
and did not get the badge (didn't expect to either, until reviewing
the news). Am I experiencing a bug or has there been a systematic
change and the news text doesn't reflect it, yet? Thanks"

* the incorrect message was in an earlier Bailey as well
2017-07-17 14:16:31 -07:00
Sabe Jones
e4d006e5cd 3.103.0 2017-07-16 16:25:07 +00:00
Sabe Jones
801b53857f fix(payments): short circuit for non-gift txns (#8881) 2017-07-16 09:24:17 -07:00
Keith Holliday
f8571ec5d5 Moved notifications to be read after yesterdailies (#8872)
* Moved notifications to be read after yesterdailies

* Prevent when user needs cron

* Updated tests
2017-07-16 09:24:09 -07:00
Matteo Pagliazzi
78ba596504 Groups can prevent members from getting gems (#8870)
* add possibility for group to block members from getting gems

* fixes

* fix tests

* adds some tests

* unit tests

* finish unit tests

* remove old code
2017-07-16 09:23:57 -07:00
Sabe Jones
fe9521a63f 3.102.3 2017-07-14 12:11:08 +00:00
Sabe Jones
c4348d8e47 Merge branch 'release' into develop 2017-07-13 22:29:35 +00:00
Sabe Jones
9b0ee6a726 3.102.2 2017-07-13 22:29:03 +00:00
Sabe Jones
c23fad3077 chore(i18n): update locales 2017-07-13 22:28:23 +00:00
Sabe Jones
6850a1fcb4 chore(news): Blog Bailey 2017-07-13 22:23:35 +00:00
Keith Holliday
bc477455bb Tasks cron ryamodal fixes (#8871)
* Changed assumption of timezone location

* Added checks for RYA and moved cron check

* Fixed modal scope issue
2017-07-13 15:11:27 -07:00
Sabe Jones
88c56c9877 Merge branch 'release' into develop 2017-07-12 20:42:23 +00:00
Sabe Jones
4cd272f99c 3.102.1 2017-07-12 20:41:58 +00:00
Sabe Jones
0292501387 chore(i18n): update locales 2017-07-12 20:40:13 +00:00
Keith Holliday
28b56256d2 Added catch for cron error (#8864)
* Added catch for cron error

* Updated logger usage
2017-07-12 13:35:08 -07:00
Sabe Jones
a4ee3aaa7e Merge branch 'release' into develop 2017-07-11 21:48:18 +00:00
Sabe Jones
7a2432a1a0 3.102.0 2017-07-11 21:42:06 +00:00
Sabe Jones
0bf515d0f9 chore(i18n): update locales 2017-07-11 21:40:44 +00:00
SabreCat
cbed198f02 chore(sprites): compile 2017-07-11 21:32:53 +00:00
SabreCat
90d77cee81 feat(content): Orca Pets and Splashy Pals 2017-07-11 21:31:26 +00:00
SabreCat
3668a9d3ac fix(sprites): correct canvases
Also adds sprites for Trapper Santa collection quest.
2017-07-11 21:29:48 +00:00
Keith Holliday
052c653cd3 Added initial inbox (#8852)
* Added initial inbox

* Minor styles

* Added more styles, selected conversations, sending messages

* Added translations and colors
2017-07-10 21:09:31 -06:00
Keith Holliday
3aa7b4b631 Fixed or logic break (#8857) 2017-07-10 21:08:35 -06:00
Sabe Jones
045378b820 Merge branch 'release' into develop 2017-07-10 20:20:24 +00:00
Sabe Jones
a256b6df03 3.101.2 2017-07-10 20:07:46 +00:00
Keith Holliday
92fdc13adf Added assumption that the date passed is in the users timezone (#8859) 2017-07-10 13:07:14 -07:00
negue
dd29c60d87 [WIP] drag/drop fixes (#8851)
* Stable: Highlight pet on dragging food / add drag* events

* Stable: hatch dialog instead of popover / .btn-flat / update bootstrap-vie

* Layout: change sidebar width to fixed 236px - removed .col-2/.col-10

* Stable: Drag&Drop Food Image + Text - refactor directive to use custom event names

* Stable: fixes

* Stable: click to select food + attached food info box

* fix lint issues

* Drag&Drop&Click: Potions on Eggs - fix click on item + attached infobox-position in click mode
2017-07-10 10:07:23 +02:00
Sabe Jones
78fd79931e Merge branch 'release' into develop 2017-07-08 01:49:25 +00:00
Sabe Jones
5055a57ae9 3.101.1 2017-07-08 01:48:50 +00:00
Keith Holliday
3fa0b72ffe Added assumption when no time is supplied (#8855)
* Added assumption when no time is supplied

* Changed format of date

* Set now options when date is specified
2017-07-07 18:46:54 -07:00
Keith Holliday
b3f9fd09c6 Check for app loading instead of daily count (#8856) 2017-07-07 12:35:26 -07:00
Keith Holliday
30437e158e Added check to prevent double cron (#8854)
* Added check to prevent double cron

* Added then and fix style issues
2017-07-07 11:14:36 -07:00
Keith Holliday
19ba1290f6 Added new web profile for checkout (#8699)
* Added new web profile for checkout

* Fixed es6 syntax

* Fixed config path
2017-07-06 15:16:54 -07:00
Grayson Gilmore
c509c8e04f Test /api/v3/tasks/unlink-all and unlink-one (#8810)
* Add tests for POST /tasks/unlink-all/:challengeId

* Add test for keep=keep-all query

* Cleanup

* Setup

* Cleanup

* Add tests for unlink-one
2017-07-06 14:25:31 -07:00
Todd Medema
00d4393024 reduce top margins on task filter bar to reduce dead space below 'add multiple' link / make UI more space efficient (#8806) 2017-07-06 14:13:35 -07:00
yugensoft
c502b1997b Updated new-groups / group-plans static page #8674 (#8729)
* dummy

* Renamed internationalized strings to more meaningful names

* moved the new group creation state out to its own URL, so it can also be linked to by the static/plans page

* Added redirect-through-login functionality from the static/plans page new-group button
This includes a static non-modal login page (similar to how other sites have both a login page and login modal)
The login body has been abstracted out from its modal-specific view into mixins to accomplish this

* deleted bak files added by mistake

* deleted scripts added by mistake

* changed static/plans Create Group button text

* Added form link (https://github.com/HabitRPG/habitica/issues/8674#issuecomment-303518039)
Removed changes to non-EN locale files (https://github.com/HabitRPG/habitica/pull/8729#issuecomment-303555211)

* reverted key name changes as per https://github.com/HabitRPG/habitica/pull/8729#issuecomment-304515534

* changed $rootScope to $scope
https://github.com/HabitRPG/habitica/pull/8729#discussion_r120695874
2017-07-06 14:08:02 -07:00
madpink
4435862ff2 Updating User API Doc (part 4) (#8792)
* Updating User API Doc (part 4)

* Fixed trailing space
2017-07-06 13:48:00 -07:00
Keith Holliday
e901850a6f continuation of PR #8161 Display error notification when attempting to purchase invalid amount of gems - fixes #8145 (#8688)
* Translation string for error notification

* Use function instead of a link for paypal

* Inject notification service, function to check the amount of gems to purchase, function to handle payments with paypal

* Throw error if amount of gems is zero or negative

* Add condition to raise error if amount is negative

* Added gem errors for gifts 0 or less

* Fixed linting and broken test

* Fixed test syntax

* Added back needed strings

* Fixed group locales
2017-07-06 13:43:43 -07:00
LlamaLad
48bbc22fb4 Dailies new subheading and summary change (#8799)
* Dailies new subheading and summary change

* summary change
2017-07-06 13:31:13 -07:00
Alys
c1e5d8b573 add missing string for mountNowOwned error message (#8843) 2017-07-06 13:23:20 -07:00
Andrew Schultz
6951b79b95 two typos in questsContent (#8837) 2017-07-06 13:20:34 -07:00
Keith Holliday
1c3a12f37d [WIP] Added initial tavern updates (#8845)
* Added initial tavern updates

* Translations and styles

* Fixed locales and lint
2017-07-06 09:38:52 -06:00
Keith Holliday
3c71748a1b Renamed production docker file (#8850) 2017-07-05 13:29:25 -07:00
Sabe Jones
8e56222fc7 Merge branch 'release' into develop 2017-07-05 20:11:13 +00:00
Sabe Jones
ac3ac73737 3.101.0 2017-07-05 20:10:53 +00:00
Sabe Jones
8004c1e759 chore(i18n): update locales 2017-07-05 20:10:13 +00:00
SabreCat
d9e50e7632 Merge remote-tracking branch 'TheHollidayInn/yesterdailies-2' into release 2017-07-05 20:04:26 +00:00
SabreCat
4cd742c19a feat(event): Summer Splashy Foam 2017-07-05 20:03:23 +00:00
Keith Holliday
6bc6c09c75 New client creator (#8841)
* Added initial creator

* Added initial styles and functionality for creator

* More style changes

* Translations and styles

* More active classes

* Removed extra locales
2017-07-04 13:11:08 -05:00
Sabe Jones
0cbf9354cc Merge branch 'release' into develop 2017-07-03 23:05:52 +00:00
Sabe Jones
03ca65f2b8 3.100.0 2017-07-03 23:05:28 +00:00
Sabe Jones
ea74271484 chore(i18n): update locales 2017-07-03 23:04:47 +00:00
SabreCat
0897367538 chore(sprites): compile 2017-07-03 22:56:48 +00:00
SabreCat
2566fcecb7 feat(content): Backgrounds and Armoire 2017-07 2017-07-03 22:54:58 +00:00
Keith Holliday
c99863f339 Added yesterdaily field (#8847)
* Added yesterdaily field

* Added yesterdaily migration

* Added description
2017-07-03 13:55:53 -05:00
Keith Holliday
71d632f6f0 Merge remote-tracking branch 'upstream/release' into yesterdailies-3 2017-07-03 09:46:34 -05:00
Joe P
06c53677f6 Group Approvals Formatting - Fix #8677 (#8784)
* Add task indication to Group Plans Tasks Awaiting Approval page

* Render markdown tasks on Group Plans Tasks Awaiting Approval page

* Fix panel code- fixes formatting issue of Approve button on Group Plans Tasks Awaiting Approval page
2017-07-01 09:33:24 -07:00
Sabe Jones
aa91c5dbae Kubernetes support for dev environments (#8753)
* Run Habitica in Kubernetes

* fix(docs): Address PR comments
2017-07-01 09:30:08 -07:00
Keith Holliday
5b7c7b77c8 Added docker production file (#8846)
* Added docker production file

* Added tag clone

* Removed docker prod
2017-07-01 09:28:51 -07:00
Vicente
d3d221dccb Repeat monthly fix https://github.com/HabitRPG/habitica/issues/8831 (#8835)
* checking nexDueDate if it's an array before applying .map

* used array created

* change let for 'strict mode'

* Used ajax when canceling from the website (#8697)

* Used ajax when canceling from the website

* Fixed grammar issue

* Payments gem reset (#8712)

* Added gem reset if user does not have date last updated set

* Fixed login of adding updated date

* fix bug that prevented sending of emails to admin addresses (#8832)

* feat(content): June 2017 subscriber items

* chore(sprites): compile

* chore(i18n): update locales

* 3.98.0

* [WIP] client/inventory/stable (#8737)

* Stable: basic layout (based on equipment)

* extract item popover-content as component

# Conflicts:
#	website/client/components/inventory/item.vue

* extract item-content as slot - list standard pets with image

* dynamic list petGroups in sidebar / content - with selected / open filter

* itemContentClass for pets

* fix filter - extract filter labels

* Filter: Hide Missing

* fix position of pets

* sort by: A-Z, Color, Hatchable

* refactor animalList - created the list once per type and cache it - sort now works before viewing one or all pets

* custom petItem to show the progress

* list specialPets - rename petGroup to animalGroup (more generic)

* equip a pet

* filter animals by input

* count pets

* list mounts

* hatchable pet popover

* hatchable pet popover #2

* PixelPaw Opacity for not owned and not hatchable pets - change item background for unowned pets

* Hold to hatch the pet - cleanup

* add food drawer + countBadge - special mounts - hide un-owned special animals - fixes

* Sliding Drawer: Buttons to scroll left/right

* Drag&Drop: food on pets

* fix hold to hatch - use mouseleave event

* 'Show All' / 'Show Less' - Animals

* Matts Image + Popover + use image width as sidebar width (removed col-2 / col-10)

* fixes: colors, v-once, drawer-errorMessage, strings

* drawerSlider - split items to pages / add divider / add first item of the next page - ResizeDirective

* ResizeDirective - throttle emits by `v-resize="value"` - fix drawer left padding

* show animals by available content width

* change sortBy button / label

* fix pet colors / backgrounds

* DragDropDirective - grabbing cursor

* remove browser specific prefixes

* fix lint issues

* show welcome dialog

* change translationkey (noFood, already exists)

* used array created

* change let for 'strict mode'
2017-07-01 09:25:04 -07:00
negue
53c610236b Client/stable fixes - part 1 (#8840)
* fixes: show ten pets in a row - show pet / no feeding progress if mount already owned

* fixes: disabled filter instead of hiding them

* fixes: don't hide special pets - same item style for mounts

* fixes: avatar changes of pet / mount

* fixes: unfocus first dropdown-item by css

* fixes: unfocus first dropdown-item by css (remove :focus style)- added "What does my pet like to eat?" popover
2017-07-01 17:46:24 +02:00
Sabe Jones
548cc2ceb0 3.99.1 2017-06-30 21:05:16 +00:00
Sabe Jones
bf03ac8e44 chore(i18n): update locales 2017-06-30 20:59:13 +00:00
SabreCat
1853113aed Merge branch 'develop' into release 2017-06-30 20:50:18 +00:00
SabreCat
1ce1ed7c6b fix(test): allow for long months 2017-06-30 20:47:18 +00:00
Sabe Jones
c9f870a929 3.99.0 2017-06-29 21:34:53 +00:00
Sabe Jones
135df1dc48 chore(build): update Dockerfile 2017-06-29 21:34:39 +00:00
Sabe Jones
a240d9581f chore(i18n): update locales 2017-06-29 21:30:15 +00:00
SabreCat
3cd591ed4f chore(sprites): compile 2017-06-29 21:22:11 +00:00
SabreCat
87076ed07c feat(content): Aqua Potions 2017-06-29 21:21:20 +00:00
Matteo Pagliazzi
33a39d3683 Client fixes (#8844)
* client: fix router when not authenticated, small fixes for tasks

* load the user only when necessary

* fix tests
2017-06-29 20:49:05 +02:00
Keith Holliday
e4f5950ffc Added required field 2017-06-29 08:11:02 -06:00
Keith Holliday
f2d81a8d9c Merge remote-tracking branch 'upstream/develop' into yesterdailies-3 2017-06-28 15:25:59 -06:00
Keith Holliday
43b6f71044 Fixed lint issue 2017-06-28 15:25:47 -06:00
Matteo Pagliazzi
06de1670b4 client: fix build and gradient 2017-06-28 10:53:35 +02:00
Keith Holliday
7fd2522e93 Merged in develop 2017-06-27 22:23:13 -06:00
Keith Holliday
acb4b79078 Added option for getting isDue field for specified date 2017-06-27 22:22:20 -06:00
Keith Holliday
8299982484 Ensured damage was only done for dailies that were due yesterday 2017-06-27 22:01:01 -06:00
Keith Holliday
207b1e91ca Added regsiter page and styles (#8836)
* Added regsiter page and styles

* Added style updates

* Added login server connection and logout

* Added login

* Added social auth

* Moved image assests

* Added trasnlations

* Added social icons

* Removed duplicate

* Updated shrinkwrap
2017-06-27 21:53:59 -06:00
Keith Holliday
aee21edd5f [WIP] Began adding tavern and party (#8814)
* Began adding tavern and party

* Fixed routing conflicts and tavern constant

* Updated button styles

* Added not on quest block

* Added no challenge block

* Began adding quest details

* Began updating group create modal to have party info

* Added create party modal

* Added share userid menu

* Began adding toggle

* Finished toggle styles

* Added start quest modal

* Ported over party ctrl code

* Finished porting over party ctrl code

* Added more quest actions

* Added own quests modal and quest modal details

* Fixed member modal styles and icons

* Added many random style updates

* Small text align fix

* Removed extra update

* Removed config and extra key

* Removed client string extras
2017-06-27 14:02:55 -06:00
Sabe Jones
6e1bbd05bc Merge branch 'release' into develop 2017-06-27 17:43:13 +00:00
Sabe Jones
763c2c28ea 3.98.1 2017-06-27 17:42:52 +00:00
Sabe Jones
7aa9ba45f6 chore(i18n): update locales 2017-06-27 17:39:08 +00:00
Sabe Jones
d67398fba6 chore(news): Guild Spotlight Bailey 2017-06-27 17:33:54 +00:00
Matteo Pagliazzi
6fb4c1b576 Client Tasks v1 (#8823)
* remove unused elements from tasks page

* remove components

* client: tasks: wip

* tasks: order, start styling them

* more tasks works

* habits controls

* more work

* tasks icons

* split columns in their own component

* implement tags for tasks

* wip

* add columns description
2017-06-26 23:55:14 +02:00
Alys
7c5bd526b1 minor text fixes: accurate flavour text for Golden Knight testimonies collection quest, etc (#8826)
* make comment more accurate: members are removed, not banned

They can rejoin with an invitation in a private group or at any time in a public group.

* change windows line breaks to unix line breaks

* change flavour text of Golden Knight collection quest to reduce number of testimonies

* fix grammatical error noticed by mandyzhou

* improve message about not being able to send PMs because we often see people report it as a bug

* update instructions for cancelling Google subscriptions (thanks to Scea for noticing)

* change Delete Completed on-hover message - fixes #8598

* correct the Orb of Rebirth's text about pets and mounts (they are not locked)
2017-06-26 22:35:29 +01:00
negue
187a9f5f19 [WIP] client/inventory/stable (#8737)
* Stable: basic layout (based on equipment)

* extract item popover-content as component

# Conflicts:
#	website/client/components/inventory/item.vue

* extract item-content as slot - list standard pets with image

* dynamic list petGroups in sidebar / content - with selected / open filter

* itemContentClass for pets

* fix filter - extract filter labels

* Filter: Hide Missing

* fix position of pets

* sort by: A-Z, Color, Hatchable

* refactor animalList - created the list once per type and cache it - sort now works before viewing one or all pets

* custom petItem to show the progress

* list specialPets - rename petGroup to animalGroup (more generic)

* equip a pet

* filter animals by input

* count pets

* list mounts

* hatchable pet popover

* hatchable pet popover #2

* PixelPaw Opacity for not owned and not hatchable pets - change item background for unowned pets

* Hold to hatch the pet - cleanup

* add food drawer + countBadge - special mounts - hide un-owned special animals - fixes

* Sliding Drawer: Buttons to scroll left/right

* Drag&Drop: food on pets

* fix hold to hatch - use mouseleave event

* 'Show All' / 'Show Less' - Animals

* Matts Image + Popover + use image width as sidebar width (removed col-2 / col-10)

* fixes: colors, v-once, drawer-errorMessage, strings

* drawerSlider - split items to pages / add divider / add first item of the next page - ResizeDirective

* ResizeDirective - throttle emits by `v-resize="value"` - fix drawer left padding

* show animals by available content width

* change sortBy button / label

* fix pet colors / backgrounds

* DragDropDirective - grabbing cursor

* remove browser specific prefixes

* fix lint issues

* show welcome dialog

* change translationkey (noFood, already exists)
2017-06-23 13:24:10 +02:00
Sabe Jones
7954763738 Merge branch 'release' into develop 2017-06-22 23:05:23 +00:00
Sabe Jones
d062fd8507 3.98.0 2017-06-22 23:04:42 +00:00
Sabe Jones
ceb10137a2 chore(i18n): update locales 2017-06-22 23:04:09 +00:00
SabreCat
58330a4d01 chore(sprites): compile 2017-06-22 22:55:36 +00:00
SabreCat
678f48fde9 feat(content): June 2017 subscriber items 2017-06-22 22:54:17 +00:00
Alys
a642d94443 fix bug that prevented sending of emails to admin addresses (#8832) 2017-06-22 14:33:27 -07:00
Keith Holliday
39a112b605 Payments gem reset (#8712)
* Added gem reset if user does not have date last updated set

* Fixed login of adding updated date
2017-06-22 14:21:09 -07:00
Keith Holliday
8c8f0ea201 Used ajax when canceling from the website (#8697)
* Used ajax when canceling from the website

* Fixed grammar issue
2017-06-22 14:13:53 -07:00
Keith Holliday
ca8541e8c4 Added needsCron field 2017-06-21 13:28:12 -06:00
Sabe Jones
773d546e4f Merge branch 'release' into develop 2017-06-21 04:01:33 +00:00
Sabe Jones
f269d381da 3.97.2 2017-06-21 04:00:53 +00:00
Sabe Jones
3483f69559 fix(sprites): realign healer fins 2017-06-21 03:59:51 +00:00
Sabe Jones
9ada0c9b02 Merge branch 'release' into develop 2017-06-21 01:52:36 +00:00
Sabe Jones
8bbe9ac36e 3.97.1 2017-06-21 01:52:08 +00:00
Sabe Jones
75b93e6ec4 fix(sprites): unbleach Matt 2017-06-21 01:51:50 +00:00
Sabe Jones
bd9bebe591 Merge branch 'release' into develop 2017-06-21 01:26:18 +00:00
Sabe Jones
f7b298d506 3.97.0 2017-06-21 01:25:54 +00:00
Sabe Jones
4bd2932955 chore(i18n): update locales 2017-06-20 22:18:38 +00:00
SabreCat
7060f5941d chore(sprites): compile 2017-06-20 22:10:04 +00:00
SabreCat
21379ee357 feat(event): Summer Splash 2017 2017-06-20 22:08:38 +00:00
Keith Holliday
fe62713809 Added migration to go from prod to test db (#8816) 2017-06-20 06:17:10 -06:00
Sabe Jones
ca7272a987 Merge branch 'release' into develop 2017-06-19 22:44:02 +00:00
Sabe Jones
cb46cd8eeb 3.96.2 2017-06-19 22:43:34 +00:00
Sabe Jones
d9d02ca81d chore(i18n): update locales 2017-06-19 22:43:18 +00:00
Sabe Jones
50c216eb41 chore(news): Bailey announcement 2017-06-19 22:38:06 +00:00
SabreCat
2c60fade01 Merge branch 'release' into develop 2017-06-17 20:20:52 +00:00
SabreCat
6bdf8fdabc 3.96.1 2017-06-17 20:19:35 +00:00
SabreCat
3db304b6bf fix(potions): disable Florals
Also add sprite for Bars of Soap in Attack of the Mundane 1
2017-06-17 20:18:36 +00:00
Matteo Pagliazzi
ea2788ab2f fix gulp in production 2017-06-17 19:02:03 +02:00
Sabe Jones
5e111f6f6c Merge branch 'release' into develop 2017-06-16 20:42:52 +00:00
Sabe Jones
ea85a8a3a8 3.96.0 2017-06-16 20:42:15 +00:00
Sabe Jones
e811a2700e feat(migration): update achievements (#8825) 2017-06-16 13:41:25 -07:00
Keith Holliday
136dcd27a9 Prevented modal close and showed correct due class in modal 2017-06-16 12:28:42 -06:00
Sabe Jones
bf76f823d5 chore(i18n): update locales 2017-06-16 17:43:26 +00:00
Sabe Jones
83b573dcfc chore(i18n): update locales 2017-06-16 17:42:28 +00:00
Matteo Pagliazzi
c4fa9426b3 Client Tasks v1 / Bootstrap configurable (#8822)
* make bs4 configurable, change gutters to match zeplin\s

* correctly customize gutters
2017-06-16 18:58:34 +02:00
Matteo Pagliazzi
042e5a8d63 Client Fixes (#8821)
* new client: fix animation flickering

* fix transitions

* update copy
2017-06-16 18:07:24 +02:00
Keith Holliday
7a8857010e Resized tasks, filter completed, add cron for non yesterdailies 2017-06-16 09:01:23 -06:00
Keith Holliday
a52bd66871 Fixed strings, yesterdaily filtering and cron check 2017-06-15 10:13:33 -06:00
Keith Holliday
f7ce269f3c Add false return when repeats are empty (#8777)
* Add false return when repeats are empty

* Added front end check for repeats on monthly-daysOfWeek

* Fixed tests with static date
2017-06-14 11:27:50 -07:00
Sabe Jones
c084f8a2b9 Merge branch 'release' into develop 2017-06-13 21:25:41 +00:00
Sabe Jones
c1c42e17b8 3.95.0 2017-06-13 21:21:55 +00:00
Sabe Jones
306a782e7a chore(i18n): update locales 2017-06-13 21:20:48 +00:00
SabreCat
20178c0722 chore(sprites): compile 2017-06-13 21:10:02 +00:00
SabreCat
256e2e809c feat(content): Nudibranch Pets 2017-06-13 21:09:13 +00:00
Matteo Pagliazzi
592345e22c Party members in header v2 (#8815)
* update comemnt

* flyout on hover

* fix hasClass and isBuffed

* polish members in party header
2017-06-13 20:55:45 +02:00
Keith Holliday
f738f550e7 Updated copy 2017-06-12 07:01:14 -06:00
Keith Holliday
495bc9aa50 Removed let from angular 2017-06-11 22:55:35 -06:00
Matteo Pagliazzi
292b2acb1e client: fix production path for chunks 2017-06-08 19:17:35 -07:00
Matteo Pagliazzi
977f9d5174 Client: party members in header (#8804)
* wip party members in header

* wip

* add inbox routes back

* polishing
2017-06-08 18:24:40 -07:00
Keith Holliday
36fa3ab06f Added cron check 2017-06-08 17:10:22 -07:00
Keith Holliday
7422d020b1 Ported over UI code 2017-06-08 16:03:20 -07:00
Keith Holliday
5d0fe0aac3 Added yesterdailiy to model 2017-06-08 15:37:36 -07:00
Matteo Pagliazzi
85644fdc1b client: user -list-detail -> member-details 2017-06-08 14:36:56 -07:00
Matteo Pagliazzi
138b5c4bdb wip client/header-party-members (#8803) 2017-06-08 14:33:23 -07:00
Keith Holliday
52edb8a8da New client members (#8795)
* Began styling member modal

* Added store and updated modal styles

* Began converting angular

* Ported over angular routes

* Fixed lint issues
2017-06-08 14:27:22 -07:00
Keith Holliday
60de7c8f21 Added cron route 2017-06-08 14:07:33 -07:00
Keith Holliday
137636cb40 Removed cron from every route 2017-06-08 14:03:30 -07:00
Keith Holliday
1999e1098e Allow guilds edit (#8800)
* test: test that admin users can update guilds

* test: test admin removeMember privileges

* fix: allow admins to edit guilds

* fix: add edit guild options for admins

* test: test that admin can't remove current leader

* Add error msg for removing current leader

* Taskwoods Quest Line (#8156)

* feat(content): Gold Quest 2016-10

* chore(news): Bailey

* chore(i18n): update locales

* chore(sprites): compile

* 3.49.0

* chore: update express

* Fix for the ReDOS vulnerability

habitica is currently affected by the high-severity [ReDOS vulnerability](https://snyk.io/vuln/npm:tough-cookie:20160722). 

Vulnerable module: `tough-cookie`
Introduced through: ` request`

This PR fixes the ReDOS vulnerability by upgrading ` request` to version 2.74.0

Check out the [Snyk test report](https://snyk.io/test/github/HabitRPG/habitica) to review other vulnerabilities that affect this repo. 

[Watch the repo](https://snyk.io/add) to 
* get alerts if newly disclosed vulnerabilities affect this repo in the future. 
* generate pull requests with the fixes you want, or let us do the work: when a newly disclosed vulnerability affects you, we'll submit a fix to you right away. 

Stay secure, 
The Snyk team

* Documentation - coupon

closes #8109

* fix(client): Allow member hp to be clickable

fixes #8016
closes #8155

* chore(npm): shrinkwrap

* test: test isAbleToEditGroup

* Add isAbleToEditGroup to groupsCtrl

* Remove unnecessary ternary

* Fix linting

* Move edit permission logic out to groupsCtrl

* fix: change ternary to boolean

* Fix linting

* Fixed merge issues
2017-06-08 13:45:24 -07:00
Keith Holliday
4d3a0c0571 Fixed issue with repeat settings turning false (#8773) 2017-06-08 12:18:49 -07:00
Matteo Pagliazzi
706de95458 Client: Header & Menu & Icons (#8770)
* header revamp - wip

* fix webpack fonts

* wip icons

* fix compilation errors

* implement icons loading without iconmoo

* new svg implementation

* wip

* fix issues with svgs

* fix issues with svgs

* fix bits svg

* fix displaying of pet in avatar

* avatar class icon

* no party header

* update navigation

* split code by route

* round gems and gp

* add string for faqs

* fix icons in css
2017-06-08 12:04:19 -07:00
Vince Campanale
e3c1eaa9d2 Preventing cardRead from notifying user. (#8473)
* added condition to prevent readCard operations from sending a notification

* created constant array to contain opNames for notifications we want to suppress and adjusted condition to accordingly

* replaced const with var to past karma test
2017-06-08 11:59:37 -07:00
Keith Holliday
17c0f795cc Began styling member modal 2017-06-08 11:03:06 -07:00
Sabe Jones
cb5ac9014e Include apidoc in test script (#8797)
* test(docs): include apidoc in script

* fix(test): also run apidoc on Travis
2017-06-08 10:40:10 -07:00
joe-salomon
0be681b7a2 Dailies performance fix - fixes #8756 (#8767)
* Changed recurring logic to not use moment-recur plugin for performance reasons

* change only nextDue calculations
add tests to make sure proper nextDue values are calculated
revert schedule.matches logic to original
revert shouldDo.test.js to original

* fix monthly nextDue logic
move tests to shouldDo.test.js

* typos

* revert to original logic. change not needed

* add failure cases
2017-06-08 10:34:05 -07:00
Sabe Jones
5360f9e587 Align doubled achievement popovers (#8798)
* bug(profile): align both achievement popups (hover vs. click)

* refactor(style): move to CSS/Stylus
2017-06-07 21:05:24 -07:00
Keith Holliday
4553a411f6 Paypal ipn options (#8713)
* Added more acceptable ipn cancelation options

* Fixed lint issue

* Fixed spelling issue
2017-06-07 10:31:44 -07:00
Alys
613f51b08d use new email template when joining a group plan for customisation of subscription cancellation information (#8637)
* use new email template when subscription is cancelled from joining a group plan

* use new email template when subscription is cancelled from joining a group plan - needs more code, tests

* change from sending new email as a cancel-subscription option to sending as a group plan join email

Uses a new group-member-join email template instead of old group-member-joining because new template includes mandril conditional merge tags.

Also adds tests and comments. Edits some comments for accuracy and typo fixes.

* adapt group-member-join email template for manual cancel message for iOS and Android subscriptions

* save test user so its profile name can be read by calls to sendTxn

* add documentation for the user model cancelSubscription function

* add constants for strings passed to mandrill email templates
2017-06-07 10:25:37 -07:00
joe-salomon
2292ba2694 Fix subscriptions ending early - fixes #8600 (#8746)
* Use “now” for calculation of the subscription end date instead of plan.dateUpdated

* add test to show previously incorrect logic does not affect sub end date.
2017-06-07 10:16:55 -07:00
joe-salomon
befacca457 Keep existing Mystery Items and Hourglasses when adding to group - fixes 8643 (#8745)
* Modified addSubToGroupUser to save existing mysteryItems and trinkets from an expired subscription
Added unit test

* fix eslint error
2017-06-07 09:59:09 -07:00
Airu
5cd30b430d Added Arashi's theme as a new audio theme (#8707)
* Add existing file

* Update menu.jade
2017-06-07 09:53:11 -07:00
Kevin Smith
c5d9ee1e0a Implemented new Achievement and Badge: Joined a Challenge (Fixes #8613) (#8761)
* Added image

* Added new achievement to user schema

* Added new achievement to content

* Added new achievement to libs

* Added achievement text to locale

* Added achievement to notification model and controller

* Grant achievement on joining or creating first challenge

* Added achievement to modal template

* Compiled new sprites

* Added integration tests

* Fix linting error
2017-06-07 09:43:16 -07:00
Sabe Jones
234328f2ba Reduce difficulty of collection quests (#8754)
* create script to insert message into party chat because collection quest is now easier

See https://github.com/HabitRPG/habitrpg/pull/7987 for more details.

* fix(quests): make collection less burdensome

* refactor(migration): return groups directly
2017-06-06 20:14:26 -07:00
SabreCat
029afa197e fix(achievements): move year-round cards out of seasonal 2017-06-07 02:41:13 +00:00
SabreCat
05b35c5147 fix(manifest): remove deleted files from manifest 2017-06-07 02:11:47 +00:00
MathWhiz
c9427ad34c New cards — Congratulations, Get Well (#8655)
* Add card and achievement sprite for Congrats card

* Add data regarding Congrats card

* Add Get Well card

* Add Get Well images

* Add schema

* Remove `if (!target.flags) target.flags = {};` code from cards

* Remove white backgrounds for congrats sprites

* add inital tests for cards

* Fix card tests

* Fix invalid urls in tests

* Update POST-user_class_cast_spellId.test.js

* Update POST-user_class_cast_spellId.test.js

* Update POST-user_class_cast_spellId.test.js

* Update congrats card sprite

* Fix card logic

* Fix user schema

* Change achievement values for new cards to Number

* Resize congrats and getwell cards

This will make them be sized properly

* Separate Market from Drops

* Extract cards to new section

* fix(sprites): revert spritesheet changes

* Add flags if target does not have them
2017-06-06 19:04:54 -07:00
madpink
d6c62262f1 Updating User API Doc (part 3) (#8720)
* Updating User API Doc (part 3)

* Updating User API Doc (part 3)

Fixed trailing spaces

* Updating User API Doc (part 3)

Made changes to @apiParamExample to make multi-line (which may have been cause of apiDoc failing)

* Updated quests to add questKey
2017-06-06 18:57:17 -07:00
MathWhiz
ec1d378504 Flagged chat messages are visible to the users that posted them (#8726)
* Allow users to see their chat messages that are hidden to others

* Fix lint

* Fix failing api test

* Add test
2017-06-06 18:55:12 -07:00
beatscribe
3bb88f450a New Beatscribe 8-bit sound theme (#8727) 2017-06-06 18:53:10 -07:00
Rick Kasten
97a38e68c5 Clean up references to repo as HabitRPG/habitrpg (#8742)
* Confirmed changes

* Removed bad link
This was apparantly missed in #8051

* Confirmed changes

* Fixed links to milestones
2017-06-06 18:51:54 -07:00
Alys
be948a1bf2 adjust postinstall command so that it works in Windows as well as *nix (#8744)
Semicolons in postinstall commands don't work in Windows.

'&&' works in *nix and in at least some versions of Windows.

This changes the meaning of the postinstall line slightly because
now the later commands won't run if the earlier ones failed but I
don't see that being a problem.
2017-06-06 18:49:31 -07:00
Sabe Jones
018976a723 Disallow interactions by blocked users; new "get objections" Members API route (#8755)
* Make flags.chatRevoked prevent sending private messages (issue #7971)

* Disallow sending gems when messages aren't allowed.

* Created function to check for objections to an interaction to user model and wired it into the API (issue #7971)

* Fixes for issues raised by reviewers.

* Added allowed values to apidoc for api.getObjectionsToInteraction.

* Refactoring of getObjectionsToInteraction and minor API changes.

* fix(objections): address PR comments

* fix(strings): use US English for base edits

* refactor(test): typos and phrasing
2017-06-06 18:49:05 -07:00
Grayson Gilmore
00e5896ac6 Add test for GET /shops/backgrounds (#8771) 2017-06-06 18:45:41 -07:00
Kevin Smith
36bc693545 Turtleheads (Fixes #8560) (#8776)
* Added new turtle head icons

* Recompiled spritesheets
2017-06-06 18:43:19 -07:00
Atte Kortesmaa
f27706cb4b Improved API documentation for hall #8087 (#8536)
* Improved API documentation for hall

* Fixes typos, removes apiHeader definitions and curl example

* Fixes @apiParam and capitalization errors. Moves @apiDefines to website/server/api-doc.js
2017-06-06 11:48:11 -07:00
MathWhiz
f6f99ec57e Require Dailies to have a Start Date (#8649)
* Require Dailies to have a Start Date

* Add preliminary test

* Fix lint errors
2017-06-06 10:05:17 -07:00
MathWhiz
c852d9d581 Add new favicon (#8732)
* Add new favicon

* Update 192x192 favicon image
2017-06-05 22:55:44 -07:00
Sabe Jones
4a78514308 3.94.1 2017-06-04 23:41:14 +00:00
Sabe Jones
265b48752d Merge branch 'develop' into release 2017-06-04 23:40:26 +00:00
Sabe Jones
db0b0d6b6d fix(migrations): return to generic state 2017-06-04 02:59:49 +00:00
Sabe Jones
20f1087552 fix(migrations): return to generic state 2017-06-04 02:58:42 +00:00
Keith Holliday
2e9bc2c31c New client guilds (#8736)
* add colors palette

* add secondary menu component and style it

* add box shadow to secondary menu

* misc css, fixes for secondary menu

* client: add equipment page with grouping, css: add some styles

* add typography

* more equipment

* stable: fix linting

* equipment: add styles (lots of general styles too)

* remove duplicate google fonts loading

* add dropdowns

* design: white search input background, remove gray from items

* start adding drawer and selected indicator

* wip equipment

* fix equipment

* equipment: correctly bind new properties on items.gear.equipped

* equipment: fix vue binding. version 2

* equipment: fix vue binding. version 3

* back to first fix for equip op, fix for sourcemaps, send http request when an item is equipped, load bootstrap-vue components where needed

* checkboxes and radio buttons

* correctly renders selected items in first postion during the first render

* add search

* general changes, constants part of app state, add popovers

* add toggle switch, rename css

* correct offset

* upgrade deps

* upgrade deps

* drawer and lot of other work

* update equipping mechanism

* finish equipment

* fix compilation and upgrade deps

* use v-show in place of v-if to fix ui issues

* v-show -> v-if

* Start of guild syyles

* fix linting in test/client

* fix es6 compilation in test/client

* fix babel compilation for tests

* fix groupsUtilities mixin tests

* More designs

* Added public guild state

* Added my guilds store

* client: buttons

* client: buttons: fix colors

* Added join and leave

* Began adding new guild form

* Create form updates

* Added search to local data

* Added filtering

* Added initial code for group create

* Added more create checks

* Added more guild routes

* Added styles to guild page

* Added more chat styles

* Began porting over angular functions

* Moved over group service functions

* Added paging

* Updated sidebar

* Updated join/leave and minor text

* Added new sidebar functions

* Updated paging

* Added some form updates

* Added more translations and styles

* Updated shrinkwrap

* Removed features config

* Lint cleanup

* Added member modal

* Added more member actions

* Updated nav

* Fixed filter toggling

* Updated create guild

* Added no guild page

* Added sort select

* Added more styles

* Added update guild form

* Removed extra css and other minor changes

* Many css and syntax fixes

* Fixed color and merge conflic

* Removed paging from my guilds

* Removed extra strings

* Many requests updates

* Small style fixes
2017-06-02 14:55:02 -06:00
SabreCat
b606dd1c40 fix(strings): remove extraneous title text 2017-06-02 16:19:42 +00:00
SabreCat
db1c2fd5a2 fix(shops): don't push if empty
Also corrects text on hatching potions
2017-06-02 15:28:28 +00:00
Sabe Jones
de1e477ce2 Merge branch 'release' into develop 2017-06-02 00:49:00 +00:00
Sabe Jones
67318177a2 3.94.0 2017-06-01 23:18:07 +00:00
Sabe Jones
cd1be828ca chore(i18n): update locales 2017-06-01 23:17:32 +00:00
SabreCat
9ffebc10a7 chore(sprites): compile 2017-06-01 23:09:05 +00:00
SabreCat
5cd11ed343 feat(content): Armoire and BGs 2017-06-01 23:08:00 +00:00
SabreCat
9de118f0d9 Merge branch 'release' into develop 2017-05-30 21:00:53 +00:00
SabreCat
5fbec4069e 3.93.2 2017-05-30 20:59:24 +00:00
SabreCat
a0f10cbf4b Merge branch 'THI/sleep-dailies-fix' into release 2017-05-30 20:58:33 +00:00
Keith Holliday
0e069e78d5 Set isDue and NextDue during sleep (#8769) 2017-05-30 15:57:38 -05:00
SabreCat
dea847ba1a chore(news): Bailey 2017-05-30 20:11:21 +00:00
Sabe Jones
46ed1813c6 Optional feedback on account deletion (#8750)
* Fixed rebase.

* Removed commented out mail sending to pass linting. Styles from settings.styl still not propagating to app.css

* fix(feedback): address PR comments

* fix(style): linting errors
2017-05-30 11:54:42 -05:00
Keith Holliday
e9750353a7 Set isDue and NextDue during sleep 2017-05-30 09:12:09 -06:00
Sabe Jones
05ea2c1ce6 Merge branch 'release' into develop 2017-05-29 01:11:00 +00:00
Sabe Jones
74d1c7763e 3.93.1 2017-05-29 01:08:31 +00:00
Keith Holliday
6f034bb5dd Fixed issue when repeat object is malformed (#8765)
* Fixed issue when repeat object is malformed

* Removed only

* Changed numeric check to lodash isFinite

* Removed newer lodash function
2017-05-28 20:07:29 -05:00
Alys
aeb8d4f500 fix typo in mageText: Habit > Habitica (thanks to Janmetdepet for finding it) (#8748) 2017-05-27 18:56:10 +10:00
Keith Holliday
58d910fe62 Added fix for double click on amazon pay (#8708) 2017-05-25 16:10:59 -05:00
SabreCat
71f2f31606 Merge branch 'release' into develop 2017-05-25 02:51:10 +00:00
SabreCat
feae40cf0a 3.93.0 2017-05-25 01:00:21 +00:00
SabreCat
0d3fe53155 chore(news): Bailey 2017-05-25 00:59:37 +00:00
SabreCat
c3a3c1514a Merge branch 'monthlies' into release 2017-05-25 00:50:19 +00:00
Keith Holliday
cc532fa993 Enabled repeatables (#8572)
* Enabled repeatables

* Added every x to weekly

* Updated new recur logic to work with tests

* Added repeatable tests back

* Added custom day start support

* Moved back to zone function

* Added zone back

* Added nextDue field

* Abstracted set next due logic, set offset, and mapped to ISO

* Removed extra codes

* Removed clone deep

* Added summary local

* Fixed every x weekly

* Prevented edit of repeats on

* Added next due date

* Fixed display of next due dates

* Fixed broken tests

* added next due date as today for weekly

* Fixed integration tests

* Updated common test

* Use user's format

* Allow user to deselect all days during week

* Removed let from front end
2017-05-24 19:49:33 -05:00
Kevin Smith
ba66a1c098 Removed cancel sub button and added info for apple/google subs (Fixes #8642) (#8666)
* Removed cancel sub button and added info for apple/google subs

* Refactored logic and constants from subscriptions view
2017-05-24 10:13:44 -06:00
Josh Holland
b4d5c634b3 Close dropdowns when user clicks outside of them (fixes #5490) (#8657)
* Close dropdowns when user clicks outside of them

Fixes #5490

* Remove expandMenu and closeMenu directives and tests

* Remove unnecessary HTML attributes
2017-05-24 10:12:38 -06:00
Sabe Jones
216006beab Merge branch 'release' into develop 2017-05-23 22:16:32 +00:00
Sabe Jones
7c236e7e0e 3.92.0 2017-05-23 22:15:40 +00:00
Sabe Jones
0221d2d7f9 chore(i18n): update locales 2017-05-23 22:12:33 +00:00
SabreCat
567eb1d98b chore(sprites): compile 2017-05-23 22:04:26 +00:00
SabreCat
3cf533f261 feat(content): new Mystery Items
and reenable Floral Potions
2017-05-23 22:03:31 +00:00
taldin
c30c51f386 Fixes apidoc error with Cast Skill (#8709)
* Fixes apidoc error with Cast Skill

Changes Body to Query, changed example from  POST body

* Updated to remove trailing space

* Wording fix per Lady Alys

* Update user.js

Kicking off another test.

* Update user.js
2017-05-23 14:06:58 -06:00
Céline O'Neil
2de794c32b Show task alias advanced option for Rewards (#8705) 2017-05-23 13:58:38 -06:00
Keith Holliday
7d000d2cf6 Removed let from front end 2017-05-23 08:56:36 -06:00
Keith Holliday
280b720c13 Allow user to deselect all days during week 2017-05-22 08:37:45 -06:00
Matteo Pagliazzi
9e1f7f3811 Client/Inventory/Items (#8734)
* client: start working on Inventory/Items

* i18n changes and fixes

* initial displaying of eggs, food and potions + sorting

* add missing files

* remove comment

* show food, eggs and potions

* add label to dropdowns acting as select menus

* popovers

* move badge to slot and component if necessary, general refactor

* fix quantity ordering

* some special items, reorganize
2017-05-22 16:30:52 +02:00
Keith Holliday
fefaed368a Use user's format 2017-05-22 08:16:12 -06:00
Keith Holliday
6f370395ea Updated common test 2017-05-22 08:06:14 -06:00
Keith Holliday
65566f7607 Fixed integration tests 2017-05-22 07:54:07 -06:00
Keith Holliday
c0117706e4 Merge remote-tracking branch 'upstream/develop' into enable-repeatables 2017-05-22 07:49:01 -06:00
Matteo Pagliazzi
f267456a30 client: fix drawer 2017-05-21 15:38:33 +02:00
Matteo Pagliazzi
228b724d52 fix missing trailing comma 2017-05-21 14:43:25 +02:00
Keith Holliday
19b09b4894 Merged in develop 2017-05-20 19:24:25 -06:00
Keith Holliday
f49d21d7b4 added next due date as today for weekly 2017-05-20 18:38:53 -06:00
Keith Holliday
c08c0685f3 Fixed broken tests 2017-05-20 17:19:35 -06:00
negue
59bfe66c94 Client/item content (#8738)
* extract item popover-content as component

# Conflicts:
#	website/client/components/inventory/item.vue

* extract item-content as slot

* scoped context to pass the item

* itemContentClass instead of itemContent-slot
2017-05-20 19:59:45 +02:00
Keith Holliday
99a2013767 Fixed display of next due dates 2017-05-18 14:12:36 -06:00
Keith Holliday
a5e0e171cc Added next due date 2017-05-18 10:42:11 -06:00
Keith Holliday
1d93943458 Prevented edit of repeats on 2017-05-18 10:26:57 -06:00
Keith Holliday
7f2719a75c Fixed every x weekly 2017-05-18 10:11:29 -06:00
Keith Holliday
388861b503 Added summary local 2017-05-15 09:15:14 -06:00
Keith Holliday
f8a99bd127 Removed clone deep 2017-05-12 11:15:09 -06:00
Keith Holliday
a82b60f144 Removed extra codes 2017-05-12 09:21:29 -06:00
Keith Holliday
f192ca4c6f Abstracted set next due logic, set offset, and mapped to ISO 2017-05-12 07:39:32 -06:00
Keith Holliday
1292f9a3d5 Added nextDue field 2017-05-11 13:11:16 -06:00
Keith Holliday
e7418472f6 Added zone back 2017-05-10 22:06:31 -06:00
Keith Holliday
850f332ddc MErged in develop 2017-05-10 15:51:50 -06:00
Keith Holliday
59fb32ea2e Moved back to zone function 2017-05-10 15:47:32 -06:00
Keith Holliday
76222ac344 Added custom day start support 2017-05-08 10:20:47 -06:00
Keith Holliday
2659a4117b Added repeatable tests back 2017-05-08 09:52:15 -06:00
Keith Holliday
a0ee73e944 Updated new recur logic to work with tests 2017-05-08 09:39:50 -06:00
Keith Holliday
6174624b89 Merged develop 2017-05-08 08:32:03 -06:00
Céline O'Neil
b1a4c1b4ff Update instructions for running select API tests, in line with wiki instructions 2017-05-01 10:04:37 -04:00
Céline O'Neil
fb80dd7c57 Allow leaving a challenge without having access to the challenge (e.g. after leaving a party or guild) 2017-05-01 10:04:37 -04:00
TheHollidayInn
0fd85c0d60 Added every x to weekly 2017-03-27 09:52:32 -06:00
Keith Holliday
8c68f450c6 Enabled repeatables 2017-03-15 14:13:15 -06:00
3400 changed files with 173079 additions and 96393 deletions

View File

@@ -1,6 +1,7 @@
{
"presets": ["es2015"],
"plugins": [
"transform-object-rest-spread",
["transform-async-to-module-method", {
"module": "bluebird",
"method": "coroutine"

View File

@@ -14,7 +14,7 @@ files:
owner: root
group: users
content: |
$(ls -td /opt/elasticbeanstalk/node-install/node-* | head -1)/bin/npm install -g npm@4
$(ls -td /opt/elasticbeanstalk/node-install/node-* | head -1)/bin/npm install -g npm@5
container_commands:
01_makeBabel:
command: "touch /tmp/.babel.json"

View File

@@ -1,6 +1,6 @@
# Reporting Bugs
[Please see these instructions for reporting bugs](https://github.com/HabitRPG/habitrpg/issues/2760)
[Please see these instructions for reporting bugs](https://github.com/HabitRPG/habitica/issues/2760)
# Pull Request

View File

@@ -4,7 +4,7 @@
[//]: # (If you have a feature request, use "Help > Request a Feature", not GitHub or the Report a Bug guild.)
[//]: # (For more guidelines see https://github.com/HabitRPG/habitrpg/issues/2760)
[//]: # (For more guidelines see https://github.com/HabitRPG/habitica/issues/2760)
[//]: # (Fill out relevant information - UUID is found in Settings -> API)
### General Info

View File

@@ -2,6 +2,9 @@ language: node_js
node_js:
- '6'
sudo: required
dist: precise
services:
- mongodb
addons:
apt:
sources:
@@ -10,14 +13,14 @@ addons:
- g++-4.8
before_install:
- $CXX --version
- npm install -g npm@4
- npm install -g npm@5
- if [ $REQUIRES_SERVER ]; then sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10; echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list; sudo apt-get update; sudo apt-get install mongodb-org-server; fi
install:
- npm install &> npm.install.log || (cat npm.install.log; false)
before_script:
- npm run test:build
- cp config.json.example config.json
- if [ $REQUIRES_SERVER ]; then until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done; export DISPLAY=:99; fi
- sleep 15
script:
- npm run $TEST
- if [ $COVERAGE ]; then ./node_modules/.bin/lcov-result-merger 'coverage/**/*.info' | ./node_modules/coveralls/bin/coveralls.js; fi
@@ -31,5 +34,5 @@ env:
- TEST="test:sanity"
- TEST="test:content" COVERAGE=true
- TEST="test:common" COVERAGE=true
- TEST="test:karma" COVERAGE=true
- TEST="client:unit" COVERAGE=true
- TEST="apidoc"

View File

@@ -1,18 +1,22 @@
FROM node:boron
# Install global packages
RUN npm install -g gulp grunt-cli bower mocha
# Clone Habitica repo and install dependencies
RUN mkdir -p /usr/src/habitrpg
WORKDIR /usr/src/habitrpg
RUN git clone https://github.com/HabitRPG/habitica.git /usr/src/habitrpg
RUN npm install
RUN bower install --allow-root
# Create Build dir
RUN mkdir -p ./website/build
# Start Habitica
EXPOSE 3000
CMD ["npm", "start"]
FROM node:boron
# Upgrade NPM to v5 (Yarn is needed because of this bug https://github.com/npm/npm/issues/16807)
# The used solution is suggested here https://github.com/npm/npm/issues/16807#issuecomment-313591975
RUN yarn global add npm@5
# Install global packages
RUN npm install -g gulp grunt-cli bower mocha
# Clone Habitica repo and install dependencies
RUN mkdir -p /usr/src/habitrpg
WORKDIR /usr/src/habitrpg
RUN git clone https://github.com/HabitRPG/habitica.git /usr/src/habitrpg
RUN cp config.json.example config.json
RUN npm install
RUN bower install --allow-root
# Create Build dir
RUN mkdir -p ./website/build
# Start Habitica
EXPOSE 3000
CMD ["npm", "start"]

22
Dockerfile-Production Normal file
View File

@@ -0,0 +1,22 @@
FROM node:boron
# Upgrade NPM to v5 (Yarn is needed because of this bug https://github.com/npm/npm/issues/16807)
# The used solution is suggested here https://github.com/npm/npm/issues/16807#issuecomment-313591975
RUN yarn global add npm@5
# Install global packages
RUN npm install -g gulp grunt-cli bower mocha
# Clone Habitica repo and install dependencies
RUN mkdir -p /usr/src/habitrpg
WORKDIR /usr/src/habitrpg
RUN git clone --branch v4.0.3 https://github.com/HabitRPG/habitica.git /usr/src/habitrpg
RUN npm install
RUN bower install --allow-root
RUN gulp build:prod --force
# Create Build dir
RUN mkdir -p ./website/build
# Start Habitica
EXPOSE 3000
CMD ["node", "./website/transpiled-babel/index.js"]

View File

@@ -66,7 +66,8 @@
},
"mode":"sandbox",
"client_id":"client_id",
"client_secret":"client_secret"
"client_secret":"client_secret",
"experience_profile_id": ""
},
"IAP_GOOGLE_KEYDIR": "/path/to/google/public/key/dir/",
"LOGGLY_TOKEN": "token",

View File

@@ -3,7 +3,7 @@ var authorUuid = 'd904bd62-da08-416b-a816-ba797c9ee265'; //... own data is done
/**
* database_reports/count_users_who_own_specified_gear.js
* https://github.com/HabitRPG/habitrpg/pull/3884
* https://github.com/HabitRPG/habitica/pull/3884
*/
var thingsOfInterest = {

View File

@@ -1,3 +1,3 @@
web:
volumes:
- '.:/habitrpg'
- '.:/usr/src/habitrpg'

36
gulp/gulp-bootstrap.js Normal file
View File

@@ -0,0 +1,36 @@
import gulp from 'gulp';
import fs from 'fs';
// Copy Bootstrap 4 config variables from /website /node_modules so we can check
// them into Git
const BOOSTRAP_NEW_CONFIG_PATH = 'website/client/assets/scss/bootstrap_config.scss';
const BOOTSTRAP_ORIGINAL_CONFIG_PATH = 'node_modules/bootstrap/scss/_custom.scss';
// https://stackoverflow.com/a/14387791/969528
function copyFile(source, target, cb) {
let cbCalled = false;
function done(err) {
if (!cbCalled) {
cb(err);
cbCalled = true;
}
}
let rd = fs.createReadStream(source);
rd.on('error', done);
let wr = fs.createWriteStream(target);
wr.on('error', done);
wr.on('close', () => done());
rd.pipe(wr);
}
gulp.task('bootstrap', (done) => {
// use new config
copyFile(
BOOSTRAP_NEW_CONFIG_PATH,
BOOTSTRAP_ORIGINAL_CONFIG_PATH,
done,
);
});

View File

@@ -1,6 +1,7 @@
import gulp from 'gulp';
import runSequence from 'run-sequence';
import babel from 'gulp-babel';
import webpackProductionBuild from '../webpack/build';
require('gulp-grunt')(gulp);
gulp.task('build', () => {
@@ -25,6 +26,14 @@ gulp.task('build:common', () => {
gulp.task('build:server', ['build:src', 'build:common']);
// Client Production Build
gulp.task('build:client', ['bootstrap'], (done) => {
webpackProductionBuild((err, output) => {
if (err) return done(err);
console.log(output);
});
});
gulp.task('build:dev', ['browserify', 'prepare:staticNewStuff'], (done) => {
gulp.start('grunt-build:dev', done);
});
@@ -33,7 +42,12 @@ gulp.task('build:dev:watch', ['build:dev'], () => {
gulp.watch(['website/client-old/**/*.styl', 'website/common/script/*']);
});
gulp.task('build:prod', ['browserify', 'build:server', 'prepare:staticNewStuff'], (done) => {
gulp.task('build:prod', [
'browserify',
'build:server',
'prepare:staticNewStuff',
'build:client',
], (done) => {
runSequence(
'grunt-build:prod',
'apidoc',

View File

@@ -49,7 +49,7 @@ gulp.task('sprites:checkCompiledDimensions', ['sprites:main', 'sprites:largeSpri
});
if (numberOfSheetsThatAreTooBig > 0) {
console.error(`${numberOfSheetsThatAreTooBig} sheets might too big for mobile Safari to be able to handle them, but there is a margin of error in these calculations so it is probably okay. Mention this to an admin so they can test a staging site on mobile Safari after your PR is merged.`); // https://github.com/HabitRPG/habitrpg/pull/6683#issuecomment-185462180
console.error(`${numberOfSheetsThatAreTooBig} sheets might too big for mobile Safari to be able to handle them, but there is a margin of error in these calculations so it is probably okay. Mention this to an admin so they can test a staging site on mobile Safari after your PR is merged.`); // https://github.com/HabitRPG/habitica/pull/6683#issuecomment-185462180
} else {
console.log('All images are within the correct dimensions');
}

View File

@@ -13,6 +13,7 @@ if (process.env.NODE_ENV === 'production') {
require('./gulp/gulp-newstuff');
require('./gulp/gulp-build');
require('./gulp/gulp-babelify');
require('./gulp/gulp-bootstrap');
} else {
require('glob').sync('./gulp/gulp-*').forEach(require);
require('gulp').task('default', ['test']);

60
kubernetes/README.md Normal file
View File

@@ -0,0 +1,60 @@
# Habitica in Kubernetes
This is a set of sample Kubernetes configuration files to launch Habitica under AWS, both as a single-node web frontend as well as a multi-node web frontend.
## Prerequisites
* An AWS account.
* A working Kubernetes installation.
* A basic understanding of how to use Kubernetes. https://kubernetes.io/
* A persistent volume for MongoDB data.
* Docker images of Habitica.
+ You can use your own, or use the one included in the YAML files.
+ If you use your own, you'll need a fork of the Habitica GitHub repo and your own Docker Hub repo, both of which are free.
## Before you begin
1. Set up Kubernetes.
2. Create an EBS volume for MongoDB data.
+ Make a note of the name, you'll need it later.
## Starting MongoDB
1. Edit mongo.yaml
+ Find the volumeID line.
+ Change the volume to the one created in the section above.
2. Run the following commands:
+ `kubectl.sh create -f mongo.yaml`
+ `kubectl.sh create -f mongo-service.yaml`
3. Wait for the MongoDB pod to start up.
## Starting a Single Web Frontend
1. Run the following commands:
+ `kubectl.sh create -f habitica.yaml`
+ `kubectl.sh create -f habitica-service.yaml`
2. Wait for the frontend to start up.
## Starting Multi-node Web Frontend
1. Run the following commands :
+ `kubectl.sh create -f habitica-rc.yaml`
+ `kubectl.sh create -f habitica-service.yaml`
2. Wait for the frontend to start up.
## Accessing Your Habitica web interface
Using `kubectl describe svc habiticaweb` get the hostname generated for the Habitica service. Open a browser and go to http://hostname:3000 to access the web front-end for the installations above.
## Shutting down
Shutting down is basically done by reversing the steps above:
+ `kubectl.sh delete -f habitica-service.yaml`
+ `kubectl.sh delete -f habitica.yaml (or habitica-rc.yaml)`
+ `kubectl.sh delete -f mongo-service.yaml`
+ `kubectl.sh delete -f mongo.yaml`
You can also just shut down all of Kubernetes as well.
## Notes
+ MongoDB data will be persistent! If you need to start with a fresh database, you'll need to remove the volume and re-create it.
+ On AWS, you probably want to use at least t2.medium minion nodes for Kubernetes. The default t2.small is too small for more than two Habitica nodes.
## Future Plans
+ Multi-node MongoDB.
+ Monitoring
+ Instructions for a better hostname. The default generated ones stink.
+ More to come....

View File

@@ -0,0 +1,25 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: habitica
labels:
name: habitica
spec:
replicas: 4
selector:
name: habitica
template:
metadata:
labels:
name: habitica
spec:
containers:
- name: habitica
image: ksonney/habitrpg:latest
env:
- name: NODE_DB_URI
value: mongodb://mongosvc/habitrpg
ports:
- containerPort: 3000
hostPort: 3000
name: habitica

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: habiticaweb
name: habiticaweb
spec:
ports:
# the port that this service should serve on
- port: 3000
# label keys and values that must match in order to receive traffic for this service
selector:
name: habitica
type: LoadBalancer

22
kubernetes/habitica.yaml Normal file
View File

@@ -0,0 +1,22 @@
apiVersion: v1
kind: Pod
metadata:
name: habitica
labels:
name: habitica
spec:
containers:
# - image: mongo:latest
# name: mongo
# ports:
# - containerPort: 27017
# name: mongo
- image: ksonney/habitrpg:latest
name: habitica
env:
- name: NODE_DB_URI
value: mongodb://mongosvc/habitrpg
ports:
- containerPort: 3000
hostPort: 3000
name: habitica

View File

@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: mongosvc
name: mongosvc
spec:
ports:
# the port that this service should serve on
- port: 27017
# label keys and values that must match in order to receive traffic for this service
selector:
name: mongodb

28
kubernetes/mongo.yaml Normal file
View File

@@ -0,0 +1,28 @@
apiVersion: v1
kind: Pod
metadata:
name: mongodb
labels:
name: mongodb
spec:
containers:
- resources:
limits :
cpu: 0.5
image: mongo
name: mongodb
ports:
- containerPort: 27017
hostPort: 27017
name: mongo
volumeMounts:
# # name must match the volume name below
- name: mongo-persistent-storage
# # mount path within the container
mountPath: /data/db
volumes:
- name: mongo-persistent-storage
awsElasticBlockStore:
volumeID: aws://YOUR-REGION/YOUR-VOLNAME
fsType: ext3

View File

@@ -0,0 +1,110 @@
'use strict';
/****************************************
* Author: @Alys
*
* Reason: Collection quests are being changed
* to require fewer items collected:
* https://github.com/HabitRPG/habitrpg/pull/7987
* This will cause existing quests to end sooner
* than the party is expecting.
* This script inserts an explanatory `system`
* message into the chat for affected parties.
***************************************/
global.Promise = require('bluebird');
const uuid = require('uuid');
const TaskQueue = require('cwait').TaskQueue;
const logger = require('./utils/logger');
const Timer = require('./utils/timer');
const connectToDb = require('./utils/connect').connectToDb;
const closeDb = require('./utils/connect').closeDb;
const message = '`This party\'s collection quest has been made easier! For details, refer to http://habitica.wikia.com/wiki/User_blog:LadyAlys/Collection_Quests_are_Now_Easier`';
const timer = new Timer();
// PROD: Enable prod db
// const DB_URI = 'mongodb://username:password@dsXXXXXX-a0.mlab.com:XXXXX,dsXXXXXX-a1.mlab.com:XXXXX/habitica?replicaSet=rs-dsXXXXXX';
const DB_URI = 'mongodb://localhost/habitrpg';
const COLLECTION_QUESTS = [
'vice2',
'egg',
'moonstone1',
'goldenknight1',
'dilatoryDistress1',
];
let Groups;
connectToDb(DB_URI).then((db) => {
Groups = db.collection('groups');
return Promise.resolve();
})
.then(findPartiesWithCollectionQuest)
// .then(displayGroups) // for testing only
.then(addMessageToGroups)
.then(() => {
timer.stop();
closeDb();
}).catch(reportError);
function reportError (err) {
logger.error('Uh oh, an error occurred');
closeDb();
timer.stop();
throw err;
}
function findPartiesWithCollectionQuest () {
logger.info('Looking up groups on collection quests...');
return Groups.find({'quest.key': {$in: COLLECTION_QUESTS}}, ['name','quest']).toArray().then((groups) => {
logger.success('Found', groups.length, 'parties on collection quests');
return Promise.resolve(groups);
})
}
function displayGroups (groups) { // for testing only
logger.info('Displaying parties...');
console.log(groups);
return Promise.resolve(groups);
}
function updateGroupById (group) {
var newMessage = {
'id' : uuid.v4(),
'text' : message,
'timestamp': Date.now(),
'likes': {},
'flags': {},
'flagCount': 0,
'uuid': 'system'
};
return Groups.findOneAndUpdate({_id: group._id}, {$push:{"chat" :{$each: [newMessage], $position:0}}}, {returnOriginal: false});
// Does not set the newMessage flag for all party members because I don't think it's essential and
// I don't want to run the extra code (extra database load, extra opportunity for bugs).
}
function addMessageToGroups (groups) {
let queue = new TaskQueue(Promise, 300);
logger.info('About to update', groups.length, 'parties...');
return Promise.map(groups, queue.wrap(updateGroupById)).then((result) => {
let updates = result.filter(res => res.lastErrorObject && res.lastErrorObject.updatedExisting)
let failures = result.filter(res => !(res.lastErrorObject && res.lastErrorObject.updatedExisting));
logger.success(updates.length, 'parties have been notified');
if (failures.length > 0) {
logger.error(failures.length, 'parties could not be notified');
}
return Promise.resolve();
});
}

View File

@@ -0,0 +1,114 @@
var migrationName = '20170616_achievements';
var authorName = 'Sabe'; // in case script author needs to know when their ...
var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
/*
* Updates to achievements for June 16, 2017 biweekly merge
* 1. Multiply various collection quest achievements based on difficulty reduction
* 2. Award Joined Challenge achievement to those who should have it already
*/
import monk from 'monk';
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbUsers = monk(connectionString).get('users', { castIds: false });
function processUsers(lastId) {
// specify a query to limit the affected users (empty for all users):
var query = {
$or: [
{'achievements.quests.dilatoryDistress1': {$gt:0}},
{'achievements.quests.egg': {$gt:0}},
{'achievements.quests.goldenknight1': {$gt:0}},
{'achievements.quests.moonstone1': {$gt:0}},
{'achievements.quests.vice2': {$gt:0}},
{'achievements.challenges': {$exists: true, $ne: []}},
{'challenges': {$exists: true, $ne: []}},
],
};
if (lastId) {
query._id = {
$gt: lastId
}
}
dbUsers.find(query, {
sort: {_id: 1},
limit: 250,
fields: [ // specify fields we are interested in to limit retrieved data (empty if we're not reading data):
'achievements',
'challenges',
],
})
.then(updateUsers)
.catch(function (err) {
console.log(err);
return exiting(1, 'ERROR! ' + err);
});
}
var progressCount = 1000;
var count = 0;
function updateUsers (users) {
if (!users || users.length === 0) {
console.warn('All appropriate users found and modified.');
displayData();
return;
}
var userPromises = users.map(updateUser);
var lastUser = users[users.length - 1];
return Promise.all(userPromises)
.then(function () {
processUsers(lastUser._id);
});
}
function updateUser (user) {
count++;
var set = {'migration': migrationName};
if (user.challenges.length > 0 || user.achievements.challenges.length > 0) {
set['achievements.joinedChallenge'] = true;
}
if (user.achievements.quests.dilatoryDistress1) {
set['achievements.quests.dilatoryDistress1'] = Math.ceil(user.achievements.quests.dilatoryDistress1 * 1.25);
}
if (user.achievements.quests.egg) {
set['achievements.quests.egg'] = Math.ceil(user.achievements.quests.egg * 2.5);
}
if (user.achievements.quests.goldenknight1) {
set['achievements.quests.goldenknight1'] = user.achievements.quests.goldenknight1 * 5;
}
if (user.achievements.quests.moonstone1) {
set['achievements.quests.moonstone1'] = user.achievements.quests.moonstone1 * 5;
}
if (user.achievements.quests.vice2) {
set['achievements.quests.vice2'] = Math.ceil(user.achievements.quests.vice2 * 1.5);
}
dbUsers.update({_id: user._id}, {$set:set});
if (count % progressCount == 0) console.warn(count + ' ' + user._id);
if (user._id == authorUuid) console.warn(authorName + ' processed');
}
function displayData() {
console.warn('\n' + count + ' users processed\n');
return exiting(0);
}
function exiting(code, msg) {
code = code || 0; // 0 = success
if (code && !msg) { msg = 'ERROR!'; }
if (msg) {
if (code) { console.error(msg); }
else { console.log( msg); }
}
process.exit(code);
}
module.exports = processUsers;

View File

@@ -0,0 +1,90 @@
var migrationName = '20170711_orcas.js';
var authorName = 'Sabe'; // in case script author needs to know when their ...
var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
/*
* Award Orca pets to owners of Orca mount, and Orca mount to everyone else
*/
var monk = require('monk');
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbUsers = monk(connectionString).get('users', { castIds: false });
function processUsers(lastId) {
// specify a query to limit the affected users (empty for all users):
var query = {
'migration':{$ne:migrationName},
};
if (lastId) {
query._id = {
$gt: lastId
}
}
dbUsers.find(query, {
sort: {_id: 1},
limit: 250,
fields: [
'items.mounts',
] // specify fields we are interested in to limit retrieved data (empty if we're not reading data):
})
.then(updateUsers)
.catch(function (err) {
console.log(err);
return exiting(1, 'ERROR! ' + err);
});
}
var progressCount = 1000;
var count = 0;
function updateUsers (users) {
if (!users || users.length === 0) {
console.warn('All appropriate users found and modified.');
displayData();
return;
}
var userPromises = users.map(updateUser);
var lastUser = users[users.length - 1];
return Promise.all(userPromises)
.then(function () {
processUsers(lastUser._id);
});
}
function updateUser (user) {
count++;
var set = {};
if (user.items.mounts['Orca-Base']) {
set = {'migration':migrationName, 'items.pets.Orca-Base': 5};
} else {
set = {'migration':migrationName, 'items.mounts.Orca-Base': true};
}
dbUsers.update({_id: user._id}, {$set:set});
if (count % progressCount == 0) console.warn(count + ' ' + user._id);
if (user._id == authorUuid) console.warn(authorName + ' processed');
}
function displayData() {
console.warn('\n' + count + ' users processed\n');
return exiting(0);
}
function exiting(code, msg) {
code = code || 0; // 0 = success
if (code && !msg) { msg = 'ERROR!'; }
if (msg) {
if (code) { console.error(msg); }
else { console.log( msg); }
}
process.exit(code);
}
module.exports = processUsers;

View File

@@ -0,0 +1,109 @@
var migrationName = '20170731_naming_day.js';
var authorName = 'Sabe'; // in case script author needs to know when their ...
var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
/*
* Award Royal Purple Gryphon Helm to Royal Purple Gryphon pet owners,
* award Royal Purple Gryphon pet to Royal Purple Gryphon mount owners,
* award Royal Purple Gryphon mount to everyone else
*/
var monk = require('monk');
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbUsers = monk(connectionString).get('users', { castIds: false });
function processUsers(lastId) {
// specify a query to limit the affected users (empty for all users):
var query = {
'migration':{$ne:migrationName},
'auth.timestamps.loggedin': {$gt: new Date('2017-01-01')},
};
if (lastId) {
query._id = {
$gt: lastId
}
}
dbUsers.find(query, {
sort: {_id: 1},
limit: 250,
fields: [
'items.mounts',
'items.pets',
] // specify fields we are interested in to limit retrieved data (empty if we're not reading data):
})
.then(updateUsers)
.catch(function (err) {
console.log(err);
return exiting(1, 'ERROR! ' + err);
});
}
var progressCount = 1000;
var count = 0;
function updateUsers (users) {
if (!users || users.length === 0) {
console.warn('All appropriate users found and modified.');
displayData();
return;
}
var userPromises = users.map(updateUser);
var lastUser = users[users.length - 1];
return Promise.all(userPromises)
.then(function () {
processUsers(lastUser._id);
});
}
function updateUser (user) {
count++;
var set = {};
var inc = {
'achievements.habiticaDays': 1,
'items.food.Cake_Skeleton': 1,
'items.food.Cake_Base': 1,
'items.food.Cake_CottonCandyBlue': 1,
'items.food.Cake_CottonCandyPink': 1,
'items.food.Cake_Shade': 1,
'items.food.Cake_White': 1,
'items.food.Cake_Golden': 1,
'items.food.Cake_Zombie': 1,
'items.food.Cake_Desert': 1,
'items.food.Cake_Red': 1
};
if (user.items.pets['Gryphon-RoyalPurple']) {
set = {'migration':migrationName, 'items.gear.owned.head_special_namingDay2017': false};
} else if (user.items.mounts['Gryphon-RoyalPurple']) {
set = {'migration':migrationName, 'items.pets.Gryphon-RoyalPurple': 5};
} else {
set = {'migration':migrationName, 'items.mounts.Gryphon-RoyalPurple': true};
}
dbUsers.update({_id: user._id}, {$set: set, $inc: inc});
if (count % progressCount == 0) console.warn(count + ' ' + user._id);
if (user._id == authorUuid) console.warn(authorName + ' processed');
}
function displayData() {
console.warn('\n' + count + ' users processed\n');
return exiting(0);
}
function exiting(code, msg) {
code = code || 0; // 0 = success
if (code && !msg) { msg = 'ERROR!'; }
if (msg) {
if (code) { console.error(msg); }
else { console.log( msg); }
}
process.exit(code);
}
module.exports = processUsers;

View File

@@ -0,0 +1,97 @@
var migrationName = '20170928_redesign_guilds.js';
/*
* Copy Guild Leader messages to end of Guild descriptions
* Copy Guild logos to beginning of Guild descriptions
*/
var monk = require('monk');
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbGroups = monk(connectionString).get('groups', { castIds: false });
function processGroups(lastId) {
// specify a query to limit the affected groups (empty for all groups):
var query = {
};
var fields = {
'description': 1,
'logo': 1,
'leaderMessage': 1,
}
if (lastId) {
query._id = {
$gt: lastId
}
}
return dbGroups.find(query, {
fields: fields,
sort: {_id: 1},
limit: 250,
})
.then(updateGroups)
.catch(function (err) {
console.log(err);
return exiting(1, 'ERROR! ' + err);
});
}
var progressCount = 1000;
var count = 0;
function updateGroups (groups) {
if (!groups || groups.length === 0) {
console.warn('All appropriate groups found and modified.');
displayData();
return;
}
var groupPromises = groups.map(updateGroup);
var lastGroup = groups[groups.length - 1];
return Promise.all(groupPromises)
.then(function () {
processGroups(lastGroup._id);
});
}
function updateGroup (group) {
count++;
var description = group.description;
if (group.logo) {
description = '![Guild Logo](' + group.logo + ')\n\n&nbsp;\n\n' + description;
}
if (group.leaderMessage) {
description = description + '\n\n&nbsp;\n\n' + group.leaderMessage;
}
var set = {
description: description,
};
if (count % progressCount == 0) console.warn(count + ' ' + group._id);
return dbGroups.update({_id: group._id}, {$set:set});
}
function displayData() {
console.warn('\n' + count + ' groups processed\n');
return exiting(0);
}
function exiting(code, msg) {
code = code || 0; // 0 = success
if (code && !msg) { msg = 'ERROR!'; }
if (msg) {
if (code) { console.error(msg); }
else { console.log( msg); }
}
process.exit(code);
}
module.exports = processGroups;

View File

@@ -0,0 +1,127 @@
var updateStore = require('../website/common/script/libs/updateStore');
var getItemInfo = require('../website/common/script/libs/getItemInfo');
var migrationName = '20170928_redesign_launch.js';
var authorName = 'paglias'; // in case script author needs to know when their ...
var authorUuid = 'ed4c688c-6652-4a92-9d03-a5a79844174a'; //... own data is done
/*
* Migrate existing in app rewards lists to pinned items
* Award Veteran Pets
*/
var monk = require('monk');
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbUsers = monk(connectionString).get('users', { castIds: false });
function processUsers(lastId) {
// specify a query to limit the affected users (empty for all users):
var query = {
'migration': {$ne:migrationName},
'auth.timestamps.loggedin': {$gt: new Date('2017-09-21')},
};
var fields = {
'items.pets': 1,
'items.gear': 1,
'stats.class': 1,
}
if (lastId) {
query._id = {
$gt: lastId
}
}
return dbUsers.find(query, {
fields: fields,
sort: {_id: 1},
limit: 250,
})
.then(updateUsers)
.catch(function (err) {
console.log(err);
return exiting(1, 'ERROR! ' + err);
});
}
var progressCount = 1000;
var count = 0;
function updateUsers (users) {
if (!users || users.length === 0) {
console.warn('All appropriate users found and modified.');
displayData();
return;
}
var userPromises = users.map(updateUser);
var lastUser = users[users.length - 1];
return Promise.all(userPromises)
.then(function () {
processUsers(lastUser._id);
});
}
function updateUser (user) {
count++;
var set = {'migration': migrationName};
var oldRewardsList = updateStore(user);
var newPinnedItems = [
{
type: 'armoire',
path: 'armoire',
},
{
type: 'potion',
path: 'potion',
},
];
oldRewardsList.forEach(item => {
var type = 'marketGear';
var itemInfo = getItemInfo(user, 'marketGear', item);
newPinnedItems.push({
type,
path: itemInfo.path,
})
});
set.pinnedItems = newPinnedItems;
if (user.items.pets['Lion-Veteran']) {
set['items.pets.Bear-Veteran'] = 5;
} else if (user.items.pets['Tiger-Veteran']) {
set['items.pets.Lion-Veteran'] = 5;
} else if (user.items.pets['Wolf-Veteran']) {
set['items.pets.Tiger-Veteran'] = 5;
} else {
set['items.pets.Wolf-Veteran'] = 5;
}
if (count % progressCount == 0) console.warn(count + ' ' + user._id);
if (user._id == authorUuid) console.warn(authorName + ' processed');
return dbUsers.update({_id: user._id}, {$set:set});
}
function displayData() {
console.warn('\n' + count + ' users processed\n');
return exiting(0);
}
function exiting(code, msg) {
code = code || 0; // 0 = success
if (code && !msg) { msg = 'ERROR!'; }
if (msg) {
if (code) { console.error(msg); }
else { console.log( msg); }
}
process.exit(code);
}
module.exports = processUsers;

View File

@@ -1,47 +1,47 @@
import Bluebird from 'Bluebird';
import { model as Challenges } from '../../website/server/models/challenge';
import { model as User } from '../../website/server/models/user';
async function syncChallengeToMembers (challenges) {
let challengSyncPromises = challenges.map(async function (challenge) {
let users = await User.find({
// _id: '',
challenges: challenge._id,
}).exec();
let promises = [];
users.forEach(function (user) {
promises.push(challenge.syncToUser(user));
promises.push(challenge.save());
promises.push(user.save());
});
return Bluebird.all(promises);
});
return await Bluebird.all(challengSyncPromises);
}
async function syncChallenges (lastChallengeDate) {
let query = {
// _id: '',
};
if (lastChallengeDate) {
query.createdOn = { $lte: lastChallengeDate };
}
let challengesFound = await Challenges.find(query)
.limit(10)
.sort('-createdAt')
.exec();
let syncedChallenges = await syncChallengeToMembers(challengesFound)
.catch(reason => console.error(reason));
let lastChallenge = challengesFound[challengesFound.length - 1];
if (lastChallenge) syncChallenges(lastChallenge.createdAt);
return syncedChallenges;
};
module.exports = syncChallenges;
import Bluebird from 'Bluebird';
import { model as Challenges } from '../../website/server/models/challenge';
import { model as User } from '../../website/server/models/user';
async function syncChallengeToMembers (challenges) {
let challengSyncPromises = challenges.map(async function (challenge) {
let users = await User.find({
// _id: '',
challenges: challenge._id,
}).exec();
let promises = [];
users.forEach(function (user) {
promises.push(challenge.syncToUser(user));
promises.push(challenge.save());
promises.push(user.save());
});
return Bluebird.all(promises);
});
return await Bluebird.all(challengSyncPromises);
}
async function syncChallenges (lastChallengeDate) {
let query = {
// _id: '',
};
if (lastChallengeDate) {
query.createdOn = { $lte: lastChallengeDate };
}
let challengesFound = await Challenges.find(query)
.limit(10)
.sort('-createdAt')
.exec();
let syncedChallenges = await syncChallengeToMembers(challengesFound)
.catch(reason => console.error(reason));
let lastChallenge = challengesFound[challengesFound.length - 1];
if (lastChallenge) syncChallenges(lastChallenge.createdAt);
return syncedChallenges;
};
module.exports = syncChallenges;

View File

@@ -21,4 +21,4 @@ var processUsers = require('./groups/update-groups-with-group-plans');
processUsers()
.catch(function (err) {
console.log(err)
})
})

View File

@@ -2,7 +2,7 @@ var _id = '';
var update = {
$addToSet: {
'purchased.plan.mysteryItems':{
$each:['back_mystery_201704','armor_mystery_201704']
$each:['shield_mystery_201709','back_mystery_201709']
}
}
};

98
migrations/s3-upload.js Normal file
View File

@@ -0,0 +1,98 @@
let Bluebird = require('bluebird');
let request = require('superagent');
let last = require('lodash/last');
let AWS = require('aws-sdk');
let config = require('../config');
const S3_DIRECTORY = 'mobileApp/images'; //config.S3.SPRITES_DIRECTORY;
AWS.config.update({
accessKeyId: config.S3.accessKeyId,
secretAccessKey: config.S3.secretAccessKey,
// region: config.get('S3_REGION'),
});
let BUCKET_NAME = config.S3.bucket;
let s3 = new AWS.S3();
// Adapted from http://stackoverflow.com/a/22210077/2601552
function uploadFile (buffer, fileName) {
return new Promise((resolve, reject) => {
s3.putObject({
Body: buffer,
Key: fileName,
Bucket: BUCKET_NAME,
}, (error) => {
if (error) {
reject(error);
} else {
// console.info(`${fileName} uploaded to ${BUCKET_NAME} succesfully.`);
resolve(fileName);
}
});
});
}
function getFileName (file) {
let piecesOfPath = file.split('/');
let name = last(piecesOfPath);
let fullName = S3_DIRECTORY + name;
return fullName;
}
function getFileFromUrl (url) {
return new Promise((resolve, reject) => {
request.get(url).end((err, res) => {
if (err) return reject(err);
let file = res.body;
resolve(file);
});
});
}
let commit = '78f94e365c72cc58f66857d5941105638db7d35c';
commit = 'df0dbaba636c9ce424cc7040f7bd7fc1aa311015';
let gihuburl = `https://api.github.com/repos/HabitRPG/habitica/commits/${commit}`
let currentIndex = 0;
function uploadToS3(start, end, filesUrls) {
let urls = filesUrls.slice(start, end);
if (urls.length === 0) {
console.log("done");
return;
}
let promises = urls.map(fullUrl => {
return getFileFromUrl(fullUrl)
.then((buffer) => {
return uploadFile(buffer, getFileName(fullUrl));
});
});
console.log(promises.length)
return Bluebird.all(promises)
.then(() => {
currentIndex += 50;
uploadToS3(currentIndex, currentIndex + 50, filesUrls);
})
.catch(e => {
console.log(e);
});
}
request.get(gihuburl)
.end((err, res) => {
console.log(err);
let files = res.body.files;
let filesUrls = [''];
filesUrls = files.map(file => {
return file.raw_url;
})
uploadToS3(currentIndex, currentIndex + 50, filesUrls);
});

View File

@@ -0,0 +1,83 @@
var migrationName = 'tasks-set-yesterdaily';
var authorName = 'TheHollidayInn'; // in case script author needs to know when their ...
var authorUuid = ''; //... own data is done
/*
* Iterates over all tasks and sets the yseterDaily field to True
*/
import monk from 'monk';
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbTasks = monk(connectionString).get('tasks', { castIds: false });
function processTasks(lastId) {
// specify a query to limit the affected tasks (empty for all tasks):
var query = {
yesterDaily: false,
};
if (lastId) {
query._id = {
$gt: lastId
}
}
dbTasks.find(query, {
sort: {_id: 1},
limit: 250,
fields: [ // specify fields we are interested in to limit retrieved data (empty if we're not reading data):
],
})
.then(updateTasks)
.catch(function (err) {
console.log(err);
return exiting(1, 'ERROR! ' + err);
});
}
var progressCount = 1000;
var count = 0;
function updateTasks (tasks) {
if (!tasks || tasks.length === 0) {
console.warn('All appropriate tasks found and modified.');
displayData();
return;
}
var taskPromises = tasks.map(updatetask);
var lasttask = tasks[tasks.length - 1];
return Promise.all(taskPromises)
.then(function () {
processtasks(lasttask._id);
});
}
function updatetask (task) {
count++;
var set = {'yesterDaily': true};
dbTasks.update({_id: task._id}, {$set:set});
if (count % progressCount == 0) console.warn(count + ' ' + task._id);
if (task._id == authorUuid) console.warn(authorName + ' processed');
}
function displayData() {
console.warn('\n' + count + ' tasks processed\n');
return exiting(0);
}
function exiting(code, msg) {
code = code || 0; // 0 = success
if (code && !msg) { msg = 'ERROR!'; }
if (msg) {
if (code) { console.error(msg); }
else { console.log( msg); }
}
process.exit(code);
}
module.exports = processtasks;

View File

@@ -0,0 +1,109 @@
var migrationName = 'UserFromProdToTest';
var authorName = 'TheHollidayInn'; // in case script author needs to know when their ...
var authorUuid = ''; //... own data is done
/*
* This migraition will copy user data from prod to test
*/
var monk = require('monk');
var testConnectionSting = ''; // FOR TEST DATABASE
var usersTest = monk(testConnectionSting).get('users', { castIds: false });
var groupsTest = monk(testConnectionSting).get('groups', { castIds: false });
var challengesTest = monk(testConnectionSting).get('challenges', { castIds: false });
var tasksTest = monk(testConnectionSting).get('tasks', { castIds: false });
var monk2 = require('monk');
var liveConnectString = ''; // FOR TEST DATABASE
var userLive = monk2(liveConnectString).get('users', { castIds: false });
var groupsLive = monk2(liveConnectString).get('groups', { castIds: false });
var challengesLive = monk2(liveConnectString).get('challenges', { castIds: false });
var tasksLive = monk2(liveConnectString).get('tasks', { castIds: false });
import uniq from 'lodash/uniq';
import Bluebird from 'bluebird';
// Variabls for updating
let userIds = [
'206039c6-24e4-4b9f-8a31-61cbb9aa3f66',
];
let groupIds = [];
let challengeIds = [];
let tasksIds = [];
async function processUsers () {
let userPromises = [];
//{_id: {$in: userIds}}
return userLive.find({guilds: 'b0764d64-8276-45a1-afa5-5ca9a5c64ca0'})
.each((user, {close, pause, resume}) => {
if (user.guilds.length > 0) groupIds = groupIds.concat(user.guilds);
if (user.party._id) groupIds.push(user.party._id);
if (user.challenges.length > 0) challengeIds = challengeIds.concat(user.challenges);
if (user.tasksOrder.rewards.length > 0) tasksIds = tasksIds.concat(user.tasksOrder.rewards);
if (user.tasksOrder.todos.length > 0) tasksIds = tasksIds.concat(user.tasksOrder.todos);
if (user.tasksOrder.dailys.length > 0) tasksIds = tasksIds.concat(user.tasksOrder.dailys);
if (user.tasksOrder.habits.length > 0) tasksIds = tasksIds.concat(user.tasksOrder.habits);
let userPromise = usersTest.update({'_id': user._id}, user, {upsert:true});
userPromises.push(userPromise);
}).then(() => {
return Bluebird.all(userPromises);
})
.then(() => {
console.log("Done User");
});
}
function processGroups () {
let promises = [];
let groupsToQuery = uniq(groupIds);
return groupsLive.find({_id: {$in: groupsToQuery}})
.each((group, {close, pause, resume}) => {
let promise = groupsTest.update({_id: group._id}, group, {upsert:true});
promises.push(promise);
}).then(() => {
return Bluebird.all(promises);
})
.then(() => {
console.log("Done Group");
});
}
function processChallenges () {
let promises = [];
let challengesToQuery = uniq(challengeIds);
return challengesLive.find({_id: {$in: challengesToQuery}})
.each((challenge, {close, pause, resume}) => {
let promise = challengesTest.update({_id: challenge._id}, challenge, {upsert:true});
promises.push(promise);
}).then(() => {
return Bluebird.all(promises);
})
.then(() => {
console.log("Done Challenge");
});
}
function processTasks () {
let promises = [];
let tasksToQuery = uniq(tasksIds);
return tasksLive.find({_id: {$in: tasksToQuery}})
.each((task, {close, pause, resume}) => {
let promise = tasksTest.update({_id: task._id}, task, {upsert:true});
promises.push(promise);
}).then(() => {
return Bluebird.all(promises);
})
.then(() => {
console.log("Done Tasks");
});
}
module.exports = async function prodToTest () {
await processUsers();
await processGroups();
await processChallenges();
await processTasks();
};

13656
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

21115
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "3.91.2",
"version": "4.0.6",
"main": "./website/server/index.js",
"dependencies": {
"@slack/client": "^3.8.1",
@@ -15,8 +15,10 @@
"aws-sdk": "^2.0.25",
"axios": "^0.16.0",
"babel-core": "^6.0.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^6.0.0",
"babel-plugin-syntax-async-functions": "^6.13.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-async-to-module-method": "^6.8.0",
"babel-plugin-transform-object-rest-spread": "^6.16.0",
"babel-plugin-transform-regenerator": "^6.16.1",
@@ -28,17 +30,18 @@
"bcrypt": "^1.0.2",
"bluebird": "^3.3.5",
"body-parser": "^1.15.0",
"bootstrap": "^4.0.0-alpha.6",
"bootstrap-vue": "^0.15.8",
"bootstrap": "4.0.0-alpha.6",
"bootstrap-vue": "^1.0.0-beta.6",
"bower": "~1.3.12",
"browserify": "~12.0.1",
"compression": "^1.6.1",
"connect-ratelimit": "0.0.7",
"cookie-session": "^1.2.0",
"coupon-code": "^0.4.5",
"cross-env": "^4.0.0",
"css-loader": "^0.28.0",
"csv-stringify": "^1.0.2",
"cwait": "^1.0.0",
"cwait": "~1.0.1",
"domain-middleware": "~0.1.0",
"estraverse": "^4.1.1",
"express": "~4.14.0",
@@ -57,7 +60,7 @@
"grunt-contrib-stylus": "~0.20.0",
"grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-hashres": "habitrpg/grunt-hashres#v0.4.2",
"grunt-hashres": "git://github.com/habitrpg/grunt-hashres#dc85db6d3002e29e1b7c5ee186b80d708d2f0e0b",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.2",
"gulp-grunt": "^0.5.2",
@@ -67,18 +70,20 @@
"gulp-uglify": "^1.4.2",
"gulp.spritesmith": "^4.1.0",
"habitica-markdown": "^1.3.0",
"hellojs": "^1.15.1",
"html-webpack-plugin": "^2.8.1",
"image-size": "~0.3.2",
"in-app-purchase": "^1.1.6",
"intro.js": "^2.6.0",
"jade": "~1.11.0",
"jquery": "^3.1.1",
"jquery": ">=3.0.0",
"js2xmlparser": "~1.0.0",
"lodash": "^4.17.4",
"merge-stream": "^1.0.0",
"method-override": "^2.3.5",
"moment": "^2.13.0",
"moment-recur": "habitrpg/moment-recur#v1.0.6",
"mongoose": "^4.8.6",
"moment-recur": "git://github.com/habitrpg/moment-recur#f147ef27bbc26ca67638385f3db4a44084c76626",
"mongoose": "~4.8.6",
"mongoose-id-autoinc": "~2013.7.14-4",
"morgan": "^1.7.0",
"nconf": "~0.8.2",
@@ -94,11 +99,12 @@
"passport-google-oauth20": "1.0.0",
"paypal-ipn": "3.0.0",
"paypal-rest-sdk": "^1.2.1",
"popper.js": "^1.11.0",
"postcss-easy-import": "^2.0.0",
"pretty-data": "^0.40.0",
"ps-tree": "^1.0.0",
"pug": "^2.0.0-beta.12",
"push-notify": "habitrpg/push-notify#v1.2.0",
"push-notify": "git://github.com/habitrpg/push-notify#6bc2b5fdb1bdc9649b9ec1964d79ca50187fc8a9",
"pusher": "^1.3.0",
"request": "~2.74.0",
"rimraf": "^2.4.3",
@@ -107,8 +113,12 @@
"sass-loader": "^6.0.2",
"serve-favicon": "^2.3.0",
"shelljs": "^0.7.6",
"sortablejs": "^1.6.1",
"stripe": "^4.2.0",
"superagent": "^3.4.3",
"svg-inline-loader": "^0.7.1",
"svg-url-loader": "^2.0.2",
"svgo-loader": "^1.2.1",
"universal-analytics": "~0.3.2",
"url-loader": "^0.5.7",
"useragent": "^2.1.9",
@@ -122,6 +132,7 @@
"vue-router": "^2.0.0-rc.5",
"vue-style-loader": "^3.0.0",
"vue-template-compiler": "^2.1.10",
"vuejs-datepicker": "git://github.com/habitrpg/vuejs-datepicker#45e607a7bccf4e3e089761b3b7b33e3f2c5dc21f",
"webpack": "^2.2.1",
"webpack-merge": "^4.0.0",
"winston": "^2.1.0",
@@ -131,11 +142,11 @@
"private": true,
"engines": {
"node": "^6.9.1",
"npm": "^4.0.2"
"npm": "^5.0.0"
},
"scripts": {
"lint": "eslint --ext .js,.vue .",
"test": "npm run lint && gulp test && npm run client:unit",
"test": "npm run lint && gulp test && npm run client:unit && gulp apidoc",
"test:build": "gulp test:prepare:build",
"test:api-v3": "gulp test:api-v3",
"test:api-v3:unit": "gulp test:api-v3:unit",
@@ -152,14 +163,15 @@
"test:nodemon": "gulp test:nodemon",
"coverage": "COVERAGE=true mocha --require register-handlers.js --reporter html-cov > coverage.html; open coverage.html",
"sprites": "gulp sprites:compile",
"client:dev": "node webpack/dev-server.js",
"client:build": "node webpack/build.js",
"client:dev": "gulp bootstrap && node webpack/dev-server.js",
"client:build": "gulp build:client",
"client:unit": "cross-env NODE_ENV=test karma start test/client/unit/karma.conf.js --single-run",
"client:unit:watch": "cross-env NODE_ENV=test karma start test/client/unit/karma.conf.js",
"client:e2e": "node test/client/e2e/runner.js",
"client:test": "npm run client:unit && npm run client:e2e",
"start": "gulp run:dev",
"postinstall": "bower --config.interactive=false install -f; gulp build; npm run client:build"
"postinstall": "gulp build",
"apidoc": "gulp apidoc"
},
"devDependencies": {
"babel-plugin-istanbul": "^4.0.0",
@@ -169,7 +181,6 @@
"chromedriver": "^2.27.2",
"connect-history-api-fallback": "^1.1.0",
"coveralls": "^2.11.2",
"cross-env": "^4.0.0",
"cross-spawn": "^5.0.1",
"csv": "~0.3.6",
"deep-diff": "~0.1.4",
@@ -207,6 +218,7 @@
"nightwatch": "^0.9.12",
"phantomjs-prebuilt": "^2.1.12",
"protractor": "^3.1.1",
"raw-loader": "^0.5.1",
"require-again": "^2.0.0",
"rewire": "^2.3.3",
"selenium-server": "^3.0.1",

View File

@@ -1,3 +1,5 @@
require("babel-register");
require("babel-polyfill");
// This file is used for creating paypal billing plans. PayPal doesn't have a web interface for setting up recurring
// payment plan definitions, instead you have to create it via their REST SDK and keep it updated the same way. So this
// file will be used once for initing your billing plan (then you get the resultant plan.id to store in config.json),
@@ -7,10 +9,10 @@ var path = require('path');
var nconf = require('nconf');
var _ = require('lodash');
var paypal = require('paypal-rest-sdk');
var blocks = require('../../../../common').content.subscriptionBlocks;
var blocks = require('../website/common').content.subscriptionBlocks;
var live = nconf.get('PAYPAL:mode')=='live';
nconf.argv().env().file('user', path.join(path.resolve(__dirname, '../../../config.json')));
nconf.argv().env().file('user', path.join(path.resolve(__dirname, '../config.json')));
var OP = 'create'; // list create update remove
@@ -49,6 +51,8 @@ _.each(blocks, function(block){
});
})
// @TODO: Add cli library for this
switch(OP) {
case "list":
paypal.billingPlan.list({status: 'ACTIVE'}, function(err, plans){
@@ -91,4 +95,17 @@ switch(OP) {
});
break;
case "remove": break;
case 'create-webprofile':
let webexpinfo = {
"name": "HabiticaProfile",
"input_fields": {
"no_shipping": 1,
},
};
paypal.webProfile.create(webexpinfo, (error, result) => {
console.log(error, result)
})
break;
}

View File

@@ -48,8 +48,10 @@ describe('GET /challenges/:challengeId', () => {
});
expect(chal.group).to.eql({
_id: group._id,
categories: [],
id: group.id,
name: group.name,
summary: group.name,
type: group.type,
privacy: group.privacy,
leader: groupLeader.id,
@@ -100,8 +102,10 @@ describe('GET /challenges/:challengeId', () => {
});
expect(chal.group).to.eql({
_id: group._id,
categories: [],
id: group.id,
name: group.name,
summary: group.name,
type: group.type,
privacy: group.privacy,
leader: groupLeader.id,
@@ -153,7 +157,9 @@ describe('GET /challenges/:challengeId', () => {
expect(chal.group).to.eql({
_id: group._id,
id: group.id,
categories: [],
name: group.name,
summary: group.name,
type: group.type,
privacy: group.privacy,
leader: groupLeader.id,

View File

@@ -41,10 +41,12 @@ describe('GET challenges/user', () => {
});
expect(foundChallenge.group).to.eql({
_id: publicGuild._id,
categories: [],
id: publicGuild._id,
type: publicGuild.type,
privacy: publicGuild.privacy,
name: publicGuild.name,
summary: publicGuild.name,
leader: publicGuild.leader._id,
});
});
@@ -61,10 +63,12 @@ describe('GET challenges/user', () => {
});
expect(foundChallenge1.group).to.eql({
_id: publicGuild._id,
categories: [],
id: publicGuild._id,
type: publicGuild.type,
privacy: publicGuild.privacy,
name: publicGuild.name,
summary: publicGuild.name,
leader: publicGuild.leader._id,
});
let foundChallenge2 = _.find(challenges, { _id: challenge2._id });
@@ -76,10 +80,12 @@ describe('GET challenges/user', () => {
});
expect(foundChallenge2.group).to.eql({
_id: publicGuild._id,
categories: [],
id: publicGuild._id,
type: publicGuild.type,
privacy: publicGuild.privacy,
name: publicGuild.name,
summary: publicGuild.name,
leader: publicGuild.leader._id,
});
});
@@ -96,10 +102,12 @@ describe('GET challenges/user', () => {
});
expect(foundChallenge1.group).to.eql({
_id: publicGuild._id,
categories: [],
id: publicGuild._id,
type: publicGuild.type,
privacy: publicGuild.privacy,
name: publicGuild.name,
summary: publicGuild.name,
leader: publicGuild.leader._id,
});
let foundChallenge2 = _.find(challenges, { _id: challenge2._id });
@@ -111,14 +119,26 @@ describe('GET challenges/user', () => {
});
expect(foundChallenge2.group).to.eql({
_id: publicGuild._id,
categories: [],
id: publicGuild._id,
type: publicGuild.type,
privacy: publicGuild.privacy,
name: publicGuild.name,
summary: publicGuild.name,
leader: publicGuild.leader._id,
});
});
it('should return not return challenges in user groups if we send member true param', async () => {
let challenges = await member.get(`/challenges/user?member=${true}`);
let foundChallenge1 = _.find(challenges, { _id: challenge._id });
expect(foundChallenge1).to.not.exist;
let foundChallenge2 = _.find(challenges, { _id: challenge2._id });
expect(foundChallenge2).to.not.exist;
});
it('should return newest challenges first', async () => {
let challenges = await user.get('/challenges/user');
@@ -137,6 +157,7 @@ describe('GET challenges/user', () => {
let { group, groupLeader } = await createAndPopulateGroup({
groupDetails: {
name: 'TestPrivateGuild',
summary: 'summary for TestPrivateGuild',
type: 'guild',
privacy: 'private',
},
@@ -158,6 +179,7 @@ describe('GET challenges/user', () => {
let { group, groupLeader } = await createAndPopulateGroup({
groupDetails: {
name: 'TestGuild',
summary: 'summary for TestGuild',
type: 'guild',
privacy: 'public',
},

View File

@@ -304,5 +304,15 @@ describe('POST /challenges', () => {
await expect(groupLeader.sync()).to.eventually.have.property('challenges').to.include(challenge._id);
});
it('awards achievement if this is creator\'s first challenge', async () => {
await groupLeader.post('/challenges', {
group: group._id,
name: 'Test Challenge',
shortName: 'TC Label',
});
groupLeader = await groupLeader.sync();
expect(groupLeader.achievements.joinedChallenge).to.be.true;
});
});
});

View File

@@ -123,5 +123,12 @@ describe('POST /challenges/:challengeId/join', () => {
await expect(authorizedUser.get('/tags')).to.eventually.have.length(userTagsLength + 1);
});
it('awards achievement if this is user\'s first challenge', async () => {
await authorizedUser.post(`/challenges/${challenge._id}/join`);
await authorizedUser.sync();
expect(authorizedUser.achievements.joinedChallenge).to.be.true;
});
});
});

View File

@@ -32,18 +32,20 @@ describe('POST /challenges/:challengeId/leave', () => {
let group;
let challenge;
let notInChallengeUser;
let notInGroupLeavingUser;
let leavingUser;
let taskText;
beforeEach(async () => {
let populatedGroup = await createAndPopulateGroup({
members: 2,
members: 3,
});
groupLeader = populatedGroup.groupLeader;
group = populatedGroup.group;
leavingUser = populatedGroup.members[0];
notInChallengeUser = populatedGroup.members[1];
notInGroupLeavingUser = populatedGroup.members[2];
challenge = await generateChallenge(groupLeader, group);
@@ -55,17 +57,16 @@ describe('POST /challenges/:challengeId/leave', () => {
await leavingUser.post(`/challenges/${challenge._id}/join`);
await notInGroupLeavingUser.post(`/challenges/${challenge._id}/join`);
await notInGroupLeavingUser.post(`/groups/${group._id}/leave`, {
keepChallenges: 'remain-in-challenges',
});
await challenge.sync();
});
it('returns an error when user doesn\'t have permissions to view the challenge', async () => {
let unauthorizedUser = await generateUser();
await expect(unauthorizedUser.post(`/challenges/${challenge._id}/leave`)).to.eventually.be.rejected.and.eql({
code: 404,
error: 'NotFound',
message: t('challengeNotFound'),
});
it('lets user leave when not a member of the challenge group', async () => {
await expect(notInGroupLeavingUser.post(`/challenges/${challenge._id}/leave`)).to.eventually.be.ok;
});
it('returns an error when user isn\'t a member of the challenge', async () => {

View File

@@ -100,8 +100,8 @@ describe('POST /challenges/:challengeId/winner/:winnerId', () => {
await sleep(0.5);
await expect(winningUser.sync()).to.eventually.have.deep.property('achievements.challenges').to.include(challenge.name);
expect(winningUser.notifications.length).to.equal(1);
expect(winningUser.notifications[0].type).to.equal('WON_CHALLENGE');
expect(winningUser.notifications.length).to.equal(2); // 2 because winningUser just joined the challenge, which now awards an achievement
expect(winningUser.notifications[1].type).to.equal('WON_CHALLENGE');
});
it('gives winner gems as reward', async () => {
@@ -114,6 +114,26 @@ describe('POST /challenges/:challengeId/winner/:winnerId', () => {
await expect(winningUser.sync()).to.eventually.have.property('balance', oldBalance + challenge.prize / 4);
});
it('doesn\'t gives winner gems if group policy prevents it', async () => {
let oldBalance = winningUser.balance;
let oldLeaderBalance = (await groupLeader.sync()).balance;
await winningUser.update({
'purchased.plan.customerId': 'group-plan',
});
await group.update({
'leaderOnly.getGems': true,
'purchased.plan.customerId': 123,
});
await groupLeader.post(`/challenges/${challenge._id}/selectWinner/${winningUser._id}`);
await sleep(0.5);
await expect(winningUser.sync()).to.eventually.have.property('balance', oldBalance);
await expect(groupLeader.sync()).to.eventually.have.property('balance', oldLeaderBalance + challenge.prize / 4);
});
it('doesn\'t refund gems to group leader', async () => {
let oldBalance = (await groupLeader.sync()).balance;

View File

@@ -84,6 +84,10 @@ describe('POST /chat/:chatId/flag', () => {
type: 'party',
privacy: 'private',
});
await user.post(`/groups/${privateGroup._id}/invite`, {
uuids: [anotherUser._id],
});
await anotherUser.post(`/groups/${privateGroup._id}/join`);
let { message } = await user.post(`/groups/${privateGroup._id}/chat`, {message: TEST_MESSAGE});
let flagResult = await admin.post(`/groups/${privateGroup._id}/chat/${message.id}/flag`);
@@ -91,7 +95,7 @@ describe('POST /chat/:chatId/flag', () => {
expect(flagResult.flags[admin._id]).to.equal(true);
expect(flagResult.flagCount).to.equal(5);
let groupWithFlags = await user.get(`/groups/${privateGroup._id}`);
let groupWithFlags = await anotherUser.get(`/groups/${privateGroup._id}`);
let messageToCheck = find(groupWithFlags.chat, {id: message.id});
expect(messageToCheck).to.not.exist;
@@ -125,4 +129,20 @@ describe('POST /chat/:chatId/flag', () => {
message: t('messageGroupChatFlagAlreadyReported'),
});
});
it('shows a hidden message to the original poster', async () => {
let { message } = await user.post(`/groups/${group._id}/chat`, {message: TEST_MESSAGE});
await admin.post(`/groups/${group._id}/chat/${message.id}/flag`);
let groupWithFlags = await user.get(`/groups/${group._id}`);
let messageToCheck = find(groupWithFlags.chat, {id: message.id});
expect(messageToCheck).to.exist;
let auGroupWithFlags = await anotherUser.get(`/groups/${group._id}`);
let auMessageToCheck = find(auGroupWithFlags.chat, {id: message.id});
expect(auMessageToCheck).to.not.exist;
});
});

View File

@@ -10,11 +10,22 @@ import {
TAVERN_ID,
} from '../../../../../website/server/models/group';
import { v4 as generateUUID } from 'uuid';
import { getMatchesByWordArray, removePunctuationFromString } from '../../../../../website/server/libs/stringUtils';
import bannedWords from '../../../../../website/server/libs/bannedWords';
import * as email from '../../../../../website/server/libs/email';
import { IncomingWebhook } from '@slack/client';
import nconf from 'nconf';
const BASE_URL = nconf.get('BASE_URL');
describe('POST /chat', () => {
let user, groupWithChat, member, additionalMember;
let testMessage = 'Test Message';
let testBannedWordMessage = 'TEST_PLACEHOLDER_SWEAR_WORD_HERE';
let testSlurMessage = 'message with TEST_PLACEHOLDER_SLUR_WORD_HERE';
let bannedWordErrorMessage = t('bannedWordUsed').split('.');
bannedWordErrorMessage[0] += ` (${removePunctuationFromString(testBannedWordMessage.toLowerCase())})`;
bannedWordErrorMessage = bannedWordErrorMessage.join('.');
before(async () => {
let { group, groupLeader, members } = await createAndPopulateGroup({
@@ -25,7 +36,6 @@ describe('POST /chat', () => {
},
members: 2,
});
user = groupLeader;
groupWithChat = group;
member = members[0];
@@ -70,20 +80,20 @@ describe('POST /chat', () => {
it('returns an error when chat privileges are revoked when sending a message to a public guild', async () => {
let userWithChatRevoked = await member.update({'flags.chatRevoked': true});
await expect(userWithChatRevoked.post(`/groups/${groupWithChat._id}/chat`, { message: testMessage})).to.eventually.be.rejected.and.eql({
code: 404,
error: 'NotFound',
message: 'Your chat privileges have been revoked.',
code: 401,
error: 'NotAuthorized',
message: t('chatPrivilegesRevoked'),
});
});
context('banned word', () => {
it('returns an error when chat message contains a banned word in tavern', async () => {
await expect(user.post('/groups/habitrpg/chat', { message: testBannedWordMessage}))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('bannedWordUsed'),
});
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: bannedWordErrorMessage,
});
});
it('errors when word is part of a phrase', async () => {
@@ -92,7 +102,7 @@ describe('POST /chat', () => {
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('bannedWordUsed'),
message: bannedWordErrorMessage,
});
});
@@ -102,10 +112,26 @@ describe('POST /chat', () => {
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('bannedWordUsed'),
message: bannedWordErrorMessage,
});
});
it('checks error message has the banned words used', async () => {
let randIndex = Math.floor(Math.random() * (bannedWords.length + 1));
let testBannedWords = bannedWords.slice(randIndex, randIndex + 2).map((w) => w.replace(/\\/g, ''));
let chatMessage = `Mixing ${testBannedWords[0]} and ${testBannedWords[1]} is bad for you.`;
await expect(user.post('/groups/habitrpg/chat', { message: chatMessage}))
.to.eventually.be.rejected
.and.have.property('message')
.that.includes(testBannedWords.join(', '));
});
it('check all banned words are matched', async () => {
let message = bannedWords.join(',').replace(/\\/g, '');
let matches = getMatchesByWordArray(message, bannedWords);
expect(matches.length).to.equal(bannedWords.length);
});
it('does not error when bad word is suffix of a word', async () => {
let wordAsSuffix = `prefix${testBannedWordMessage}`;
let message = await user.post('/groups/habitrpg/chat', { message: wordAsSuffix});
@@ -166,6 +192,114 @@ describe('POST /chat', () => {
});
});
context('banned slur', () => {
beforeEach(() => {
sandbox.spy(email, 'sendTxn');
sandbox.stub(IncomingWebhook.prototype, 'send');
});
afterEach(() => {
sandbox.restore();
});
it('errors and revokes privileges when chat message contains a banned slur', async () => {
await expect(user.post(`/groups/${groupWithChat._id}/chat`, { message: testSlurMessage})).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('bannedSlurUsed'),
});
// Email sent to mods
await sleep(0.5);
expect(email.sendTxn).to.be.calledOnce;
expect(email.sendTxn.args[0][1]).to.be.eql('slur-report-to-mods');
// Slack message to mods
expect(IncomingWebhook.prototype.send).to.be.calledOnce;
/* eslint-disable camelcase */
expect(IncomingWebhook.prototype.send).to.be.calledWith({
text: `${user.profile.name} (${user.id}) tried to post a slur`,
attachments: [{
fallback: 'Slur Message',
color: 'danger',
author_name: `${user.profile.name} - ${user.auth.local.email} - ${user._id}`,
title: 'Slur in Test Guild',
title_link: `${BASE_URL}/groups/guild/${groupWithChat.id}`,
text: testSlurMessage,
// footer: sandbox.match(/<.*?groupId=group-id&chatId=chat-id\|Flag this message>/),
mrkdwn_in: [
'text',
],
}],
});
/* eslint-enable camelcase */
// Chat privileges are revoked
await expect(user.post(`/groups/${groupWithChat._id}/chat`, { message: testMessage})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('chatPrivilegesRevoked'),
});
// Restore chat privileges to continue testing
user.flags.chatRevoked = false;
await user.update({'flags.chatRevoked': false});
});
it('does not allow slurs in private groups', async () => {
let { group, members } = await createAndPopulateGroup({
groupDetails: {
name: 'Party',
type: 'party',
privacy: 'private',
},
members: 1,
});
await expect(members[0].post(`/groups/${group._id}/chat`, { message: testSlurMessage})).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('bannedSlurUsed'),
});
// Email sent to mods
await sleep(0.5);
expect(email.sendTxn).to.be.calledThrice;
expect(email.sendTxn.args[2][1]).to.be.eql('slur-report-to-mods');
// Slack message to mods
expect(IncomingWebhook.prototype.send).to.be.calledOnce;
/* eslint-disable camelcase */
expect(IncomingWebhook.prototype.send).to.be.calledWith({
text: `${members[0].profile.name} (${members[0].id}) tried to post a slur`,
attachments: [{
fallback: 'Slur Message',
color: 'danger',
author_name: `${members[0].profile.name} - ${members[0].auth.local.email} - ${members[0]._id}`,
title: 'Slur in Party - (private party)',
title_link: undefined,
text: testSlurMessage,
// footer: sandbox.match(/<.*?groupId=group-id&chatId=chat-id\|Flag this message>/),
mrkdwn_in: [
'text',
],
}],
});
/* eslint-enable camelcase */
// Chat privileges are revoked
await expect(members[0].post(`/groups/${groupWithChat._id}/chat`, { message: testMessage})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('chatPrivilegesRevoked'),
});
// Restore chat privileges to continue testing
members[0].flags.chatRevoked = false;
await members[0].update({'flags.chatRevoked': false});
});
});
it('does not error when sending a message to a private guild with a user with revoked chat', async () => {
let { group, members } = await createAndPopulateGroup({
groupDetails: {

View File

@@ -0,0 +1,32 @@
import {
generateUser,
generateGroup,
} from '../../../../helpers/api-v3-integration.helper';
describe('GET /group-plans', () => {
let user;
let groupPlan;
before(async () => {
user = await generateUser({balance: 4});
groupPlan = await generateGroup(user,
{
name: 'public guild - is member',
type: 'guild',
privacy: 'public',
},
{
purchased: {
plan: {
customerId: 'existings',
},
},
});
});
it('returns group plans for the user', async () => {
let groupPlans = await user.get('/group-plans');
expect(groupPlans[0]._id).to.eql(groupPlan._id);
});
});

View File

@@ -16,6 +16,12 @@ describe('GET /groups', () => {
const NUMBER_OF_USERS_PRIVATE_GUILDS = 1;
const NUMBER_OF_GROUPS_USER_CAN_VIEW = 5;
const GUILD_PER_PAGE = 30;
let categories = [{
slug: 'newCat',
name: 'New Category',
}];
let publicGuildNotMember;
let privateGuildUserIsMemberOf;
before(async () => {
await resetHabiticaDB();
@@ -31,16 +37,18 @@ describe('GET /groups', () => {
await leader.post(`/groups/${publicGuildUserIsMemberOf._id}/invite`, { uuids: [user._id]});
await user.post(`/groups/${publicGuildUserIsMemberOf._id}/join`);
await generateGroup(leader, {
publicGuildNotMember = await generateGroup(leader, {
name: 'public guild - is not member',
type: 'guild',
privacy: 'public',
categories,
});
let privateGuildUserIsMemberOf = await generateGroup(leader, {
privateGuildUserIsMemberOf = await generateGroup(leader, {
name: 'private guild - is member',
type: 'guild',
privacy: 'private',
categories,
});
await leader.post(`/groups/${privateGuildUserIsMemberOf._id}/invite`, { uuids: [user._id]});
await user.post(`/groups/${privateGuildUserIsMemberOf._id}/join`);
@@ -100,6 +108,50 @@ describe('GET /groups', () => {
.to.eventually.have.a.lengthOf(NUMBER_OF_PUBLIC_GUILDS);
});
describe('filters', () => {
it('returns public guilds filtered by category', async () => {
let guilds = await user.get(`/groups?type=publicGuilds&categories=${categories[0].slug}`);
expect(guilds[0]._id).to.equal(publicGuildNotMember._id);
});
it('returns private guilds filtered by category', async () => {
let guilds = await user.get(`/groups?type=privateGuilds&categories=${categories[0].slug}`);
expect(guilds[0]._id).to.equal(privateGuildUserIsMemberOf._id);
});
it('filters public guilds by size', async () => {
await generateGroup(user, {
name: 'guild1',
type: 'guild',
privacy: 'public',
memberCount: 1,
});
// @TODO: anyway to set higher memberCount in tests right now?
let guilds = await user.get('/groups?type=publicGuilds&minMemberCount=3');
expect(guilds.length).to.equal(0);
});
it('filters private guilds by size', async () => {
await generateGroup(user, {
name: 'guild1',
type: 'guild',
privacy: 'private',
memberCount: 1,
});
// @TODO: anyway to set higher memberCount in tests right now?
let guilds = await user.get('/groups?type=privateGuilds&minMemberCount=3');
expect(guilds.length).to.equal(0);
});
});
describe('public guilds pagination', () => {
it('req.query.paginate must be a boolean string', async () => {
await expect(user.get('/groups?paginate=aString&type=publicGuilds'))
@@ -149,8 +201,8 @@ describe('GET /groups', () => {
await expect(user.get('/groups?type=publicGuilds&paginate=true&page=1'))
.to.eventually.have.a.lengthOf(GUILD_PER_PAGE);
let page2 = await expect(user.get('/groups?type=publicGuilds&paginate=true&page=2'))
.to.eventually.have.a.lengthOf(1 + 2); // 1 created now, 2 by other tests
expect(page2[2].name).to.equal('guild with less members');
.to.eventually.have.a.lengthOf(1 + 3); // 1 created now, 3 by other tests
expect(page2[3].name).to.equal('guild with less members');
});
});

View File

@@ -66,11 +66,25 @@ describe('GET /groups/:groupId/members', () => {
expect(res[0].profile).to.have.all.keys(['name']);
});
it('req.query.includeAllPublicFields === true only works with parties', async () => {
it('req.query.includeAllPublicFields === true works with guilds', async () => {
let group = await generateGroup(user, {type: 'guild', name: generateUUID()});
let res = await user.get(`/groups/${group._id}/members?includeAllPublicFields=true`);
expect(res[0]).to.have.all.keys(['_id', 'id', 'profile']);
expect(res[0].profile).to.have.all.keys(['name']);
let [memberRes] = await user.get(`/groups/${group._id}/members?includeAllPublicFields=true`);
expect(memberRes).to.have.all.keys([ // works as: object has all and only these keys
'_id', 'id', 'preferences', 'profile', 'stats', 'achievements', 'party',
'backer', 'contributor', 'auth', 'items', 'inbox',
]);
expect(Object.keys(memberRes.auth)).to.eql(['timestamps']);
expect(Object.keys(memberRes.preferences).sort()).to.eql([
'size', 'hair', 'skin', 'shirt',
'chair', 'costume', 'sleep', 'background', 'tasks',
].sort());
expect(memberRes.stats.maxMP).to.exist;
expect(memberRes.stats.maxHealth).to.equal(common.maxHealth);
expect(memberRes.stats.toNextLevel).to.equal(common.tnl(memberRes.stats.lvl));
expect(memberRes.inbox.optOut).to.exist;
expect(memberRes.inbox.messages).to.not.exist;
});
it('populates all public fields if req.query.includeAllPublicFields === true and it is a party', async () => {

View File

@@ -220,7 +220,7 @@ describe('POST /group/:groupId/join', () => {
it('clears invitation from user when joining party', async () => {
await invitedUser.post(`/groups/${party._id}/join`);
await expect(invitedUser.get('/user')).to.eventually.not.have.deep.property('invitations.party.id');
await expect(invitedUser.get('/user')).to.eventually.not.have.deep.property('invitations.parties[0].id');
});
it('increments memberCount when joining party', async () => {

View File

@@ -247,7 +247,7 @@ describe('POST /groups/:groupId/leave', () => {
let userWithoutInvitation = await invitedUser.get('/user');
expect(userWithoutInvitation.invitations.party).to.be.empty;
expect(userWithoutInvitation.invitations.parties[0]).to.be.empty;
});
});

View File

@@ -107,7 +107,7 @@ describe('POST /group/:groupId/reject-invite', () => {
it('clears invitation from user', async () => {
await invitedUser.post(`/groups/${party._id}/reject-invite`);
await expect(invitedUser.get('/user')).to.eventually.not.have.deep.property('invitations.party.id');
await expect(invitedUser.get('/user')).to.eventually.not.have.deep.property('invitations.parties[0].id');
});
});
});

View File

@@ -11,6 +11,7 @@ describe('POST /groups/:groupId/removeMember/:memberId', () => {
let guild;
let member;
let member2;
let adminUser;
beforeEach(async () => {
let { group, groupLeader, invitees, members } = await createAndPopulateGroup({
@@ -28,6 +29,7 @@ describe('POST /groups/:groupId/removeMember/:memberId', () => {
invitedUser = invitees[0];
member = members[0];
member2 = members[1];
adminUser = await generateUser({ 'contributor.admin': true });
});
context('All Groups', () => {
@@ -42,7 +44,7 @@ describe('POST /groups/:groupId/removeMember/:memberId', () => {
});
});
it('returns an error when user is a non-leader member of a group', async () => {
it('returns an error when user is a non-leader member of a group and not an admin', async () => {
expect(member2.post(`/groups/${guild._id}/removeMember/${member._id}`))
.to.eventually.be.rejected.and.eql({
code: 401,
@@ -87,7 +89,30 @@ describe('POST /groups/:groupId/removeMember/:memberId', () => {
let invitedUserWithoutInvite = await invitedUser.get('/user');
expect(_.findIndex(invitedUserWithoutInvite.invitations.guilds, {id: guild._id})).eql(-1);
expect(_.findIndex(invitedUserWithoutInvite.invitations.guilds, { id: guild._id })).eql(-1);
});
it('allows an admin to remove other members', async () => {
await adminUser.post(`/groups/${guild._id}/removeMember/${member._id}`);
let memberRemoved = await member.get('/user');
expect(memberRemoved.guilds.indexOf(guild._id)).eql(-1);
});
it('allows an admin to remove other invites', async () => {
await adminUser.post(`/groups/${guild._id}/removeMember/${invitedUser._id}`);
let invitedUserWithoutInvite = await invitedUser.get('/user');
expect(_.findIndex(invitedUserWithoutInvite.invitations.guilds, { id: guild._id })).eql(-1);
});
it('does not allow an admin to remove a leader', async () => {
expect(adminUser.post(`/groups/${guild._id}/removeMember/${leader._id}`))
.to.eventually.be.rejected.and.eql({
code: 401,
text: t('cannotRemoveCurrentLeader'),
});
});
it('sends email to user with rescinded invite', async () => {
@@ -152,13 +177,13 @@ describe('POST /groups/:groupId/removeMember/:memberId', () => {
});
it('can remove other invites', async () => {
expect(partyInvitedUser.invitations.party).to.not.be.empty;
expect(partyInvitedUser.invitations.parties[0]).to.not.be.empty;
await partyLeader.post(`/groups/${party._id}/removeMember/${partyInvitedUser._id}`);
let invitedUserWithoutInvite = await partyInvitedUser.get('/user');
expect(invitedUserWithoutInvite.invitations.party).to.be.empty;
expect(invitedUserWithoutInvite.invitations.parties[0]).to.be.empty;
});
it('removes new messages from a member who is removed', async () => {

View File

@@ -440,7 +440,38 @@ describe('Post /groups/:groupId/invite', () => {
await inviter.post(`/groups/${party._id}/invite`, {
uuids: [userToInvite._id],
});
expect((await userToInvite.get('/user')).invitations.party.id).to.equal(party._id);
expect((await userToInvite.get('/user')).invitations.parties[0].id).to.equal(party._id);
});
it('allow inviting a user to 2 different parties', async () => {
// Create another inviter
let inviter2 = await generateUser();
// Create user to invite
let userToInvite = await generateUser();
// Create second group
let party2 = await inviter2.post('/groups', {
name: 'Test Party 2',
type: 'party',
});
// Invite to first party
await inviter.post(`/groups/${party._id}/invite`, {
uuids: [userToInvite._id],
});
// Invite to second party
await inviter2.post(`/groups/${party2._id}/invite`, {
uuids: [userToInvite._id],
});
// Get updated user
let invitedUser = await userToInvite.get('/user');
expect(invitedUser.invitations.parties.length).to.equal(2);
expect(invitedUser.invitations.parties[0].id).to.equal(party._id);
expect(invitedUser.invitations.parties[1].id).to.equal(party2._id);
});
it('allow inviting a user if party id is not associated with a real party', async () => {
@@ -451,7 +482,7 @@ describe('Post /groups/:groupId/invite', () => {
await inviter.post(`/groups/${party._id}/invite`, {
uuids: [userToInvite._id],
});
expect((await userToInvite.get('/user')).invitations.party.id).to.equal(party._id);
expect((await userToInvite.get('/user')).invitations.parties[0].id).to.equal(party._id);
});
it('allows 30 members in a party', async () => {

View File

@@ -1,10 +1,11 @@
import {
createAndPopulateGroup,
generateUser,
translate as t,
} from '../../../../helpers/api-v3-integration.helper';
describe('PUT /group', () => {
let leader, nonLeader, groupToUpdate;
let leader, nonLeader, groupToUpdate, adminUser;
let groupName = 'Test Public Guild';
let groupType = 'guild';
let groupUpdatedName = 'Test Public Guild Updated';
@@ -18,13 +19,13 @@ describe('PUT /group', () => {
},
members: 1,
});
adminUser = await generateUser({ 'contributor.admin': true });
groupToUpdate = group;
leader = groupLeader;
nonLeader = members[0];
});
it('returns an error when a non group leader tries to update', async () => {
it('returns an error when a user that is not an admin or group leader tries to update', async () => {
await expect(nonLeader.put(`/groups/${groupToUpdate._id}`, {
name: groupUpdatedName,
})).to.eventually.be.rejected.and.eql({
@@ -44,6 +45,29 @@ describe('PUT /group', () => {
expect(updatedGroup.name).to.equal(groupUpdatedName);
});
it('updates a group categories', async () => {
let categories = [{
slug: 'newCat',
name: 'New Category',
}];
let updatedGroup = await leader.put(`/groups/${groupToUpdate._id}`, {
categories,
});
expect(updatedGroup.categories[0].slug).to.eql(categories[0].slug);
expect(updatedGroup.categories[0].name).to.eql(categories[0].name);
});
it('allows an admin to update a guild', async () => {
let updatedGroup = await adminUser.put(`/groups/${groupToUpdate._id}`, {
name: groupUpdatedName,
});
expect(updatedGroup.leader._id).to.eql(leader._id);
expect(updatedGroup.leader.profile.name).to.eql(leader.profile.name);
expect(updatedGroup.name).to.equal(groupUpdatedName);
});
it('allows a leader to change leaders', async () => {
let updatedGroup = await leader.put(`/groups/${groupToUpdate._id}`, {
name: groupUpdatedName,

View File

@@ -0,0 +1,64 @@
import {
generateUser,
translate as t,
} from '../../../../helpers/api-v3-integration.helper';
import { v4 as generateUUID } from 'uuid';
describe('GET /members/:toUserId/objections/:interaction', () => {
let user;
before(async () => {
user = await generateUser();
});
it('validates req.params.memberId', async () => {
await expect(
user.get('/members/invalidUUID/objections/send-private-message')
).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('handles non-existing members', async () => {
let dummyId = generateUUID();
await expect(
user.get(`/members/${dummyId}/objections/send-private-message`)
).to.eventually.be.rejected.and.eql({
code: 404,
error: 'NotFound',
message: t('userWithIDNotFound', {userId: dummyId}),
});
});
it('handles non-existing interactions', async () => {
let receiver = await generateUser();
await expect(
user.get(`/members/${receiver._id}/objections/hug-a-whole-forest-of-trees`)
).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('returns an empty array if there are no objections', async () => {
let receiver = await generateUser();
await expect(
user.get(`/members/${receiver._id}/objections/send-private-message`)
).to.eventually.be.fulfilled.and.eql([]);
});
it('returns an array of objections if any exist', async () => {
let receiver = await generateUser({'inbox.blocks': [user._id]});
await expect(
user.get(`/members/${receiver._id}/objections/send-private-message`)
).to.eventually.be.fulfilled.and.eql([
t('notAuthorizedToSendMessageToThisUser'),
]);
});
});

View File

@@ -82,6 +82,20 @@ describe('POST /members/send-private-message', () => {
});
});
it('returns an error when chat privileges are revoked', async () => {
let userWithChatRevoked = await generateUser({'flags.chatRevoked': true});
let receiver = await generateUser();
await expect(userWithChatRevoked.post('/members/send-private-message', {
message: messageToSend,
toUserId: receiver._id,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('chatPrivilegesRevoked'),
});
});
it('sends a private message to a user', async () => {
let receiver = await generateUser();

View File

@@ -43,7 +43,7 @@ describe('POST /members/transfer-gems', () => {
});
});
it('returns error when to user is not found', async () => {
it('returns error when recipient is not found', async () => {
await expect(userToSendMessage.post('/members/transfer-gems', {
message,
gemAmount,
@@ -55,7 +55,7 @@ describe('POST /members/transfer-gems', () => {
});
});
it('returns error when to user attempts to send gems to themselves', async () => {
it('returns error when user attempts to send gems to themselves', async () => {
await expect(userToSendMessage.post('/members/transfer-gems', {
message,
gemAmount,
@@ -67,6 +67,64 @@ describe('POST /members/transfer-gems', () => {
});
});
it('returns error when recipient has blocked the sender', async () => {
let receiverWhoBlocksUser = await generateUser({'inbox.blocks': [userToSendMessage._id]});
await expect(userToSendMessage.post('/members/transfer-gems', {
message,
gemAmount,
toUserId: receiverWhoBlocksUser._id,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('notAuthorizedToSendMessageToThisUser'),
});
});
it('returns error when sender has blocked recipient', async () => {
let sender = await generateUser({'inbox.blocks': [receiver._id]});
await expect(sender.post('/members/transfer-gems', {
message,
gemAmount,
toUserId: receiver._id,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('notAuthorizedToSendMessageToThisUser'),
});
});
it('returns an error when chat privileges are revoked', async () => {
let userWithChatRevoked = await generateUser({'flags.chatRevoked': true});
await expect(userWithChatRevoked.post('/members/transfer-gems', {
message,
gemAmount,
toUserId: receiver._id,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('chatPrivilegesRevoked'),
});
});
it('works when only the recipient\'s chat privileges are revoked', async () => {
let receiverWithChatRevoked = await generateUser({'flags.chatRevoked': true});
await expect(userToSendMessage.post('/members/transfer-gems', {
message,
gemAmount,
toUserId: receiverWithChatRevoked._id,
})).to.eventually.be.fulfilled;
let updatedReceiver = await receiverWithChatRevoked.get('/user');
let updatedSender = await userToSendMessage.get('/user');
expect(updatedReceiver.balance).to.equal(gemAmount / 4);
expect(updatedSender.balance).to.equal(0);
});
it('returns error when there is no gemAmount', async () => {
await expect(userToSendMessage.post('/members/transfer-gems', {
message,
@@ -144,7 +202,7 @@ describe('POST /members/transfer-gems', () => {
expect(updatedSender.balance).to.equal(0);
});
it('does not requrie a message', async () => {
it('does not require a message', async () => {
await userToSendMessage.post('/members/transfer-gems', {
gemAmount,
toUserId: receiver._id,

View File

@@ -6,7 +6,7 @@ import superagent from 'superagent';
import nconf from 'nconf';
const API_TEST_SERVER_PORT = nconf.get('PORT');
describe('GET /qr-code/user/:memberId', () => {
xdescribe('GET /qr-code/user/:memberId', () => {
let user;
before(async () => {

View File

@@ -0,0 +1,25 @@
import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
describe('GET /shops/backgrounds', () => {
let user;
beforeEach(async () => {
user = await generateUser();
});
it('returns a valid shop object', async () => {
let shop = await user.get('/shops/backgrounds');
expect(shop.identifier).to.equal('backgroundShop');
expect(shop.text).to.eql(t('backgroundShop'));
expect(shop.notes).to.eql(t('backgroundShopText'));
expect(shop.imageName).to.equal('background_shop');
expect(shop.sets).to.be.an('array');
let sets = shop.sets.map(set => set.identifier);
expect(sets).to.include('incentiveBackgrounds');
expect(sets).to.include('backgrounds062014');
});
});

View File

@@ -1,3 +1,4 @@
import moment from 'moment';
import {
generateUser,
} from '../../../../helpers/api-integration/v3';
@@ -12,7 +13,7 @@ describe('GET /tasks/user', () => {
it('returns all user\'s tasks', async () => {
let createdTasks = await user.post('/tasks/user', [{text: 'test habit', type: 'habit'}, {text: 'test todo', type: 'todo'}]);
let tasks = await user.get('/tasks/user');
expect(tasks.length).to.equal(createdTasks.length + 1); // + 1 because 1 is a default task
expect(tasks.length).to.equal(createdTasks.length + 1); // Plus one for generated todo
});
it('returns only a type of user\'s tasks if req.query.type is specified', async () => {
@@ -127,4 +128,106 @@ describe('GET /tasks/user', () => {
let allCompletedTodos = await user.get('/tasks/user?type=_allCompletedTodos');
expect(allCompletedTodos.length).to.equal(numberOfTodos);
});
it('returns dailies with isDue for the date specified', async () => {
// @TODO Add required format
let startDate = moment().subtract('1', 'days').toISOString();
let createdTasks = await user.post('/tasks/user', [
{
text: 'test daily',
type: 'daily',
startDate,
frequency: 'daily',
everyX: 2,
},
]);
let dailys = await user.get('/tasks/user?type=dailys');
expect(dailys.length).to.be.at.least(1);
expect(dailys[0]._id).to.equal(createdTasks._id);
expect(dailys[0].isDue).to.be.false;
let dailys2 = await user.get(`/tasks/user?type=dailys&dueDate=${startDate}`);
expect(dailys2[0]._id).to.equal(createdTasks._id);
expect(dailys2[0].isDue).to.be.true;
});
xit('returns dailies with isDue for the date specified and will add CDS offset if time is not supplied and assumes timezones', async () => {
let timezone = 420;
await user.update({
'preferences.dayStart': 0,
'preferences.timezoneOffset': timezone,
});
let startDate = moment().zone(timezone).subtract('4', 'days').startOf('day').toISOString();
await user.post('/tasks/user', [
{
text: 'test daily',
type: 'daily',
startDate,
frequency: 'daily',
everyX: 2,
},
]);
let today = moment().format('YYYY-MM-DD');
let dailys = await user.get(`/tasks/user?type=dailys&dueDate=${today}`);
expect(dailys[0].isDue).to.be.true;
let yesterday = moment().subtract('1', 'days').format('YYYY-MM-DD');
let dailys2 = await user.get(`/tasks/user?type=dailys&dueDate=${yesterday}`);
expect(dailys2[0].isDue).to.be.false;
});
xit('returns dailies with isDue for the date specified and will add CDS offset if time is not supplied and assumes timezones', async () => {
let timezone = 240;
await user.update({
'preferences.dayStart': 0,
'preferences.timezoneOffset': timezone,
});
let startDate = moment().zone(timezone).subtract('4', 'days').startOf('day').toISOString();
await user.post('/tasks/user', [
{
text: 'test daily',
type: 'daily',
startDate,
frequency: 'daily',
everyX: 2,
},
]);
let today = moment().format('YYYY-MM-DD');
let dailys = await user.get(`/tasks/user?type=dailys&dueDate=${today}`);
expect(dailys[0].isDue).to.be.true;
let yesterday = moment().subtract('1', 'days').format('YYYY-MM-DD');
let dailys2 = await user.get(`/tasks/user?type=dailys&dueDate=${yesterday}`);
expect(dailys2[0].isDue).to.be.false;
});
xit('returns dailies with isDue for the date specified and will add CDS offset if time is not supplied and assumes timezones', async () => {
let timezone = 540;
await user.update({
'preferences.dayStart': 0,
'preferences.timezoneOffset': timezone,
});
let startDate = moment().zone(timezone).subtract('4', 'days').startOf('day').toISOString();
await user.post('/tasks/user', [
{
text: 'test daily',
type: 'daily',
startDate,
frequency: 'daily',
everyX: 2,
},
]);
let today = moment().format('YYYY-MM-DD');
let dailys = await user.get(`/tasks/user?type=dailys&dueDate=${today}`);
expect(dailys[0].isDue).to.be.true;
let yesterday = moment().subtract('1', 'days').format('YYYY-MM-DD');
let dailys2 = await user.get(`/tasks/user?type=dailys&dueDate=${yesterday}`);
expect(dailys2[0].isDue).to.be.false;
});
});

View File

@@ -215,6 +215,13 @@ describe('POST /tasks/:id/score/:direction', () => {
expect(task.isDue).to.equal(true);
});
it('computes nextDue', async () => {
await user.post(`/tasks/${daily._id}/score/up`);
let task = await user.get(`/tasks/${daily._id}`);
expect(task.nextDue.length).to.eql(6);
});
it('scores up daily even if it is already completed'); // Yes?
it('scores down daily even if it is already uncompleted'); // Yes?

View File

@@ -0,0 +1,109 @@
import {
generateUser,
generateGroup,
generateChallenge,
translate as t,
} from '../../../../helpers/api-integration/v3';
describe('POST /tasks/unlink-all/:challengeId', () => {
let user;
let guild;
let challenge;
let tasksToTest = {
habit: {
text: 'test habit',
type: 'habit',
up: false,
down: true,
},
todo: {
text: 'test todo',
type: 'todo',
},
daily: {
text: 'test daily',
type: 'daily',
frequency: 'daily',
everyX: 5,
startDate: new Date(),
},
reward: {
text: 'test reward',
type: 'reward',
},
};
beforeEach(async () => {
user = await generateUser();
guild = await generateGroup(user);
challenge = await generateChallenge(user, guild);
});
it('fails if no keep query', async () => {
await expect(user.post(`/tasks/unlink-all/${challenge._id}`))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('fails if invalid challenge id', async () => {
await expect(user.post('/tasks/unlink-all/123?keep=remove-all'))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('fails on an unbroken challenge', async () => {
await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.daily);
await expect(user.post(`/tasks/unlink-all/${challenge._id}?keep=remove-all`))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('cantOnlyUnlinkChalTask'),
});
});
it('unlinks all tasks from a challenge and deletes them on keep=remove-all', async () => {
const daily = await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.daily);
await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.habit);
await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.reward);
await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.todo);
await user.del(`/challenges/${challenge._id}`);
const response = await user.post(`/tasks/unlink-all/${challenge._id}?keep=remove-all`);
expect(response).to.eql({});
await expect(user.get(`/tasks/${daily._id}`)).to.eventually.be.rejected.and.eql({
code: 404,
error: 'NotFound',
message: t('taskNotFound'),
});
});
it('unlinks a task from a challenge on keep=keep-all', async () => {
const daily = await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.daily);
const anotherUser = await generateUser();
await user.post(`/groups/${guild._id}/invite`, {
uuids: [anotherUser._id],
});
// Have the second user join the group and challenge
await anotherUser.post(`/groups/${guild._id}/join`);
await anotherUser.post(`/challenges/${challenge._id}/join`);
// Have the leader delete the challenge and unlink the tasks
await user.del(`/challenges/${challenge._id}`);
await user.post(`/tasks/unlink-all/${challenge._id}?keep=keep-all`);
// Get the task for the second user
const [, anotherUserTask] = await anotherUser.get('/tasks/user');
// Expect the second user to still have the task, but unlinked
expect(anotherUserTask.challenge).to.eql({
taskId: daily._id,
id: challenge._id,
shortName: challenge.shortName,
broken: 'CHALLENGE_DELETED',
winner: null,
});
});
});

View File

@@ -0,0 +1,110 @@
import {
generateUser,
generateGroup,
generateChallenge,
translate as t,
} from '../../../../helpers/api-integration/v3';
import { v4 as generateUUID } from 'uuid';
describe('POST /tasks/unlink-one/:taskId', () => {
let user;
let guild;
let challenge;
let tasksToTest = {
habit: {
text: 'test habit',
type: 'habit',
up: false,
down: true,
},
todo: {
text: 'test todo',
type: 'todo',
},
daily: {
text: 'test daily',
type: 'daily',
frequency: 'daily',
everyX: 5,
startDate: new Date(),
},
reward: {
text: 'test reward',
type: 'reward',
},
};
beforeEach(async () => {
user = await generateUser();
guild = await generateGroup(user);
challenge = await generateChallenge(user, guild);
});
it('fails if no keep query', async () => {
const daily = await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.daily);
await expect(user.post(`/tasks/unlink-one/${daily._id}`))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('fails if invalid task id', async () => {
await expect(user.post('/tasks/unlink-one/123?keep=remove'))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('fails on task not found', async () => {
await expect(user.post(`/tasks/unlink-one/${generateUUID()}?keep=keep`))
.to.eventually.be.rejected.and.eql({
code: 404,
error: 'NotFound',
message: t('taskNotFound'),
});
});
it('fails on task unlinked to challenge', async () => {
let daily = await user.post('/tasks/user', tasksToTest.daily);
await expect(user.post(`/tasks/unlink-one/${daily._id}?keep=keep`))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('cantOnlyUnlinkChalTask'),
});
});
it('fails on unbroken challenge', async () => {
await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.daily);
let [daily] = await user.get('/tasks/user');
await expect(user.post(`/tasks/unlink-one/${daily._id}?keep=keep`))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('cantOnlyUnlinkChalTask'),
});
});
it('unlinks a task from a challenge and saves it on keep=keep', async () => {
await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.daily);
let [, daily] = await user.get('/tasks/user');
await user.del(`/challenges/${challenge._id}`);
await user.post(`/tasks/unlink-one/${daily._id}?keep=keep`);
[, daily] = await user.get('/tasks/user');
expect(daily.challenge).to.eql({});
});
it('unlinks a task from a challenge and deletes it on keep=remove', async () => {
await user.post(`/tasks/challenge/${challenge._id}`, tasksToTest.daily);
let [, daily] = await user.get('/tasks/user');
await user.del(`/challenges/${challenge._id}`);
await user.post(`/tasks/unlink-one/${daily._id}?keep=remove`);
const tasks = await user.get('/tasks/user');
// Only the default task should remain
expect(tasks.length).to.eql(1);
});
});

View File

@@ -131,8 +131,9 @@ describe('POST /tasks/user', () => {
expect(task.updatedAt).not.to.equal('tomorrow');
expect(task.challenge).not.to.equal('no');
expect(task.completed).to.equal(false);
expect(task.streak).not.to.equal('never');
expect(task.dateCompleted).not.to.equal('never');
expect(task.value).not.to.equal(324);
expect(task.yesterDaily).to.equal(true);
});
it('ignores invalid fields', async () => {
@@ -510,6 +511,7 @@ describe('POST /tasks/user', () => {
expect(task.weeksOfMonth).to.eql([3]);
expect(new Date(task.startDate)).to.eql(now);
expect(task.isDue).to.be.true;
expect(task.nextDue.length).to.eql(6);
});
it('creates multiple dailys', async () => {
@@ -614,6 +616,18 @@ describe('POST /tasks/user', () => {
expect((new Date(task.startDate)).getDay()).to.eql(today);
});
it('returns an error if the start date is empty', async () => {
await expect(user.post('/tasks/user', {
text: 'test daily',
type: 'daily',
startDate: '',
})).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: 'daily validation failed',
});
});
it('can create checklists', async () => {
let task = await user.post('/tasks/user', {
text: 'test daily',

View File

@@ -396,6 +396,7 @@ describe('PUT /tasks/:id', () => {
notes: 'some new notes',
frequency: 'daily',
everyX: 5,
yesterDaily: false,
startDate: moment().add(1, 'days').toDate(),
});
@@ -404,6 +405,8 @@ describe('PUT /tasks/:id', () => {
expect(savedDaily.frequency).to.eql('daily');
expect(savedDaily.everyX).to.eql(5);
expect(savedDaily.isDue).to.be.false;
expect(savedDaily.nextDue.length).to.eql(6);
expect(savedDaily.yesterDaily).to.be.false;
});
it('can update checklists (replace it)', async () => {

View File

@@ -16,214 +16,336 @@ import {
sha1MakeSalt,
sha1Encrypt as sha1EncryptPassword,
} from '../../../../../website/server/libs/password';
import * as email from '../../../../../website/server/libs/email';
const DELETE_CONFIRMATION = 'DELETE';
describe('DELETE /user', () => {
let user;
let password = 'password'; // from habitrpg/test/helpers/api-integration/v3/object-generators.js
beforeEach(async () => {
user = await generateUser({balance: 10});
});
it('returns an errors if password is wrong', async () => {
await expect(user.del('/user', {
password: 'wrong-password',
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('wrongPassword'),
});
});
it('returns an error if user has active subscription', async () => {
let userWithSubscription = await generateUser({'purchased.plan.customerId': 'fake-customer-id'});
await expect(userWithSubscription.del('/user', {
password,
})).to.be.rejected.and.to.eventually.eql({
code: 401,
error: 'NotAuthorized',
message: t('cannotDeleteActiveAccount'),
});
});
it('deletes the user\'s tasks', async () => {
// gets the user's tasks ids
let ids = [];
each(user.tasksOrder, (idsForOrder) => {
ids.push(...idsForOrder);
});
expect(ids.length).to.be.above(0); // make sure the user has some task to delete
await user.del('/user', {
password,
});
await Bluebird.all(map(ids, id => {
return expect(checkExistence('tasks', id)).to.eventually.eql(false);
}));
});
it('reduces memberCount in challenges user is linked to', async () => {
let populatedGroup = await createAndPopulateGroup({
members: 2,
});
let group = populatedGroup.group;
let authorizedUser = populatedGroup.members[1];
let challenge = await generateChallenge(populatedGroup.groupLeader, group);
await authorizedUser.post(`/challenges/${challenge._id}/join`);
await challenge.sync();
expect(challenge.memberCount).to.eql(2);
await authorizedUser.del('/user', {
password,
});
await challenge.sync();
expect(challenge.memberCount).to.eql(1);
});
it('deletes the user', async () => {
await user.del('/user', {
password,
});
await expect(checkExistence('users', user._id)).to.eventually.eql(false);
});
it('deletes the user with a legacy sha1 password', async () => {
let textPassword = 'mySecretPassword';
let salt = sha1MakeSalt();
let sha1HashedPassword = sha1EncryptPassword(textPassword, salt);
await user.update({
'auth.local.hashed_password': sha1HashedPassword,
'auth.local.passwordHashMethod': 'sha1',
'auth.local.salt': salt,
});
await user.sync();
expect(user.auth.local.passwordHashMethod).to.equal('sha1');
expect(user.auth.local.salt).to.equal(salt);
expect(user.auth.local.hashed_password).to.equal(sha1HashedPassword);
// delete the user
await user.del('/user', {
password: textPassword,
});
await expect(checkExistence('users', user._id)).to.eventually.eql(false);
});
context('last member of a party', () => {
let party;
context('user with local auth', async () => {
beforeEach(async () => {
party = await generateGroup(user, {
type: 'party',
privacy: 'private',
user = await generateUser({balance: 10});
});
it('returns an error if password is wrong', async () => {
await expect(user.del('/user', {
password: 'wrong-password',
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('wrongPassword'),
});
});
it('deletes party when user is the only member', async () => {
it('returns an error if password is not supplied', async () => {
await expect(user.del('/user', {
password: '',
})).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('missingPassword'),
});
});
it('deletes the user', async () => {
await user.del('/user', {
password,
});
await expect(checkExistence('party', party._id)).to.eventually.eql(false);
await expect(checkExistence('users', user._id)).to.eventually.eql(false);
});
});
context('last member of a private guild', () => {
let privateGuild;
it('returns an error if excessive feedback is supplied', async () => {
let feedbackText = 'spam feedback ';
let feedback = feedbackText;
while (feedback.length < 10000) {
feedback = feedback + feedbackText;
}
beforeEach(async () => {
privateGuild = await generateGroup(user, {
type: 'guild',
privacy: 'private',
await expect(user.del('/user', {
password,
feedback,
})).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: 'Account deletion feedback is limited to 10,000 characters. For lengthy feedback, email admin@habitica.com.',
});
});
it('deletes guild when user is the only member', async () => {
it('returns an error if user has active subscription', async () => {
let userWithSubscription = await generateUser({'purchased.plan.customerId': 'fake-customer-id'});
await expect(userWithSubscription.del('/user', {
password,
})).to.be.rejected.and.to.eventually.eql({
code: 401,
error: 'NotAuthorized',
message: t('cannotDeleteActiveAccount'),
});
});
it('deletes the user\'s tasks', async () => {
await user.post('/tasks/user', {
text: 'test habit',
type: 'habit',
});
await user.sync();
// gets the user's tasks ids
let ids = [];
each(user.tasksOrder, (idsForOrder) => {
ids.push(...idsForOrder);
});
expect(ids.length).to.be.above(0); // make sure the user has some task to delete
await user.del('/user', {
password,
});
await expect(checkExistence('groups', privateGuild._id)).to.eventually.eql(false);
await Bluebird.all(map(ids, id => {
return expect(checkExistence('tasks', id)).to.eventually.eql(false);
}));
});
});
context('groups user is leader of', () => {
let guild, oldLeader, newLeader;
beforeEach(async () => {
let { group, groupLeader, members } = await createAndPopulateGroup({
groupDetails: {
type: 'guild',
privacy: 'public',
},
members: 1,
it('reduces memberCount in challenges user is linked to', async () => {
let populatedGroup = await createAndPopulateGroup({
members: 2,
});
guild = group;
newLeader = members[0];
oldLeader = groupLeader;
});
let group = populatedGroup.group;
let authorizedUser = populatedGroup.members[1];
it('chooses new group leader for any group user was the leader of', async () => {
await oldLeader.del('/user', {
let challenge = await generateChallenge(populatedGroup.groupLeader, group);
await authorizedUser.post(`/challenges/${challenge._id}/join`);
await challenge.sync();
expect(challenge.memberCount).to.eql(2);
await authorizedUser.del('/user', {
password,
});
let updatedGuild = await newLeader.get(`/groups/${guild._id}`);
await challenge.sync();
expect(updatedGuild.leader).to.exist;
expect(updatedGuild.leader._id).to.not.eql(oldLeader._id);
});
});
context('groups user is a part of', () => {
let group1, group2, userToDelete, otherUser;
beforeEach(async () => {
userToDelete = await generateUser({balance: 10});
group1 = await generateGroup(userToDelete, {
type: 'guild',
privacy: 'public',
});
let {group, members} = await createAndPopulateGroup({
groupDetails: {
type: 'guild',
privacy: 'public',
},
members: 3,
});
group2 = group;
otherUser = members[0];
await userToDelete.post(`/groups/${group2._id}/join`);
expect(challenge.memberCount).to.eql(1);
});
it('removes user from all groups user was a part of', async () => {
await userToDelete.del('/user', {
it('sends feedback to the admin email', async () => {
sandbox.spy(email, 'sendTxn');
let feedback = 'Reasons for Deletion';
await user.del('/user', {
password,
feedback,
});
expect(email.sendTxn).to.be.calledOnce;
sandbox.restore();
});
it('does not send email if no feedback is supplied', async () => {
sandbox.spy(email, 'sendTxn');
await user.del('/user', {
password,
});
let updatedGroup1Members = await otherUser.get(`/groups/${group1._id}/members`);
let updatedGroup2Members = await otherUser.get(`/groups/${group2._id}/members`);
let userInGroup = find(updatedGroup2Members, (member) => {
return member._id === userToDelete._id;
expect(email.sendTxn).to.not.be.called;
sandbox.restore();
});
it('deletes the user with a legacy sha1 password', async () => {
let textPassword = 'mySecretPassword';
let salt = sha1MakeSalt();
let sha1HashedPassword = sha1EncryptPassword(textPassword, salt);
await user.update({
'auth.local.hashed_password': sha1HashedPassword,
'auth.local.passwordHashMethod': 'sha1',
'auth.local.salt': salt,
});
expect(updatedGroup1Members).to.be.empty;
expect(updatedGroup2Members).to.not.be.empty;
expect(userInGroup).to.not.exist;
await user.sync();
expect(user.auth.local.passwordHashMethod).to.equal('sha1');
expect(user.auth.local.salt).to.equal(salt);
expect(user.auth.local.hashed_password).to.equal(sha1HashedPassword);
// delete the user
await user.del('/user', {
password: textPassword,
});
await expect(checkExistence('users', user._id)).to.eventually.eql(false);
});
context('last member of a party', () => {
let party;
beforeEach(async () => {
party = await generateGroup(user, {
type: 'party',
privacy: 'private',
});
});
it('deletes party when user is the only member', async () => {
await user.del('/user', {
password,
});
await expect(checkExistence('party', party._id)).to.eventually.eql(false);
});
});
context('last member of a private guild', () => {
let privateGuild;
beforeEach(async () => {
privateGuild = await generateGroup(user, {
type: 'guild',
privacy: 'private',
});
});
it('deletes guild when user is the only member', async () => {
await user.del('/user', {
password,
});
await expect(checkExistence('groups', privateGuild._id)).to.eventually.eql(false);
});
});
context('groups user is leader of', () => {
let guild, oldLeader, newLeader;
beforeEach(async () => {
let { group, groupLeader, members } = await createAndPopulateGroup({
groupDetails: {
type: 'guild',
privacy: 'public',
},
members: 1,
});
guild = group;
newLeader = members[0];
oldLeader = groupLeader;
});
it('chooses new group leader for any group user was the leader of', async () => {
await oldLeader.del('/user', {
password,
});
let updatedGuild = await newLeader.get(`/groups/${guild._id}`);
expect(updatedGuild.leader).to.exist;
expect(updatedGuild.leader._id).to.not.eql(oldLeader._id);
});
});
context('groups user is a part of', () => {
let group1, group2, userToDelete, otherUser;
beforeEach(async () => {
userToDelete = await generateUser({balance: 10});
group1 = await generateGroup(userToDelete, {
type: 'guild',
privacy: 'public',
});
let {group, members} = await createAndPopulateGroup({
groupDetails: {
type: 'guild',
privacy: 'public',
},
members: 3,
});
group2 = group;
otherUser = members[0];
await userToDelete.post(`/groups/${group2._id}/join`);
});
it('removes user from all groups user was a part of', async () => {
await userToDelete.del('/user', {
password,
});
let updatedGroup1Members = await otherUser.get(`/groups/${group1._id}/members`);
let updatedGroup2Members = await otherUser.get(`/groups/${group2._id}/members`);
let userInGroup = find(updatedGroup2Members, (member) => {
return member._id === userToDelete._id;
});
expect(updatedGroup1Members).to.be.empty;
expect(updatedGroup2Members).to.not.be.empty;
expect(userInGroup).to.not.exist;
});
});
});
context('user with Facebook auth', async () => {
beforeEach(async () => {
user = await generateUser({
auth: {
facebook: {
id: 'facebook-id',
},
},
});
});
it('returns an error if confirmation phrase is wrong', async () => {
await expect(user.del('/user', {
password: 'just-do-it',
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('incorrectDeletePhrase'),
});
});
it('returns an error if confirmation phrase is not supplied', async () => {
await expect(user.del('/user', {
password: '',
})).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('missingPassword'),
});
});
it('deletes a Facebook user', async () => {
await user.del('/user', {
password: DELETE_CONFIRMATION,
});
await expect(checkExistence('users', user._id)).to.eventually.eql(false);
});
});
context('user with Google auth', async () => {
beforeEach(async () => {
user = await generateUser({
auth: {
google: {
id: 'google-id',
},
},
});
});
it('deletes a Google user', async () => {
await user.del('/user', {
password: DELETE_CONFIRMATION,
});
await expect(checkExistence('users', user._id)).to.eventually.eql(false);
});
});
});

View File

@@ -82,7 +82,7 @@ describe('GET /user/anonymized', () => {
});
// tasks
expect(tasks2).to.exist;
expect(tasks2.length).to.eql(5); // +1 because generateUser() assigns one todo
expect(tasks2.length).to.eql(5);
expect(tasks2[0].checklist).to.exist;
_.forEach(tasks2, (task) => {
expect(task.text).to.eql('task text');

View File

@@ -221,6 +221,27 @@ describe('POST /user/class/cast/:spellId', () => {
expect(syncedGroupTask.value).to.equal(0);
});
it('increases both user\'s achievement values', async () => {
let party = await createAndPopulateGroup({
members: 1,
});
let leader = party.groupLeader;
let recipient = party.members[0];
await leader.update({'stats.gp': 10});
await leader.post(`/user/class/cast/birthday?targetId=${recipient._id}`);
await leader.sync();
await recipient.sync();
expect(leader.achievements.birthday).to.equal(1);
expect(recipient.achievements.birthday).to.equal(1);
});
it('only increases user\'s achievement one if target == caster', async () => {
await user.update({'stats.gp': 10});
await user.post(`/user/class/cast/birthday?targetId=${user._id}`);
await user.sync();
expect(user.achievements.birthday).to.equal(1);
});
// TODO find a way to have sinon working in integration tests
// it doesn't work when tests are running separately from server
it('passes correct target to spell when targetType === \'task\'');

View File

@@ -1,5 +1,6 @@
import {
generateUser,
createAndPopulateGroup,
translate as t,
} from '../../../../helpers/api-integration/v3';
@@ -31,4 +32,70 @@ describe('POST /user/purchase/:type/:key', () => {
expect(user.items[type][key]).to.equal(1);
});
it('can convert gold to gems if subscribed', async () => {
let oldBalance = user.balance;
await user.update({
'purchased.plan.customerId': 'group-plan',
'stats.gp': 1000,
});
await user.post('/user/purchase/gems/gem');
await user.sync();
expect(user.balance).to.equal(oldBalance + 0.25);
});
it('leader can convert gold to gems even if the group plan prevents it', async () => {
let { group, groupLeader } = await createAndPopulateGroup({
groupDetails: {
name: 'test',
type: 'guild',
privacy: 'private',
},
});
await group.update({
'leaderOnly.getGems': true,
'purchased.plan.customerId': 123,
});
await groupLeader.sync();
let oldBalance = groupLeader.balance;
await groupLeader.update({
'purchased.plan.customerId': 'group-plan',
'stats.gp': 1000,
});
await groupLeader.post('/user/purchase/gems/gem');
await groupLeader.sync();
expect(groupLeader.balance).to.equal(oldBalance + 0.25);
});
it('cannot convert gold to gems if the group plan prevents it', async () => {
let { group, members } = await createAndPopulateGroup({
groupDetails: {
name: 'test',
type: 'guild',
privacy: 'private',
},
members: 1,
});
await group.update({
'leaderOnly.getGems': true,
'purchased.plan.customerId': 123,
});
let oldBalance = members[0].balance;
await members[0].update({
'purchased.plan.customerId': 'group-plan',
'stats.gp': 1000,
});
await expect(members[0].post('/user/purchase/gems/gem'))
.to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('groupPolicyCannotGetGems'),
});
await members[0].sync();
expect(members[0].balance).to.equal(oldBalance);
});
});

View File

@@ -2,17 +2,34 @@ import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
import content from '../../../../../website/common/script/content/index';
describe('POST /user/release-both', () => {
let user;
let animal = 'Wolf-Base';
const loadPets = () => {
let pets = {};
for (let p in content.pets) {
pets[p] = content.pets[p];
pets[p] = 5;
}
return pets;
};
const loadMounts = () => {
let mounts = {};
for (let m in content.pets) {
mounts[m] = content.pets[m];
mounts[m] = true;
}
return mounts;
};
beforeEach(async () => {
user = await generateUser({
'items.currentMount': animal,
'items.currentPet': animal,
'items.pets': {animal: 5},
'items.mounts': {animal: true},
'items.pets': loadPets(),
'items.mounts': loadMounts(),
});
});

View File

@@ -2,15 +2,25 @@ import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
import content from '../../../../../website/common/script/content/index';
describe('POST /user/release-mounts', () => {
let user;
let animal = 'Wolf-Base';
const loadMounts = () => {
let mounts = {};
for (let m in content.pets) {
mounts[m] = content.pets[m];
mounts[m] = true;
}
return mounts;
};
beforeEach(async () => {
user = await generateUser({
'items.currentMount': animal,
'items.mounts': {animal: true},
'items.mounts': loadMounts(),
});
});

View File

@@ -2,15 +2,25 @@ import {
generateUser,
translate as t,
} from '../../../../helpers/api-integration/v3';
import content from '../../../../../website/common/script/content/index';
describe('POST /user/release-pets', () => {
let user;
let animal = 'Wolf-Base';
const loadPets = () => {
let pets = {};
for (let p in content.pets) {
pets[p] = content.pets[p];
pets[p] = 5;
}
return pets;
};
beforeEach(async () => {
user = await generateUser({
'items.currentPet': animal,
'items.pets': {animal: 5},
'items.pets': loadPets(),
});
});

View File

@@ -10,43 +10,31 @@ import nconf from 'nconf';
const API_TEST_SERVER_PORT = nconf.get('PORT');
describe('GET /user/auth/local/reset-password-set-new-one', () => {
// @TODO skipped because on travis the client isn't available and the redirect fails
xdescribe('GET /user/auth/local/reset-password-set-new-one', () => {
let endpoint = `http://localhost:${API_TEST_SERVER_PORT}/static/user/auth/local/reset-password-set-new-one`;
// Tests to validate the validatePasswordResetCodeAndFindUser function
it('renders an error page if the code is missing', async () => {
try {
await superagent.get(endpoint);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
const res = await superagent.get(endpoint);
expect(res.req.path.indexOf('hasError=true') !== -1).to.equal(true);
});
it('renders an error page if the code is invalid json', async () => {
try {
await superagent.get(`${endpoint}?code=invalid`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
const res = await superagent.get(`${endpoint}?code=invalid`);
expect(res.req.path.indexOf('hasError=true') !== -1).to.equal(true);
});
it('renders an error page if the code cannot be decrypted', async () => {
let user = await generateUser();
try {
let code = JSON.stringify({ // not encrypted
userId: user._id,
expiresAt: new Date(),
});
await superagent.get(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
let code = JSON.stringify({ // not encrypted
userId: user._id,
expiresAt: new Date(),
});
const res = await superagent.get(`${endpoint}?code=${code}`);
expect(res.req.path.indexOf('hasError=true') !== -1).to.equal(true);
});
it('renders an error page if the code is expired', async () => {
@@ -60,12 +48,8 @@ describe('GET /user/auth/local/reset-password-set-new-one', () => {
'auth.local.passwordResetCode': code,
});
try {
await superagent.get(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
const res = await superagent.get(`${endpoint}?code=${code}`);
expect(res.req.path.indexOf('hasError=true') !== -1).to.equal(true);
});
it('renders an error page if the user does not exist', async () => {
@@ -74,12 +58,8 @@ describe('GET /user/auth/local/reset-password-set-new-one', () => {
expiresAt: moment().add({days: 1}),
}));
try {
await superagent.get(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
const res = await superagent.get(`${endpoint}?code=${code}`);
expect(res.req.path.indexOf('hasError=true') !== -1).to.equal(true);
});
it('renders an error page if the user has no local auth', async () => {
@@ -93,12 +73,8 @@ describe('GET /user/auth/local/reset-password-set-new-one', () => {
auth: 'not an object with valid fields',
});
try {
await superagent.get(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
const res = await superagent.get(`${endpoint}?code=${code}`);
expect(res.req.path.indexOf('hasError=true') !== -1).to.equal(true);
});
it('renders an error page if the code doesn\'t match the one saved at user.auth.passwordResetCode', async () => {
@@ -112,12 +88,8 @@ describe('GET /user/auth/local/reset-password-set-new-one', () => {
'auth.local.passwordResetCode': 'invalid',
});
try {
await superagent.get(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
const res = await superagent.get(`${endpoint}?code=${code}`);
expect(res.req.path.indexOf('hasError=true') !== -1).to.equal(true);
});
//
@@ -134,7 +106,8 @@ describe('GET /user/auth/local/reset-password-set-new-one', () => {
});
let res = await superagent.get(`${endpoint}?code=${code}`);
expect(res.status).to.equal(200);
expect(res.req.path.indexOf('hasError=false') !== -1).to.equal(true);
expect(res.req.path.indexOf('code=') !== -1).to.equal(true);
});
});

View File

@@ -10,49 +10,46 @@ import {
import moment from 'moment';
import {
generateUser,
requester,
translate as t,
} from '../../../../../helpers/api-integration/v3';
import superagent from 'superagent';
import nconf from 'nconf';
const API_TEST_SERVER_PORT = nconf.get('PORT');
describe('POST /user/auth/local/reset-password-set-new-one', () => {
let endpoint = `http://localhost:${API_TEST_SERVER_PORT}/static/user/auth/local/reset-password-set-new-one`;
describe('POST /user/auth/reset-password-set-new-one', () => {
const endpoint = '/user/auth/reset-password-set-new-one';
const api = requester();
// Tests to validate the validatePasswordResetCodeAndFindUser function
it('renders an error page if the code is missing', async () => {
try {
await superagent.post(endpoint);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(endpoint)).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('invalidPasswordResetCode'),
});
});
it('renders an error page if the code is invalid json', async () => {
try {
await superagent.post(`${endpoint}?code=invalid`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(`${endpoint}?code=invalid`)).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('invalidPasswordResetCode'),
});
});
it('renders an error page if the code cannot be decrypted', async () => {
let user = await generateUser();
try {
let code = JSON.stringify({ // not encrypted
userId: user._id,
expiresAt: new Date(),
});
await superagent.post(`${endpoint}?code=${code}`);
let code = JSON.stringify({ // not encrypted
userId: user._id,
expiresAt: new Date(),
});
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(`${endpoint}`, {
code,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('invalidPasswordResetCode'),
});
});
it('renders an error page if the code is expired', async () => {
@@ -66,12 +63,13 @@ describe('POST /user/auth/local/reset-password-set-new-one', () => {
'auth.local.passwordResetCode': code,
});
try {
await superagent.post(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(`${endpoint}`, {
code,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('invalidPasswordResetCode'),
});
});
it('renders an error page if the user does not exist', async () => {
@@ -80,12 +78,13 @@ describe('POST /user/auth/local/reset-password-set-new-one', () => {
expiresAt: moment().add({days: 1}),
}));
try {
await superagent.post(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(`${endpoint}`, {
code,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('invalidPasswordResetCode'),
});
});
it('renders an error page if the user has no local auth', async () => {
@@ -99,12 +98,13 @@ describe('POST /user/auth/local/reset-password-set-new-one', () => {
auth: 'not an object with valid fields',
});
try {
await superagent.post(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(`${endpoint}`, {
code,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('invalidPasswordResetCode'),
});
});
it('renders an error page if the code doesn\'t match the one saved at user.auth.passwordResetCode', async () => {
@@ -118,12 +118,13 @@ describe('POST /user/auth/local/reset-password-set-new-one', () => {
'auth.local.passwordResetCode': 'invalid',
});
try {
await superagent.post(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(`${endpoint}`, {
code,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('invalidPasswordResetCode'),
});
});
//
@@ -139,12 +140,13 @@ describe('POST /user/auth/local/reset-password-set-new-one', () => {
'auth.local.passwordResetCode': code,
});
try {
await superagent.post(`${endpoint}?code=${code}`);
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(`${endpoint}`, {
code,
})).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('renders the error page if the password confirmation is missing', async () => {
@@ -158,14 +160,14 @@ describe('POST /user/auth/local/reset-password-set-new-one', () => {
'auth.local.passwordResetCode': code,
});
try {
await superagent
.post(`${endpoint}?code=${code}`)
.send({newPassword: 'my new password'});
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(`${endpoint}`, {
newPassword: 'my new password',
code,
})).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('invalidReqParams'),
});
});
it('renders the error page if the password confirmation does not match', async () => {
@@ -179,17 +181,15 @@ describe('POST /user/auth/local/reset-password-set-new-one', () => {
'auth.local.passwordResetCode': code,
});
try {
await superagent
.post(`${endpoint}?code=${code}`)
.send({
newPassword: 'my new password',
confirmPassword: 'not matching',
});
throw new Error('Request should fail.');
} catch (err) {
expect(err.status).to.equal(401);
}
await expect(api.post(`${endpoint}`, {
newPassword: 'my new password',
confirmPassword: 'not matching',
code,
})).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('passwordConfirmationMatch'),
});
});
it('renders the success page and save the user', async () => {
@@ -203,14 +203,13 @@ describe('POST /user/auth/local/reset-password-set-new-one', () => {
'auth.local.passwordResetCode': code,
});
let res = await superagent
.post(`${endpoint}?code=${code}`)
.send({
newPassword: 'my new password',
confirmPassword: 'my new password',
});
let res = await api.post(`${endpoint}`, {
newPassword: 'my new password',
confirmPassword: 'my new password',
code,
});
expect(res.status).to.equal(200);
expect(res.message).to.equal(t('passwordChangeSuccess'));
await user.sync();
expect(user.auth.local.passwordResetCode).to.equal(undefined);
@@ -246,14 +245,13 @@ describe('POST /user/auth/local/reset-password-set-new-one', () => {
'auth.local.passwordResetCode': code,
});
let res = await superagent
.post(`${endpoint}?code=${code}`)
.send({
newPassword: 'my new password',
confirmPassword: 'my new password',
});
let res = await api.post(`${endpoint}`, {
newPassword: 'my new password',
confirmPassword: 'my new password',
code,
});
expect(res.status).to.equal(200);
expect(res.message).to.equal(t('passwordChangeSuccess'));
await user.sync();
expect(user.auth.local.passwordResetCode).to.equal(undefined);

View File

@@ -59,13 +59,8 @@ describe('POST /user/auth/local/register', () => {
let tags = await requests.get('/tags');
expect(habits).to.have.a.lengthOf(0);
expect(dailys).to.have.a.lengthOf(0);
expect(todos).to.have.a.lengthOf(1);
expect(todos[0].text).to.eql(t('defaultTodo1Text'));
expect(todos[0].notes).to.eql(t('defaultTodoNotes'));
expect(rewards).to.have.a.lengthOf(0);
expect(tags).to.have.a.lengthOf(7);
@@ -78,7 +73,7 @@ describe('POST /user/auth/local/register', () => {
expect(tags[6].name).to.eql(t('defaultTag7'));
});
it('for Web', async () => {
xit('for Web', async () => {
api = requester(
null,
{'x-client': 'habitica-web'},
@@ -129,7 +124,9 @@ describe('POST /user/auth/local/register', () => {
expect(tags[5].name).to.eql(t('defaultTag6'));
expect(tags[6].name).to.eql(t('defaultTag7'));
});
});
context('does not provide default tags and tasks', async () => {
it('for Android', async () => {
api = requester(
null,
@@ -154,34 +151,11 @@ describe('POST /user/auth/local/register', () => {
let rewards = await requests.get('/tasks/user?type=rewards');
let tags = await requests.get('/tags');
expect(habits).to.have.a.lengthOf(2);
expect(habits[0].text).to.eql(t('defaultHabit4Text'));
expect(habits[0].notes).to.eql(t('defaultHabit4Notes'));
expect(habits[1].text).to.eql(t('defaultHabit5Text'));
expect(habits[1].notes).to.eql(t('defaultHabit5Notes'));
expect(dailys).to.have.a.lengthOf(1);
expect(dailys[0].text).to.eql(t('defaultDaily1Text'));
expect(dailys[0].notes).to.eql('');
expect(todos).to.have.a.lengthOf(2);
expect(todos[0].text).to.eql(t('defaultTodo1Text'));
expect(todos[0].notes).to.eql(t('defaultTodoNotes'));
expect(todos[1].text).to.eql(t('defaultTodo2Text'));
expect(todos[1].notes).to.eql(t('defaultTodo2Notes'));
expect(rewards).to.have.a.lengthOf(1);
expect(rewards[0].text).to.eql(t('defaultReward2Text'));
expect(rewards[0].notes).to.eql(t('defaultReward2Notes'));
expect(tags).to.have.a.lengthOf(7);
expect(tags[0].name).to.eql(t('defaultTag1'));
expect(tags[1].name).to.eql(t('defaultTag2'));
expect(tags[2].name).to.eql(t('defaultTag3'));
expect(tags[3].name).to.eql(t('defaultTag4'));
expect(tags[4].name).to.eql(t('defaultTag5'));
expect(tags[5].name).to.eql(t('defaultTag6'));
expect(tags[6].name).to.eql(t('defaultTag7'));
expect(habits).to.have.a.lengthOf(0);
expect(dailys).to.have.a.lengthOf(0);
expect(todos).to.have.a.lengthOf(0);
expect(rewards).to.have.a.lengthOf(0);
expect(tags).to.have.a.lengthOf(0);
});
it('for iOS', async () => {
@@ -208,34 +182,11 @@ describe('POST /user/auth/local/register', () => {
let rewards = await requests.get('/tasks/user?type=rewards');
let tags = await requests.get('/tags');
expect(habits).to.have.a.lengthOf(2);
expect(habits[0].text).to.eql(t('defaultHabit4Text'));
expect(habits[0].notes).to.eql(t('defaultHabit4Notes'));
expect(habits[1].text).to.eql(t('defaultHabit5Text'));
expect(habits[1].notes).to.eql(t('defaultHabit5Notes'));
expect(dailys).to.have.a.lengthOf(1);
expect(dailys[0].text).to.eql(t('defaultDaily1Text'));
expect(dailys[0].notes).to.eql('');
expect(todos).to.have.a.lengthOf(2);
expect(todos[0].text).to.eql(t('defaultTodo1Text'));
expect(todos[0].notes).to.eql(t('defaultTodoNotes'));
expect(todos[1].text).to.eql(t('defaultTodo2Text'));
expect(todos[1].notes).to.eql(t('defaultTodo2Notes'));
expect(rewards).to.have.a.lengthOf(1);
expect(rewards[0].text).to.eql(t('defaultReward2Text'));
expect(rewards[0].notes).to.eql(t('defaultReward2Notes'));
expect(tags).to.have.a.lengthOf(7);
expect(tags[0].name).to.eql(t('defaultTag1'));
expect(tags[1].name).to.eql(t('defaultTag2'));
expect(tags[2].name).to.eql(t('defaultTag3'));
expect(tags[3].name).to.eql(t('defaultTag4'));
expect(tags[4].name).to.eql(t('defaultTag5'));
expect(tags[5].name).to.eql(t('defaultTag6'));
expect(tags[6].name).to.eql(t('defaultTag7'));
expect(habits).to.have.a.lengthOf(0);
expect(dailys).to.have.a.lengthOf(0);
expect(todos).to.have.a.lengthOf(0);
expect(rewards).to.have.a.lengthOf(0);
expect(tags).to.have.a.lengthOf(0);
});
});
@@ -509,7 +460,73 @@ describe('POST /user/auth/local/register', () => {
confirmPassword: password,
});
expect(user.invitations.party).to.eql({
expect(user.invitations.parties[0].id).to.eql(group._id);
expect(user.invitations.parties[0].name).to.eql(group.name);
expect(user.invitations.parties[0].inviter).to.eql(groupLeader._id);
});
it('awards achievement to inviter', async () => {
let { group, groupLeader } = await createAndPopulateGroup({
groupDetails: { type: 'party', privacy: 'private' },
});
let invite = encrypt(JSON.stringify({
id: group._id,
inviter: groupLeader._id,
sentAt: Date.now(),
}));
await api.post(`/user/auth/local/register?groupInvite=${invite}`, {
username,
email,
password,
confirmPassword: password,
});
await groupLeader.sync();
expect(groupLeader.achievements.invitedFriend).to.be.true;
});
it('user not added to a party on expired invite', async () => {
let { group, groupLeader } = await createAndPopulateGroup({
groupDetails: { type: 'party', privacy: 'private' },
});
let invite = encrypt(JSON.stringify({
id: group._id,
inviter: groupLeader._id,
sentAt: Date.now() - 6.912e8, // 8 days old
}));
let user = await api.post(`/user/auth/local/register?groupInvite=${invite}`, {
username,
email,
password,
confirmPassword: password,
});
expect(user.invitations.party).to.eql({});
});
it('adds a user to a guild on an invite of type other than party', async () => {
let { group, groupLeader } = await createAndPopulateGroup({
groupDetails: { type: 'guild', privacy: 'private' },
});
let invite = encrypt(JSON.stringify({
id: group._id,
inviter: groupLeader._id,
sentAt: Date.now(),
}));
let user = await api.post(`/user/auth/local/register?groupInvite=${invite}`, {
username,
email,
password,
confirmPassword: password,
});
expect(user.invitations.guilds[0]).to.eql({
id: group._id,
name: group.name,
inviter: groupLeader._id,
@@ -601,10 +618,10 @@ describe('POST /user/auth/local/register', () => {
confirmPassword: password,
});
expect(user.tasksOrder.todos).to.not.be.empty;
expect(user.tasksOrder.todos).to.be.empty;
expect(user.tasksOrder.dailys).to.be.empty;
expect(user.tasksOrder.habits).to.not.be.empty;
expect(user.tasksOrder.rewards).to.not.be.empty;
expect(user.tasksOrder.habits).to.be.empty;
expect(user.tasksOrder.rewards).to.be.empty;
});
it('populates user with default tags', async () => {
@@ -631,23 +648,8 @@ describe('POST /user/auth/local/register', () => {
let habits = await requests.get('/tasks/user?type=habits');
let todos = await requests.get('/tasks/user?type=todos');
function findTag (tagName) {
let tag = user.tags.find((userTag) => {
return userTag.name === t(tagName);
});
return tag.id;
}
expect(habits[0].tags).to.have.a.lengthOf(3);
expect(habits[0].tags).to.include.members(['defaultTag1', 'defaultTag4', 'defaultTag6'].map(findTag));
expect(habits[1].tags).to.have.a.lengthOf(1);
expect(habits[1].tags).to.include.members(['defaultTag3'].map(findTag));
expect(habits[2].tags).to.have.a.lengthOf(2);
expect(habits[2].tags).to.include.members(['defaultTag2', 'defaultTag3'].map(findTag));
expect(todos[0].tags).to.have.a.lengthOf(0);
expect(habits).to.have.a.lengthOf(0);
expect(todos).to.have.a.lengthOf(0);
});
});
});

View File

@@ -102,6 +102,7 @@ describe('Amazon Payments', () => {
});
it('should purchase gems', async () => {
sinon.stub(user, 'canGetGems').returnsPromise().resolves(true);
await amzLib.checkout({user, orderReferenceId, headers});
expect(paymentBuyGemsStub).to.be.calledOnce;
@@ -111,22 +112,52 @@ describe('Amazon Payments', () => {
headers,
});
expectAmazonStubs();
expect(user.canGetGems).to.be.calledOnce;
user.canGetGems.restore();
});
it('should gift gems', async () => {
it('should error if gem amount is too low', async () => {
let receivingUser = new User();
receivingUser.save();
let gift = {
type: 'gems',
gems: {
amount: 16,
amount: 0,
uuid: receivingUser._id,
},
};
await expect(amzLib.checkout({gift, user, orderReferenceId, headers}))
.to.eventually.be.rejected.and.to.eql({
httpCode: 400,
message: 'Amount must be at least 1.',
name: 'BadRequest',
});
});
it('should error if user cannot get gems gems', async () => {
sinon.stub(user, 'canGetGems').returnsPromise().resolves(false);
await expect(amzLib.checkout({user, orderReferenceId, headers})).to.eventually.be.rejected.and.to.eql({
httpCode: 401,
message: i18n.t('groupPolicyCannotGetGems'),
name: 'NotAuthorized',
});
user.canGetGems.restore();
});
it('should gift gems', async () => {
let receivingUser = new User();
await receivingUser.save();
let gift = {
type: 'gems',
uuid: receivingUser._id,
gems: {
amount: 16,
},
};
amount = 16 / 4;
await amzLib.checkout({gift, user, orderReferenceId, headers});
gift.member = receivingUser;
expect(paymentBuyGemsStub).to.be.calledOnce;
expect(paymentBuyGemsStub).to.be.calledWith({
user,
@@ -525,6 +556,7 @@ describe('Amazon Payments', () => {
nextBill: moment(user.purchased.plan.lastBillingDate).add({ days: subscriptionLength }),
paymentMethod: amzLib.constants.PAYMENT_METHOD,
headers,
cancellationReason: undefined,
});
expectAmazonStubs();
});
@@ -555,6 +587,7 @@ describe('Amazon Payments', () => {
nextBill: moment(user.purchased.plan.lastBillingDate).add({ days: subscriptionLength }),
paymentMethod: amzLib.constants.PAYMENT_METHOD,
headers,
cancellationReason: undefined,
});
amzLib.closeBillingAgreement.restore();
});
@@ -593,6 +626,7 @@ describe('Amazon Payments', () => {
nextBill: moment(group.purchased.plan.lastBillingDate).add({ days: subscriptionLength }),
paymentMethod: amzLib.constants.PAYMENT_METHOD,
headers,
cancellationReason: undefined,
});
expectAmazonStubs();
});
@@ -623,6 +657,7 @@ describe('Amazon Payments', () => {
nextBill: moment(group.purchased.plan.lastBillingDate).add({ days: subscriptionLength }),
paymentMethod: amzLib.constants.PAYMENT_METHOD,
headers,
cancellationReason: undefined,
});
amzLib.closeBillingAgreement.restore();
});

View File

@@ -57,7 +57,20 @@ describe('Apple Payments', () => {
});
});
it('errors if the user cannot purchase gems', async () => {
sinon.stub(user, 'canGetGems').returnsPromise().resolves(false);
await expect(applePayments.verifyGemPurchase(user, receipt, headers))
.to.eventually.be.rejected.and.to.eql({
httpCode: 401,
name: 'NotAuthorized',
message: i18n.t('groupPolicyCannotGetGems'),
});
user.canGetGems.restore();
});
it('purchases gems', async () => {
sinon.stub(user, 'canGetGems').returnsPromise().resolves(true);
await applePayments.verifyGemPurchase(user, receipt, headers);
expect(iapSetupStub).to.be.calledOnce;
@@ -74,6 +87,8 @@ describe('Apple Payments', () => {
amount: 5.25,
headers,
});
expect(user.canGetGems).to.be.calledOnce;
user.canGetGems.restore();
});
});

View File

@@ -79,6 +79,13 @@ describe('cron', () => {
expect(user.purchased.plan.gemsBought).to.equal(0);
});
it('resets plan.gemsBought on a new month if user does not have purchased.plan.dateUpdated', () => {
user.purchased.plan.gemsBought = 10;
user.purchased.plan.dateUpdated = undefined;
cron({user, tasksByType, daysMissed, analytics});
expect(user.purchased.plan.gemsBought).to.equal(0);
});
it('does not reset plan.gemsBought within the month', () => {
let clock = sinon.useFakeTimers(moment().startOf('month').add(2, 'days').unix());
user.purchased.plan.dateUpdated = moment().startOf('month').toDate();
@@ -313,6 +320,24 @@ describe('cron', () => {
expect(tasksByType.dailys[0].completed).to.be.false;
expect(user.stats.hp).to.equal(healthBefore);
});
it('sets isDue for daily', () => {
let daily = {
text: 'test daily',
type: 'daily',
frequency: 'daily',
everyX: 5,
startDate: new Date(),
};
let task = new Tasks.daily(Tasks.Task.sanitize(daily)); // eslint-disable-line new-cap
tasksByType.dailys.push(task);
tasksByType.dailys[0].completed = true;
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.dailys[0].isDue).to.be.exist;
});
});
describe('todos', () => {
@@ -366,6 +391,14 @@ describe('cron', () => {
expect(tasksByType.dailys[0].isDue).to.be.false;
});
it('computes nextDue', () => {
tasksByType.dailys[0].frequency = 'daily';
tasksByType.dailys[0].everyX = 5;
tasksByType.dailys[0].startDate = moment().add(1, 'days').toDate();
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.dailys[0].nextDue.length).to.eql(6);
});
it('should add history', () => {
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.dailys[0].history).to.be.lengthOf(1);
@@ -450,6 +483,25 @@ describe('cron', () => {
expect(progress.down).to.equal(-1);
});
it('should do damage for only yesterday\'s dailies', () => {
daysMissed = 3;
tasksByType.dailys[0].startDate = moment(new Date()).subtract({days: 1});
let daily = {
text: 'test daily',
type: 'daily',
};
let task = new Tasks.daily(Tasks.Task.sanitize(daily)); // eslint-disable-line new-cap
tasksByType.dailys.push(task);
tasksByType.dailys[1].startDate = moment(new Date()).subtract({days: 2});
tasksByType.dailys[1].everyX = 2;
tasksByType.dailys[1].frequency = 'daily';
cron({user, tasksByType, daysMissed, analytics});
expect(user.stats.hp).to.equal(48);
});
});
describe('habits', () => {
@@ -514,6 +566,17 @@ describe('cron', () => {
expect(tasksByType.habits[0].counterDown).to.equal(0);
});
it('should reset habit counters even if user is resting in the Inn', () => {
user.preferences.sleep = true;
tasksByType.habits[0].counterUp = 1;
tasksByType.habits[0].counterDown = 1;
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(0);
expect(tasksByType.habits[0].counterDown).to.equal(0);
});
it('should reset a weekly habit counter each Monday', () => {
tasksByType.habits[0].frequency = 'weekly';
tasksByType.habits[0].counterUp = 1;
@@ -533,6 +596,114 @@ describe('cron', () => {
expect(tasksByType.habits[0].counterDown).to.equal(0);
});
it('should reset a weekly habit counter with custom daily start', () => {
clock.restore();
// Server clock: Monday 12am UTC
let monday = new Date('May 22, 2017 00:00:00 GMT').getTime();
clock = sinon.useFakeTimers(monday);
// cron runs at 2am
user.preferences.dayStart = 2;
tasksByType.habits[0].frequency = 'weekly';
tasksByType.habits[0].counterUp = 1;
tasksByType.habits[0].counterDown = 1;
daysMissed = 1;
// should not reset
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(1);
expect(tasksByType.habits[0].counterDown).to.equal(1);
clock.restore();
// Server clock: Monday 3am UTC
monday = new Date('May 22, 2017 03:00:00 GMT').getTime();
clock = sinon.useFakeTimers(monday);
// should reset after user CDS
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(0);
expect(tasksByType.habits[0].counterDown).to.equal(0);
});
it('should not reset a weekly habit counter when server tz is Monday but user\'s tz is Tuesday', () => {
clock.restore();
// Server clock: Monday 11pm UTC
let monday = new Date('May 22, 2017 23:00:00 GMT').getTime();
clock = sinon.useFakeTimers(monday);
// User clock: Tuesday 1am UTC + 2
user.preferences.timezoneOffset = -120;
tasksByType.habits[0].frequency = 'weekly';
tasksByType.habits[0].counterUp = 1;
tasksByType.habits[0].counterDown = 1;
daysMissed = 1;
// should not reset
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(1);
expect(tasksByType.habits[0].counterDown).to.equal(1);
// User missed one cron, which will subtract User clock back to Monday 1am UTC + 2
// should reset
daysMissed = 2;
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(0);
expect(tasksByType.habits[0].counterDown).to.equal(0);
});
it('should reset a weekly habit counter when server tz is Sunday but user\'s tz is Monday', () => {
clock.restore();
// Server clock: Sunday 11pm UTC
let sunday = new Date('May 21, 2017 23:00:00 GMT').getTime();
clock = sinon.useFakeTimers(sunday);
// User clock: Monday 2am UTC + 3
user.preferences.timezoneOffset = -180;
tasksByType.habits[0].frequency = 'weekly';
tasksByType.habits[0].counterUp = 1;
tasksByType.habits[0].counterDown = 1;
daysMissed = 1;
// should reset
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(0);
expect(tasksByType.habits[0].counterDown).to.equal(0);
});
it('should not reset a weekly habit counter when server tz is Monday but user\'s tz is Sunday', () => {
clock.restore();
// Server clock: Monday 2am UTC
let monday = new Date('May 22, 2017 02:00:00 GMT').getTime();
clock = sinon.useFakeTimers(monday);
// User clock: Sunday 11pm UTC - 3
user.preferences.timezoneOffset = 180;
tasksByType.habits[0].frequency = 'weekly';
tasksByType.habits[0].counterUp = 1;
tasksByType.habits[0].counterDown = 1;
daysMissed = 1;
// should not reset
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(1);
expect(tasksByType.habits[0].counterDown).to.equal(1);
});
it('should reset a monthly habit counter the first day of each month', () => {
tasksByType.habits[0].frequency = 'monthly';
tasksByType.habits[0].counterUp = 1;
@@ -551,6 +722,59 @@ describe('cron', () => {
expect(tasksByType.habits[0].counterUp).to.equal(0);
expect(tasksByType.habits[0].counterDown).to.equal(0);
});
it('should reset a monthly habit counter when server tz is last day of month but user tz is first day of the month', () => {
clock.restore();
daysMissed = 0;
// Server clock: 4/30/17 11pm UTC
let monday = new Date('April 30, 2017 23:00:00 GMT').getTime();
clock = sinon.useFakeTimers(monday);
// User clock: 5/1/17 2am UTC + 3
user.preferences.timezoneOffset = -180;
tasksByType.habits[0].frequency = 'monthly';
tasksByType.habits[0].counterUp = 1;
tasksByType.habits[0].counterDown = 1;
daysMissed = 1;
// should reset
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(0);
expect(tasksByType.habits[0].counterDown).to.equal(0);
});
it('should not reset a monthly habit counter when server tz is first day of month but user tz is 2nd day of the month', () => {
clock.restore();
// Server clock: 5/1/17 11pm UTC
let monday = new Date('May 1, 2017 23:00:00 GMT').getTime();
clock = sinon.useFakeTimers(monday);
// User clock: 5/2/17 2am UTC + 3
user.preferences.timezoneOffset = -180;
tasksByType.habits[0].frequency = 'monthly';
tasksByType.habits[0].counterUp = 1;
tasksByType.habits[0].counterDown = 1;
daysMissed = 1;
// should not reset
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(1);
expect(tasksByType.habits[0].counterDown).to.equal(1);
// User missed one day, which will subtract User clock back to 5/1/17 2am UTC + 3
// should reset
daysMissed = 2;
cron({user, tasksByType, daysMissed, analytics});
expect(tasksByType.habits[0].counterUp).to.equal(0);
expect(tasksByType.habits[0].counterDown).to.equal(0);
});
});
});

View File

@@ -142,12 +142,12 @@ describe('emails', () => {
describe('getGroupUrl', () => {
it('returns correct url if group is the tavern', () => {
let getGroupUrl = require(pathToEmailLib).getGroupUrl;
expect(getGroupUrl({_id: TAVERN_ID, type: 'guild'})).to.eql('/#/options/groups/tavern');
expect(getGroupUrl({_id: TAVERN_ID, type: 'guild'})).to.eql('/groups/tavern');
});
it('returns correct url if group is a guild', () => {
let getGroupUrl = require(pathToEmailLib).getGroupUrl;
expect(getGroupUrl({_id: 'random _id', type: 'guild'})).to.eql('/#/options/groups/guilds/random _id');
expect(getGroupUrl({_id: 'random _id', type: 'guild'})).to.eql('/groups/guild/random _id');
});
it('returns correct url if group is a party', () => {

View File

@@ -63,7 +63,21 @@ describe('Google Payments', () => {
});
});
it('should throw an error if user cannot purchase gems', async () => {
sinon.stub(user, 'canGetGems').returnsPromise().resolves(false);
await expect(googlePayments.verifyGemPurchase(user, receipt, signature, headers))
.to.eventually.be.rejected.and.to.eql({
httpCode: 401,
name: 'NotAuthorized',
message: i18n.t('groupPolicyCannotGetGems'),
});
user.canGetGems.restore();
});
it('purchases gems', async () => {
sinon.stub(user, 'canGetGems').returnsPromise().resolves(true);
await googlePayments.verifyGemPurchase(user, receipt, signature, headers);
expect(iapSetupStub).to.be.calledOnce;
@@ -82,6 +96,8 @@ describe('Google Payments', () => {
amount: 5.25,
headers,
});
expect(user.canGetGems).to.be.calledOnce;
user.canGetGems.restore();
});
});

View File

@@ -16,6 +16,7 @@ describe('payments/index', () => {
beforeEach(async () => {
user = new User();
user.profile.name = 'sender';
await user.save();
group = generateGroup({
name: 'test group',
@@ -504,6 +505,18 @@ describe('payments/index', () => {
expect(daysTillTermination).to.be.within(13, 15);
});
it('terminates at next billing date even if dateUpdated is prior to now', async () => {
data.nextBill = moment().add({ days: 15 });
data.user.purchased.plan.dateUpdated = moment().subtract({ days: 10 });
await api.cancelSubscription(data);
let now = new Date();
let daysTillTermination = moment(user.purchased.plan.dateTerminated).diff(now, 'days');
expect(daysTillTermination).to.be.within(13, 15);
});
it('resets plan.extraMonths', async () => {
user.purchased.plan.extraMonths = 5;
@@ -653,5 +666,32 @@ describe('payments/index', () => {
expect(updatedUser.items.pets['Jackalope-RoyalPurple']).to.eql(5);
});
it('saves previously unused Mystery Items and Hourglasses for an expired subscription', async () => {
let planExpirationDate = new Date();
planExpirationDate.setDate(planExpirationDate.getDate() - 2);
let mysteryItem = 'item';
let mysteryItems = [mysteryItem];
let consecutive = {
trinkets: 3,
};
// set expired plan with unused items
plan.mysteryItems = mysteryItems;
plan.consecutive = consecutive;
plan.dateCreated = planExpirationDate;
plan.dateTerminated = planExpirationDate;
plan.customerId = null;
user.purchased.plan = plan;
await user.save();
await api.addSubToGroupUser(user, group);
let updatedUser = await User.findById(user._id).exec();
expect(updatedUser.purchased.plan.mysteryItems[0]).to.eql(mysteryItem);
expect(updatedUser.purchased.plan.consecutive.trinkets).to.equal(consecutive.trinkets);
});
});
});

View File

@@ -138,7 +138,7 @@ describe('Canceling a subscription for group', () => {
]);
});
it('prevents non group leader from manging subscription', async () => {
it('prevents non group leader from managing subscription', async () => {
let groupMember = new User();
data.user = groupMember;
data.groupId = group._id;

View File

@@ -1,5 +1,6 @@
import moment from 'moment';
import stripeModule from 'stripe';
import nconf from 'nconf';
import * as sender from '../../../../../../../website/server/libs/email';
import * as api from '../../../../../../../website/server/libs/payments';
@@ -12,17 +13,24 @@ import {
generateGroup,
} from '../../../../../../helpers/api-unit.helper.js';
describe('Purchasing a subscription for group', () => {
describe('Purchasing a group plan for group', () => {
const EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_GOOGLE = 'Google_subscription';
const EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_IOS = 'iOS_subscription';
const EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_NORMAL = 'normal_subscription';
const EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_NONE = 'no_subscription';
let plan, group, user, data;
let stripe = stripeModule('test');
let groupLeaderName = 'sender';
let groupName = 'test group';
beforeEach(async () => {
user = new User();
user.profile.name = 'sender';
user.profile.name = groupLeaderName;
await user.save();
group = generateGroup({
name: 'test group',
name: groupName,
type: 'guild',
privacy: 'public',
leader: user._id,
@@ -81,7 +89,7 @@ describe('Purchasing a subscription for group', () => {
sender.sendTxn.restore();
});
it('creates a subscription', async () => {
it('creates a group plan', async () => {
expect(group.purchased.plan.planId).to.not.exist;
data.groupId = group._id;
@@ -157,7 +165,7 @@ describe('Purchasing a subscription for group', () => {
expect(updatedLeader.items.mounts['Jackalope-RoyalPurple']).to.be.true;
});
it('sends an email to members of group', async () => {
it('sends an email to member of group who was not a subscriber', async () => {
let recipient = new User();
recipient.profile.name = 'recipient';
recipient.guilds.push(group._id);
@@ -169,11 +177,181 @@ describe('Purchasing a subscription for group', () => {
expect(sender.sendTxn).to.be.calledTwice;
expect(sender.sendTxn.firstCall.args[0]._id).to.equal(recipient._id);
expect(sender.sendTxn.firstCall.args[1]).to.equal('group-member-joining');
expect(sender.sendTxn.firstCall.args[1]).to.equal('group-member-join');
expect(sender.sendTxn.firstCall.args[2]).to.eql([
{name: 'LEADER', content: user.profile.name},
{name: 'GROUP_NAME', content: group.name},
{name: 'PREVIOUS_SUBSCRIPTION_TYPE', content: EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_NONE},
]);
// confirm that the other email sent is appropriate:
expect(sender.sendTxn.secondCall.args[0]._id).to.equal(group.leader);
expect(sender.sendTxn.secondCall.args[1]).to.equal('group-subscription-begins');
});
it('sends one email to subscribed member of group, stating subscription is cancelled (Stripe)', async () => {
let recipient = new User();
recipient.profile.name = 'recipient';
plan.key = 'basic_earned';
plan.paymentMethod = stripePayments.constants.PAYMENT_METHOD;
recipient.purchased.plan = plan;
recipient.guilds.push(group._id);
await recipient.save();
data.groupId = group._id;
await api.createSubscription(data);
expect(sender.sendTxn).to.be.calledTwice;
expect(sender.sendTxn.firstCall.args[0]._id).to.equal(recipient._id);
expect(sender.sendTxn.firstCall.args[1]).to.equal('group-member-join');
expect(sender.sendTxn.firstCall.args[2]).to.eql([
{name: 'LEADER', content: user.profile.name},
{name: 'GROUP_NAME', content: group.name},
{name: 'PREVIOUS_SUBSCRIPTION_TYPE', content: EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_NORMAL},
]);
// confirm that the other email sent is not a cancel-subscription email:
expect(sender.sendTxn.secondCall.args[0]._id).to.equal(group.leader);
expect(sender.sendTxn.secondCall.args[1]).to.equal('group-subscription-begins');
});
it('sends one email to subscribed member of group, stating subscription is cancelled (Amazon)', async () => {
sinon.stub(amzLib, 'getBillingAgreementDetails')
.returnsPromise()
.resolves({
BillingAgreementDetails: {
BillingAgreementStatus: {State: 'Closed'},
},
});
let recipient = new User();
recipient.profile.name = 'recipient';
plan.planId = 'basic_earned';
plan.paymentMethod = amzLib.constants.PAYMENT_METHOD;
recipient.purchased.plan = plan;
recipient.guilds.push(group._id);
await recipient.save();
data.groupId = group._id;
await api.createSubscription(data);
expect(sender.sendTxn).to.be.calledTwice;
expect(sender.sendTxn.firstCall.args[0]._id).to.equal(recipient._id);
expect(sender.sendTxn.firstCall.args[1]).to.equal('group-member-join');
expect(sender.sendTxn.firstCall.args[2]).to.eql([
{name: 'LEADER', content: user.profile.name},
{name: 'GROUP_NAME', content: group.name},
{name: 'PREVIOUS_SUBSCRIPTION_TYPE', content: EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_NORMAL},
]);
// confirm that the other email sent is not a cancel-subscription email:
expect(sender.sendTxn.secondCall.args[0]._id).to.equal(group.leader);
expect(sender.sendTxn.secondCall.args[1]).to.equal('group-subscription-begins');
amzLib.getBillingAgreementDetails.restore();
});
it('sends one email to subscribed member of group, stating subscription is cancelled (PayPal)', async () => {
sinon.stub(paypalPayments, 'paypalBillingAgreementCancel').returnsPromise().resolves({});
sinon.stub(paypalPayments, 'paypalBillingAgreementGet')
.returnsPromise().resolves({
agreement_details: { // eslint-disable-line camelcase
next_billing_date: moment().add(3, 'months').toDate(), // eslint-disable-line camelcase
cycles_completed: 1, // eslint-disable-line camelcase
},
});
let recipient = new User();
recipient.profile.name = 'recipient';
plan.planId = 'basic_earned';
plan.paymentMethod = paypalPayments.constants.PAYMENT_METHOD;
recipient.purchased.plan = plan;
recipient.guilds.push(group._id);
await recipient.save();
data.groupId = group._id;
await api.createSubscription(data);
expect(sender.sendTxn).to.be.calledTwice;
expect(sender.sendTxn.firstCall.args[0]._id).to.equal(recipient._id);
expect(sender.sendTxn.firstCall.args[1]).to.equal('group-member-join');
expect(sender.sendTxn.firstCall.args[2]).to.eql([
{name: 'LEADER', content: user.profile.name},
{name: 'GROUP_NAME', content: group.name},
{name: 'PREVIOUS_SUBSCRIPTION_TYPE', content: EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_NORMAL},
]);
// confirm that the other email sent is not a cancel-subscription email:
expect(sender.sendTxn.secondCall.args[0]._id).to.equal(group.leader);
expect(sender.sendTxn.secondCall.args[1]).to.equal('group-subscription-begins');
paypalPayments.paypalBillingAgreementGet.restore();
paypalPayments.paypalBillingAgreementCancel.restore();
});
it('sends appropriate emails when subscribed member of group must manually cancel recurring Android subscription', async () => {
const TECH_ASSISTANCE_EMAIL = nconf.get('TECH_ASSISTANCE_EMAIL');
plan.customerId = 'random';
plan.paymentMethod = api.constants.GOOGLE_PAYMENT_METHOD;
let recipient = new User();
recipient.profile.name = 'recipient';
recipient.purchased.plan = plan;
recipient.guilds.push(group._id);
await recipient.save();
user.guilds.push(group._id);
await user.save();
data.groupId = group._id;
await api.createSubscription(data);
expect(sender.sendTxn).to.be.calledFourTimes;
expect(sender.sendTxn.args[0][0]._id).to.equal(TECH_ASSISTANCE_EMAIL);
expect(sender.sendTxn.args[0][1]).to.equal('admin-user-subscription-details');
expect(sender.sendTxn.args[1][0]._id).to.equal(recipient._id);
expect(sender.sendTxn.args[1][1]).to.equal('group-member-join');
expect(sender.sendTxn.args[1][2]).to.eql([
{name: 'LEADER', content: groupLeaderName},
{name: 'GROUP_NAME', content: groupName},
{name: 'PREVIOUS_SUBSCRIPTION_TYPE', content: EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_GOOGLE},
]);
expect(sender.sendTxn.args[2][0]._id).to.equal(group.leader);
expect(sender.sendTxn.args[2][1]).to.equal('group-member-join');
expect(sender.sendTxn.args[3][0]._id).to.equal(group.leader);
expect(sender.sendTxn.args[3][1]).to.equal('group-subscription-begins');
});
it('sends appropriate emails when subscribed member of group must manually cancel recurring iOS subscription', async () => {
const TECH_ASSISTANCE_EMAIL = nconf.get('TECH_ASSISTANCE_EMAIL');
plan.customerId = 'random';
plan.paymentMethod = api.constants.IOS_PAYMENT_METHOD;
let recipient = new User();
recipient.profile.name = 'recipient';
recipient.purchased.plan = plan;
recipient.guilds.push(group._id);
await recipient.save();
user.guilds.push(group._id);
await user.save();
data.groupId = group._id;
await api.createSubscription(data);
expect(sender.sendTxn).to.be.calledFourTimes;
expect(sender.sendTxn.args[0][0]._id).to.equal(TECH_ASSISTANCE_EMAIL);
expect(sender.sendTxn.args[0][1]).to.equal('admin-user-subscription-details');
expect(sender.sendTxn.args[1][0]._id).to.equal(recipient._id);
expect(sender.sendTxn.args[1][1]).to.equal('group-member-join');
expect(sender.sendTxn.args[1][2]).to.eql([
{name: 'LEADER', content: groupLeaderName},
{name: 'GROUP_NAME', content: groupName},
{name: 'PREVIOUS_SUBSCRIPTION_TYPE', content: EMAIL_TEMPLATE_SUBSCRIPTION_TYPE_IOS},
]);
expect(sender.sendTxn.args[2][0]._id).to.equal(group.leader);
expect(sender.sendTxn.args[2][1]).to.equal('group-member-join');
expect(sender.sendTxn.args[3][0]._id).to.equal(group.leader);
expect(sender.sendTxn.args[3][1]).to.equal('group-subscription-begins');
});
it('adds months to members with existing gift subscription', async () => {
@@ -333,7 +511,7 @@ describe('Purchasing a subscription for group', () => {
});
it('adds months to members with existing recurring subscription (Android)');
it('adds months to members with existing recurring subscription (iOs)');
it('adds months to members with existing recurring subscription (iOS)');
it('adds months to members who already cancelled but not yet terminated recurring subscription', async () => {
let recipient = new User();
@@ -418,7 +596,7 @@ describe('Purchasing a subscription for group', () => {
let updatedUser = await User.findById(recipient._id).exec();
expect(updatedUser.purchased.plan.extraMonths).to.within(7, 8);
expect(updatedUser.purchased.plan.extraMonths).to.within(7, 9);
});
it('adds months to members with existing recurring subscription and ignores existing negative extraMonths', async () => {
@@ -603,7 +781,7 @@ describe('Purchasing a subscription for group', () => {
expect(updatedUser.purchased.plan.dateCreated).to.exist;
});
it('does not modify a user with a Google subscription', async () => {
it('does not modify a user with an Android subscription', async () => {
plan.customerId = 'random';
plan.paymentMethod = api.constants.GOOGLE_PAYMENT_METHOD;

View File

@@ -61,23 +61,54 @@ describe('Paypal Payments', () => {
});
it('creates a link for gem purchases', async () => {
let link = await paypalPayments.checkout();
let link = await paypalPayments.checkout({user: new User()});
expect(paypalPaymentCreateStub).to.be.calledOnce;
expect(paypalPaymentCreateStub).to.be.calledWith(getPaypalCreateOptions('Habitica Gems', 5.00));
expect(link).to.eql(approvalHerf);
});
it('creates a link for gifting gems', async () => {
it('should error if gem amount is too low', async () => {
let receivingUser = new User();
receivingUser.save();
let gift = {
type: 'gems',
gems: {
amount: 16,
amount: 0,
uuid: receivingUser._id,
},
};
await expect(paypalPayments.checkout({gift}))
.to.eventually.be.rejected.and.to.eql({
httpCode: 400,
message: 'Amount must be at least 1.',
name: 'BadRequest',
});
});
it('should error if the user cannot get gems', async () => {
let user = new User();
sinon.stub(user, 'canGetGems').returnsPromise().resolves(false);
await expect(paypalPayments.checkout({user})).to.eventually.be.rejected.and.to.eql({
httpCode: 401,
message: i18n.t('groupPolicyCannotGetGems'),
name: 'NotAuthorized',
});
});
it('creates a link for gifting gems', async () => {
let receivingUser = new User();
await receivingUser.save();
let gift = {
type: 'gems',
uuid: receivingUser._id,
gems: {
amount: 16,
},
};
let link = await paypalPayments.checkout({gift});
expect(paypalPaymentCreateStub).to.be.calledOnce;
@@ -447,6 +478,7 @@ describe('Paypal Payments', () => {
groupId,
paymentMethod: 'Paypal',
nextBill: nextBillingDate,
cancellationReason: undefined,
});
});
@@ -464,6 +496,7 @@ describe('Paypal Payments', () => {
groupId: group._id,
paymentMethod: 'Paypal',
nextBill: nextBillingDate,
cancellationReason: undefined,
});
});
});

View File

@@ -71,7 +71,7 @@ describe('slack', () => {
expect(IncomingWebhook.prototype.send).to.be.calledWithMatch({
attachments: [sandbox.match({
title: 'Flag in Some group',
title_link: sandbox.match(/.*\/#\/options\/groups\/guilds\/group-id/),
title_link: sandbox.match(/.*\/groups\/guild\/group-id/),
})],
});
});
@@ -86,7 +86,7 @@ describe('slack', () => {
expect(IncomingWebhook.prototype.send).to.be.calledWithMatch({
attachments: [sandbox.match({
title: 'Flag in Tavern',
title_link: sandbox.match(/.*\/#\/options\/groups\/tavern/),
title_link: sandbox.match(/.*\/groups\/tavern/),
})],
});
});

View File

@@ -48,7 +48,57 @@ describe('Stripe Payments', () => {
payments.createSubscription.restore();
});
it('should error if gem amount is too low', async () => {
let receivingUser = new User();
receivingUser.save();
gift = {
type: 'gems',
gems: {
amount: 0,
uuid: receivingUser._id,
},
};
await expect(stripePayments.checkout({
token,
user,
gift,
groupId,
email,
headers,
coupon,
}, stripe))
.to.eventually.be.rejected.and.to.eql({
httpCode: 400,
message: 'Amount must be at least 1.',
name: 'BadRequest',
});
});
it('should error if user cannot get gems', async () => {
gift = undefined;
sinon.stub(user, 'canGetGems').returnsPromise().resolves(false);
await expect(stripePayments.checkout({
token,
user,
gift,
groupId,
email,
headers,
coupon,
}, stripe)).to.eventually.be.rejected.and.to.eql({
httpCode: 401,
message: i18n.t('groupPolicyCannotGetGems'),
name: 'NotAuthorized',
});
});
it('should purchase gems', async () => {
gift = undefined;
sinon.stub(user, 'canGetGems').returnsPromise().resolves(true);
await stripePayments.checkout({
token,
user,
@@ -73,16 +123,18 @@ describe('Stripe Payments', () => {
paymentMethod: 'Stripe',
gift,
});
expect(user.canGetGems).to.be.calledOnce;
user.canGetGems.restore();
});
it('should gift gems', async () => {
let receivingUser = new User();
receivingUser.save();
await receivingUser.save();
gift = {
type: 'gems',
uuid: receivingUser._id,
gems: {
amount: 16,
uuid: receivingUser._id,
},
};
@@ -96,7 +148,6 @@ describe('Stripe Payments', () => {
coupon,
}, stripe);
gift.member = receivingUser;
expect(stripeChargeStub).to.be.calledOnce;
expect(stripeChargeStub).to.be.calledWith({
amount: '400',
@@ -683,6 +734,7 @@ describe('Stripe Payments', () => {
groupId: undefined,
nextBill: currentPeriodEndTimeStamp * 1000, // timestamp in seconds
paymentMethod: 'Stripe',
cancellationReason: undefined,
});
});
@@ -702,6 +754,7 @@ describe('Stripe Payments', () => {
groupId,
nextBill: currentPeriodEndTimeStamp * 1000, // timestamp in seconds
paymentMethod: 'Stripe',
cancellationReason: undefined,
});
});
});

View File

@@ -33,6 +33,7 @@ describe('response middleware', () => {
success: true,
data: {field: 1},
notifications: [],
userV: res.locals.user._v,
});
});
@@ -49,6 +50,7 @@ describe('response middleware', () => {
data: {field: 1},
message: 'hello',
notifications: [],
userV: res.locals.user._v,
});
});
@@ -64,12 +66,12 @@ describe('response middleware', () => {
success: false,
data: {field: 1},
notifications: [],
userV: res.locals.user._v,
});
});
it('returns userV if a user is authenticated req.query.userV is passed', () => {
it('returns userV if a user is authenticated', () => {
responseMiddleware(req, res, next);
req.query.userV = 3;
res.respond(200, {field: 1});
expect(res.json).to.be.calledOnce;
@@ -101,6 +103,7 @@ describe('response middleware', () => {
data: {},
},
],
userV: res.locals.user._v,
});
});
});

View File

@@ -228,7 +228,7 @@ describe('Group Model', () => {
});
it('applies damage only to participating members of party even under buggy conditions', async () => {
// stops unfair damage from mbugs like https://github.com/HabitRPG/habitrpg/issues/7653
// stops unfair damage from mbugs like https://github.com/HabitRPG/habitica/issues/7653
party.quest.members = {
[questLeader._id]: true,
[participatingMember._id]: true,

View File

@@ -1,6 +1,7 @@
import Bluebird from 'bluebird';
import moment from 'moment';
import { model as User } from '../../../../../website/server/models/user';
import { model as Group } from '../../../../../website/server/models/group';
import common from '../../../../../website/common';
describe('User Model', () => {
@@ -179,6 +180,75 @@ describe('User Model', () => {
});
});
context('canGetGems', () => {
let user;
let group;
beforeEach(() => {
user = new User();
let leader = new User();
group = new Group({
name: 'test',
type: 'guild',
privacy: 'private',
leader: leader._id,
});
});
it('returns true if user is not subscribed', async () => {
expect(await user.canGetGems()).to.equal(true);
});
it('returns true if user is not subscribed with a group plan', async () => {
user.purchased.plan.customerId = 123;
expect(await user.canGetGems()).to.equal(true);
});
it('returns true if user is subscribed with a group plan', async () => {
user.purchased.plan.customerId = 'group-plan';
expect(await user.canGetGems()).to.equal(true);
});
it('returns true if user is part of a group', async () => {
user.guilds.push(group._id);
expect(await user.canGetGems()).to.equal(true);
});
it('returns true if user is part of a group with a subscription', async () => {
user.guilds.push(group._id);
user.purchased.plan.customerId = 'group-plan';
group.purchased.plan.customerId = 123;
await group.save();
expect(await user.canGetGems()).to.equal(true);
});
it('returns true if leader is part of a group with a subscription and canGetGems: false', async () => {
user.guilds.push(group._id);
user.purchased.plan.customerId = 'group-plan';
group.purchased.plan.customerId = 123;
group.leader = user._id;
group.leaderOnly.getGems = true;
await group.save();
expect(await user.canGetGems()).to.equal(true);
});
it('returns true if user is part of a group with no subscription but canGetGems: false', async () => {
user.guilds.push(group._id);
user.purchased.plan.customerId = 'group-plan';
group.leaderOnly.getGems = true;
await group.save();
expect(await user.canGetGems()).to.equal(true);
});
it('returns false if user is part of a group with a subscription and canGetGems: false', async () => {
user.guilds.push(group._id);
user.purchased.plan.customerId = 'group-plan';
group.purchased.plan.customerId = 123;
group.leaderOnly.getGems = true;
await group.save();
expect(await user.canGetGems()).to.equal(false);
});
});
context('hasNotCancelled', () => {
let user;
beforeEach(() => {

View File

@@ -112,6 +112,41 @@ describe('Groups Controller', function() {
});
});
describe('isAbleToEditGroup', () => {
var guild;
beforeEach(() => {
user.contributor = {};
guild = specHelper.newGroup({
_id: 'unique-guild-id',
type: 'guild',
members: ['not-user-id'],
$save: sandbox.spy(),
});
});
it('returns true if user is an admin', () => {
guild.leader = 'not-user-id';
user.contributor.admin = true;
expect(scope.isAbleToEditGroup(guild)).to.be.ok;
});
it('returns true if user is group leader', () => {
guild.leader = {_id: user._id}
expect(scope.isAbleToEditGroup(guild)).to.be.ok;
});
it('returns false is user is not a leader or admin', () => {
expect(scope.isAbleToEditGroup(guild)).to.not.be.ok;
});
it('returns false is user is an admin but group is a party', () => {
guild.type = 'party';
user.contributor.admin = true;
expect(scope.isAbleToEditGroup(guild)).to.not.be.ok;
});
});
describe('editGroup', () => {
var guild;

View File

@@ -1,63 +1,63 @@
describe('Group Tasks Meta Actions Controller', () => {
let rootScope, scope, user, userSerivce;
beforeEach(() => {
module(function($provide) {
$provide.value('User', {});
});
inject(($rootScope, $controller) => {
rootScope = $rootScope;
user = specHelper.newUser();
user._id = "unique-user-id";
userSerivce = {user: user};
scope = $rootScope.$new();
scope.task = {
group: {
assignedUsers: [],
approval: {
required: false,
}
},
};
scope.task._edit = angular.copy(scope.task);
$controller('GroupTaskActionsCtrl', {$scope: scope, User: userSerivce});
});
});
describe('toggleTaskRequiresApproval', function () {
it('toggles task approval required field from false to true', function () {
scope.toggleTaskRequiresApproval();
expect(scope.task._edit.group.approval.required).to.be.true;
});
it('toggles task approval required field from true to false', function () {
scope.task._edit.group.approval.required = true;
scope.toggleTaskRequiresApproval();
expect(scope.task._edit.group.approval.required).to.be.false;
});
});
describe('assign events', function () {
it('adds a group member to assigned users on "addedGroupMember" event ', () => {
var testId = 'test-id';
rootScope.$broadcast('addedGroupMember', testId);
expect(scope.task.group.assignedUsers).to.contain(testId);
expect(scope.task._edit.group.assignedUsers).to.contain(testId);
});
it('removes a group member to assigned users on "addedGroupMember" event ', () => {
var testId = 'test-id';
scope.task.group.assignedUsers.push(testId);
scope.task._edit.group.assignedUsers.push(testId);
rootScope.$broadcast('removedGroupMember', testId);
expect(scope.task.group.assignedUsers).to.not.contain(testId);
expect(scope.task._edit.group.assignedUsers).to.not.contain(testId);
});
});
});
describe('Group Tasks Meta Actions Controller', () => {
let rootScope, scope, user, userSerivce;
beforeEach(() => {
module(function($provide) {
$provide.value('User', {});
});
inject(($rootScope, $controller) => {
rootScope = $rootScope;
user = specHelper.newUser();
user._id = "unique-user-id";
userSerivce = {user: user};
scope = $rootScope.$new();
scope.task = {
group: {
assignedUsers: [],
approval: {
required: false,
}
},
};
scope.task._edit = angular.copy(scope.task);
$controller('GroupTaskActionsCtrl', {$scope: scope, User: userSerivce});
});
});
describe('toggleTaskRequiresApproval', function () {
it('toggles task approval required field from false to true', function () {
scope.toggleTaskRequiresApproval();
expect(scope.task._edit.group.approval.required).to.be.true;
});
it('toggles task approval required field from true to false', function () {
scope.task._edit.group.approval.required = true;
scope.toggleTaskRequiresApproval();
expect(scope.task._edit.group.approval.required).to.be.false;
});
});
describe('assign events', function () {
it('adds a group member to assigned users on "addedGroupMember" event ', () => {
var testId = 'test-id';
rootScope.$broadcast('addedGroupMember', testId);
expect(scope.task.group.assignedUsers).to.contain(testId);
expect(scope.task._edit.group.assignedUsers).to.contain(testId);
});
it('removes a group member to assigned users on "addedGroupMember" event ', () => {
var testId = 'test-id';
scope.task.group.assignedUsers.push(testId);
scope.task._edit.group.assignedUsers.push(testId);
rootScope.$broadcast('removedGroupMember', testId);
expect(scope.task.group.assignedUsers).to.not.contain(testId);
expect(scope.task._edit.group.assignedUsers).to.not.contain(testId);
});
});
});

View File

@@ -6,6 +6,7 @@ describe('Notification Controller', function() {
beforeEach(function() {
user = specHelper.newUser();
user._id = "unique-user-id";
user.needsCron = false;
var userSync = sinon.stub().returns({
then: function then (f) { f(); }
@@ -99,7 +100,7 @@ describe('Notification Controller', function() {
});
describe('User challenge won notification watch', function() {
it('opens challenge won modal when a challenge-won notification is recieved', function() {
it('opens challenge won modal when a challenge-won notification is received', function() {
rootScope.$digest();
rootScope.userNotifications.push({type: 'WON_CHALLENGE'});
rootScope.$digest();
@@ -108,7 +109,7 @@ describe('Notification Controller', function() {
expect(achievement.displayAchievement).to.be.calledWith('wonChallenge');
});
it('does not open challenge won modal if no new challenge-won notification is recieved', function() {
it('does not open challenge won modal if no new challenge-won notification is received', function() {
rootScope.$digest();
rootScope.$digest();
@@ -117,7 +118,7 @@ describe('Notification Controller', function() {
});
describe('User streak achievement notification watch', function() {
it('opens streak achievement modal when a streak-achievement notification is recieved', function() {
it('opens streak achievement modal when a streak-achievement notification is received', function() {
rootScope.$digest();
rootScope.userNotifications.push({type: 'STREAK_ACHIEVEMENT'});
rootScope.$digest();
@@ -126,7 +127,7 @@ describe('Notification Controller', function() {
expect(achievement.displayAchievement).to.be.calledWith('streak', {size: 'md'});
});
it('does not open streak achievement modal if no new streak-achievement notification is recieved', function() {
it('does not open streak achievement modal if no new streak-achievement notification is received', function() {
rootScope.$digest();
rootScope.$digest();
@@ -135,7 +136,7 @@ describe('Notification Controller', function() {
});
describe('User ultimate gear set achievement notification watch', function() {
it('opens ultimate gear set achievement modal when an ultimate-gear-achievement notification is recieved', function() {
it('opens ultimate gear set achievement modal when an ultimate-gear-achievement notification is received', function() {
rootScope.$digest();
rootScope.userNotifications.push({type: 'ULTIMATE_GEAR_ACHIEVEMENT'});
rootScope.$digest();
@@ -144,7 +145,7 @@ describe('Notification Controller', function() {
expect(achievement.displayAchievement).to.be.calledWith('ultimateGear', {size: 'md'});
});
it('does not open ultimate gear set achievement modal if no new ultimate-gear-achievement notification is recieved', function() {
it('does not open ultimate gear set achievement modal if no new ultimate-gear-achievement notification is received', function() {
rootScope.$digest();
rootScope.$digest();
@@ -153,7 +154,7 @@ describe('Notification Controller', function() {
});
describe('User rebirth achievement notification watch', function() {
it('opens rebirth achievement modal when a rebirth-achievement notification is recieved', function() {
it('opens rebirth achievement modal when a rebirth-achievement notification is received', function() {
rootScope.$digest();
rootScope.userNotifications.push({type: 'REBIRTH_ACHIEVEMENT'});
rootScope.$digest();
@@ -162,7 +163,7 @@ describe('Notification Controller', function() {
expect(achievement.displayAchievement).to.be.calledWith('rebirth');
});
it('does not open rebirth achievement modal if no new rebirth-achievement notification is recieved', function() {
it('does not open rebirth achievement modal if no new rebirth-achievement notification is received', function() {
rootScope.$digest();
rootScope.$digest();
@@ -171,7 +172,7 @@ describe('Notification Controller', function() {
});
describe('User contributor achievement notification watch', function() {
it('opens contributor achievement modal when a new-contributor-level notification is recieved', function() {
it('opens contributor achievement modal when a new-contributor-level notification is received', function() {
rootScope.$digest();
rootScope.userNotifications.push({type: 'NEW_CONTRIBUTOR_LEVEL'});
rootScope.$digest();
@@ -180,7 +181,7 @@ describe('Notification Controller', function() {
expect(achievement.displayAchievement).to.be.calledWith('contributor', {size: 'md'});
});
it('does not open contributor achievement modal if no new new-contributor-level notification is recieved', function() {
it('does not open contributor achievement modal if no new new-contributor-level notification is received', function() {
rootScope.$digest();
rootScope.$digest();

View File

@@ -1,35 +0,0 @@
'use strict';
describe('closeMenu Directive', function() {
var scope;
beforeEach(module('habitrpg'));
beforeEach(inject(function($rootScope) {
scope = $rootScope.$new();
scope.$digest();
}));
it('closes a connected menu when element is clicked', inject(function($compile) {
var menuElement = $compile('<a data-close-menu menu="mobile">')(scope);
scope._expandedMenu = { menu: 'mobile' };
menuElement.appendTo(document.body);
menuElement.triggerHandler('click');
expect(scope._expandedMenu.menu).to.eql(null)
}));
it('closes a connected menu when child element is clicked', inject(function($compile) {
var menuElementWithChild = $compile('<li></li>')(scope);
var menuElementChild = $compile('<a data-close-menu></a>')(scope);
scope._expandedMenu = { menu: 'mobile' };
menuElementWithChild.appendTo(document.body);
menuElementChild.appendTo(menuElementWithChild);
menuElementChild.triggerHandler('click');
expect(scope._expandedMenu.menu).to.eql(null)
}));
});

View File

@@ -1,35 +0,0 @@
'use strict';
describe('expandMenu Directive', function() {
var menuElement, scope;
beforeEach(module('habitrpg'));
beforeEach(inject(function($rootScope, $compile) {
scope = $rootScope.$new();
var element = '<a data-expand-menu menu="mobile"></a>';
menuElement = $compile(element)(scope);
scope.$digest();
}));
it('expands a connected menu when element is clicked', function() {
expect(scope._expandedMenu).to.not.exist;
menuElement.appendTo(document.body);
menuElement.triggerHandler('click');
expect(scope._expandedMenu.menu).to.eql('mobile')
});
it('closes a connected menu when it is already open', function() {
scope._expandedMenu = {};
scope._expandedMenu.menu = 'mobile';
menuElement.appendTo(document.body);
menuElement.triggerHandler('click');
expect(scope._expandedMenu.menu).to.eql(null)
});
});

View File

@@ -47,7 +47,7 @@ describe('memberServices', function() {
it('calls get challenge members', function() {
var challengeId = 1;
var memberUrl = apiV3Prefix + '/challenges/' + challengeId + '/members?includeAllMembers=true';
var memberUrl = apiV3Prefix + '/challenges/' + challengeId + '/members';
$httpBackend.expectGET(memberUrl).respond({});
members.getChallengeMembers(challengeId);
$httpBackend.flush();

View File

@@ -1,5 +1,5 @@
import Vue from 'vue';
import DrawerComponent from 'client/components/inventory/drawer.vue';
import DrawerComponent from 'client/components/ui/drawer.vue';
describe('DrawerComponent', () => {
it('sets the correct default data', () => {

View File

@@ -0,0 +1,20 @@
import roundBigNumberFilter from 'client/filters/roundBigNumber';
describe('round big number filter', () => {
it('can round a decimal number', () => {
expect(roundBigNumberFilter(4.567)).to.equal(4.57);
expect(roundBigNumberFilter(4.562)).to.equal(4.56);
});
it('can round thousands', () => {
expect(roundBigNumberFilter(70065)).to.equal('70.1k');
});
it('can round milions', () => {
expect(roundBigNumberFilter(10000987)).to.equal('10.0m');
});
it('can round bilions', () => {
expect(roundBigNumberFilter(1000000000)).to.equal('1.0b');
});
});

View File

@@ -4,7 +4,13 @@ import Vue from 'vue';
describe('i18n plugin', () => {
before(() => {
Vue.use(i18n);
Vue.use(i18n, {
i18nData: {
strings: {
reportBug: 'Report a Bug',
},
},
});
});
it('adds $t to Vue.prototype', () => {

View File

@@ -9,7 +9,7 @@ describe('tasks actions', () => {
});
describe('fetchUserTasks', () => {
it('fetches user tasks', async () => {
xit('fetches user tasks', async () => {
expect(store.state.tasks.loadingStatus).to.equal('NOT_LOADED');
const tasks = [{_id: 1}];
sandbox.stub(axios, 'get').withArgs('/api/v3/tasks/user').returns(Promise.resolve({data: {data: tasks}}));
@@ -36,7 +36,7 @@ describe('tasks actions', () => {
expect(store.state.tasks.loadingStatus).to.equal('LOADED');
});
it('can reload tasks if forceLoad is true', async () => {
xit('can reload tasks if forceLoad is true', async () => {
store.state.tasks = {
loadingStatus: 'LOADED',
data: [{_id: 1}],

View File

@@ -1,7 +1,7 @@
import axios from 'axios';
import generateStore from 'client/store';
describe('tasks actions', () => {
describe('user actions', () => {
let store;
beforeEach(() => {
@@ -45,7 +45,7 @@ describe('tasks actions', () => {
const user = {_id: 2};
sandbox.stub(axios, 'get').withArgs('/api/v3/user').returns(Promise.resolve({data: {data: user}}));
await store.dispatch('user:fetch', true);
await store.dispatch('user:fetch', {forceLoad: true});
expect(store.state.user.data).to.equal(user);
expect(store.state.user.loadingStatus).to.equal('LOADED');

View File

@@ -121,6 +121,17 @@ describe('achievements', () => {
});
});
it('card achievements exist with counts', () => {
let cardTypes = ['greeting', 'thankyou', 'birthday', 'congrats', 'getwell', 'goodluck'];
cardTypes.forEach((card) => {
let cardAchiev = basicAchievs[`${card}Cards`];
expect(cardAchiev).to.exist;
expect(cardAchiev).to.have.property('optionalCount')
.that.is.a('number');
});
});
it('rebirth achievement exists with no count', () => {
let rebirth = basicAchievs.rebirth;
@@ -174,7 +185,7 @@ describe('achievements', () => {
});
it('card achievements exist with counts', () => {
let cardTypes = ['greeting', 'thankyou', 'nye', 'valentine', 'birthday'];
let cardTypes = ['nye', 'valentine'];
cardTypes.forEach((card) => {
let cardAchiev = seasonalAchievs[`${card}Cards`];

Some files were not shown because too many files have changed in this diff Show More