Compare commits

...

581 Commits

Author SHA1 Message Date
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
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
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
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
SabreCat
023fd6e6b0 3.91.2 2017-05-19 20:51:10 +00:00
SabreCat
7ee2f90f37 fix(docs): move apiParamExamples to newlines 2017-05-19 20:49:59 +00:00
SabreCat
46709ddadd 3.91.1 2017-05-19 20:22:06 +00:00
SabreCat
a3ee09e764 chore(event): disable Fairy Potions 2017-05-19 20:17:51 +00:00
Sabe Jones
4127f36c02 chore(i18n): update locales 2017-05-19 20:16:18 +00:00
SabreCat
dad924ac7d chore(sprites): compile 2017-05-19 20:05:55 +00:00
Sabe Jones
547c87dee7 Guild A/B test and Achievement (#8740)
* WIP(guilds): AB test pester modal

* WIP(AB-test): guild pester cont'd

* fix(style): linting error

* fix(AB-test): markModified and notif enum

* fix(tests): update AB expectations

* fix(modal): remove extra includes

* feat(achievements): add Joined Guild cheevo
Also removes unused achievement sprites, and properly saves counter used in A/B testing

* fix(style): linting error from conflict
2017-05-19 14:45:11 -05: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
Sabe Jones
8a9ed04f5e Merge branch 'release' into develop 2017-05-18 02:13:14 +00:00
Sabe Jones
4e66c038a6 3.91.0 2017-05-18 02:11:56 +00:00
Sabe Jones
bd9618e1c6 chore(i18n): update locales 2017-05-18 02:08:40 +00:00
SabreCat
342034a80d chore(sprites): compile 2017-05-18 01:59:44 +00:00
SabreCat
f2aed3cb27 chore(news): Bailey
Also rolls back a leftover bit of the Spring Fling.
2017-05-18 01:58:37 +00:00
SabreCat
4f5f15d162 fix(test): account for cumulative balance 2017-05-18 01:44:07 +00:00
SabreCat
b5c1b78789 docs(content): comment bundle structure 2017-05-18 01:44:07 +00:00
SabreCat
f2ace5bb63 test(bundles): check balance deduction 2017-05-18 01:44:07 +00:00
SabreCat
72b8ba2d5c fix(test): remove only 2017-05-18 01:44:07 +00:00
SabreCat
8555e4bea8 test(bundles): shop and purchase tests 2017-05-18 01:44:07 +00:00
SabreCat
4de5b4253b fix(style): address linting errors 2017-05-18 01:44:07 +00:00
SabreCat
410004f8c6 feat(purchases): sell bundled quests 2017-05-18 01:44:07 +00:00
SabreCat
76c7e15497 refactor(content): split quests file 2017-05-18 01:44:06 +00:00
Sabe Jones
e6f605f23a Discount Bundled Quests (#8731)
* refactor(content): split quests file

* feat(purchases): sell bundled quests

* fix(style): address linting errors

* test(bundles): shop and purchase tests

* fix(test): remove only

* test(bundles): check balance deduction

* docs(content): comment bundle structure

* fix(test): account for cumulative balance
2017-05-17 20:36:34 -05:00
Matteo Pagliazzi
0af1203832 Client Redesign: Inventory pages, secondary menu, misc css and design items (#8631)
* 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

* fix linting in test/client

* fix es6 compilation in test/client

* fix babel compilation for tests

* fix groupsUtilities mixin tests

* client: buttons

* client: buttons: fix colors

* client: finish buttons and dropdowns

* upgrade bootstrap-vue, finish buttons and dropdowns

* fix tasks page layout

* misc fixes for buttons

* add textareas

* fix app menu

* add inputs

* fixes for toggleSwitch

* typography

* checkboxes and radio buttons

* add checkbox icon

* fix equip.js

* extract strings to newClient.json

* add Popover above 'Use Costume' / 'Auto Equip' slider - disable item select if costume-mode and 'useCostume' isn't active

* show "you have disabled your costume" error above the drawer items

* check errorMessage for null

* hide star if costume not enabled

* fix errorMessage (!errorMessage seems not to work for string)

* show minimize / expand icon - always centered by css

* drawer test

* drawer: fix centering on large screens

* fix show more button

* add margin when two dropdowns are next to each other

* adjust the page padding based on the drawer, misc fixes

* drawer fixes
2017-05-16 21:09:55 +02:00
Alys
1de379a2c3 adjust banned words. TRIGGER / CONTENT WARNING: assault, slurs, swearwords, etc 2017-05-16 13:08:09 +10:00
Keith Holliday
388861b503 Added summary local 2017-05-15 09:15:14 -06:00
Alys
f52806ed69 minor text changes: Shield-Hand Item; space in quest completion modal; Rebirth clarification (#8681)
* replace Shield with Shield-Hand Item where appropriate for consistency and clarity

* add space in quest completion modal heading between name of quest and "Completed!"

* clarify Rebirth text - restart your current character, not create a new one

* correct the instructions for editing a group (edit button not pencil icon)

* correct typo in questVice3Completion: breath > breathe

* fix type: Starststemic > Starsystemic
2017-05-14 20:53:15 +10:00
Alys
d89b9e08af update / delete outdated README.md files (#8719)
Information from test/api/README.md and test/api/v3/README.md has been moved to http://habitica.wikia.com/wiki/Using_Your_Local_Install_to_Modify_Habitica's_Website_and_API for consistency with other Blacksmith documentation.
2017-05-14 14:40:13 +10: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
Alys
65e71140ee adjust banned words list -- TRIGGER / CONTENT WARNING: assault, slurs, swearwords, etc 2017-05-13 00:48:35 +10:00
Keith Holliday
f192ca4c6f Abstracted set next due logic, set offset, and mapped to ISO 2017-05-12 07:39:32 -06:00
SabreCat
36b09d40b9 Merge branch 'release' into develop 2017-05-11 22:30:23 +00:00
Sabe Jones
4fdd754b31 3.90.2 2017-05-11 20:16:28 +00:00
Sabe Jones
36ff063991 chore(i18n): update locales 2017-05-11 20:14:21 +00:00
SabreCat
20dcb1cb8a chore(sprites): compile 2017-05-11 20:08:33 +00:00
SabreCat
3a1527073f chore(news): Bailey 2017-05-11 20:08:12 +00: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
727cdc9402 Tasks is due (#8711)
* Added isDue field and isDue set on create

* Added isDue update on update task

* Add isdue calc to score task

* Added isdue calc to cron

* Fixed lint issue

* Added isDue to no set and updated grammar
2017-05-10 07:40:45 -06:00
SabreCat
638c9dee89 Merge branch 'release' into develop 2017-05-09 19:36:42 +00:00
SabreCat
168ed02226 3.90.1 2017-05-09 19:30:31 +00:00
Sabe Jones
aa253cf72e chore(i18n): update locales 2017-05-09 19:25:30 +00:00
SabreCat
247742c60d chore(news): Bailey
also adds Managers info to Group Plans page
2017-05-09 19:18:29 +00:00
yugensoft
7d89deb094 Continuation of PR #8675, fix internationalization (#8698)
* Made uneditable habits show counter reset frequency
Added counter reset frequency to counter tooltip
Solves issue https://github.com/HabitRPG/habitica/issues/8571

* Internationalization fix, pursuant to https://github.com/HabitRPG/habitica/pull/8675#discussion_r112982947

(cherry picked from commit 2adac35e31)
2017-05-09 18:54:38 +00:00
Sabe Jones
c128b701fa chore(i18n): update locales 2017-05-09 18:52:38 +00:00
yugensoft
2adac35e31 Continuation of PR #8675, fix internationalization (#8698)
* Made uneditable habits show counter reset frequency
Added counter reset frequency to counter tooltip
Solves issue https://github.com/HabitRPG/habitica/issues/8571

* Internationalization fix, pursuant to https://github.com/HabitRPG/habitica/pull/8675#discussion_r112982947
2017-05-09 13:22:09 -05:00
SabreCat
f01e13ffc0 3.90.0 2017-05-09 17:53:03 +00:00
Alys
4e9d631b71 adjust banned words list -- TRIGGER / CONTENT WARNING: words about assault, slurs, etc 2017-05-09 09:21:06 +10:00
SabreCat
f1de7c02e9 Merge branch 'develop' into release 2017-05-08 23:14:45 +00:00
SabreCat
15d4f7d6ab Revert "Add tests for shouldDo - fixes #8585 (#8660)"
This reverts commit 4bbebdd237. The change to moment.utcOffset() from moment.zone() broke cron code for determining today's date.
2017-05-08 22:08:24 +00: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
Keith Holliday
c8b6e8ea7c Updated docker file to use Node (#8704) 2017-05-08 07:40:55 -06:00
madpink
409b5d5965 Updating User API Doc (part 2) (#8602)
* Updating APIDOC for issue 8087

* Updating User API Doc (round 2)

cleaned up trailing sapces

* Updating User API Doc (round 2)

Changed mpHeal to mpheal
2017-05-08 07:37:01 -06:00
MathWhiz
e7209511ca Challenge API Doc Updates (#8626)
* Improve API Documentation for Challenges API

* Fix previously raised issues

* Change suggestions by @Alys
2017-05-08 07:36:02 -06:00
Mateus Etto
8c76ccd39b Fix bugs with approved tasks in a Group Plan (#8629)
* Store all approved tasks in an array

* Created bulkScore using score callback

* Removed unnecessary code

* Added verification to run the code only for Approved Tasks

* Created scoreTasks on server and necessary code on client

* Revert "Created scoreTasks on server and necessary code on client"

This reverts commit b786c0e71a.

* Fixed gold/xp earn-lose-earnAgain problem

* Do not read already read notifications

* Removed unnecessary variable
2017-05-08 07:35:08 -06:00
Jaka Kranjc
399c91ccab travis: don't pollute the log with npm output (#8706)
unless it fails; saves ~7k lines
2017-05-08 07:33:49 -06:00
Grace Chen
4bbebdd237 Add tests for shouldDo - fixes #8585 (#8660)
* Fix #8585 - Add shouldDo CDS and timezone variation test suite

* Fix #8585 - resolve feedback
2017-05-08 07:32:38 -06:00
yugensoft
4f305bd505 Updated vagrant script to fix bcrypt missing error (#8670)
* Updated npm version to match http://habitica.wikia.com/wiki/Setting_up_Habitica_Locally; added npm-pre-gyp dependency necessary for bcrypt to install

* changed npm version as per request https://github.com/HabitRPG/habitica/pull/8670#discussion_r112010106
2017-05-07 07:57:50 +10:00
Alys
024feaa2f4 add banned words to be blocked in Tavern Chat -- CONTENT WARNING: this commit contains slurs, swear words, etc 2017-05-06 07:37:17 +10:00
Sabe Jones
d2dc8f1856 Release Mergeback 2017/05/03 (#8716)
* Content 2017/05 (#8714)

* feat(content): May 2017
Add Armoire, add BGs, end Spring Fling

* chore(sprites): compile

* chore(i18n): update locales

* 3.89.0
2017-05-03 15:02:54 -05:00
SabreCat
364ed8dbab 3.89.0 2017-05-03 18:22:12 +00:00
Sabe Jones
73328b6dab Content 2017/05 (#8714)
* feat(content): May 2017
Add Armoire, add BGs, end Spring Fling

* chore(sprites): compile

* chore(i18n): update locales
2017-05-03 13:21:25 -05:00
Keith Holliday
e3a08c1905 Added loggly integration (#8690)
* Added loggly integration

* Added back console logger

* Updated shrinkwrap
2017-05-02 09:17:23 -06:00
Sabe Jones
dad0eea9e0 Merge branch 'release' into develop 2017-04-28 19:31:22 +00:00
Sabe Jones
76849cdcaa 3.88.1 2017-04-28 19:30:33 +00:00
Sabe Jones
eb6ac42717 chore(i18n): update locales 2017-04-28 19:29:56 +00:00
SabreCat
d44a298e2d chore(news): Bailey 2017-04-28 19:24:32 +00:00
Alys
864ca91144 modify Market intro for eggs to clarify that quest eggs don't drop (#8680)
Ref: https://habitica.slack.com/archives/C02RK7DKF/p1491847171061587?thread_ts=1491779437.902223&cid=C02RK7DKF
2017-04-27 21:10:43 +10:00
Cai Lu
78816dd4cb Fix character values (#8541)
* Display an error when invalid values are given

* Add character values tests for settingsCtrl

* Only check for invalid level values

* Remove unnecessary validation function

* Min level of 1 on user model

* (tests) Removed stubbing on restore
2017-04-26 15:10:56 -06:00
Keith Holliday
6a99daebac continuation of PR #8074 Adding spam prevention - fixes #8060 (#8687)
* Adding code to look over the most recent messages to look for spam from a user

* Adding in translatable error message

* Adding 2 tests for spam detection

* Fixing changes requested for pull request

* Adding unit tests for group and fixing requested changes

* Fixing message and tests

* Forgot to remove this import

* Fixing lint errors

* Cleaning up the code and tests to be more readable

* Fixing lint errors

* Fixed linting issues

* Syntax fixes

* Updated grammar
2017-04-26 13:37:18 -06:00
SabreCat
c9ee6c7f73 Merge branch 'release' into develop 2017-04-26 17:40:51 +00:00
SabreCat
ffc4618657 3.88.0 2017-04-26 02:07:17 +00:00
Sabe Jones
30fde273b8 chore(i18n): update locales 2017-04-26 02:05:38 +00:00
SabreCat
38573ad357 chore(sprites): compile 2017-04-26 01:57:19 +00:00
SabreCat
c23180e6eb chore(news): Bailey 2017-04-26 01:56:59 +00:00
SabreCat
f7e2a0464f fix(incentives): backfill
Also adds various missing data from prior commit
2017-04-26 01:04:02 +00:00
SabreCat
6994c6769a feat(content): More Check-in Incentives 2017-04-25 22:13:07 +00:00
SabreCat
984e7f8005 feat(content): Subscriber Items 2017-04 2017-04-25 22:11:20 +00:00
Keith Holliday
e2f4b0e3dc Group managers (#8591)
* Added abiltiy to add group managers

* Added ability to remove managers

* Added ability for managers to add group tasks

* Allower managers to assign tasks

* Allowed managers to unassign tasks

* Allow managers to delete group tasks

* Allowed managers to approve

* Added initial ui

* Added approval view for managers

* Allowed managers to edit

* Fixed lint issues

* Added spacing to buttons

* Removed leader from selection of group managers

* Code review updates

* Ensured approvals are only done once

* Added ability for parties to add managers

* Add notifications to all managers when approval is requests

* Removed tasks need approval notifications from all managers when task is approve

* Fixed linting issues

* Hid add managers UI from groups that are not subscribed

* Removed let from front end

* Fixed issues with post task url params

* Fixed string locales

* Removed extra limited strings

* Added cannotedit tasks function

* Added limit fields and notification check by taskId

* Localized string and other minor issues

* Added manager and leader indicator

* Added group notifications refresh on sync

* Added close button for group notifications

* Removed group approval notifications when manager is removed

* Moved leader/manager indicators to after hp

* Added manager fields to groups

* Spelling and syntax fixes
2017-04-25 08:28:56 -06:00
Keith Holliday
369702884a Prevented ios and android subs from being upgrade to group plans (#8646)
* Prevented ios and android subs from being upgrade to group plans

* Add admin email sender

* Updated admin email

* Updated get user email

* Fixed grammar issue
2017-04-24 08:01:27 -06:00
Keith Holliday
d438990d18 Added block when user types a swear word listed in banned words (#8197)
* Added block when user types a swear word listed in banned words

* Moved banned words check to server

* Removed unused code

* Moved banned words to separate file and fixed grammar.

* Updated chat test

* Changed error to BadRequest

* Fixed regex matching

* Updated test banned word

* Moved banned words and cached regex

* Updated banned word message

* Add ban filter only for tavern

* Added tavern id constant

* Added more tests for banned words

* Added warning to banned words

* Added alert

* Added new regex to capture markdown

* Fixed lint, spelling and importing
2017-04-24 07:55:42 -06:00
yugensoft
7d3213fd66 Made uneditable habits show counter reset frequency (#8675)
Added counter reset frequency to counter tooltip
Solves issue https://github.com/HabitRPG/habitica/issues/8571
2017-04-22 14:01:06 -05:00
Alys
bde4eafc05 add mountText for all drop eggs and quest eggs (#8678)
I've checked that all these added strings do exist in locales/en/content.json
2017-04-22 14:00:18 -05:00
Travis
5a2ba27808 Creating api for gifting Hall Of Heroes Item Reference (#8118)
* Creating specific api to vend item reference for gifting items to a user through the hall of heroes. closes #8100

* removed 'When in doubt, ask Tyler' from the hall of heroes line

* Moving hall of heroes item path call from server side to client side

* updating let to var

* Addressing PR comments
2017-04-22 13:57:41 -05:00
Keith Holliday
024268a51e Added wintery skins to content (#8645)
* Added wintery skins to content

* Removed features json

* Fixed some name issues
2017-04-22 13:54:57 -05:00
MathWhiz
f7281e71e8 Change icon for NPC achievement (#8628)
* Change icon for NPC achievement

* Add npc icon
2017-04-22 13:52:45 -05:00
SabreCat
f3712c0641 3.87.1 2017-04-21 20:40:03 +00:00
Sabe Jones
7df10d51b0 PRs 2017/04/07 - 2017/04/14 (#8691)
* Issue 8432: Pre-test for initial fix

* Add failing test, seeking help/advice

* Fixes achievements injection. Now trying with Guide

* Fixes tests

* Remoed logging

* Mock ENV function

* Removes test focus

* Remove Beat Master unlock for Rebirth

* Special message when complete all check-in prizes

* Updated comment

* fix(test): unpend party cap test

* remove wrong subscriptions from gift modal

* edit the new issue template to emphasise that the Report a Bug guild should be used first (#8659)

* fix(translation): resolve merge conflict

* fix(news): merge conflict

* Added email invite limit (#8664)

* Added email invite limit

* change error message for sending too many invitations to instruct them to email us

* fix test error message to use variable in locales string

* add comment to warn about keeping INVITES_LIMIT low

If INVITES_LIMIT is allowed to be greater than MAX_EMAIL_INVITES_BY_USER
then the inviter can send more than MAX_EMAIL_INVITES_BY_USER invitations
at once.

* Fix for automatic allocation not persisting #8641 (#8661)

* Fixed text of check-in prize when it is a set of backgrounds (#8599)

* Fixed text of check-in prize when it is a set of backgrounds

* Use existing i18n string for BGs name

* Added user.preferences.language as second parameter

* fix Shiny Seeds info about achievement (not given to caster) (#8679)

Ref: https://habitica.slack.com/archives/C02RK7DKF/p1492032261365388

* Release mergeback v3.86.0 (#8685)

* 3.85.0

* New User Tasks for Mobile (#8682)

* feat(mobile): different default tasks

* fix(linting): missing space

* fix(user): correct client type logic

* test(integration): tasks by platform

* fix(test): remove only

* test(user): deeper checks on tasks

* refactor(test): whitespace for readability

* feat(subs): Jackalope Pets (#8684)

* chore(sprites): compile

* chore(i18n): update locales

* 3.86.0
2017-04-21 15:38:24 -05:00
SabreCat
91438aff90 Merge branch 'release' into develop 2017-04-20 22:21:33 +00:00
Sabe Jones
0c3f40716b 3.87.0 2017-04-20 21:29:01 +00:00
Sabe Jones
ec306b614a chore(news): Bailey 2017-04-20 20:02:37 +00:00
Sabe Jones
a6d8beff9d chore(i18n): update locales 2017-04-20 19:48:09 +00:00
SabreCat
bebf03ee91 chore(sprites): compile 2017-04-20 19:39:19 +00:00
SabreCat
2ea35c673a fix(quest): strings and fetch items 2017-04-20 19:35:16 +00:00
SabreCat
90d15b18f8 feat(content): Fairy Potions, Mistiflying Quests 2017-04-20 19:01:51 +00:00
Sabe Jones
91ed55cf66 Release mergeback v3.86.0 (#8685)
* 3.85.0

* New User Tasks for Mobile (#8682)

* feat(mobile): different default tasks

* fix(linting): missing space

* fix(user): correct client type logic

* test(integration): tasks by platform

* fix(test): remove only

* test(user): deeper checks on tasks

* refactor(test): whitespace for readability

* feat(subs): Jackalope Pets (#8684)

* chore(sprites): compile

* chore(i18n): update locales

* 3.86.0
2017-04-18 19:23:24 -05:00
Sabe Jones
93aa37a164 3.86.0 2017-04-18 22:57:50 +00:00
Alys
4275da0a2e fix Shiny Seeds info about achievement (not given to caster) (#8679)
Ref: https://habitica.slack.com/archives/C02RK7DKF/p1492032261365388
2017-04-19 08:56:15 +10:00
Sabe Jones
f782687609 chore(i18n): update locales 2017-04-18 22:50:18 +00:00
Sabe Jones
164fb69108 chore(sprites): compile 2017-04-18 22:43:33 +00:00
Sabe Jones
b1678e1769 feat(subs): Jackalope Pets (#8684) 2017-04-18 17:38:53 -05:00
Sabe Jones
7f8851c72b New User Tasks for Mobile (#8682)
* feat(mobile): different default tasks

* fix(linting): missing space

* fix(user): correct client type logic

* test(integration): tasks by platform

* fix(test): remove only

* test(user): deeper checks on tasks

* refactor(test): whitespace for readability
2017-04-18 15:50:50 -05:00
Mateus Etto
d9f48dcbb0 Fixed text of check-in prize when it is a set of backgrounds (#8599)
* Fixed text of check-in prize when it is a set of backgrounds

* Use existing i18n string for BGs name

* Added user.preferences.language as second parameter
2017-04-17 14:39:05 +10:00
Tyler Nychka
bd6f901ccf Fix for automatic allocation not persisting #8641 (#8661) 2017-04-17 06:49:16 +10:00
SabreCat
884bf02961 Merge branch 'sabrecat/butterflies' into develop 2017-04-13 20:31:19 +00:00
SabreCat
4aad44e29e 3.85.0 2017-04-13 20:29:51 +00:00
Sabe Jones
b40ee88165 chore(i18n): update locales 2017-04-13 20:28:14 +00:00
SabreCat
5d90aff51b chore(sprites): compile
Also add promo images to Bailey
2017-04-13 20:19:57 +00:00
SabreCat
9e36a531ea feat(content): Butterfly Pet Quest 2017-04-13 20:11:36 +00:00
Sabe Jones
f9b40a699a 3.84.3 2017-04-12 21:09:05 +00:00
Alys
33380f63f6 add comment to warn about keeping INVITES_LIMIT low
If INVITES_LIMIT is allowed to be greater than MAX_EMAIL_INVITES_BY_USER
then the inviter can send more than MAX_EMAIL_INVITES_BY_USER invitations
at once.
2017-04-12 21:07:46 +00:00
Alys
2f010e4689 fix test error message to use variable in locales string 2017-04-12 21:07:35 +00:00
Alys
fbda3a87ef change error message for sending too many invitations to instruct them to email us 2017-04-12 21:07:25 +00:00
TheHollidayInn
8a2e6a98c2 Added email invite limit 2017-04-12 21:03:10 +00:00
Keith Holliday
7d42e8fc71 Added email invite limit (#8664)
* Added email invite limit

* change error message for sending too many invitations to instruct them to email us

* fix test error message to use variable in locales string

* add comment to warn about keeping INVITES_LIMIT low

If INVITES_LIMIT is allowed to be greater than MAX_EMAIL_INVITES_BY_USER
then the inviter can send more than MAX_EMAIL_INVITES_BY_USER invitations
at once.
2017-04-12 15:54:35 -05:00
SabreCat
0442b87608 fix(news): merge conflict 2017-04-11 22:23:27 +00:00
SabreCat
c1d1a3e14e fix(translation): resolve merge conflict 2017-04-11 22:04:55 +00:00
SabreCat
dd5a9aa6cc Merge branch 'sabrecat/egg-quest' into develop 2017-04-11 20:10:49 +00:00
Alys
0bb6e5f3fc edit the new issue template to emphasise that the Report a Bug guild should be used first (#8659) 2017-04-11 14:52:19 -05:00
SabreCat
ad0a51167d 3.84.2 2017-04-11 19:23:42 +00:00
SabreCat
b7f1001b1a chore(news): Bailey 2017-04-11 19:23:28 +00:00
Sabe Jones
81ea1a0f9e chore(i18n): update locales 2017-04-11 19:02:17 +00:00
SabreCat
a466d20935 Revert "Unlimit parties (#8653)"
This reverts commit a4feae4dbb.
2017-04-11 18:54:30 +00:00
SabreCat
635c0cf3d1 feat(event): enable Egg Hunt 2017-04-11 18:54:07 +00:00
Matteo Pagliazzi
69347df050 Merge branch 'Yutsuten-orb-rebirth' into develop 2017-04-11 17:10:50 +02:00
Matteo Pagliazzi
9cad5525e6 Merge branch 'orb-rebirth' of https://github.com/Yutsuten/habitica into Yutsuten-orb-rebirth 2017-04-11 17:10:42 +02:00
Matteo Pagliazzi
b1e6aceffe Merge branch 'Yutsuten-checkin-complete-msg' into develop 2017-04-11 17:08:51 +02:00
Matteo Pagliazzi
17068875f4 Merge branch 'checkin-complete-msg' of https://github.com/Yutsuten/habitica into Yutsuten-checkin-complete-msg 2017-04-11 17:08:43 +02:00
Matteo Pagliazzi
342fc2e344 Merge branch 'paglias/fix-wrong-subs' into develop 2017-04-11 17:07:15 +02:00
Matteo Pagliazzi
b8b1557e49 Merge branch 'develop' into paglias/fix-wrong-subs 2017-04-11 17:07:05 +02:00
Matteo Pagliazzi
f90ef04e83 Merge branch 'eastwood-develop' into develop 2017-04-11 17:03:20 +02:00
Matteo Pagliazzi
d0561512de Merge branch 'develop' of https://github.com/eastwood/habitica into eastwood-develop 2017-04-11 17:03:09 +02:00
Matteo Pagliazzi
b84c672f33 remove wrong subscriptions from gift modal 2017-04-11 10:15:54 +02:00
Mateus Etto
aafbb889be Merge branch 'develop' into checkin-complete-msg 2017-04-09 19:58:53 -03:00
SabreCat
8bfafa6df0 Merge branch 'viirus/androidFixes' into release 2017-04-06 22:15:14 +00:00
SabreCat
13865bcf49 Merge branch 'viirus/androidFixes' into develop 2017-04-06 22:10:02 +00:00
Phillip Thelen
78a99bf314 add assertion for newUser field on registration 2017-04-06 22:03:50 +02:00
Phillip Thelen
38edc5b416 fix linter error 2017-04-06 22:03:33 +02:00
SabreCat
f9ca69196a fix(test): unpend party cap test 2017-04-06 19:58:33 +00:00
SabreCat
0e77df6e7b Merge branch 'sabrecat/shiny-seeds' into develop 2017-04-06 19:56:20 +00:00
SabreCat
91b6d3db02 3.84.1 2017-04-06 19:42:01 +00:00
Sabe Jones
d16ce1ce48 chore(i18n): update locales 2017-04-06 19:41:13 +00:00
SabreCat
564c366bfb chore(sprites): compile 2017-04-06 19:35:16 +00:00
SabreCat
c8c65a4f4f feat(event): Shiny Seeds 2017-04-06 19:35:05 +00:00
Phillip Thelen
8d168a0318 return newUser as true for new local accounts 2017-04-05 22:20:08 +02:00
Phillip Thelen
a3dd2f497e fix setup process for new android users 2017-04-05 22:19:49 +02:00
Sabe Jones
a4feae4dbb Unlimit parties (#8653)
* fix(party): unlimit parties
to address premature feature release

* fix(test): pend irrelevant test
2017-04-04 21:51:17 -05:00
Sabe Jones
d8620e1636 v3.84.0 - Backgrounds and Armoire 2017/04 (#8652)
* Release Mergeback (#8644)

* Remove email addresses from translatable strings (#8448)

* Fix User > Profile showing {getProgressDisplay()}

* Remove bad nextRewardAt check

* 1st iteration of issue #8385 - more pending

* #8385 config and jade fixes, tests pending

* #8385 fixing lint errors

* Fix faqs string and test

* Fix faq.jade and add workaround for faq.js

* Fixing accidental checking for faq.js

* fix emails in faq.js

* fetch emails once in auth.js

* Fixing community manager email in auth.js

(cherry picked from commit 842fbe42a8)

* chore(i18n): update locales

(cherry picked from commit b2225f05e5)

* Merge branch 'stripe-webhook' into develop

(cherry picked from commit 30f514e46f)

* add recent Grand Gala seasonal special equipment names (#8606)

This is to help translators add good glossary entries now for keeping the current wiki pages consistent with future additions to the website's seasonal shop.
(cherry picked from commit 4846bc5769)

* stripe webhook for unpaid subs: add 3 days of remaining time

(cherry picked from commit 1d7b733759)

* New default background (#8597)

* feat(bgs): new default background

* feat(bgs): backfill migration

* fix(migration): extraneous imports, bad paths

* fix(bgs): address comments

* fix(test): assert equality

(cherry picked from commit 03088f1d9f)

* chore(sprites): compile

(cherry picked from commit 831b122ce2)

* chore(i18n): update locales

(cherry picked from commit be1754ab07)

* chore(public-docs): Community Guidelines update
Also Bailey announcement

(cherry picked from commit 565d50dd99)

* chore(i18n): update locales

(cherry picked from commit d4198f8913)

* 3.83.0

(cherry picked from commit ea18489991)

* chore(news): Bailey

* rebuild shrinkwrap

(cherry picked from commit 96ce948e1a)

* stripe webhook: fix handling of automatic requests

(cherry picked from commit c4463f991b)

* 3.83.1

* v3.83.2 - April Fools 2017 (#8632)

* feat(event): April Fools 2017

* feat(event): NPCs and Bailey

* fix(event): tweak NPCs, add challenge link

* chore(sprites): compile

* 3.83.2

* v3.83.3 Fooling Fix (#8633)

* fix(fooling): add logic to party and member modals

* 3.83.3

* v3.83.4 Export fooling (#8634)

* fix(fooling): allow export

* 3.83.4

* v3.83.5 End Fooling (#8638)

* chore(event): no more foolin

* chore(sprites): compile

* 3.83.5

* fix(merge-conflict): prefer develop

for config.json.example

* fix(merge-conflict): fewer istanbul deps

* Replace golden rock mount body sprite

* feat(content): BGs and Armoire 2017-04
Also fixes a positioning issue on Spring Healer headgear.

* chore(sprites): compile

* chore(i18n): update locales

* 3.84.0
2017-04-04 15:49:05 -05:00
Sabe Jones
8e6f4a15a7 v3.84.0 - Backgrounds and Armoire 2017/04 (#8651)
* Remove email addresses from translatable strings (#8448)

* Fix User > Profile showing {getProgressDisplay()}

* Remove bad nextRewardAt check

* 1st iteration of issue #8385 - more pending

* #8385 config and jade fixes, tests pending

* #8385 fixing lint errors

* Fix faqs string and test

* Fix faq.jade and add workaround for faq.js

* Fixing accidental checking for faq.js

* fix emails in faq.js

* fetch emails once in auth.js

* Fixing community manager email in auth.js

(cherry picked from commit 842fbe42a8)

* chore(i18n): update locales

(cherry picked from commit b2225f05e5)

* Merge branch 'stripe-webhook' into develop

(cherry picked from commit 30f514e46f)

* add recent Grand Gala seasonal special equipment names (#8606)

This is to help translators add good glossary entries now for keeping the current wiki pages consistent with future additions to the website's seasonal shop.
(cherry picked from commit 4846bc5769)

* stripe webhook for unpaid subs: add 3 days of remaining time

(cherry picked from commit 1d7b733759)

* New default background (#8597)

* feat(bgs): new default background

* feat(bgs): backfill migration

* fix(migration): extraneous imports, bad paths

* fix(bgs): address comments

* fix(test): assert equality

(cherry picked from commit 03088f1d9f)

* chore(sprites): compile

(cherry picked from commit 831b122ce2)

* chore(i18n): update locales

(cherry picked from commit be1754ab07)

* chore(public-docs): Community Guidelines update
Also Bailey announcement

(cherry picked from commit 565d50dd99)

* chore(i18n): update locales

(cherry picked from commit d4198f8913)

* 3.83.0

(cherry picked from commit ea18489991)

* chore(news): Bailey

* rebuild shrinkwrap

(cherry picked from commit 96ce948e1a)

* stripe webhook: fix handling of automatic requests

(cherry picked from commit c4463f991b)

* 3.83.1

* v3.83.2 - April Fools 2017 (#8632)

* feat(event): April Fools 2017

* feat(event): NPCs and Bailey

* fix(event): tweak NPCs, add challenge link

* chore(sprites): compile

* 3.83.2

* v3.83.3 Fooling Fix (#8633)

* fix(fooling): add logic to party and member modals

* 3.83.3

* v3.83.4 Export fooling (#8634)

* fix(fooling): allow export

* 3.83.4

* v3.83.5 End Fooling (#8638)

* chore(event): no more foolin

* chore(sprites): compile

* 3.83.5

* fix(merge-conflict): prefer develop

for config.json.example

* fix(merge-conflict): fewer istanbul deps

* Replace golden rock mount body sprite

* feat(content): BGs and Armoire 2017-04
Also fixes a positioning issue on Spring Healer headgear.

* chore(sprites): compile

* chore(i18n): update locales

* 3.84.0
2017-04-04 15:48:41 -05:00
Sabe Jones
7c516b7cbb Release Mergeback (#8644)
* Remove email addresses from translatable strings (#8448)

* Fix User > Profile showing {getProgressDisplay()}

* Remove bad nextRewardAt check

* 1st iteration of issue #8385 - more pending

* #8385 config and jade fixes, tests pending

* #8385 fixing lint errors

* Fix faqs string and test

* Fix faq.jade and add workaround for faq.js

* Fixing accidental checking for faq.js

* fix emails in faq.js

* fetch emails once in auth.js

* Fixing community manager email in auth.js

(cherry picked from commit 842fbe42a8)

* chore(i18n): update locales

(cherry picked from commit b2225f05e5)

* Merge branch 'stripe-webhook' into develop

(cherry picked from commit 30f514e46f)

* add recent Grand Gala seasonal special equipment names (#8606)

This is to help translators add good glossary entries now for keeping the current wiki pages consistent with future additions to the website's seasonal shop.
(cherry picked from commit 4846bc5769)

* stripe webhook for unpaid subs: add 3 days of remaining time

(cherry picked from commit 1d7b733759)

* New default background (#8597)

* feat(bgs): new default background

* feat(bgs): backfill migration

* fix(migration): extraneous imports, bad paths

* fix(bgs): address comments

* fix(test): assert equality

(cherry picked from commit 03088f1d9f)

* chore(sprites): compile

(cherry picked from commit 831b122ce2)

* chore(i18n): update locales

(cherry picked from commit be1754ab07)

* chore(public-docs): Community Guidelines update
Also Bailey announcement

(cherry picked from commit 565d50dd99)

* chore(i18n): update locales

(cherry picked from commit d4198f8913)

* 3.83.0

(cherry picked from commit ea18489991)

* chore(news): Bailey

* rebuild shrinkwrap

(cherry picked from commit 96ce948e1a)

* stripe webhook: fix handling of automatic requests

(cherry picked from commit c4463f991b)

* 3.83.1

* v3.83.2 - April Fools 2017 (#8632)

* feat(event): April Fools 2017

* feat(event): NPCs and Bailey

* fix(event): tweak NPCs, add challenge link

* chore(sprites): compile

* 3.83.2

* v3.83.3 Fooling Fix (#8633)

* fix(fooling): add logic to party and member modals

* 3.83.3

* v3.83.4 Export fooling (#8634)

* fix(fooling): allow export

* 3.83.4

* v3.83.5 End Fooling (#8638)

* chore(event): no more foolin

* chore(sprites): compile

* 3.83.5

* fix(merge-conflict): prefer develop

for config.json.example

* fix(merge-conflict): fewer istanbul deps
2017-04-03 16:34:37 -05:00
Sabe Jones
46d96b444b fix(merge-conflict): fewer istanbul deps 2017-04-03 12:51:07 -05:00
Sabe Jones
60c9434b14 fix(merge-conflict): prefer develop
for config.json.example
2017-04-03 12:49:37 -05:00
Sabe Jones
c3901e8615 Merge branch 'develop' into release 2017-04-03 12:20:25 -05:00
Sabe Jones
d166de8ad0 v3.83.5 End Fooling (#8638)
* chore(event): no more foolin

* chore(sprites): compile

* 3.83.5
2017-04-02 09:02:15 -05:00
Sabe Jones
82e9afe9ce v3.83.4 Export fooling (#8634)
* fix(fooling): allow export

* 3.83.4
2017-03-31 22:23:02 -05:00
Sabe Jones
999202a8a5 v3.83.3 Fooling Fix (#8633)
* fix(fooling): add logic to party and member modals

* 3.83.3
2017-03-31 20:26:40 -05:00
Sabe Jones
8b53adfcb1 v3.83.2 - April Fools 2017 (#8632)
* feat(event): April Fools 2017

* feat(event): NPCs and Bailey

* fix(event): tweak NPCs, add challenge link

* chore(sprites): compile

* 3.83.2
2017-03-31 19:52:32 -05:00
SabreCat
c23062f87e chore(npm): update shrinkwrap 2017-03-31 16:44:10 +00:00
Alys
ec98541df6 fix text problems in Community Guidelines and broken email links; also add press kit link (#8623) 2017-03-31 18:07:18 +02:00
Alys
4fed13afdd add note to encourage reporting of begging for gems (#8605)
Also changes the email addresses in config.json.example to the real addresses so that we can use local install screenshots to tell if the correct address variable has been used.
2017-03-31 18:06:22 +02:00
SabreCat
866b28ec15 chore(news): Bailey
(cherry picked from commit ea7c07e21d)
2017-03-30 19:04:41 +00:00
SabreCat
bdf4a69eaf 3.83.1 2017-03-30 19:04:07 +00:00
Matteo Pagliazzi
4c121fba19 stripe webhook: fix handling of automatic requests
(cherry picked from commit c4463f991b)
2017-03-30 19:03:58 +00:00
Matteo Pagliazzi
0ecb95a294 rebuild shrinkwrap
(cherry picked from commit 96ce948e1a)
2017-03-30 19:03:26 +00:00
SabreCat
ea7c07e21d chore(news): Bailey 2017-03-30 19:01:31 +00:00
Matteo Pagliazzi
c4463f991b stripe webhook: fix handling of automatic requests 2017-03-30 00:14:51 +02:00
Matteo Pagliazzi
96ce948e1a rebuild shrinkwrap 2017-03-29 16:10:32 +02:00
Sabe Jones
6d06685dfa 3.83.0
(cherry picked from commit ea18489991)
2017-03-29 03:58:14 +00:00
Sabe Jones
32b6566e37 chore(i18n): update locales
(cherry picked from commit d4198f8913)
2017-03-29 03:57:44 +00:00
SabreCat
ca3b4cd8ae chore(public-docs): Community Guidelines update
Also Bailey announcement

(cherry picked from commit 565d50dd99)
2017-03-29 03:57:27 +00:00
Sabe Jones
c90b4b488e chore(i18n): update locales
(cherry picked from commit be1754ab07)
2017-03-29 03:57:15 +00:00
SabreCat
8c203637d7 chore(sprites): compile
(cherry picked from commit 831b122ce2)
2017-03-29 03:57:06 +00:00
Sabe Jones
58f72b7eaa New default background (#8597)
* feat(bgs): new default background

* feat(bgs): backfill migration

* fix(migration): extraneous imports, bad paths

* fix(bgs): address comments

* fix(test): assert equality

(cherry picked from commit 03088f1d9f)
2017-03-29 03:56:55 +00:00
Matteo Pagliazzi
f0bbe84bd1 stripe webhook for unpaid subs: add 3 days of remaining time
(cherry picked from commit 1d7b733759)
2017-03-29 03:56:45 +00:00
Alys
038e3f3235 add recent Grand Gala seasonal special equipment names (#8606)
This is to help translators add good glossary entries now for keeping the current wiki pages consistent with future additions to the website's seasonal shop.
(cherry picked from commit 4846bc5769)
2017-03-29 03:56:26 +00:00
Sabe Jones
1a7c8c1f87 Merge branch 'stripe-webhook' into develop
(cherry picked from commit 30f514e46f)
2017-03-29 03:55:47 +00:00
Matteo Pagliazzi
c73d6154a8 chore(i18n): update locales
(cherry picked from commit b2225f05e5)
2017-03-29 03:55:28 +00:00
Gerardo Saca
e8b77ad2b2 Remove email addresses from translatable strings (#8448)
* Fix User > Profile showing {getProgressDisplay()}

* Remove bad nextRewardAt check

* 1st iteration of issue #8385 - more pending

* #8385 config and jade fixes, tests pending

* #8385 fixing lint errors

* Fix faqs string and test

* Fix faq.jade and add workaround for faq.js

* Fixing accidental checking for faq.js

* fix emails in faq.js

* fetch emails once in auth.js

* Fixing community manager email in auth.js

(cherry picked from commit 842fbe42a8)
2017-03-29 03:55:11 +00:00
Sabe Jones
ea18489991 3.83.0 2017-03-29 03:33:13 +00:00
Sabe Jones
5eb1b6684e 3.82.0 2017-03-29 03:33:09 +00:00
Sabe Jones
a2f77eeba2 3.81.0 2017-03-29 03:32:29 +00:00
Sabe Jones
d4198f8913 chore(i18n): update locales 2017-03-29 03:28:07 +00:00
SabreCat
565d50dd99 chore(public-docs): Community Guidelines update
Also Bailey announcement
2017-03-29 03:21:44 +00:00
Sabe Jones
be1754ab07 chore(i18n): update locales 2017-03-28 22:05:20 +00:00
SabreCat
831b122ce2 chore(sprites): compile 2017-03-28 21:53:12 +00:00
Sabe Jones
03088f1d9f New default background (#8597)
* feat(bgs): new default background

* feat(bgs): backfill migration

* fix(migration): extraneous imports, bad paths

* fix(bgs): address comments

* fix(test): assert equality
2017-03-28 16:49:24 -05:00
Matteo Pagliazzi
1d7b733759 stripe webhook for unpaid subs: add 3 days of remaining time 2017-03-28 21:51:55 +02:00
Keith Holliday
d170f0b1bd Fixed injection minification issue (#8608) 2017-03-28 13:12:51 -06:00
Alys
4846bc5769 add recent Grand Gala seasonal special equipment names (#8606)
This is to help translators add good glossary entries now for keeping the current wiki pages consistent with future additions to the website's seasonal shop.
2017-03-28 11:32:42 -05:00
Sabe Jones
30f514e46f Merge branch 'stripe-webhook' into develop 2017-03-28 16:11:13 +00:00
Matteo Pagliazzi
6aad018eb2 Mocha 3 and Coverage (#8601)
* upgrade mocha to v3

* shrinkwrap

* import changes from PR #8487

* fix bin

* upgrade istanbul

* use correct mocha bin
2017-03-28 13:50:34 +02:00
Mateus Etto
f2d9bdf7ae Updated comment 2017-03-28 06:57:20 -03:00
Matteo Pagliazzi
daf9421f4f old client: guilds: show invite button and completely hide box for party info 2017-03-28 11:24:01 +02:00
Mateus Etto
2d7e280598 Special message when complete all check-in prizes 2017-03-27 22:24:47 -03:00
Mateus Etto
d1de41290d Remove Beat Master unlock for Rebirth 2017-03-27 19:59:24 -03:00
Matteo Pagliazzi
b2225f05e5 chore(i18n): update locales 2017-03-27 18:19:45 +02:00
Gerardo Saca
842fbe42a8 Remove email addresses from translatable strings (#8448)
* Fix User > Profile showing {getProgressDisplay()}

* Remove bad nextRewardAt check

* 1st iteration of issue #8385 - more pending

* #8385 config and jade fixes, tests pending

* #8385 fixing lint errors

* Fix faqs string and test

* Fix faq.jade and add workaround for faq.js

* Fixing accidental checking for faq.js

* fix emails in faq.js

* fetch emails once in auth.js

* Fixing community manager email in auth.js
2017-03-27 18:03:31 +02:00
Mateus Etto
5eadf9e486 Fixed subscription popup too narrow in Japanese (#8581) (#8583) 2017-03-27 09:57:49 -06:00
TheHollidayInn
0fd85c0d60 Added every x to weekly 2017-03-27 09:52:32 -06:00
Keith Holliday
68ad3e2d4a Task notes modals (#8521)
* Merged in develop

* Show task notes modal on click

* Began adding tests

* Removed extra characters

* Fixed lingering popup

* Added markdown

* Fixed line endings
2017-03-27 09:10:21 -06:00
madpink
de947f8069 Updating User API Doc (part 1) (#8476)
* Update API Doc #8087

Includes: GET /api/v3/user – POST /api/v3/user/buy/:key

* User API Doc update 1

Changed "GET user" description to a URL to the user model

* Update API DOC User 1

Cleaned up stray spaces

* Updated API Doc for User (part 1)

for GET user:
restored apiDescription from first PR
put link to model into "apiSuccessExample"

* Remove notifications from example responses

* Fixed trailing spaces
2017-03-26 21:42:21 +02:00
Mateus Etto
d541e3aa31 Fixed collection quest progress not being updated (#8584) 2017-03-26 21:27:44 +02:00
Mateus Etto
b0eda344f1 Limit party size to 30 members (#8589)
* Added a field in Party page with members count and maximum members in party

* Added information of invitations counter

* Limited party to 2 members on server (API)

* Fixed english text

* Consider current number of invitations in the party

* Moved PARTY_LIMIT_MEMBERS to common folder

* Access the PARTY_LIMIT_MEMBERS through groupsCtrl

* Some corrections

* Hide invite button when invite limit is reached

* Added missing trailing comma

* Do not test 'returns only first 30 invites' in a party anymore, but in a guild: party is limited to 30 members, so it would always fail

* Test: allow 30 members in a party

* Test: do not allow 30+ members in a party

* Improved 'allow 30 members in a party' test

* Test: 'allow 30+ members in a guild'

* Added missing trailing comma

* Code style corrections

* Fixed new line position

* Party limit check done inside Group.validateInvitations function

* Improved members count query

* Fixed tests

* Rewrite tests

* Removed import of BadRequest: value became unused

* Added 'await' to remaining 'Group.validateInvitations' functions

* Fixed tests that would always success
2017-03-26 21:23:19 +02:00
Alys
02708a7b10 remove "Habitica - Gamify Your Life" video from Press Kit (#8595)
- removes embedded youtube video from press kit page
- removes "Habitica - Gamify Your Life.mp4" from presskit.zip
2017-03-26 21:12:09 +02:00
Matteo Pagliazzi
fd9f3a32c4 fix linting 2017-03-25 17:48:51 +01:00
Matteo Pagliazzi
6e0341a4ff add more logging 2017-03-25 17:33:35 +01:00
Matteo Pagliazzi
625077fc1a add tests and fix bugs 2017-03-25 17:22:28 +01:00
Matteo Pagliazzi
9d456e934c remove un-necessary JSON.parse 2017-03-25 11:46:40 +01:00
Matteo Pagliazzi
771d8f492a update stripe webhooks url 2017-03-25 11:46:40 +01:00
Matteo Pagliazzi
f3fab88f0b add console.log statements for debugging 2017-03-25 11:46:40 +01:00
Matteo Pagliazzi
207e3476e6 add stripe webhook to handle cancelled subscriptions 2017-03-25 11:46:40 +01:00
Clint Ryan
6956f5345e Removes test focus 2017-03-24 23:45:56 +11:00
Sabe Jones
0ec293bd15 chore(news): Bailey 2017-03-23 21:00:48 +00:00
Sabe Jones
cb00ecc0be chore(i18n): update locales 2017-03-23 19:53:14 +00:00
SabreCat
94ef4f80cc chore(sprites): compile 2017-03-23 19:45:05 +00:00
Sabe Jones
814b163e1a March 2017 Content (#8594)
* feat(content): Mystery 032017, Shimmer Potions

* fix(date): end 4/19 not 30

* fix(dates): Floral after Shimmer
2017-03-23 14:41:41 -05:00
Sabe Jones
421bdce38b fix(sprites): don't get blocked (#8576) 2017-03-23 12:23:29 -05:00
Keith Holliday
624566ecec Added end date option to group plan migration (#8588) 2017-03-23 10:40:15 -06:00
Sabe Jones
77ff91868e Redirection fixes (#8592)
* fix(redirects): logic update

* test(middlewares): redirects tests

* fix(nconf): IS_PROD is boolean

* fix(test): treat IS_PROD as Boolean here too

* fix(test): apiUrl test copypasta
2017-03-23 10:25:58 -05:00
Clint Ryan
cc68abb67e Mock ENV function 2017-03-24 00:36:05 +11:00
Clint Ryan
b48be4e619 Remoed logging 2017-03-23 00:43:59 +11:00
Clint Ryan
7a543d07a4 Fixes tests 2017-03-23 00:41:28 +11:00
SabreCat
59f490d178 fix(sprites): accidental project_file deletion 2017-03-21 19:42:02 +00:00
SabreCat
ae64ef94ae fix(event): update Justin sprite 2017-03-21 19:06:43 +00:00
Sabe Jones
2335e22a0c chore(i18n): update locales 2017-03-21 18:58:46 +00:00
SabreCat
910154b3ed chore(news): Bailey 2017-03-21 18:46:17 +00:00
SabreCat
31e36339c4 fix(event): update Daniel sprite 2017-03-20 19:12:43 +00:00
SabreCat
07fe1df024 chore(sprites): compile 2017-03-20 18:36:37 +00:00
Matteo Pagliazzi
258742f6b7 Optional HTTP Basic Auth (#8586)
* add ability to add http basic auth to the website

* debug

* remove console.log
2017-03-20 15:02:48 +01:00
Clint Ryan
9115be68b2 Fixes achievements injection. Now trying with Guide 2017-03-19 10:11:11 +11:00
Matteo Pagliazzi
d9d7c69432 Client: async resources, make store reusable, move plugins and add getTaskFor getter (#8575)
Add library to manage async resource
Make Store reusable for easier testing
Move plugin to libs
Add getTaskFor getter with tests
2017-03-18 18:33:08 +01:00
Sabe Jones
03d6c459bf chore(i18n): update locales 2017-03-18 17:09:34 +00:00
Sabe Jones
12cefe4e9f Spring Fling 2017 (#8579)
* feat(event): Spring Fling 2017

* fix(sprites): adjustments
Also enables pastel hair/skin purchases
2017-03-18 12:01:41 -05:00
Keith Holliday
21ad808cc1 Aded challenge migration sync (#8492)
* Aded challenge migration sync

* Fixed async grouping

* Mapped promises and added error catching

* Added placholders for syncing specific challenges

* Prvented overriding of attribute and createdAt
2017-03-17 16:58:55 -05:00
SabreCat
db9befde17 Merge branch 'release' into develop 2017-03-16 19:45:11 +00:00
SabreCat
01af658c2d 3.80.1 2017-03-16 19:43:18 +00:00
SabreCat
52738575fa chore(news): Bailey 2017-03-16 19:43:08 +00:00
Lulock
cc9bca5f63 invalid class change throws error (#8496) (#8531)
* invalid class-change throws error

minor fixes

indentation fixes

indentation fixes

indentation fixes

* minor fixes
2017-03-16 13:38:24 -05:00
Matteo Pagliazzi
05d75a4d5c chore(i18n): update locales 2017-03-16 15:56:01 +01:00
Keith Holliday
8c68f450c6 Enabled repeatables 2017-03-15 14:13:15 -06:00
Blade Barringer
164177f010 Enable shouldDo tests 2017-03-14 20:59:27 -05:00
SabreCat
fc69a3a960 3.80.0 2017-03-15 00:49:36 +00:00
SabreCat
797adbb1dc chore(news): Bailey 2017-03-15 00:17:10 +00:00
Keith Holliday
3dc20a9832 Ensured upgraded groups are charge correctly (#8567)
* Ensured upgraded groups are charge correctly

* Added names to magic numbers

* Limited group fields query
2017-03-14 18:09:12 -05:00
Sabe Jones
cfa433aa75 chore(i18n): update locales 2017-03-14 21:03:46 +00:00
SabreCat
9bc2d22d30 chore(sprites): compile 2017-03-14 20:54:27 +00:00
Sabe Jones
4909f67ded feat(content): Pet Quest and Future Mystery Sets (#8569) 2017-03-14 14:31:10 -05:00
Matteo Pagliazzi
8bc6534ff5 Merge pull request #8558 from HabitRPG/fix-achievements
Attempt to fix achievements awarding
2017-03-14 13:11:04 +01:00
Clint Ryan
83bd4dcf60 Add failing test, seeking help/advice 2017-03-14 12:35:48 +11:00
Matteo Pagliazzi
a8ebd04ac8 fix typo in if condition and write test 2017-03-13 21:43:40 +01:00
Matteo Pagliazzi
e0d499abab expand explanation 2017-03-13 21:18:22 +01:00
Matteo Pagliazzi
f67e065de2 attempt to fix achievements awarding 2017-03-13 21:18:22 +01:00
Matteo Pagliazzi
283403d6c8 Merge pull request #8563 from Alys/20170312-canceled-group-plan
use correct wording and date format for cancelled Group Plan in Payment Details screen
2017-03-13 21:16:13 +01:00
Matteo Pagliazzi
55c7d6a191 Merge pull request #8542 from HabitRPG/client/guilds-infinite-loading
Client: Guilds: infinite loading
2017-03-13 21:15:06 +01:00
Alys
a5011f000e add new feature descriptions to Social > Group Plans page (#8564)
* add new features to Social > Group Plans page and remove windows line breaks

* add price to Social > Group Plans page and remove windows line breaks
2017-03-13 21:14:14 +01:00
Matteo Pagliazzi
c5633e2074 client redesign: add infinite loading for guilds + misc fixes 2017-03-13 19:47:09 +01:00
Matteo Pagliazzi
939712ad1f api: add pagination for guilds
start adding apiMessages

add apiMessages lib with tests

use apiMessage and fix tests

fix content tests

guilds pagination: add api docs

guilds pagination: improve api docs
2017-03-13 19:46:53 +01:00
Alys
09490551d4 correct wording and date format for cancelled Group Plan in Payment Details screen 2017-03-12 18:42:34 +10:00
Clint Ryan
92b02295b5 Issue 8432: Pre-test for initial fix 2017-03-11 23:29:51 +11:00
Matteo Pagliazzi
767763fbf6 upgrade hello.js to use Facebook API v2.7 2017-03-11 12:25:38 +01:00
SabreCat
237e0df611 3.79.2 2017-03-11 00:20:04 +00:00
Sabe Jones
ca903f0dc3 Group migration fixes (#8555)
* fix(migration): better subs handling

* feat(migration): award jackalopes

* fix(lint): no console logs
2017-03-10 18:18:02 -06:00
Keith Holliday
bde41699ee Reverted should do file (#8556) 2017-03-10 17:37:52 -06:00
Keith Holliday
d0d4b47c47 Fixed purchased check (#8552) 2017-03-10 17:27:30 -06:00
Sabe Jones
c616346233 3.79.1 2017-03-10 17:05:21 +00:00
Sabe Jones
311d3a256a Moment-recur fix (#8553)
* fix(npm): no pre/post for moment-recur

* chore(npm): update shrinkwrap
2017-03-10 11:01:51 -06:00
SabreCat
af6f3f9656 chore(npm): update shrinkwrap 2017-03-10 15:38:01 +00:00
Sabe Jones
15681fedcc Merge branch 'release' into develop 2017-03-10 04:30:45 +00:00
Sabe Jones
bf12f8aa71 v3.79.0 Release (#8551)
* Habits v2: adding counter to habits (cleaned up branch) - fixes #8113 (#8198)

* Clean version of PR 8175

The original PR for this was here:
https://github.com/HabitRPG/habitica/pull/8175

Unfortunately while fixing a conflict in tasks.json, I messed up the rebase and wound up pulling in too many commits and making a giant mess. Sorry. :P

* Fixing test failure

This test seems to occasionally start failing (another coder reported the same thing happening to them in the blacksmiths’ guild) because the order in which the tasks are created can sometimes not match the order in the array. So I have sorted the tasks array after creation by the task name to ensure a consistent ordering, and slightly reordered the expect statements to match.

* Debounce `$scope` updates when typing in chat. (#8485)

Fixes #6462, by saving a bunch of time per frame. See the issue for evidence of
the win.

* fix(nextRewardUnlocksIn): Check-in prize message was always plural --… (#8458)

* fix(nextRewardUnlocksIn): Check-in prize message was always plural -- moving to a non-sentence like structure to fix incorrect grammar.

* fix(countLeft): Check-in prize message was always plural -- moving to a non-sentence like structure to fix incorrect grammar.

* Added support for grouping tasks by challenge (#8469)

* Added support for grouping tasks by chllenge

* Fixed tests and updated default challenge model name

* Fixed broken member test

* Updated setting string

* Changed to shortName

* Began abstracting task grouping

* Added initial task directive code

* Added new directives to help with grouping of tasks

* Removed random console.log

* Leaving a group (#8517)

* Leaving a group or a guild no longer removes the user from the challenges of that group or guild.

* Updating api docs for leaving group to take into account the default path no longer leaving challenges when leaving a group.

* Updating api docs for leaving group to take into account the default path no longer leaving challenges when leaving a group.

* refactored according to blade's comments to not be a breaking change. The api now accepts a body parameter to specify wether the user
should remain in the groups challenges or leave them. The change also adds more tests around this behavior to confirm that it works
as expected.

* Tasks score notes (#8507)

* Added setting and modal for score notes

* Added persistent score notes

* Fixed linting issues and documented new field

* Added max length to task score notes

* Added check for score notes existence

* Combined tasks perferences

* Repeatables (#8444)

* Added initial should do weekly tests

* Added support back in for days of the week and every x day

* Added better week day mapper

* Added initial monthly

* Added every x months

* Added yearlies

* Fixed every nth weekdy of month

* Fixed tests to check every x week on weekday

* Began combining x month with nth weekday

* Added every x month combined with date and weekday

* Fixed lint issues

* Saved moment-recurr to package.json

* Added new repeat fields

* Added UI for repeatables

* Ensured only dalies are affected by summary

* Added local strings

* Updated npm shrinkwrap

* Shared day map constant

* Updated shrinkwrap

* Added ui back

* Updated copy of test cases

* Added new translation strings

* Updated shrinkwrap

* Fixed broken test

* Made should do tests static for better consitency

* Fixed issue with no repeat

* Fixed line endings

* Added frequency enum values

* Fixed spacing

* Upgrade lodash to v4 and lint more files (#8495)

* common: import lodash modules separately

* remove test/content from .eslintignore, fix with eslint --fix content/index

* lint test/content

* lint content/index except for lodash methods

* upgrade server/models

* upgrade server/middlewares and server/libs

* port server/controllers/top-level

* port server/controllers/api-v3

* port views and tests

* client old port lodash and _(, missing _.

* upgrade client-old

* port common/script (root level files only)

* port common/script/fns

* port common/libs

* port common/script/ops

* port common/script/content and common/script/libs/shops.js

* misc fixes

* misc fixes

* misc fixes

* more tests fixes

* fix payments test stubbing, down to 2 failing tests

* remove more instances of lodash wrapping

* fix bug where toObject does not clone object

* fix tests

* upgrade migration or add lodash 4 note

* update shrinkwrap

* fix linting

* upgrade eslint-config-habitrpg

* update shrinkwrap

* recompile shrinkwrap

* chore(i18n): update locales

* Fixed lint issues with model in task services (#8523)

* ApiDoc Group (#8522)

* ApiDoc Group

* Remove space

* Add tags to default tasks (#8419)

* Add ability to add tags to default tasks

* fix missing semicolon

* fix nesting callbacks error

* Add tags to default tasks

* fix default tags

* Start test

* Finish test

* Fix tests

* Move test

* Fix padded-bock

* Fix test

* Fix request

* fix requests

* fix test

* fix lint

* Refine test

* Fix test

* Fix Test

* Fix tests

* Please work :(

* Fix stupid mistake

* Fix lint

* Fixes

* fix function

* fix lint

* fix lint

* Client/inventory WIP (#8527)

* some stable work and faster less recompilation

*  user with zero tasks can use the app

* wip work to show loading status of resources

* revert changes to sync

* Client: Guilds Discovery (#8529)

* wip: add guilds discovery page

* add public guilds page

* fix and add tests for the groups utilities mixin

* Properly format a subscription end date according to user preference (#8514)

* Client: Guild page and mix changes (#8533)

* update deps

* add guilds page

* improve karma conf, add tests for actions

* Client: semantic ui -> bootstrap 4 and less -> scss (#8535)

* client: semantic ui -> bootstrap 4 and less -> scss

* start porting components to boostrap

* port header, start porting menu

* port loading screen

* port most of the menu

* port secondary menus

* port guilds and stable

* disable tavern for now, port inbox

* typo

* put back old tavern code

* fix: remove semanticui from gulpfile

* client: add some margin to the avatar

* Group plans subs to all (#8394)

* Added subscriptions to all members when group subs

* Added unsub when group cancels

* Give user a subscription when they join a subbed group

* Removed subscription when user leaves or is removed from group

* Fixed linting issues:

* Added tests for users with a subscription being upgraded to group plan

* Added tests for checking if existing recurring user sub gets updated during group plan. Added better merging for plans

* Added test for existing gift subscriptions

* Added additional months to user when they have an existing recurring subscription and get upgraded to group sub

* Adds test for user who has cancelled with date termined in the future

* Added test to ensure date termined is reset

* Added tests for extra months carrying over

* Added test for gems bought field

* Add tests to for fields that should remain when upgrading

* Added test for all payment methods

* Added prevention for when a user joins a second group plan

* Fixed subscribing tests

* Separated group plan payment tests

* Added prevention of editing a user with a unlimited sub

* Add tests to ensure group keeps plan if they are in two and leave one

* Ensured users with two group plans do not get cancelled when on group plan is cancelled

* Ensured users without group sub are untouched when group cancels

* Fixed lint issues

* Added new emails

* Added fix for cron tests

* Add restore to stubbed methods

* Ensured cancelled group subscriptions are updated

* Changed group plan exist check to check for date terminated

* Updated you cannont delete active group message

* Removed description requirement

* Added upgrade group plan for Amazon payments

* Fixed lint issues

* Fixed broken tests

* Fixed user delete tests

* Fixed function calls

* Hid cancel button if user has group plan

* Hide difficulty from rewards

* Prevented add user functions to be called when group plan is cancelled

* Fixed merge issue

* Correctly displayed group price

* Added message when you are about to join canclled group plan

* Fixed linting issues

* Updated tests to have no redirect to homes

* Allowed leaving a group with a canceld subscription

* Fixed spelling issues

* Prevented user from changing leader with active sub

* Added payment details title to replace subscription title

* Ensured we do not count leader when displaying upcoming cost

* Prevented party tasks from being displayed twice

* Prevented cancelling and already cancelled sub

* Fixed styles of subscriptions

* Added more specific mystery item tests

* Fixed test to refer to leader

* Extended test range to account for short months

* Fixed merge conflicts

* Updated yarn file

* Added missing locales

* Trigger notification

* Removed yarn

* Fixed locales

* Fixed scope mispelling

* Fixed line endings

* Removed extra advanced options from rewards

* Prevent group leader from leaving an active group plan

* Fixed issue with extra months applied to cancelled group plan

* Ensured member count is calculated when updatedGroupPlan

* Updated amazon payment method constant name

* Added comment to cancel sub user method

* Fixed smantic issues

* Added unite test for user isSubscribed and hasNotCancelled

* Add tests for isSubscribed and hasNotCanceled

* Changed default days remaining to 2 days for group plans

* Fixed logic with adding canceled notice to group invite

* mongoose: upgrade to 4.8.6 and remove un-necessary _.clone calls now that toObject clones correctly

* config.json: do not enable APN by default

* Moved show counters to directive (#8537)

* Moved show counters to directive

- hide counters on challenge page
- hide counters on group page

* Changed let to var

* Tasks sort delete fix (#8526)

* Fixed task sorting

* Add sync when group task is deleted

* Added sync when user tasks reorder

* Abstracted show logic and removed task grouping from group page

* Fixed scope typo

* Localized the default challenge short name

* Removed default shortName

* Fixed test for challenge shortName

* client: router: always scroll to the top

* fix(sprites): adjust eggs (#8543)

* adjust apidocs comment to remove unnecessary id parameter with incorrect syntax

* Repeatables fixes (#8538)

* Prevented watch functions from being called when task._edit is removed

* Added start date support on the UI task summary

* Fixed setting of monthly and calculations

* Fixed linting issues

* Added check for existence

* Added existence check

* Ensured correct start date is used on update

* Hid repeat options from anything not a daily

* Added missing locales

* Moved repeatables out of advance options

* Minification fix hide features (#8544)

* Added minification fix

* Hid settings for features we will not release yet

* Hid repeatables UI

* Removed extra file

* Removed repeats every from weekly

* Added start date back

* Hid counter reset when advance is collpased

* Group migrations (#8528)

* Added create group migration

* Add migration for unlimited group subscription

* Add migration to update group members with group plans

* Added error catch

* Added comments

* Group plans copy changes (#8546)

* Added new message for when user has group plan

* Changed subscription wording to group plan

* Updated copy

* Jackalopes (#8547)

* feat(content): add Jackalope rare mount

* chore(news): Bailey for Group Plans

* fix(sprites): correct inconsistent file perms

* Group plans add mount (#8548)

* Added jakcalop mount to group plan members

* Changed pet assignment to mount

* Updated migration to not update canceled group plans (#8550)

* Send group plans subscription message to Slack (#8549)

* feat(Slack): send group plans sub message

* fix(Slack): grab more relevant user data

* 3.79.0

* chore(i18n): update locales

* chore(sprites): compile
2017-03-09 21:50:22 -06:00
SabreCat
41ee72d407 chore(sprites): compile 2017-03-10 02:06:18 +00:00
Sabe Jones
9a5f6d4ad6 chore(i18n): update locales 2017-03-10 01:58:16 +00:00
SabreCat
d19237cdbe 3.79.0 2017-03-10 01:47:32 +00:00
Sabe Jones
18bd3f8c54 Send group plans subscription message to Slack (#8549)
* feat(Slack): send group plans sub message

* fix(Slack): grab more relevant user data
2017-03-09 19:11:21 -06:00
Keith Holliday
8b65ce3053 Updated migration to not update canceled group plans (#8550) 2017-03-09 17:50:42 -06:00
Keith Holliday
38b894db56 Group plans add mount (#8548)
* Added jakcalop mount to group plan members

* Changed pet assignment to mount
2017-03-09 16:15:00 -07:00
Sabe Jones
61db283473 Jackalopes (#8547)
* feat(content): add Jackalope rare mount

* chore(news): Bailey for Group Plans

* fix(sprites): correct inconsistent file perms
2017-03-09 14:50:28 -07:00
Keith Holliday
d70d39cc49 Group plans copy changes (#8546)
* Added new message for when user has group plan

* Changed subscription wording to group plan

* Updated copy
2017-03-09 14:27:52 -07:00
Keith Holliday
c26b884bc7 Group migrations (#8528)
* Added create group migration

* Add migration for unlimited group subscription

* Add migration to update group members with group plans

* Added error catch

* Added comments
2017-03-09 14:26:31 -07:00
Keith Holliday
11c8f2a775 Minification fix hide features (#8544)
* Added minification fix

* Hid settings for features we will not release yet

* Hid repeatables UI

* Removed extra file

* Removed repeats every from weekly

* Added start date back

* Hid counter reset when advance is collpased
2017-03-08 18:50:57 -07:00
Keith Holliday
1082359f2c Repeatables fixes (#8538)
* Prevented watch functions from being called when task._edit is removed

* Added start date support on the UI task summary

* Fixed setting of monthly and calculations

* Fixed linting issues

* Added check for existence

* Added existence check

* Ensured correct start date is used on update

* Hid repeat options from anything not a daily

* Added missing locales

* Moved repeatables out of advance options
2017-03-08 16:48:30 -07:00
Alys
6486862242 adjust apidocs comment to remove unnecessary id parameter with incorrect syntax 2017-03-09 08:06:15 +10:00
Sabe Jones
f68cc569d6 fix(sprites): adjust eggs (#8543) 2017-03-08 11:12:49 -06:00
Matteo Pagliazzi
b10751e874 client: router: always scroll to the top 2017-03-08 09:25:36 +01:00
Keith Holliday
b75c57f130 Tasks sort delete fix (#8526)
* Fixed task sorting

* Add sync when group task is deleted

* Added sync when user tasks reorder

* Abstracted show logic and removed task grouping from group page

* Fixed scope typo

* Localized the default challenge short name

* Removed default shortName

* Fixed test for challenge shortName
2017-03-07 14:28:49 -07:00
Keith Holliday
28c93ea869 Moved show counters to directive (#8537)
* Moved show counters to directive

- hide counters on challenge page
- hide counters on group page

* Changed let to var
2017-03-07 13:58:39 -07:00
Matteo Pagliazzi
7f630f2b86 config.json: do not enable APN by default 2017-03-07 14:19:27 +01:00
Matteo Pagliazzi
1a8f591251 mongoose: upgrade to 4.8.6 and remove un-necessary _.clone calls now that toObject clones correctly 2017-03-07 14:16:14 +01:00
Keith Holliday
be60fb0635 Group plans subs to all (#8394)
* Added subscriptions to all members when group subs

* Added unsub when group cancels

* Give user a subscription when they join a subbed group

* Removed subscription when user leaves or is removed from group

* Fixed linting issues:

* Added tests for users with a subscription being upgraded to group plan

* Added tests for checking if existing recurring user sub gets updated during group plan. Added better merging for plans

* Added test for existing gift subscriptions

* Added additional months to user when they have an existing recurring subscription and get upgraded to group sub

* Adds test for user who has cancelled with date termined in the future

* Added test to ensure date termined is reset

* Added tests for extra months carrying over

* Added test for gems bought field

* Add tests to for fields that should remain when upgrading

* Added test for all payment methods

* Added prevention for when a user joins a second group plan

* Fixed subscribing tests

* Separated group plan payment tests

* Added prevention of editing a user with a unlimited sub

* Add tests to ensure group keeps plan if they are in two and leave one

* Ensured users with two group plans do not get cancelled when on group plan is cancelled

* Ensured users without group sub are untouched when group cancels

* Fixed lint issues

* Added new emails

* Added fix for cron tests

* Add restore to stubbed methods

* Ensured cancelled group subscriptions are updated

* Changed group plan exist check to check for date terminated

* Updated you cannont delete active group message

* Removed description requirement

* Added upgrade group plan for Amazon payments

* Fixed lint issues

* Fixed broken tests

* Fixed user delete tests

* Fixed function calls

* Hid cancel button if user has group plan

* Hide difficulty from rewards

* Prevented add user functions to be called when group plan is cancelled

* Fixed merge issue

* Correctly displayed group price

* Added message when you are about to join canclled group plan

* Fixed linting issues

* Updated tests to have no redirect to homes

* Allowed leaving a group with a canceld subscription

* Fixed spelling issues

* Prevented user from changing leader with active sub

* Added payment details title to replace subscription title

* Ensured we do not count leader when displaying upcoming cost

* Prevented party tasks from being displayed twice

* Prevented cancelling and already cancelled sub

* Fixed styles of subscriptions

* Added more specific mystery item tests

* Fixed test to refer to leader

* Extended test range to account for short months

* Fixed merge conflicts

* Updated yarn file

* Added missing locales

* Trigger notification

* Removed yarn

* Fixed locales

* Fixed scope mispelling

* Fixed line endings

* Removed extra advanced options from rewards

* Prevent group leader from leaving an active group plan

* Fixed issue with extra months applied to cancelled group plan

* Ensured member count is calculated when updatedGroupPlan

* Updated amazon payment method constant name

* Added comment to cancel sub user method

* Fixed smantic issues

* Added unite test for user isSubscribed and hasNotCancelled

* Add tests for isSubscribed and hasNotCanceled

* Changed default days remaining to 2 days for group plans

* Fixed logic with adding canceled notice to group invite
2017-03-06 15:09:50 -07:00
Matteo Pagliazzi
03a1d61c08 client: add some margin to the avatar 2017-03-06 21:09:19 +01:00
Matteo Pagliazzi
0767dc97b7 fix: remove semanticui from gulpfile 2017-03-06 20:58:41 +01:00
Matteo Pagliazzi
4978a62829 Client: semantic ui -> bootstrap 4 and less -> scss (#8535)
* client: semantic ui -> bootstrap 4 and less -> scss

* start porting components to boostrap

* port header, start porting menu

* port loading screen

* port most of the menu

* port secondary menus

* port guilds and stable

* disable tavern for now, port inbox

* typo

* put back old tavern code
2017-03-06 20:09:34 +01:00
Matteo Pagliazzi
0a35e63897 Client: Guild page and mix changes (#8533)
* update deps

* add guilds page

* improve karma conf, add tests for actions
2017-03-05 19:07:48 +01:00
Megan Tiu
03b3e79ea0 Properly format a subscription end date according to user preference (#8514) 2017-03-03 11:52:57 -07:00
Matteo Pagliazzi
dc8598ae81 Client: Guilds Discovery (#8529)
* wip: add guilds discovery page

* add public guilds page

* fix and add tests for the groups utilities mixin
2017-03-03 19:38:17 +01:00
Sabe Jones
3629f7f8a5 Merge branch 'release' into develop 2017-03-03 17:36:25 +00:00
Matteo Pagliazzi
8805f81b96 Client/inventory WIP (#8527)
* some stable work and faster less recompilation

*  user with zero tasks can use the app

* wip work to show loading status of resources

* revert changes to sync
2017-03-03 15:40:21 +01:00
MathWhiz
207dbf35d6 Add tags to default tasks (#8419)
* Add ability to add tags to default tasks

* fix missing semicolon

* fix nesting callbacks error

* Add tags to default tasks

* fix default tags

* Start test

* Finish test

* Fix tests

* Move test

* Fix padded-bock

* Fix test

* Fix request

* fix requests

* fix test

* fix lint

* Refine test

* Fix test

* Fix Test

* Fix tests

* Please work :(

* Fix stupid mistake

* Fix lint

* Fixes

* fix function

* fix lint

* fix lint
2017-03-03 14:57:57 +01:00
Sabe Jones
448a953147 Backgrounds and Armoire 2017/03 (#8525)
* feat(content): add Armoire and BGs 2017-03

* chore(sprites): compile

* chore(event): disable Cupid Potions

* fix(sprites): correct shop canvas

* chore(news): Bailey 2017-03-02

* 3.78.0
2017-03-02 15:49:07 -06:00
MathWhiz
4fb1ff2baa ApiDoc Group (#8522)
* ApiDoc Group

* Remove space
2017-03-02 18:11:50 +01:00
Keith Holliday
be64274be4 Fixed lint issues with model in task services (#8523) 2017-03-02 08:16:28 -07:00
Sabe Jones
390970a73a chore(news): Bailey 2017-03-01 (#8524) 2017-03-01 18:54:14 -06:00
Matteo Pagliazzi
0cb254d5fc chore(i18n): update locales 2017-03-01 18:33:35 +01:00
Matteo Pagliazzi
98c019a0b6 Upgrade lodash to v4 and lint more files (#8495)
* common: import lodash modules separately

* remove test/content from .eslintignore, fix with eslint --fix content/index

* lint test/content

* lint content/index except for lodash methods

* upgrade server/models

* upgrade server/middlewares and server/libs

* port server/controllers/top-level

* port server/controllers/api-v3

* port views and tests

* client old port lodash and _(, missing _.

* upgrade client-old

* port common/script (root level files only)

* port common/script/fns

* port common/libs

* port common/script/ops

* port common/script/content and common/script/libs/shops.js

* misc fixes

* misc fixes

* misc fixes

* more tests fixes

* fix payments test stubbing, down to 2 failing tests

* remove more instances of lodash wrapping

* fix bug where toObject does not clone object

* fix tests

* upgrade migration or add lodash 4 note

* update shrinkwrap

* fix linting

* upgrade eslint-config-habitrpg

* update shrinkwrap

* recompile shrinkwrap
2017-03-01 17:10:48 +01:00
Keith Holliday
ef02e59590 Repeatables (#8444)
* Added initial should do weekly tests

* Added support back in for days of the week and every x day

* Added better week day mapper

* Added initial monthly

* Added every x months

* Added yearlies

* Fixed every nth weekdy of month

* Fixed tests to check every x week on weekday

* Began combining x month with nth weekday

* Added every x month combined with date and weekday

* Fixed lint issues

* Saved moment-recurr to package.json

* Added new repeat fields

* Added UI for repeatables

* Ensured only dalies are affected by summary

* Added local strings

* Updated npm shrinkwrap

* Shared day map constant

* Updated shrinkwrap

* Added ui back

* Updated copy of test cases

* Added new translation strings

* Updated shrinkwrap

* Fixed broken test

* Made should do tests static for better consitency

* Fixed issue with no repeat

* Fixed line endings

* Added frequency enum values

* Fixed spacing
2017-02-27 15:41:21 -07:00
Keith Holliday
93befcebcc Tasks score notes (#8507)
* Added setting and modal for score notes

* Added persistent score notes

* Fixed linting issues and documented new field

* Added max length to task score notes

* Added check for score notes existence

* Combined tasks perferences
2017-02-27 14:56:34 -07:00
Keith Holliday
68a042cdb9 Leaving a group (#8517)
* Leaving a group or a guild no longer removes the user from the challenges of that group or guild.

* Updating api docs for leaving group to take into account the default path no longer leaving challenges when leaving a group.

* Updating api docs for leaving group to take into account the default path no longer leaving challenges when leaving a group.

* refactored according to blade's comments to not be a breaking change. The api now accepts a body parameter to specify wether the user
should remain in the groups challenges or leave them. The change also adds more tests around this behavior to confirm that it works
as expected.
2017-02-27 13:58:30 -07:00
Keith Holliday
30954fe7c5 Added support for grouping tasks by challenge (#8469)
* Added support for grouping tasks by chllenge

* Fixed tests and updated default challenge model name

* Fixed broken member test

* Updated setting string

* Changed to shortName

* Began abstracting task grouping

* Added initial task directive code

* Added new directives to help with grouping of tasks

* Removed random console.log
2017-02-27 11:34:03 -07:00
deonna
44f23a7675 fix(nextRewardUnlocksIn): Check-in prize message was always plural --… (#8458)
* fix(nextRewardUnlocksIn): Check-in prize message was always plural -- moving to a non-sentence like structure to fix incorrect grammar.

* fix(countLeft): Check-in prize message was always plural -- moving to a non-sentence like structure to fix incorrect grammar.
2017-02-27 11:20:57 -07:00
Matt Handley
705a78e835 Debounce $scope updates when typing in chat. (#8485)
Fixes #6462, by saving a bunch of time per frame. See the issue for evidence of
the win.
2017-02-27 11:19:42 -07:00
astolat
6d0df78441 Habits v2: adding counter to habits (cleaned up branch) - fixes #8113 (#8198)
* Clean version of PR 8175

The original PR for this was here:
https://github.com/HabitRPG/habitica/pull/8175

Unfortunately while fixing a conflict in tasks.json, I messed up the rebase and wound up pulling in too many commits and making a giant mess. Sorry. :P

* Fixing test failure

This test seems to occasionally start failing (another coder reported the same thing happening to them in the blacksmiths’ guild) because the order in which the tasks are created can sometimes not match the order in the array. So I have sorted the tasks array after creation by the task name to ensure a consistent ordering, and slightly reordered the expect statements to match.
2017-02-27 11:15:45 -07:00
Megan Tiu
6f0d0b1fb3 Use backticks in 'quest started' system message (#8503)
Fixes #8445
2017-02-26 16:03:58 +10:00
Sabe Jones
dfcd32d54a chore(i18n): update locales 2017-02-23 18:04:06 +00:00
Sabe Jones
c24cbdc987 feat(content): strings for Armoire and BGs 2017-03 2017-02-23 17:55:50 +00:00
Sabe Jones
68d8c0de51 3.77.0 2017-02-23 05:22:59 +00:00
Sabe Jones
a7b0fa195f chore(news): Bailey 2017-02-23 02:57:09 +00:00
Sabe Jones
ab65aa692f fix(sprites): NYE 2x pixelfixes
and move a promo to subfolder
2017-02-23 02:56:33 +00:00
Sabe Jones
198d4df02a fix(analytics): consistent partyID label 2017-02-22 20:47:52 +00:00
Sabe Jones
6fa2f643fd fix(event): stop giving out party stuff 2017-02-21 22:21:13 +00:00
Sabe Jones
4d39861b51 fix(event): disable buying Santa quests 2017-02-21 22:16:32 +00:00
Sabe Jones
d4c99b6db6 fix(avatar): disable wintery customizations 2017-02-21 21:59:43 +00:00
Sabe Jones
a79dc90a45 chore(sprites): compile 2017-02-21 21:21:53 +00:00
Sabe Jones
daa6bd0315 chore(event): end Valentine's 2017-02-21 21:21:25 +00:00
Sabe Jones
99f2373214 feat(content): Mystery items 2017/02 2017-02-21 21:20:24 +00:00
Phillip Thelen
374d528647 Implement iOS subscriptions (#8493)
* implement iOS subscriptions

* add additional tests to request body

* Improve subscription cancelling

* change string to constant
2017-02-21 19:22:13 +01:00
Alys
8550ca4d29 change heading on forgot-password form to "Email a Password Reset Link"
Previously it was "Email New Password"
2017-02-19 09:45:58 +10:00
Keith Holliday
79f6b59f6e Options view cleanup (#8484)
* Split the settings into their own files

* Refactor profile jade items to have separate files
2017-02-17 03:55:59 -07:00
Keith Holliday
e37ad420ce Updated tests to have no redirect to homes (#8494) 2017-02-16 16:33:49 -07:00
Sabe Jones
2f9ff92cbd 3.76.0 2017-02-16 23:12:55 +00:00
Sabe Jones
56479e7fbd chore(i18n): update locales 2017-02-16 21:07:51 +00:00
Sabe Jones
66e4849553 feat(content): subscriber item strings 2017-02-16 20:56:16 +00:00
Sabe Jones
9e29b44ad9 chore(sprites): compile 2017-02-16 20:51:35 +00:00
Sabe Jones
605488dd47 feat(content): Guinea Pig quest 2017-02-16 20:51:12 +00:00
MathWhiz
6c16b4b77e ApiDoc - Development (#8480)
* Add api info

* Remove extra spaces
2017-02-16 08:53:21 -07:00
Matteo Pagliazzi
80205dcc67 recompile shrinkwrap 2017-02-15 17:25:49 +01:00
Matteo Pagliazzi
65d5bf69f6 Upgrade webpack to v2 and other deps (#8491)
* update to webpack2 and other deps

* fix linting
2017-02-15 17:24:37 +01:00
Matteo Pagliazzi
20792f5455 New Client: stable (#8426)
* try to freeze content object

* deep freeze the content object, start to implement stable

* freeze at the /common level

* go back to freezing content only on the client

* use deep-frezze-strict to support phantomjs

* use own version of deepFreeze

* update comment about deepFreeze
2017-02-15 12:49:57 +01:00
Sabe Jones
6fd509df13 fix(news): missing blog info 2017-02-14 21:00:38 +00:00
Sabe Jones
d7df18a97a 3.75.3 2017-02-14 18:29:11 +00:00
Sabe Jones
ff5c44c5a8 feat(event): Valentine's 2017-02-14 17:32:23 +00:00
Matteo Pagliazzi
c929fa1351 chore(i18n): update locales 2017-02-14 18:19:14 +01:00
Matteo Pagliazzi
d30e7b9251 Don't send plaintext reset passwords via email (#8457)
* start work to avoid sending reset password in plaintext via email

* start checking parameters

* fix new password reset email

* render error if password reset code is missing or invalid

* implement POST route, conversion to bcrypt and messages

* add auth.local.passwordResetCode field

* add failing tests, move reset code validation func to lib, fixes, remove old tests

* fix unit tests

* fix page rendering and add integration tests

* fix password reset page

* add integration test

* fix string

* fix tests url
2017-02-14 18:08:31 +01:00
Matteo Pagliazzi
c6c6632405 fix(tests): correctly append query string 2017-02-13 12:54:45 +01:00
Matteo Pagliazzi
e0d9ecca52 fix(tests): do not redirect to home page when cancelling a subscription 2017-02-13 12:21:34 +01:00
Marcel O'Neil
78f187f87a Task edit screen changes [fixes #8474]
move Dailies repeats out of Advanced Options; enlarge Notes; reduce spacings
2017-02-13 20:02:27 +10:00
Alys
af047d3c82 revert commits accidentally added from "Added support for grouping tasks by challenge"
So sorry, but I accidentally pushed some commits I'd been testing. :( This reverts them.

Reverts c496f94c79 ad6073220d d669db0f9a c244fe488d
2017-02-12 12:17:23 +10:00
Alys
20e8f47def adjust links to wiki's page for Extensions, Add-Ons, and Customizations
- remove redundant link from footer's Company column (still exists in Community)
- change link to point directly to wiki page instead of to a wiki redirect for:
   - static/features page ("3rd Party Tools" section)
   - static/extensions redirection
2017-02-11 23:14:47 +10:00
Keith Holliday
c496f94c79 Updated setting string 2017-02-11 17:39:53 +10:00
Keith Holliday
ad6073220d Fixed broken member test 2017-02-11 17:39:53 +10:00
Keith Holliday
d669db0f9a Fixed tests and updated default challenge model name 2017-02-11 17:39:53 +10:00
Keith Holliday
c244fe488d Added support for grouping tasks by chllenge 2017-02-11 17:39:53 +10:00
Monica Williams
aef71db0f5 removes changes to all local files except for en file (#8463) 2017-02-11 17:06:57 +10:00
Sabe Jones
ac566882fe 3.75.2 2017-02-08 22:02:59 +00:00
Sabe Jones
1ad662a090 chore(news): blog Bailey 2017-02-08 20:38:40 +00:00
Rachel Williams
1db52de45d Reordered Magic Hatching Potions, fixes issue 8465 (#8467)
* Moved Royal Purple to top of list, ordered other mounts from Spring to Winter

* Issue 8465, moved Royal Purple to top and arranged other pets/mounts from Spring-Winter

* Fixed whitespacing mistake from previous commit

* Magic Hatching Potions reordered by season
2017-02-08 13:14:30 -06:00
Travis
f8cfdfa37d Updating attribute calculation to look at all equipment #8188 (#8202)
* Taking all equipped items into account when calculating attributes instead of just head, weapon, sheild, and armor. closes #8185

* Refactored the stat calculations a bit so that all stat calculations are handled in the same location in the same way to try and reduce duplicate logic.
This commit also adds a number of tests to test this new behavior.

* spelling fixes
2017-02-07 12:04:12 -07:00
Sabe Jones
ffd36465c9 chore(packages): update passport 2017-02-07 00:25:41 +00:00
Myles Louis Dakan
dbb1e3aa18 Mods blocking (#8364)
* updated logic for blocking/unblocking

* updated 1 test and added 2
2017-02-05 22:32:10 -07:00
Matteo Pagliazzi
07ce68c596 remove newrelic 2017-02-05 18:43:00 +01:00
Keith Holliday
4c5d72c96f Fixed group plan checkout with stripe (#8475) 2017-02-04 09:01:53 -07:00
Matteo Pagliazzi
7121653515 3.75.1 2017-02-03 11:38:55 +01:00
Matteo Pagliazzi
ce2b66a2be update deps 2017-02-03 11:15:30 +01:00
Matteo Pagliazzi
43e381cfc1 Revert "Fix Gem purchase validation" (#8471) 2017-02-03 11:08:06 +01:00
Phillip Thelen
ca5161b48a fix gem purchase validation (#8470) 2017-02-03 10:58:48 +01:00
Sabe Jones
44dec6dc4b fix(news): Android URL 2017-02-02 22:13:31 +00:00
Sabe Jones
fb8f0bed43 3.75.0 2017-02-02 22:08:17 +00:00
Sabe Jones
c391de9e86 chore(news): Bailey
and tweak today's migrations for new format
2017-02-02 21:04:36 +00:00
Sabe Jones
7a534ab81d fix(payments): customerId query 2017-02-02 19:51:52 +00:00
Sabe Jones
32c7f40c4b chore(sprites): compile 2017-02-02 17:31:43 +00:00
Sabe Jones
569fbff244 feat(content): backgrounds and Armoire Feb 2017 2017-02-02 17:30:46 +00:00
Sabe Jones
3fe847f329 feat(content): Cupid Hatching Potions 2017-02-02 17:29:33 +00:00
Sabe Jones
d52d759733 3.74.1 2017-02-02 15:45:23 +00:00
Sabe Jones
5e5a755022 chore(sprites): compile 2017-02-02 15:18:12 +00:00
Sabe Jones
8d148b4d69 End Winter Wonderland (#8466)
* chore(event): end Winter Wonderland

* fix(test): update constant
2017-02-02 09:08:51 -06:00
Sabe Jones
248b64a43f 3.74.0 2017-02-02 00:59:44 +00:00
Sabe Jones
57ed0f0a10 chore(i18n): update locales 2017-02-02 00:55:58 +00:00
Sabe Jones
3455adaef5 chore(news): Bailey 2017-02-02 00:48:24 +00:00
Phillip Thelen
4d0295a60d Support subscription payment through Google Play Store (#8437)
* Support subscription payment through Google Play Store

* minor fixes to iap subscriptions

* Support subscription payment through Google Play Store

* minor fixes to iap subscriptions

* revert change to test

* add unit tests for google payments

* add integration tests for google payments

* change config formatting for play api

* fix typo in file name

* fix typo in example config

* Improve google payment tests

* fix linter errors
2017-02-01 18:39:37 -06:00
Sabe Jones
a002bc5e20 fix(migration): curly typo 2017-02-01 21:00:48 +00:00
Sabe Jones
b9d1086e24 chore(migration): update Take This format 2017-02-01 20:52:26 +00:00
madpink
412a0ecc8c Updating Tasks and Tags API Doc (#8447)
* Updating Tasks and Tags API Doc

* Update Tasks and Tag API Doc

added back  * @apiUse ChallengeNotFound

* Update Tasks and Tag API Doc #8447

Corrected NotAuthorized errors to 401
2017-02-01 19:37:27 +01:00
Sabe Jones
d44c9ea853 3.73.1 2017-01-31 21:11:21 +00:00
Sabe Jones
c44c581265 fix(shops): correct event boolean 2017-01-31 21:10:51 +00:00
Sabe Jones
f666f3cd04 3.73.0 2017-01-31 19:22:22 +00:00
Sabe Jones
236bd6cec4 fix(test): linting and constant 2017-01-31 19:21:13 +00:00
Keith Holliday
e124c36274 Added double columns to edit modal (#8456)
* Added double columns to edit modal

* Fixed task notes z index and border styles

* Moved tags to right column and updated min width
2017-01-31 12:05:49 -07:00
Sabe Jones
d5511a0047 chore(i18n): update locales 2017-01-31 18:38:23 +00:00
Sabe Jones
87f003f392 chore(sprites): compile 2017-01-31 18:32:03 +00:00
Sabe Jones
930a869365 feat(event): Habit Birthday 2017 2017-01-31 18:30:39 +00:00
Alys
809da8add0 update landing page's number of user accounts to 2 million
YES! TWO MILLION!
2017-01-31 20:54:33 +10:00
Sabe Jones
1dad176320 3.72.1 2017-01-26 18:52:39 +00:00
Sabe Jones
1596c6218f chore(news): Bailey 2017-01-26 2017-01-26 18:10:13 +00:00
Sabe Jones
0d3aba950a fix(config): remove deprecated env var 2017-01-25 23:27:34 +00:00
Sabe Jones
f1110e0f89 chore(i18n): update locales 2017-01-25 22:31:54 +00:00
Sabe Jones
7273f8f6d9 feat(content): strings for upcoming items 2017-01-25 22:25:32 +00:00
Keith Holliday
a0ae200a54 Removed extra async (#8455) 2017-01-25 09:47:21 -07:00
2201 changed files with 108153 additions and 67123 deletions

View File

@@ -8,16 +8,13 @@ dist/
dist-client/
# Not linted
migrations/*
website/client-old/
scripts/*
test/server_side/**/*
test/client-old/spec/**/*
# Temporarilly disabled. These should be removed when the linting errors are fixed TODO
website/common/script/content/index.js
migrations/*
scripts/*
website/common/browserify.js
test/content/**/*
Gruntfile.js
gulpfile.js
gulp

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

@@ -1,21 +1,19 @@
[//]: # (Before logging this issue, look through common problems at https://github.com/HabitRPG/habitrpg/issues If you find your issue there, read at least the first post to see if there is a workaround for you)
[//]: # (Before logging this issue, please post to the Report a Bug guild from the Habitica website's Help menu. Most bugs can be handled quickly there. If a GitHub issue is needed, you will be advised of that by a moderator or staff member -- a player with a dark blue or purple name. It is recommended that you don't create a new issue unless advised to.)
[//]: # (Github is primarily used for reporting bugs. If you have a feature request, use "Help > Request a Feature" so that the feature request can be vetted by the larger Habitica community)
[//]: # (Bugs in the mobile apps can also be reported there.)
[//]: # (To report a bug in one of the mobile apps, please report it in the correct repository. Android: https://github.com/HabitRPG/habitrpg-android, iOS: https://github.com/HabitRPG/habitrpg-ios)
[//]: # (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
### General Info
* UUID:
* Browser:
* OS:
### Description
[//]: # (Describe bug in detail here. Include pictures if helpful.)
[//]: # (Describe bug in detail here. Include screenshots if helpful.)
#### Console Errors
[//]: # (Include any JavaScript console errors here.)

View File

@@ -12,22 +12,25 @@ before_install:
- $CXX --version
- npm install -g npm@4
- 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
after_script:
- ./node_modules/.bin/lcov-result-merger 'coverage/**/*.info' | ./node_modules/coveralls/bin/coveralls.js
script: npm run $TEST
script:
- npm run $TEST
- if [ $COVERAGE ]; then ./node_modules/.bin/lcov-result-merger 'coverage/**/*.info' | ./node_modules/coveralls/bin/coveralls.js; fi
env:
global:
- CXX=g++-4.8
- DISABLE_REQUEST_LOGGING=true
matrix:
- TEST="lint"
- TEST="test:api-v3" REQUIRES_SERVER=true
- TEST="test:api-v3" REQUIRES_SERVER=true COVERAGE=true
- TEST="test:sanity"
- TEST="test:content"
- TEST="test:common"
- TEST="test:karma"
- TEST="client:unit"
- 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,43 +1,16 @@
FROM ubuntu:trusty
MAINTAINER Sabe Jones <sabe@habitica.com>
# Avoid ERROR: invoke-rc.d: policy-rc.d denied execution of start.
RUN echo -e '#!/bin/sh\nexit 0' > /usr/sbin/policy-rc.d
# Install prerequisites
RUN apt-get update
RUN apt-get install -y \
build-essential \
curl \
git \
libfontconfig1 \
libfreetype6 \
libkrb5-dev \
python
# Install NodeJS
RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
RUN apt-get install -y nodejs
# Install npm@latest
RUN curl -sL https://www.npmjs.org/install.sh | sh
# Clean up package management
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
FROM node:boron
# Install global packages
RUN npm install -g gulp grunt-cli bower mocha
# Clone Habitica repo and install dependencies
WORKDIR /habitrpg
RUN git clone https://github.com/HabitRPG/habitica.git /habitrpg
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 environment config file and build directory
RUN cp config.json.example config.json
# Create Build dir
RUN mkdir -p ./website/build
# Start Habitica

18
Dockerfile-prod Normal file
View File

@@ -0,0 +1,18 @@
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 --branch v3.99.0 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"]

View File

@@ -5,8 +5,7 @@ Habitica [![Build Status](https://travis-ci.org/HabitRPG/habitica.svg?branch=dev
We need more programmers! Your assistance will be greatly appreciated.
For an introduction to the technologies used and how the software is organized, refer to [Contributing to Habitica](http://habitica.wikia.com/wiki/Contributing_to_Habitica#Coders_.28Web_.26_Mobile.29) - "Coders (Web & Mobile)" section.
For an introduction to the technologies used and how the software is organized, refer to [Guidance for Blacksmiths](http://habitica.wikia.com/wiki/Guidance_for_Blacksmiths).
To set up a local install of Habitica for development and testing, see [Setting up Habitica Locally](http://habitica.wikia.com/wiki/Setting_up_Habitica_Locally), which contains instructions for Windows, *nix / Mac OS, and Vagrant.
To set up a local install of Habitica for development and testing on various platforms, see [Setting up Habitica Locally](http://habitica.wikia.com/wiki/Setting_up_Habitica_Locally).
Then read [Guidance for Blacksmiths](http://habitica.wikia.com/wiki/Guidance_for_Blacksmiths) for additional instructions and useful tips.

View File

@@ -30,7 +30,7 @@
"bootstrap-tour": "0.10.1",
"css-social-buttons": "samcollins/css-social-buttons#v1.1.1 ",
"github-buttons": "mdo/github-buttons#v3.0.0",
"hello": "1.13.4",
"hello": "1.14.1",
"jquery": "2.1.0",
"jquery-colorbox": "1.4.36",
"jquery-ui": "1.10.3",

View File

@@ -2,12 +2,18 @@
"PORT":3000,
"ENABLE_CONSOLE_LOGS_IN_PROD":"false",
"IP":"0.0.0.0",
"CORES":1,
"WEB_CONCURRENCY":1,
"BASE_URL":"http://localhost:3000",
"FACEBOOK_KEY":"123456789012345",
"FACEBOOK_SECRET":"aaaabbbbccccddddeeeeffff00001111",
"GOOGLE_CLIENT_ID":"123456789012345",
"GOOGLE_CLIENT_SECRET":"aaaabbbbccccddddeeeeffff00001111",
"PLAY_API": {
"CLIENT_ID": "aaaabbbbccccddddeeeeffff00001111",
"CLIENT_SECRET": "aaaabbbbccccddddeeeeffff00001111",
"ACCESS_TOKEN":"aaaabbbbccccddddeeeeffff00001111",
"REFRESH_TOKEN":"aaaabbbbccccddddeeeeffff00001111"
},
"NODE_DB_URI":"mongodb://localhost/habitrpg",
"TEST_DB_URI":"mongodb://localhost/habitrpg_test",
"NODE_ENV":"development",
@@ -67,9 +73,14 @@
"LOGGLY_ACCOUNT": "account",
"PUSH_CONFIGS": {
"GCM_SERVER_API_KEY": "",
"APN_ENABLED": "true",
"APN_ENABLED": "false",
"FCM_SERVER_API_KEY": ""
},
"SITE_HTTP_AUTH": {
"ENABLED": "false",
"USERNAME": "admin",
"PASSWORD": "password"
},
"PUSHER": {
"ENABLED": "false",
"APP_ID": "appId",
@@ -80,5 +91,15 @@
"FLAGGING_URL": "https://hooks.slack.com/services/id/id/id",
"FLAGGING_FOOTER_LINK": "https://habitrpg.github.io/flag-o-rama/",
"SUBSCRIPTIONS_URL": "https://hooks.slack.com/services/id/id/id"
},
"ITUNES_SHARED_SECRET": "aaaabbbbccccddddeeeeffff00001111",
"EMAILS" : {
"COMMUNITY_MANAGER_EMAIL" : "leslie@habitica.com",
"TECH_ASSISTANCE_EMAIL" : "admin@habitica.com",
"PRESS_ENQUIRY_EMAIL" : "leslie@habitica.com"
},
"LOGGLY" : {
"TOKEN" : "example-token",
"SUBDOMAIN" : "exmaple-subdomain"
}
}

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 = {

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

@@ -25,7 +25,7 @@ gulp.task('build:common', () => {
gulp.task('build:server', ['build:src', 'build:common']);
gulp.task('build:dev', ['browserify', 'prepare:staticNewStuff', 'semantic-ui'], (done) => {
gulp.task('build:dev', ['browserify', 'prepare:staticNewStuff'], (done) => {
gulp.start('grunt-build:dev', done);
});
@@ -33,7 +33,7 @@ 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', 'semantic-ui'], (done) => {
gulp.task('build:prod', ['browserify', 'build:server', 'prepare:staticNewStuff'], (done) => {
runSequence(
'grunt-build:prod',
'apidoc',

View File

@@ -1,43 +0,0 @@
import gulp from 'gulp';
import fs from 'fs';
// Make semantic-ui-less work with a theme in a different folder
// Code taken from https://www.artembutusov.com/webpack-semantic-ui/
// Relative to node_modules/semantic-ui-less
const SEMANTIC_THEME_PATH = '../../website/client/assets/less/semantic-ui/theme.config';
// fix well known bug with default distribution
function fixFontPath (filename) {
return new Promise((resolve, reject) => {
fs.readFile(filename, 'utf8', (err, content) => {
if (err) return reject(err);
let newContent = content.replace(
'@fontPath : \'../../themes/',
'@fontPath : \'../../../themes/'
);
fs.writeFile(filename, newContent, 'utf8', (err1) => {
if (err) return reject(err1);
resolve();
});
});
});
}
gulp.task('semantic-ui', (done) => {
// relocate default config
fs.writeFile(
'node_modules/semantic-ui-less/theme.config',
`@import '${SEMANTIC_THEME_PATH}';\n`,
'utf8',
(err) => {
if (err) return done(err);
fixFontPath('node_modules/semantic-ui-less/themes/default/globals/site.variables')
.then(() => done())
.catch(done);
}
);
});

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

@@ -280,7 +280,7 @@ gulp.task('test:e2e:safe', ['test:prepare', 'test:prepare:server'], (cb) => {
gulp.task('test:api-v3:unit', (done) => {
let runner = exec(
testBin('mocha test/api/v3/unit --recursive --require ./test/helpers/start-server'),
testBin('node_modules/.bin/istanbul cover --dir coverage/api-v3-unit --report lcovonly node_modules/mocha/bin/_mocha -- test/api/v3/unit --recursive --require ./test/helpers/start-server'),
(err, stdout, stderr) => {
if (err) {
process.exit(1);
@@ -298,7 +298,7 @@ gulp.task('test:api-v3:unit:watch', () => {
gulp.task('test:api-v3:integration', (done) => {
let runner = exec(
testBin('mocha test/api/v3/integration --recursive --require ./test/helpers/start-server'),
testBin('node_modules/.bin/istanbul cover --dir coverage/api-v3-integration --report lcovonly node_modules/mocha/bin/_mocha -- test/api/v3/integration --recursive --require ./test/helpers/start-server'),
{maxBuffer: 500 * 1024},
(err, stdout, stderr) => {
if (err) {

View File

@@ -67,7 +67,7 @@ gulp.task('transifex:malformedStrings', () => {
let stringsWithIncorrectNumberOfInterpolations = [];
let count = 0;
_(ALL_LANGUAGES).each(function (lang) {
_.each(ALL_LANGUAGES, function (lang) {
_.each(stringsToLookFor, function (strings, file) {
let translationFile = fs.readFileSync(LOCALES + lang + '/' + file);
@@ -89,7 +89,7 @@ gulp.task('transifex:malformedStrings', () => {
}
});
});
}).value();
});
if (!_.isEmpty(stringsWithMalformedInterpolations)) {
let message = 'The following strings have malformed or missing interpolations';
@@ -114,7 +114,7 @@ function getArrayOfLanguages () {
function eachTranslationFile (languages, cb) {
let jsonFiles = stripOutNonJsonFiles(fs.readdirSync(ENGLISH_LOCALE));
_(languages).each((lang) => {
_.each(languages, (lang) => {
_.each(jsonFiles, (filename) => {
try {
var translationFile = fs.readFileSync(LOCALES + lang + '/' + filename);
@@ -128,7 +128,7 @@ function eachTranslationFile (languages, cb) {
cb(null, lang, filename, parsedEnglishFile, parsedTranslationFile);
});
}).value();
});
}
function eachTranslationString (languages, cb) {
@@ -153,7 +153,7 @@ function formatMessageForPosting (msg, items) {
function getStringsWith (json, interpolationRegex) {
var strings = {};
_(json).each(function (file_name) {
_.each(json, function (file_name) {
var raw_file = fs.readFileSync(ENGLISH_LOCALE + file_name);
var parsed_json = JSON.parse(raw_file);
@@ -162,7 +162,7 @@ function getStringsWith (json, interpolationRegex) {
var match = value.match(interpolationRegex);
if (match) strings[file_name][key] = match;
});
}).value();
});
return strings;
}

View File

@@ -9,11 +9,11 @@
require('babel-register');
if (process.env.NODE_ENV === 'production') {
require('./gulp/gulp-semanticui');
require('./gulp/gulp-apidoc');
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']);

View File

@@ -1,5 +1,12 @@
// %mongo server:27017/dbname underscore.js my_commands.js
// %mongo server:27017/dbname underscore.js --shell
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var habits = 0,
dailies = 0,
todos = 0,

View File

@@ -3,6 +3,12 @@
*/
// mongo habitrpg ./node_modules/underscore/underscore.js ./migrations/20130326_migrate_pets.js
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var mapping = {
bearcub: {name:'BearCub', modifier: 'Base'},
cactus: {name:'Cactus', modifier:'Base'},

View File

@@ -4,6 +4,12 @@
// mongo habitrpg ./node_modules/underscore/underscore.js migrations/20130327_apply_tokens.js
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var mapping = [
{
tier: 1,

View File

@@ -6,6 +6,11 @@
* mongo habitrpg ./node_modules/underscore/underscore.js ./migrations/20130508_fix_duff_party_subscriptions.js
*/
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
// since our primary subscription will first hit parties now, we *definitely* need an index there
db.parties.ensureIndex( { 'members': 1}, {background: true} );

View File

@@ -1,5 +1,11 @@
//mongo habitrpg ./node_modules/lodash/lodash.js migrations/20130602_survey_rewards.js
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var members = []
members = _.uniq(members);

View File

@@ -3,6 +3,12 @@
// Racer was notorious for adding duplicates, randomly deleting documents, etc. Once we pull the plug on old.habit,
// run this migration to cleanup all the corruption
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
db.users.find().forEach(function(user){
// remove corrupt tasks, which will either be null-value or no id

View File

@@ -5,6 +5,12 @@
// @see http://stackoverflow.com/questions/14867697/mongoose-full-collection-scan
//Also, what do we think of a Mongoose Migration module? something like https://github.com/madhums/mongoose-migrate
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
db.users.find().forEach(function(user){
// Add invites to groups

View File

@@ -8,6 +8,12 @@
var mongo = require('mongoskin');
var _ = require('lodash');
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var backupUsers = mongo.db('localhost:27017/habitrpg_old?auto_reconnect').collection('users');
var liveUsers = mongo.db('localhost:27017/habitrpg_new?auto_reconnect').collection('users');

View File

@@ -1,5 +1,11 @@
// node .migrations/20131127_restore_dayStart.js
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var mongo = require('mongoskin');
var _ = require('lodash');

View File

@@ -8,6 +8,12 @@ mongo = require('mongoskin')
_ = require('lodash')
async = require('async')
# IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
# We've now upgraded to lodash v4 but the code used in this migration has not been
# adapted to work with it. Before this migration is used again any lodash method should
# be checked for compatibility against the v4 changelog and changed if necessary.
# https://github.com/lodash/lodash/wiki/Changelog#v400
db = mongo.db('localhost:27017/habitrpg?auto_reconnect')
###

View File

@@ -1,5 +1,11 @@
// node .migrations/20131221_restore_NaN_history.js
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
/**
* After the classes migration, users lost some history entries
*/

View File

@@ -1,5 +1,11 @@
// node .migrations/20131225_restore_streaks.js
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
/**
* After the classes migration, users lost some history entries
*/

View File

@@ -5,6 +5,12 @@ var migrationName = '20140823_remove_undefined_and_false_notifications';
var authorName = 'Alys'; // in case script author needs to know when their ...
var authorUuid = 'd904bd62-da08-416b-a816-ba797c9ee265'; //... own data is done
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
/**
* https://github.com/HabitRPG/habitrpg/pull/3907
*/

View File

@@ -4,6 +4,12 @@ var migrationName = '20140829_change_headAccessory_to_eyewear';
var authorName = 'Alys'; // in case script author needs to know when their ...
var authorUuid = 'd904bd62-da08-416b-a816-ba797c9ee265'; //... own data is done
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
/**
* https://github.com/HabitRPG/habitrpg/issues/3645
*/

View File

@@ -4,6 +4,11 @@
//
// node 20140831_increase_gems_for_previous_contributions.js > 20140831_increase_gems_for_previous_contributions_output.txt
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var migrationName = '20140831_increase_gems_for_previous_contributions';

View File

@@ -8,6 +8,12 @@ var authorUuid = 'd904bd62-da08-416b-a816-ba797c9ee265'; //... own data is done
* Convert Tier 7 contributors with admin flag to Tier 8 (moderators).
*/
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var mongo = require('mongoskin');
var _ = require('lodash');

View File

@@ -1,3 +1,9 @@
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
// require moment, lodash
db.users.find(
{'purchased.plan.customerId':{$ne:null}},

View File

@@ -9,6 +9,12 @@ var authorUuid = 'd904bd62-da08-416b-a816-ba797c9ee265'; //... own data is done
var dbserver = 'localhost:27017' // CHANGE THIS FOR PRODUCTION DATABASE
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var mongo = require('mongoskin');
var _ = require('lodash');

View File

@@ -8,6 +8,12 @@ var authorUuid = 'd904bd62-da08-416b-a816-ba797c9ee265'; //... own data is done
var dbserver = 'localhost:27017' // CHANGE THIS FOR PRODUCTION DATABASE
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var mongo = require('mongoskin');
var _ = require('lodash');

View File

@@ -19,6 +19,12 @@ var authorUuid = 'd904bd62-da08-416b-a816-ba797c9ee265'; //... own data is done
var dbserver = 'localhost:27017' // CHANGE THIS FOR PRODUCTION DATABASE
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var mongo = require('mongoskin');
var _ = require('lodash');
var moment = require('moment');

View File

@@ -6,6 +6,12 @@ var authorUuid = 'd904bd62-da08-416b-a816-ba797c9ee265'; //... own data is done
* force all active players to rest in the inn due to massive server fail
*/
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var dbserver = 'localhost:27017' // CHANGE THIS FOR PRODUCTION DATABASE
var mongo = require('mongoskin');

View File

@@ -19,6 +19,12 @@ var authorUuid = 'd904bd62-da08-416b-a816-ba797c9ee265'; //... own data is done
* means minimal new testing.
*/
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var dbserver = 'localhost:27017' // FOR TEST DATABASE
// var dbserver = 'username:password@ds031379-a0.mongolab.com:31379' // FOR PRODUCTION DATABASE
var dbname = 'habitrpg';

View File

@@ -7,6 +7,12 @@ var migrationName = '20160111_challenges_condense_same_day_history_entries.js';
var dbserver = '';
var dbname = '';
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var mongo = require('mongoskin');
var _ = require('lodash');
var moment = require('moment');

View File

@@ -11,6 +11,12 @@ var dbserver = 'localhost:27017'; // FOR TEST DATABASE
// var dbserver = 'username:password@ds031379-a0.mongolab.com:31379'; // FOR PRODUCTION DATABASE
var dbname = 'habitrpg';
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var mongo = require('mongoskin');
var _ = require('lodash');

View File

@@ -14,6 +14,12 @@ var dbname = 'habitrpg';
var mongo = require('mongoskin');
var _ = require('lodash');
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var dbUsers = mongo.db(dbserver + '/' + dbname + '?auto_reconnect').collection('users');
// specify a query to limit the affected users (empty for all users):

View File

@@ -2,6 +2,12 @@ var uuid = require('uuid').v4;
var mongo = require('mongodb').MongoClient;
var _ = require('lodash');
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
var taskIds = require('checklists-no-id.json').map(function (obj) {
return obj._id;
});

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,109 @@
var migrationName = '20170131_habit_birthday.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 2017 party robes if user has 2016 robes, 2016 robes if they have the 2015 robes,
* 2015 robes if they have the 2014 robes, and 2014 robes otherwise. Also cake!
*/
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-24')}, // remove after first run to cover remaining users
};
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)
'items.gear.owned'
],
})
.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.items && user.items.gear && user.items.gear.owned && user.items.gear.owned.hasOwnProperty('armor_special_birthday2016')) {
set['items.gear.owned.armor_special_birthday2017'] = false;
} else if (user.items && user.items.gear && user.items.gear.owned && user.items.gear.owned.hasOwnProperty('armor_special_birthday2015')) {
set['items.gear.owned.armor_special_birthday2016'] = false;
} else if (user.items && user.items.gear && user.items.gear.owned && user.items.gear.owned.hasOwnProperty('armor_special_birthday')) {
set['items.gear.owned.armor_special_birthday2015'] = false;
} else {
set['items.gear.owned.armor_special_birthday'] = false;
}
var inc = {
'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,
'achievements.habitBirthdays':1
};
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,88 @@
var migrationName = '20170418_subscriber_jackalopes.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 Jackalope pet to all current subscribers
*/
var monk = require('monk');
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbUsers = monk(connectionString).get('users', { castIds: false });
var now = new Date();
function processUsers(lastId) {
// specify a query to limit the affected users (empty for all users):
var query = {
'purchased.plan.customerId': {$type: 2},
$or: [
{'purchased.plan.dateTerminated': null},
{'purchased.plan.dateTerminated': {$exists: false}},
{'purchased.plan.dateTerminated': {$gt: now}},
]
};
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):
})
.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 = {'items.pets.Jackalope-RoyalPurple': 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,207 @@
var migrationName = '20170425_missing_incentives';
var authorName = 'Sabe'; // in case script author needs to know when their ...
var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
/*
* Award missing Royal Purple Hatching Potion to users with 55+ check-ins
* Reduce users with impossible check-in counts to a reasonable number
*/
import monk from 'monk';
import common from '../website/common';
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 = {
'loginIncentives': {$gt:99},
'migration': {$ne: migrationName},
};
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):
})
.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 language = user.preferences.language || 'en';
var set = {'migration': migrationName};
var inc = {
'items.eggs.BearCub': 0,
'items.eggs.Cactus': 0,
'items.eggs.Dragon': 0,
'items.eggs.FlyingPig': 0,
'items.eggs.Fox': 0,
'items.eggs.LionCub': 0,
'items.eggs.PandaCub': 0,
'items.eggs.TigerCub': 0,
'items.eggs.Wolf': 0,
'items.food.Chocolate': 0,
'items.food.CottonCandyBlue': 0,
'items.food.CottonCandyPink': 0,
'items.food.Fish': 0,
'items.food.Honey': 0,
'items.food.Meat': 0,
'items.food.Milk': 0,
'items.food.Potatoe': 0,
'items.food.RottenMeat': 0,
'items.food.Strawberry': 0,
'items.hatchingPotions.Base': 0,
'items.hatchingPotions.CottonCandyBlue': 0,
'items.hatchingPotions.CottonCandyPink': 0,
'items.hatchingPotions.Desert': 0,
'items.hatchingPotions.Golden': 0,
'items.hatchingPotions.Red': 0,
'items.hatchingPotions.RoyalPurple': 0,
'items.hatchingPotions.Shade': 0,
'items.hatchingPotions.Skeleton': 0,
'items.hatchingPotions.White': 0,
'items.hatchingPotions.Zombie': 0,
};
var nextReward;
if (user.loginIncentives >= 105) {
inc['items.hatchingPotions.RoyalPurple'] += 1;
nextReward = 110;
}
if (user.loginIncentives >= 110) {
inc['items.eggs.BearCub'] += 1;
inc['items.eggs.Cactus'] += 1;
inc['items.eggs.Dragon'] += 1;
inc['items.eggs.FlyingPig'] += 1;
inc['items.eggs.Fox'] += 1;
inc['items.eggs.LionCub'] += 1;
inc['items.eggs.PandaCub'] += 1;
inc['items.eggs.TigerCub'] += 1;
inc['items.eggs.Wolf'] += 1;
nextReward = 115;
}
if (user.loginIncentives >= 115) {
inc['items.hatchingPotions.RoyalPurple'] += 1;
nextReward = 120;
}
if (user.loginIncentives >= 120) {
inc['items.hatchingPotions.Base'] += 1;
inc['items.hatchingPotions.CottonCandyBlue'] += 1;
inc['items.hatchingPotions.CottonCandyPink'] += 1;
inc['items.hatchingPotions.Desert'] += 1;
inc['items.hatchingPotions.Golden'] += 1;
inc['items.hatchingPotions.Red'] += 1;
inc['items.hatchingPotions.Shade'] += 1;
inc['items.hatchingPotions.Skeleton'] += 1;
inc['items.hatchingPotions.White'] += 1;
inc['items.hatchingPotions.Zombie'] += 1;
nextReward = 125;
}
if (user.loginIncentives >= 125) {
inc['items.hatchingPotions.RoyalPurple'] += 1;
nextReward = 130;
}
if (user.loginIncentives >= 130) {
inc['items.food.Chocolate'] += 3;
inc['items.food.CottonCandyBlue'] += 3;
inc['items.food.CottonCandyPink'] += 3;
inc['items.food.Fish'] += 3;
inc['items.food.Honey'] += 3;
inc['items.food.Meat'] += 3;
inc['items.food.Milk'] += 3;
inc['items.food.Potatoe'] += 3;
inc['items.food.RottenMeat'] += 3;
inc['items.food.Strawberry'] += 3;
}
if (user.loginIncentives >= 135) {
inc['items.hatchingPotions.RoyalPurple'] += 1;
nextReward = 140;
}
if (user.loginIncentives >= 140) {
set['items.gear.owned.weapon_special_skeletonKey'] = true;
set['items.gear.owned.shield_special_lootBag'] = true;
nextReward = 145;
}
if (user.loginIncentives >= 145) {
inc['items.hatchingPotions.RoyalPurple'] += 1;
nextReward = 150;
}
if (user.loginIncentives >= 150) {
set['items.gear.owned.head_special_clandestineCowl'] = true;
set['items.gear.owned.armor_special_sneakthiefRobes'] = true;
nextReward = 155;
}
if (user.loginIncentives > 155) {
set.loginIncentives = 155;
nextReward = 160;
}
var push = {
'notifications': {
'type': 'LOGIN_INCENTIVE',
'data': {
'nextRewardAt': nextReward,
'rewardKey': [
'shop_armoire',
],
'rewardText': common.i18n.t('checkInRewards', language),
'reward': [],
'message': common.i18n.t('backloggedCheckInRewards', language),
},
'id': common.uuid(),
}
};
dbUsers.update({_id: user._id}, {$set:set, $push:push, $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,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

@@ -6,6 +6,12 @@
// Due to some big user profiles it needs more RAM than is allowed by default by v8 (arounf 1.7GB).
// Run the script with --max-old-space-size=4096 to allow up to 4GB of RAM
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
console.log('Starting migrations/api_v3/challenges.js.');
require('babel-register');

View File

@@ -9,6 +9,12 @@
// Run the script with --max-old-space-size=4096 to allow up to 4GB of RAM
console.log('Starting migrations/api_v3/challengesMembers.js.');
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
require('babel-register');
require('babel-polyfill');

View File

@@ -8,6 +8,12 @@
// Run the script with --max-old-space-size=4096 to allow up to 4GB of RAM
console.log('Starting migrations/api_v3/coupons.js.');
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
require('babel-register');
require('babel-polyfill');

View File

@@ -8,6 +8,12 @@
// Run the script with --max-old-space-size=4096 to allow up to 4GB of RAM
console.log('Starting migrations/api_v3/unsubscriptions.js.');
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
require('babel-register');
require('babel-polyfill');

View File

@@ -16,6 +16,12 @@
// Run the script with --max-old-space-size=4096 to allow up to 4GB of RAM
console.log('Starting migrations/api_v3/groups.js.');
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
require('babel-register');
require('babel-polyfill');

View File

@@ -9,6 +9,12 @@
// Run the script with --max-old-space-size=4096 to allow up to 4GB of RAM
console.log('Starting migrations/api_v3/users.js.');
// IMPORTANT NOTE: this migration was written when we were using version 3 of lodash.
// We've now upgraded to lodash v4 but the code used in this migration has not been
// adapted to work with it. Before this migration is used again any lodash method should
// be checked for compatibility against the v4 changelog and changed if necessary.
// https://github.com/lodash/lodash/wiki/Changelog#v400
require('babel-register');
require('babel-polyfill');

View File

@@ -0,0 +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;

View File

@@ -7,6 +7,6 @@
db.users.find().forEach(function(user){
user.tasks = user.habits.concat(user.dailys).concat(user.todos).concat(user.rewards);
var found = _.any(user.tasks, {text: ""})
var found = _.some(user.tasks, {text: ""})
if (found) printjson({id:user._id, auth:user.auth});
})

View File

@@ -0,0 +1,40 @@
var migrationName = 'AddUnlimitedSubscription';
var authorName = 'TheHollidayInn'; // in case script author needs to know when their ...
var authorUuid = ''; //... own data is done
/*
* This migrations will add a free subscription to a specified group
*/
import moment from 'moment';
import { model as Group } from '../../website/server/models/group';
// @TODO: this should probably be a GroupManager library method
async function addUnlimitedSubscription (groupId, dateTerminated) {
let group = await Group.findById(groupId);
group.purchased.plan.customerId = "group-unlimited";
group.purchased.plan.dateCreated = new Date();
group.purchased.plan.dateUpdated = new Date();
group.purchased.plan.paymentMethod = "Group Unlimited";
group.purchased.plan.planId = "group_monthly";
group.purchased.plan.dateTerminated = null;
if (dateTerminated) {
let dateToEnd = moment(dateTerminated).toDate();
group.purchased.plan.dateTerminated = dateToEnd;
}
// group.purchased.plan.owner = ObjectId();
group.purchased.plan.subscriptionId = "";
return group.save();
};
module.exports = async function addUnlimitedSubscriptionCreator () {
let groupId = process.argv[2];
if (!groupId) throw Error('Group ID is required');
let dateTerminated = process.argv[3];
let result = await addUnlimitedSubscription(groupId, dateTerminated);
};

View File

@@ -0,0 +1,32 @@
import Bluebird from 'bluebird';
import { model as Group } from '../../website/server/models/group';
import { model as User } from '../../website/server/models/user';
// @TODO: this should probably be a GroupManager library method
async function createGroup (name, privacy, type, leaderId) {
let user = await User.findById(leaderId);
let group = new Group({
name,
privacy,
type,
});
group.leader = user._id;
user.guilds.push(group._id);
return Bluebird.all([group.save(), user.save()]);
};
module.exports = async function groupCreator () {
let name = process.argv[2];
let privacy = process.argv[3];
let type = process.argv[4];
let leaderId = process.argv[5];
let result = await createGroup(name, privacy, type, leaderId)
};

View File

@@ -0,0 +1,46 @@
var migrationName = 'Jackalopes for Unlimited Subscribers';
/*
* This migration will find users with unlimited subscriptions who are also eligible for Jackalope mounts, and award them
*/
import Bluebird from 'bluebird';
import { model as Group } from '../../website/server/models/group';
import { model as User } from '../../website/server/models/user';
import * as payments from '../../website/server/libs/payments';
async function handOutJackalopes () {
let promises = [];
let cursor = User.find({
'purchased.plan.customerId':'habitrpg',
}).cursor();
cursor.on('data', async function(user) {
console.log('User: ' + user._id);
let groupList = [];
if (user.party._id) groupList.push(user.party._id);
groupList = groupList.concat(user.guilds);
let subscribedGroup =
await Group.findOne({
'_id': {$in: groupList},
'purchased.plan.planId': 'group_monthly',
'purchased.plan.dateTerminated': null,
},
{'_id':1}
);
if (subscribedGroup) {
User.update({'_id':user._id},{$set:{'items.mounts.Jackalope-RoyalPurple':true}}).exec();
promises.push(user.save());
}
});
cursor.on('close', async function() {
console.log('done');
return await Bluebird.all(promises);
});
};
module.exports = handOutJackalopes;

View File

@@ -0,0 +1,33 @@
var migrationName = 'ResyncGroupPlanMembers';
var authorName = 'TheHollidayInn'; // in case script author needs to know when their ...
var authorUuid = ''; //... own data is done
/*
* This migrations will iterate through all groups with a group plan a subscription and resync the free
* subscription to all members
*/
import Bluebird from 'bluebird';
import { model as Group } from '../../website/server/models/group';
import * as payments from '../../website/server/libs/payments';
async function updateGroupsWithGroupPlans () {
let cursor = Group.find({
'purchased.plan.planId': 'group_monthly',
'purchased.plan.dateTerminated': null,
}).cursor();
let promises = [];
cursor.on('data', function(group) {
promises.push(payments.addSubscriptionToGroupUsers(group));
promises.push(group.save())
});
cursor.on('close', async function() {
return await Bluebird.all(promises);
});
};
module.exports = updateGroupsWithGroupPlans;

View File

@@ -1,6 +1,9 @@
// EMAIL="x@y.com" node ./migrations/manual_password_reset.js
// Be sure to have PRODUCTION_DB in your config.json
// IMPORTANT: this script isn't updated to use the new password encryption that uses bcrypt
// using it will break accounts and should not be used until upgraded
var nconf = require('nconf'),
path = require('path');
nconf.argv().env().file('user', path.join(path.resolve(__dirname, '../config.json')));

View File

@@ -1,21 +1,24 @@
require("babel-register");
require("babel-polyfill");
// This file must use ES5, everything required can be in ES6
function setUpServer () {
var nconf = require('nconf');
var mongoose = require('mongoose');
var Bluebird = require('bluebird');
var setupNconf = require('../website/server/libs/setupNconf');
setupNconf();
// We require src/server and npt src/index because
// 1. nconf is already setup
// 2. we don't need clustering
require('../website/server/server'); // eslint-disable-line global-require
}
setUpServer();
// Replace this with your migration
var processUsers = require('./new_stuff');
processUsers();
require("babel-register");
require("babel-polyfill");
// This file must use ES5, everything required can be in ES6
function setUpServer () {
var nconf = require('nconf');
var mongoose = require('mongoose');
var Bluebird = require('bluebird');
var setupNconf = require('../website/server/libs/setupNconf');
setupNconf();
// We require src/server and npt src/index because
// 1. nconf is already setup
// 2. we don't need clustering
require('../website/server/server'); // eslint-disable-line global-require
}
setUpServer();
// Replace this with your migration
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:['shield_mystery_201701','eyewear_mystery_201701']
$each:['body_mystery_201706','back_mystery_201706']
}
}
};

View File

@@ -10,7 +10,6 @@ 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 = {
@@ -45,10 +44,10 @@ function updateUsers (users) {
return;
}
var userPaymentPromises = users.map(updateUser);
var userPromises = users.map(updateUser);
var lastUser = users[users.length - 1];
return Promise.all(userPaymentPromises)
return Promise.all(userPromises)
.then(function () {
processUsers(lastUser._id);
});

View File

@@ -6,49 +6,69 @@ var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
* Remove flag stating that the Enchanted Armoire is empty, for when new equipment is added
*/
var mongo = require('mongoskin');
var monk = require('monk');
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbUsers = monk(connectionString).get('users', { castIds: false });
var dbUsers = mongo.db(connectionString).collection('users');
function processUsers(lastId) {
// specify a query to limit the affected users (empty for all users):
var query = {
'flags.armoireEmpty': true,
};
// specify a query to limit the affected users (empty for all users):
var query = {
'flags.armoireEmpty':true
};
if (lastId) {
query._id = {
$gt: lastId
}
}
// specify fields we are interested in to limit retrieved data (empty if we're not reading data):
var fields = {
};
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):
})
.then(updateUsers)
.catch(function (err) {
console.log(err);
return exiting(1, 'ERROR! ' + err);
});
}
console.warn('Updating users...');
var progressCount = 1000;
var count = 0;
dbUsers.findEach(query, fields, {batchSize:250}, function(err, user) {
if (err) { return exiting(1, 'ERROR! ' + err); }
if (!user) {
function updateUsers (users) {
if (!users || users.length === 0) {
console.warn('All appropriate users found and modified.');
setTimeout(displayData, 300000);
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++;
// specify user data to change:
var set = {'migration':migrationName, 'flags.armoireEmpty':false};
var set = {'migration': migrationName, 'flags.armoireEmpty': false};
dbUsers.update({_id:user._id}, {$set:set});
dbUsers.update({_id: user._id}, {$set:set});
if (count%progressCount == 0) console.warn(count + ' ' + user._id);
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!'; }
@@ -58,3 +78,5 @@ function exiting(code, msg) {
}
process.exit(code);
}
module.exports = processUsers;

View File

@@ -1,4 +1,4 @@
var migrationName = '20170103_takeThis.js'; // Update per month
var migrationName = '20170502_takeThis.js'; // Update per month
var authorName = 'Sabe'; // in case script author needs to know when their ...
var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
@@ -6,41 +6,64 @@ var authorUuid = '7f14ed62-5408-4e1b-be83-ada62d504931'; //... own data is done
* Award Take This ladder items to participants in this month's challenge
*/
var mongo = require('mongoskin');
var monk = require('monk');
var connectionString = 'mongodb://localhost:27017/habitrpg?auto_reconnect=true'; // FOR TEST DATABASE
var dbUsers = monk(connectionString).get('users', { castIds: false });
var dbUsers = mongo.db(connectionString).collection('users');
function processUsers(lastId) {
// specify a query to limit the affected users (empty for all users):
var query = {
'migration':{$ne:migrationName},
'challenges':{$in:['69999331-d4ea-45a0-8c3f-f725d22b56c8']} // Update per month
};
// specify a query to limit the affected users (empty for all users):
var query = {
'migration':{$ne:migrationName},
'challenges':{$in:['ff674aba-a114-4a6f-8ebc-1de27ffb646e']}
};
if (lastId) {
query._id = {
$gt: lastId
}
}
// specify fields we are interested in to limit retrieved data (empty if we're not reading data):
var fields = {
'items.gear.owned': 1
};
dbUsers.find(query, {
sort: {_id: 1},
limit: 250,
fields: [
'items.gear.owned',
] // 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);
});
}
console.warn('Updating users...');
var progressCount = 1000;
var count = 0;
dbUsers.findEach(query, fields, {batchSize:250}, function(err, user) {
if (err) { return exiting(1, 'ERROR! ' + err); }
if (!user) {
function updateUsers (users) {
if (!users || users.length === 0) {
console.warn('All appropriate users found and modified.');
setTimeout(displayData, 300000);
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++;
// specify user data to change:
var set = {};
if (typeof user.items.gear.owned.back_special_takeThis !== 'undefined') {
set = {'migration':migrationName};
{ else if (typeof user.items.gear.owned.body_special_takeThis !== 'undefined') {
} else if (typeof user.items.gear.owned.body_special_takeThis !== 'undefined') {
set = {'migration':migrationName, 'items.gear.owned.back_special_takeThis':false};
} else if (typeof user.items.gear.owned.head_special_takeThis !== 'undefined') {
set = {'migration':migrationName, 'items.gear.owned.body_special_takeThis':false};
@@ -54,19 +77,17 @@ dbUsers.findEach(query, fields, {batchSize:250}, function(err, user) {
set = {'migration':migrationName, 'items.gear.owned.shield_special_takeThis':false};
}
dbUsers.update({_id:user._id}, {$set:set});
dbUsers.update({_id: user._id}, {$set:set});
if (count%progressCount == 0) console.warn(count + ' ' + user._id);
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!'; }
@@ -77,4 +98,4 @@ function exiting(code, msg) {
process.exit(code);
}
module.exports = processUsers;

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();
};

5762
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,22 +1,24 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "3.72.0",
"version": "3.101.1",
"main": "./website/server/index.js",
"dependencies": {
"@slack/client": "3.6.0",
"@slack/client": "^3.8.1",
"accepts": "^1.3.2",
"amazon-payments": "0.0.4",
"amplitude": "^2.0.3",
"apidoc": "^0.16.0",
"apidoc": "^0.17.5",
"apn": "^1.7.6",
"async": "^1.5.0",
"autoprefixer": "^6.4.0",
"aws-sdk": "^2.0.25",
"axios": "^0.15.3",
"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,22 +30,25 @@
"bcrypt": "^1.0.2",
"bluebird": "^3.3.5",
"body-parser": "^1.15.0",
"bootstrap": "^4.0.0-alpha.6",
"bootstrap-vue": "^0.15.8",
"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",
"css-loader": "^0.23.1",
"css-loader": "^0.28.0",
"csv-stringify": "^1.0.2",
"cwait": "^1.0.0",
"domain-middleware": "~0.1.0",
"estraverse": "^4.1.1",
"express": "~4.14.0",
"express-basic-auth": "^1.0.1",
"express-csv": "~0.6.0",
"express-validator": "^2.18.0",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.4",
"extract-text-webpack-plugin": "^2.0.0-rc.3",
"file-loader": "^0.10.0",
"glob": "^4.3.5",
"got": "^6.1.1",
"grunt": "~0.4.1",
@@ -54,7 +59,7 @@
"grunt-contrib-stylus": "~0.20.0",
"grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-hashres": "~0.4.1",
"grunt-hashres": "habitrpg/grunt-hashres#v0.4.2",
"gulp": "^3.9.0",
"gulp-babel": "^6.1.2",
"gulp-grunt": "^0.5.2",
@@ -64,67 +69,69 @@
"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",
"jade": "~1.11.0",
"jquery": "https://registry.npmjs.org/jquery/-/jquery-3.1.1.tgz",
"jquery": "^3.1.1",
"js2xmlparser": "~1.0.0",
"json-loader": "^0.5.4",
"less": "^2.7.1",
"less-loader": "^2.2.3",
"lodash": "^3.10.1",
"lodash.pickby": "^4.2.0",
"lodash.setwith": "^4.2.0",
"lodash": "^4.17.4",
"merge-stream": "^1.0.0",
"method-override": "^2.3.5",
"moment": "^2.13.0",
"mongoose": "^4.7.1",
"moment-recur": "habitrpg/moment-recur#v1.0.6",
"mongoose": "^4.8.6",
"mongoose-id-autoinc": "~2013.7.14-4",
"morgan": "^1.7.0",
"nconf": "~0.8.2",
"newrelic": "^1.27.2",
"nib": "^1.1.0",
"node-gcm": "^0.14.4",
"node-sass": "^4.5.0",
"nodemailer": "^2.3.2",
"object-path": "^0.9.2",
"ora": "^0.2.0",
"ora": "^1.1.0",
"pageres": "^4.1.1",
"passport": "~0.2.1",
"passport-facebook": "2.0.0",
"passport": "^0.3.2",
"passport-facebook": "^2.0.0",
"passport-google-oauth20": "1.0.0",
"paypal-ipn": "3.0.0",
"paypal-rest-sdk": "^1.2.1",
"postcss-easy-import": "^1.0.1",
"postcss-easy-import": "^2.0.0",
"pretty-data": "^0.40.0",
"ps-tree": "^1.0.0",
"pug": "^2.0.0-beta6",
"pug": "^2.0.0-beta.12",
"push-notify": "habitrpg/push-notify#v1.2.0",
"pusher": "^1.3.0",
"request": "~2.74.0",
"rimraf": "^2.4.3",
"run-sequence": "^1.1.4",
"s3-upload-stream": "^1.0.6",
"semantic-ui-less": "~2.2.4",
"sass-loader": "^6.0.2",
"serve-favicon": "^2.3.0",
"shelljs": "^0.6.0",
"shelljs": "^0.7.6",
"stripe": "^4.2.0",
"superagent": "^1.8.3",
"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",
"uuid": "^2.0.1",
"useragent": "^2.1.9",
"uuid": "^3.0.1",
"validator": "^4.9.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"vue": "^2.1.0",
"vue-hot-reload-api": "^1.2.0",
"vue-loader": "^10.0.0",
"vue-loader": "^11.0.0",
"vue-mugen-scroll": "^0.2.1",
"vue-router": "^2.0.0-rc.5",
"vue-template-compiler": "^2.1.0",
"webpack": "^1.12.2",
"webpack-merge": "^0.8.3",
"vue-style-loader": "^3.0.0",
"vue-template-compiler": "^2.1.10",
"webpack": "^2.2.1",
"webpack-merge": "^4.0.0",
"winston": "^2.1.0",
"winston-loggly-bulk": "^1.4.2",
"xml2js": "^0.4.4"
},
"private": true,
@@ -134,15 +141,15 @@
},
"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",
"test:api-v3:integration": "gulp test:api-v3:integration",
"test:api-v3:integration:separate-server": "NODE_ENV=test gulp test:api-v3:integration:separate-server",
"test:sanity": "mocha test/sanity --recursive",
"test:common": "mocha test/common --recursive",
"test:content": "mocha test/content --recursive",
"test:sanity": "istanbul cover --dir coverage/sanity --report lcovonly node_modules/mocha/bin/_mocha -- test/sanity --recursive",
"test:common": "istanbul cover --dir coverage/common --report lcovonly node_modules/mocha/bin/_mocha -- test/common --recursive",
"test:content": "istanbul cover --dir coverage/content --report lcovonly node_modules/mocha/bin/_mocha -- test/content --recursive",
"test:karma": "karma start test/client-old/spec/karma.conf.js --single-run",
"test:karma:watch": "karma start test/client-old/spec/karma.conf.js",
"test:prepare:webdriver": "webdriver-manager update",
@@ -151,39 +158,41 @@
"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:unit": "karma start test/client/unit/karma.conf.js --single-run",
"client:unit:watch": "karma start test/client/unit/karma.conf.js",
"client:dev": "gulp bootstrap && node webpack/dev-server.js",
"client:build": "gulp bootstrap && node webpack/build.js",
"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": "bower --config.interactive=false install -f && gulp build && npm run client:build",
"apidoc": "gulp apidoc"
},
"devDependencies": {
"babel-plugin-istanbul": "^4.0.0",
"chai": "^3.4.0",
"chai-as-promised": "^5.1.0",
"chalk": "^1.1.3",
"chromedriver": "^2.21.2",
"chromedriver": "^2.27.2",
"connect-history-api-fallback": "^1.1.0",
"coveralls": "^2.11.2",
"cross-spawn": "^2.1.5",
"cross-env": "^4.0.0",
"cross-spawn": "^5.0.1",
"csv": "~0.3.6",
"deep-diff": "~0.1.4",
"eslint": "^3.0.0",
"eslint-config-habitrpg": "^2.0.0",
"eslint-config-habitrpg": "^3.0.0",
"eslint-friendly-formatter": "^2.0.5",
"eslint-loader": "^1.3.0",
"eslint-plugin-html": "^1.3.0",
"eslint-plugin-html": "^2.0.0",
"eslint-plugin-mocha": "^4.7.0",
"event-stream": "^3.2.2",
"eventsource-polyfill": "^0.9.6",
"expect.js": "~0.2.0",
"grunt-karma": "~0.12.1",
"http-proxy-middleware": "^0.12.0",
"inject-loader": "^2.0.1",
"isparta-loader": "^2.0.0",
"istanbul": "^0.3.14",
"http-proxy-middleware": "^0.17.0",
"inject-loader": "^3.0.0-beta4",
"istanbul": "^1.1.0-alpha.1",
"karma": "^1.3.0",
"karma-babel-preprocessor": "^6.0.1",
"karma-chai-plugins": "~0.6.0",
@@ -191,28 +200,31 @@
"karma-mocha": "^0.2.0",
"karma-mocha-reporter": "^1.1.1",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sinon-chai": "^1.2.0",
"karma-sinon-chai": "~1.2.0",
"karma-sinon-stub-promise": "^1.0.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.24",
"karma-webpack": "^1.7.0",
"karma-webpack": "^2.0.2",
"lcov-result-merger": "^1.0.2",
"lolex": "^1.4.0",
"mocha": "^2.3.3",
"mocha": "^3.2.0",
"mongodb": "^2.0.46",
"mongoskin": "~2.1.0",
"monk": "^3.1.3",
"nightwatch": "^0.8.18",
"monk": "^4.0.0",
"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": "2.53.0",
"selenium-server": "^3.0.1",
"sinon": "^1.17.2",
"sinon-chai": "^2.8.0",
"sinon-stub-promise": "^4.0.0",
"superagent-defaults": "^0.1.13",
"vinyl-transform": "^1.0.0",
"webpack-dev-middleware": "^1.4.0",
"webpack-hot-middleware": "^2.6.0"
"webpack-bundle-analyzer": "^2.2.1",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.6.1"
}
}

1
test/README.md Normal file
View File

@@ -0,0 +1 @@
For information about writing and running tests, see [Using Your Local Install to Modify Habitica's Website and API](http://habitica.wikia.com/wiki/Using_Your_Local_Install_to_Modify_Habitica%27s_Website_and_API).

View File

@@ -1,123 +0,0 @@
# So you want to write API integration tests?
@TODO rewrite
That's great! This README will serve as a quick primer for style conventions and practices for these tests.
## What is this?
These are integration tests for the Habitica API. They are performed by making HTTP requests to the API's endpoints and asserting on the data that is returned.
If the javascript looks weird to you, that's because it's written in [ES2015](http://www.ecma-international.org/ecma-262/6.0/) and transpiled by [Babel](https://babeljs.io/docs/learn-es2015/).
## How to run the tests
First, install gulp.
```bash
$ npm install -g gulp
```
To run the api tests, make sure the mongo db is up and running and then type this on the command line:
```bash
$ gulp test:api-v2
```
It may take a little while to get going, since it requires the web server to start up before the tests can run.
You can also run a watch command for the api tests. This will allow the tests to re-run automatically when you make changes in the `/test/api/v2/`.
```bash
$ gulp test:api-v2:watch
```
One caveat. If you have a severe syntax error in your files, the tests may fail to run, but they won't alert you that they are not running. If you ever find your test hanging for a while, run this to get the stackstrace. Once you've fixed the problem, you can resume running the watch comand.
```bash
$ gulp test:api:safe
```
If you'd like to run the tests individually and inspect the output from the server, in one pane you can run:
```bash
$ gulp test:nodemon
```
And run your tests in another pane:
```bash
$ mocha path/to/file.js
# Mark a test with the `.only` attribute
$ mocha
```
## Structure
Each top level route has it's own directory. So, all the routes that begin with `/groups/` live in `/test/api/groups/`.
Each test should:
* encompase a single route
* begin with the REST parameter for the route
* display the full name of the route, swapping out `/` for `_`
* end with test.js
So, for the `POST` route `/groups/:id/leave`, it would be
```bash
POST-groups_id_leave.test.js
```
## Promises
To mitigate [callback hell](http://callbackhell.com/) :imp:, we've written a helper method to generate a user object that can make http requests that [return promises](https://babeljs.io/docs/learn-es2015/#promises). This makes it very easy to chain together commands. All you need to do to make a subsequent request is return another promise and then call `.then((result) => {})` on the surrounding block, like so:
```js
it('does something', () => {
let user;
return generateUser().then((_user) => { // We return the initial promise so this test can be run asyncronously
user = _user;
return user.post('/groups', {
type: 'party',
});
}).then((party) => { // the result of the promise above is the argument of the function
return user.put(`/groups/${party._id}`, {
name: 'My party',
});
}).then((result) => {
return user.get('/groups/party');
}).then((party) => {
expect(party.name).to.eql('My party');
});
});
```
If the test is simple, you can use the [chai-as-promised](http://chaijs.com/plugins/chai-as-promised) `return expect(somePromise).to.eventually` syntax to make your assertion.
```js
it('makes the party creator the leader automatically', () => {
return expect(user.post('/groups', {
type: 'party',
})).to.eventually.have.deep.property('leader._id', user._id);
});
```
If the test is checking that the request returns an error, use the `.eventually.be.rejected.and.eql` syntax.
```js
it('returns an error', () => {
return expect(user.get('/groups/id-of-a-party-that-user-does-not-belong-to'))
.to.eventually.be.rejected.and.eql({
code: 404,
text: t('messageGroupNotFound'),
});
});
```
## Questions?
Ask in the [Aspiring Coder's Guild](https://habitica.com/#/options/groups/guilds/68d4a01e-db97-4786-8ee3-05d612c5af6f)!

View File

@@ -1,4 +0,0 @@
# How to run tests:
1. `npm test` is equivalent to `gulp test:api-v3` which will run, in order, `gulp lint`, `gulp test:api-v3:unit` and `gulp test:api-v3:integration`. If one of these fails, the whole `npm test` command blocks and fails. Each of these commands can also be run as a standalone command.
2. To run the server and the integrations tests in two different terminals (to better inspect the output in the server) run `npm start` in one and `npm test:api-v3:integration:separate-server` in the other

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

@@ -117,7 +117,6 @@ describe('POST /challenges/:challengeId/leave', () => {
});
expect(testTask).to.not.be.undefined;
expect(testTask.challenge).to.eql({});
});
});
});

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 () => {

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

@@ -4,11 +4,17 @@ import {
sleep,
server,
} from '../../../../helpers/api-v3-integration.helper';
import {
SPAM_MESSAGE_LIMIT,
SPAM_MIN_EXEMPT_CONTRIB_LEVEL,
TAVERN_ID,
} from '../../../../../website/server/models/group';
import { v4 as generateUUID } from 'uuid';
describe('POST /chat', () => {
let user, groupWithChat, userWithChatRevoked, member;
let user, groupWithChat, member, additionalMember;
let testMessage = 'Test Message';
let testBannedWordMessage = 'TEST_PLACEHOLDER_SWEAR_WORD_HERE';
before(async () => {
let { group, groupLeader, members } = await createAndPopulateGroup({
@@ -22,8 +28,8 @@ describe('POST /chat', () => {
user = groupLeader;
groupWithChat = group;
userWithChatRevoked = await members[0].update({'flags.chatRevoked': true});
member = members[0];
additionalMember = members[1];
});
it('Returns an error when no message is provided', async () => {
@@ -62,10 +68,101 @@ 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'),
});
});
it('errors when word is part of a phrase', async () => {
let wordInPhrase = `phrase ${testBannedWordMessage} end`;
await expect(user.post('/groups/habitrpg/chat', { message: wordInPhrase}))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('bannedWordUsed'),
});
});
it('errors when word is surrounded by non alphabet characters', async () => {
let wordInPhrase = `_!${testBannedWordMessage}@_`;
await expect(user.post('/groups/habitrpg/chat', { message: wordInPhrase}))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('bannedWordUsed'),
});
});
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});
expect(message.message.id).to.exist;
});
it('does not error when bad word is prefix of a word', async () => {
let wordAsPrefix = `${testBannedWordMessage}suffix`;
let message = await user.post('/groups/habitrpg/chat', { message: wordAsPrefix});
expect(message.message.id).to.exist;
});
it('does not error when sending a chat message containing a banned word to a party', async () => {
let { group, members } = await createAndPopulateGroup({
groupDetails: {
name: 'Party',
type: 'party',
privacy: 'private',
},
members: 1,
});
let message = await members[0].post(`/groups/${group._id}/chat`, { message: testBannedWordMessage});
expect(message.message.id).to.exist;
});
it('does not error when sending a chat message containing a banned word to a public guild', async () => {
let { group, members } = await createAndPopulateGroup({
groupDetails: {
name: 'public guild',
type: 'guild',
privacy: 'public',
},
members: 1,
});
let message = await members[0].post(`/groups/${group._id}/chat`, { message: testBannedWordMessage});
expect(message.message.id).to.exist;
});
it('does not error when sending a chat message containing a banned word to a private guild', async () => {
let { group, members } = await createAndPopulateGroup({
groupDetails: {
name: 'private guild',
type: 'guild',
privacy: 'private',
},
members: 1,
});
let message = await members[0].post(`/groups/${group._id}/chat`, { message: testBannedWordMessage});
expect(message.message.id).to.exist;
});
});
@@ -173,4 +270,30 @@ describe('POST /chat', () => {
expect(message.message.id).to.exist;
expect(memberWithNotification.newMessages[`${group._id}`]).to.exist;
});
context('Spam prevention', () => {
it('Returns an error when the user has been posting too many messages', async () => {
// Post as many messages are needed to reach the spam limit
for (let i = 0; i < SPAM_MESSAGE_LIMIT; i++) {
let result = await additionalMember.post(`/groups/${TAVERN_ID}/chat`, { message: testMessage }); // eslint-disable-line no-await-in-loop
expect(result.message.id).to.exist;
}
await expect(additionalMember.post(`/groups/${TAVERN_ID}/chat`, { message: testMessage })).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('messageGroupChatSpam'),
});
});
it('contributor should not receive spam alert', async () => {
let userSocialite = await member.update({'contributor.level': SPAM_MIN_EXEMPT_CONTRIB_LEVEL, 'flags.chatRevoked': false});
// Post 1 more message than the spam limit to ensure they do not reach the limit
for (let i = 0; i < SPAM_MESSAGE_LIMIT + 1; i++) {
let result = await userSocialite.post(`/groups/${TAVERN_ID}/chat`, { message: testMessage }); // eslint-disable-line no-await-in-loop
expect(result.message.id).to.exist;
}
});
});
});

View File

@@ -7,6 +7,7 @@ import {
import {
TAVERN_ID,
} from '../../../../../website/server/models/group';
import apiMessages from '../../../../../website/server/libs/apiMessages';
describe('GET /groups', () => {
let user;
@@ -14,6 +15,7 @@ describe('GET /groups', () => {
const NUMBER_OF_PUBLIC_GUILDS_USER_IS_MEMBER = 1;
const NUMBER_OF_USERS_PRIVATE_GUILDS = 1;
const NUMBER_OF_GROUPS_USER_CAN_VIEW = 5;
const GUILD_PER_PAGE = 30;
before(async () => {
await resetHabiticaDB();
@@ -98,6 +100,60 @@ describe('GET /groups', () => {
.to.eventually.have.a.lengthOf(NUMBER_OF_PUBLIC_GUILDS);
});
describe('public guilds pagination', () => {
it('req.query.paginate must be a boolean string', async () => {
await expect(user.get('/groups?paginate=aString&type=publicGuilds'))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: 'Invalid request parameters.',
});
});
it('req.query.paginate can only be true when req.query.type includes publicGuilds', async () => {
await expect(user.get('/groups?paginate=true&type=notPublicGuilds'))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: apiMessages('guildsOnlyPaginate'),
});
});
it('req.query.page can\'t be negative', async () => {
await expect(user.get('/groups?paginate=true&page=-1&type=publicGuilds'))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: 'Invalid request parameters.',
});
});
it('returns 30 guilds per page ordered by number of members', async () => {
await user.update({balance: 9000});
let groups = await Promise.all(_.times(60, (i) => {
return generateGroup(user, {
name: `public guild ${i} - is member`,
type: 'guild',
privacy: 'public',
});
}));
// update group number 32 and not the first to make sure sorting works
await groups[32].update({name: 'guild with most members', memberCount: 199});
await groups[33].update({name: 'guild with less members', memberCount: -100});
let page0 = await expect(user.get('/groups?type=publicGuilds&paginate=true'))
.to.eventually.have.a.lengthOf(GUILD_PER_PAGE);
expect(page0[0].name).to.equal('guild with most members');
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');
});
});
it('returns all the user\'s guilds when guilds passed in as query', async () => {
await expect(user.get('/groups?type=guilds'))
.to.eventually.have.a.lengthOf(NUMBER_OF_PUBLIC_GUILDS_USER_IS_MEMBER + NUMBER_OF_USERS_PRIVATE_GUILDS);

View File

@@ -63,15 +63,17 @@ describe('GET /groups/:groupId/invites', () => {
});
it('returns only first 30 invites', async () => {
let group = await generateGroup(user, {type: 'party', name: generateUUID()});
let leader = await generateUser({balance: 4});
let group = await generateGroup(leader, {type: 'guild', privacy: 'public', name: generateUUID()});
let invitesToGenerate = [];
for (let i = 0; i < 31; i++) {
invitesToGenerate.push(generateUser());
}
let generatedInvites = await Promise.all(invitesToGenerate);
await user.post(`/groups/${group._id}/invite`, {uuids: generatedInvites.map(invite => invite._id)});
await leader.post(`/groups/${group._id}/invite`, {uuids: generatedInvites.map(invite => invite._id)});
let res = await user.get('/groups/party/invites');
let res = await leader.get(`/groups/${group._id}/invites`);
expect(res.length).to.equal(30);
res.forEach(member => {
expect(member).to.have.all.keys(['_id', 'id', 'profile']);

View File

@@ -84,7 +84,7 @@ describe('GET /groups/:groupId/members', () => {
expect(Object.keys(memberRes.auth)).to.eql(['timestamps']);
expect(Object.keys(memberRes.preferences).sort()).to.eql([
'size', 'hair', 'skin', 'shirt',
'chair', 'costume', 'sleep', 'background',
'chair', 'costume', 'sleep', 'background', 'tasks',
].sort());
expect(memberRes.stats.maxMP).to.exist;

View File

@@ -0,0 +1,93 @@
import {
createAndPopulateGroup,
translate as t,
} from '../../../../helpers/api-v3-integration.helper';
import { find } from 'lodash';
describe('POST /group/:groupId/remove-manager', () => {
let leader, nonLeader, groupToUpdate;
let groupName = 'Test Public Guild';
let groupType = 'guild';
let nonManager;
function findAssignedTask (memberTask) {
return memberTask.group.id === groupToUpdate._id;
}
beforeEach(async () => {
let { group, groupLeader, members } = await createAndPopulateGroup({
groupDetails: {
name: groupName,
type: groupType,
privacy: 'public',
},
members: 1,
});
groupToUpdate = group;
leader = groupLeader;
nonLeader = members[0];
nonManager = members[0];
});
it('returns an error when a non group leader tries to add member', async () => {
await expect(nonLeader.post(`/groups/${groupToUpdate._id}/remove-manager`, {
managerId: nonLeader._id,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('messageGroupOnlyLeaderCanUpdate'),
});
});
it('returns an error when manager does not exist', async () => {
await expect(leader.post(`/groups/${groupToUpdate._id}/remove-manager`, {
managerId: nonManager._id,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('userIsNotManager'),
});
});
it('allows a leader to remove managers', async () => {
await leader.post(`/groups/${groupToUpdate._id}/add-manager`, {
managerId: nonLeader._id,
});
let updatedGroup = await leader.post(`/groups/${groupToUpdate._id}/remove-manager`, {
managerId: nonLeader._id,
});
expect(updatedGroup.managers[nonLeader._id]).to.not.exist;
});
it('removes group approval notifications from a manager that is removed', async () => {
await leader.post(`/groups/${groupToUpdate._id}/add-manager`, {
managerId: nonLeader._id,
});
let task = await leader.post(`/tasks/group/${groupToUpdate._id}`, {
text: 'test todo',
type: 'todo',
requiresApproval: true,
});
await nonLeader.post(`/tasks/${task._id}/assign/${leader._id}`);
let memberTasks = await leader.get('/tasks/user');
let syncedTask = find(memberTasks, findAssignedTask);
await expect(leader.post(`/tasks/${syncedTask._id}/score/up`))
.to.eventually.be.rejected.and.to.eql({
code: 401,
error: 'NotAuthorized',
message: t('taskApprovalHasBeenRequested'),
});
let updatedGroup = await leader.post(`/groups/${groupToUpdate._id}/remove-manager`, {
managerId: nonLeader._id,
});
await nonLeader.sync();
expect(nonLeader.notifications.length).to.equal(0);
expect(updatedGroup.managers[nonLeader._id]).to.not.exist;
});
});

View File

@@ -74,6 +74,18 @@ describe('POST /group', () => {
expect(updatedUser.guilds).to.include(guild._id);
});
it('awards the Joined Guild achievement', async () => {
await user.post('/groups', {
name: 'some guild',
type: 'guild',
privacy: 'public',
});
let updatedUser = await user.get('/user');
expect(updatedUser.achievements.joinedGuild).to.eql(true);
});
context('public guild', () => {
it('creates a group', async () => {
let groupName = 'Test Public Guild';

View File

@@ -68,6 +68,12 @@ describe('POST /group/:groupId/join', () => {
await expect(joiningUser.get(`/groups/${publicGuild._id}`)).to.eventually.have.property('memberCount', oldMemberCount + 1);
});
it('awards Joined Guild achievement', async () => {
await joiningUser.post(`/groups/${publicGuild._id}/join`);
await expect(joiningUser.get('/user')).to.eventually.have.deep.property('achievements.joinedGuild', true);
});
});
context('Joining a private guild', () => {
@@ -147,8 +153,14 @@ describe('POST /group/:groupId/join', () => {
}),
};
expect(inviter.notifications[0].type).to.eql('GROUP_INVITE_ACCEPTED');
expect(inviter.notifications[0].data).to.eql(expectedData);
expect(inviter.notifications[1].type).to.eql('GROUP_INVITE_ACCEPTED');
expect(inviter.notifications[1].data).to.eql(expectedData);
});
it('awards Joined Guild achievement', async () => {
await invitedUser.post(`/groups/${guild._id}/join`);
await expect(invitedUser.get('/user')).to.eventually.have.deep.property('achievements.joinedGuild', true);
});
});
});

View File

@@ -78,7 +78,7 @@ describe('POST /groups/:groupId/leave', () => {
expect(leader.newMessages[groupToLeave._id]).to.be.empty;
});
context('With challenges', () => {
context('with challenges', () => {
let challenge;
beforeEach(async () => {
@@ -106,10 +106,25 @@ describe('POST /groups/:groupId/leave', () => {
let userWithChallengeTasks = await leader.get('/user');
expect(userWithChallengeTasks.challenges).to.not.include(challenge._id);
// @TODO find elegant way to assert against the task existing
expect(userWithChallengeTasks.tasksOrder.habits).to.not.be.empty;
});
it('keeps the user in the challenge when the keepChallenges parameter is set to remain-in-challenges', async () => {
await leader.post(`/groups/${groupToLeave._id}/leave`, {keepChallenges: 'remain-in-challenges'});
let userWithChallengeTasks = await leader.get('/user');
expect(userWithChallengeTasks.challenges).to.include(challenge._id);
});
it('drops the user in the challenge when the keepChallenges parameter isn\'t set', async () => {
await leader.post(`/groups/${groupToLeave._id}/leave`);
let userWithChallengeTasks = await leader.get('/user');
expect(userWithChallengeTasks.challenges).to.not.include(challenge._id);
});
});
it('prevents quest leader from leaving a groupToLeave');

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 () => {

View File

@@ -1,10 +1,14 @@
import {
generateUser,
generateGroup,
translate as t,
} from '../../../../helpers/api-v3-integration.helper';
import { v4 as generateUUID } from 'uuid';
import nconf from 'nconf';
const INVITES_LIMIT = 100;
const PARTY_LIMIT_MEMBERS = 30;
const MAX_EMAIL_INVITES_BY_USER = 200;
describe('Post /groups/:groupId/invite', () => {
let inviter;
@@ -12,7 +16,7 @@ describe('Post /groups/:groupId/invite', () => {
let groupName = 'Test Public Guild';
beforeEach(async () => {
inviter = await generateUser({balance: 1});
inviter = await generateUser({balance: 4});
group = await inviter.post('/groups', {
name: groupName,
type: 'guild',
@@ -203,13 +207,37 @@ describe('Post /groups/:groupId/invite', () => {
});
});
it('returns an error when a user has sent the max number of email invites', async () => {
let inviterWithMax = await generateUser({
invitesSent: MAX_EMAIL_INVITES_BY_USER,
balance: 4,
});
let tmpGroup = await inviterWithMax.post('/groups', {
name: groupName,
type: 'guild',
});
await expect(inviterWithMax.post(`/groups/${tmpGroup._id}/invite`, {
emails: [testInvite],
inviter: 'inviter name',
}))
.to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('inviteLimitReached', {techAssistanceEmail: nconf.get('EMAILS:TECH_ASSISTANCE_EMAIL')}),
});
});
it('invites a user to a group by email', async () => {
let res = await inviter.post(`/groups/${group._id}/invite`, {
emails: [testInvite],
inviter: 'inviter name',
});
let updatedUser = await inviter.sync();
expect(res).to.exist;
expect(updatedUser.invitesSent).to.eql(1);
});
it('invites multiple users to a group by email', async () => {
@@ -217,7 +245,10 @@ describe('Post /groups/:groupId/invite', () => {
emails: [testInvite, {name: 'test2', email: 'test2@habitica.com'}],
});
let updatedUser = await inviter.sync();
expect(res).to.exist;
expect(updatedUser.invitesSent).to.eql(2);
});
});
@@ -265,6 +296,25 @@ describe('Post /groups/:groupId/invite', () => {
expect(invitedUser.invitations.guilds[0].id).to.equal(group._id);
expect(invite).to.exist;
});
it('invites marks invite with cancelled plan', async () => {
let cancelledPlanGroup = await generateGroup(inviter, {
type: 'guild',
name: generateUUID(),
});
await cancelledPlanGroup.createCancelledSubscription();
let newUser = await generateUser();
let invite = await inviter.post(`/groups/${cancelledPlanGroup._id}/invite`, {
uuids: [newUser._id],
emails: [{name: 'test', email: 'test@habitica.com'}],
});
let invitedUser = await newUser.get('/user');
expect(invitedUser.invitations.guilds[0].id).to.equal(cancelledPlanGroup._id);
expect(invitedUser.invitations.guilds[0].cancelledPlan).to.be.true;
expect(invite).to.exist;
});
});
describe('guild invites', () => {
@@ -301,6 +351,19 @@ describe('Post /groups/:groupId/invite', () => {
});
});
it('allows 30+ members in a guild', async () => {
let invitesToGenerate = [];
// Generate 30 users to invite (30 + leader = 31 members)
for (let i = 0; i < PARTY_LIMIT_MEMBERS; i++) {
invitesToGenerate.push(generateUser());
}
let generatedInvites = await Promise.all(invitesToGenerate);
// Invite users
expect(await inviter.post(`/groups/${group._id}/invite`, {
uuids: generatedInvites.map(invite => invite._id),
})).to.be.an('array');
});
// @TODO: Add this after we are able to mock the group plan route
xit('returns an error when a non-leader invites to a group plan', async () => {
let userToInvite = await generateUser();
@@ -390,5 +453,36 @@ describe('Post /groups/:groupId/invite', () => {
});
expect((await userToInvite.get('/user')).invitations.party.id).to.equal(party._id);
});
it('allows 30 members in a party', async () => {
let invitesToGenerate = [];
// Generate 29 users to invite (29 + leader = 30 members)
for (let i = 0; i < PARTY_LIMIT_MEMBERS - 1; i++) {
invitesToGenerate.push(generateUser());
}
let generatedInvites = await Promise.all(invitesToGenerate);
// Invite users
expect(await inviter.post(`/groups/${party._id}/invite`, {
uuids: generatedInvites.map(invite => invite._id),
})).to.be.an('array');
});
it('does not allow 30+ members in a party', async () => {
let invitesToGenerate = [];
// Generate 30 users to invite (30 + leader = 31 members)
for (let i = 0; i < PARTY_LIMIT_MEMBERS; i++) {
invitesToGenerate.push(generateUser());
}
let generatedInvites = await Promise.all(invitesToGenerate);
// Invite users
await expect(inviter.post(`/groups/${party._id}/invite`, {
uuids: generatedInvites.map(invite => invite._id),
}))
.to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('partyExceedsMembersLimit', {maxMembersParty: PARTY_LIMIT_MEMBERS}),
});
});
});
});

View File

@@ -0,0 +1,85 @@
import {
generateUser,
createAndPopulateGroup,
translate as t,
} from '../../../../helpers/api-v3-integration.helper';
describe('POST /group/:groupId/add-manager', () => {
let leader, nonLeader, groupToUpdate;
let groupName = 'Test Public Guild';
let groupType = 'guild';
let nonMember;
context('Guilds', () => {
beforeEach(async () => {
let { group, groupLeader, members } = await createAndPopulateGroup({
groupDetails: {
name: groupName,
type: groupType,
privacy: 'public',
},
members: 1,
});
groupToUpdate = group;
leader = groupLeader;
nonLeader = members[0];
nonMember = await generateUser();
});
it('returns an error when a non group leader tries to add member', async () => {
await expect(nonLeader.post(`/groups/${groupToUpdate._id}/add-manager`, {
managerId: nonLeader._id,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('messageGroupOnlyLeaderCanUpdate'),
});
});
it('returns an error when trying to promote a non member', async () => {
await expect(leader.post(`/groups/${groupToUpdate._id}/add-manager`, {
managerId: nonMember._id,
})).to.eventually.be.rejected.and.eql({
code: 401,
error: 'NotAuthorized',
message: t('userMustBeMember'),
});
});
it('allows a leader to add managers', async () => {
let updatedGroup = await leader.post(`/groups/${groupToUpdate._id}/add-manager`, {
managerId: nonLeader._id,
});
expect(updatedGroup.managers[nonLeader._id]).to.be.true;
});
});
context('Party', () => {
let party, partyLeader, partyNonLeader;
beforeEach(async () => {
let { group, groupLeader, members } = await createAndPopulateGroup({
groupDetails: {
name: groupName,
type: 'party',
privacy: 'private',
},
members: 1,
});
party = group;
partyLeader = groupLeader;
partyNonLeader = members[0];
});
it('allows leader of party to add managers', async () => {
let updatedGroup = await partyLeader.post(`/groups/${party._id}/add-manager`, {
managerId: partyNonLeader._id,
});
expect(updatedGroup.managers[partyNonLeader._id]).to.be.true;
});
});
});

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({
@@ -43,4 +44,24 @@ describe('PUT /group', () => {
expect(updatedGroup.leader.profile.name).to.eql(leader.profile.name);
expect(updatedGroup.name).to.equal(groupUpdatedName);
});
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,
leader: nonLeader._id,
});
expect(updatedGroup.leader._id).to.eql(nonLeader._id);
expect(updatedGroup.leader.profile.name).to.eql(nonLeader.profile.name);
expect(updatedGroup.name).to.equal(groupUpdatedName);
});
});

View File

@@ -40,13 +40,14 @@ describe('PUT /heroes/:heroId', () => {
});
});
it('updates contributor level, balance, ads, blocked', async () => {
it('change contributor level, balance, ads', async () => {
let hero = await generateUser();
let prevBlockState = hero.auth.blocked;
let prevSleepState = hero.preferences.sleep;
let heroRes = await user.put(`/hall/heroes/${hero._id}`, {
balance: 3,
contributor: {level: 1},
purchased: {ads: true},
auth: {blocked: true},
});
// test response
@@ -61,18 +62,47 @@ describe('PUT /heroes/:heroId', () => {
expect(heroRes.balance).to.equal(3 + 0.75); // 3+0.75 for first contrib level
expect(heroRes.contributor.level).to.equal(1);
expect(heroRes.purchased.ads).to.equal(true);
expect(heroRes.auth.blocked).to.equal(true);
// test hero values
await hero.sync();
expect(hero.balance).to.equal(3 + 0.75); // 3+0.75 for first contrib level
expect(hero.contributor.level).to.equal(1);
expect(hero.purchased.ads).to.equal(true);
expect(hero.auth.blocked).to.equal(true);
expect(hero.preferences.sleep).to.equal(true);
expect(hero.auth.blocked).to.equal(prevBlockState);
expect(hero.preferences.sleep).to.equal(prevSleepState);
expect(hero.notifications.length).to.equal(1);
expect(hero.notifications[0].type).to.equal('NEW_CONTRIBUTOR_LEVEL');
});
it('block a user', async () => {
let hero = await generateUser();
let heroRes = await user.put(`/hall/heroes/${hero._id}`, {
auth: {blocked: true},
preferences: {sleep: true},
});
// test response values
expect(heroRes.auth.blocked).to.equal(true);
// test hero values
await hero.sync();
expect(hero.auth.blocked).to.equal(true);
expect(hero.preferences.sleep).to.equal(true);
});
it('unblock a user', async () => {
let hero = await generateUser();
let prevSleepState = hero.preferences.sleep;
let heroRes = await user.put(`/hall/heroes/${hero._id}`, {
auth: {blocked: false},
});
// test response values
expect(heroRes.auth.blocked).to.equal(false);
// test hero values
await hero.sync();
expect(hero.auth.blocked).to.equal(false);
expect(hero.preferences.sleep).to.equal(prevSleepState);
});
it('updates chatRevoked flag', async () => {
let hero = await generateUser();

View File

@@ -37,7 +37,7 @@ describe('GET /members/:memberId', () => {
expect(Object.keys(memberRes.auth)).to.eql(['timestamps']);
expect(Object.keys(memberRes.preferences).sort()).to.eql([
'size', 'hair', 'skin', 'shirt',
'chair', 'costume', 'sleep', 'background',
'chair', 'costume', 'sleep', 'background', 'tasks',
].sort());
expect(memberRes.stats.maxMP).to.exist;

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 {
import amzLib from '../../../../../../website/server/libs/amazonPayments';
describe('payments : amazon #subscribeCancel', () => {
let endpoint = '/amazon/subscribe/cancel';
let endpoint = '/amazon/subscribe/cancel?noRedirect=true';
let user, group, amazonSubscribeCancelStub;
beforeEach(async () => {
@@ -22,7 +22,7 @@ describe('payments : amazon #subscribeCancel', () => {
});
describe('success', () => {
beforeEach(async () => {
beforeEach(() => {
amazonSubscribeCancelStub = sinon.stub(amzLib, 'cancelSubscription').returnsPromise().resolves({});
});
@@ -66,7 +66,7 @@ describe('payments : amazon #subscribeCancel', () => {
'purchased.plan.lastBillingDate': new Date(),
});
await user.get(`${endpoint}?groupId=${group._id}`);
await user.get(`${endpoint}&groupId=${group._id}`);
expect(amazonSubscribeCancelStub).to.be.calledOnce;
expect(amazonSubscribeCancelStub.args[0][0].user._id).to.eql(user._id);

View File

@@ -26,7 +26,7 @@ describe('payments - amazon - #subscribe', () => {
let subscription = 'basic_3mo';
let coupon;
beforeEach(async () => {
beforeEach(() => {
subscribeWithAmazonStub = sinon.stub(amzLib, 'subscribe').returnsPromise().resolves({});
});

View File

@@ -0,0 +1,41 @@
import {generateUser} from '../../../../../helpers/api-integration/v3';
import applePayments from '../../../../../../website/server/libs/applePayments';
describe('payments : apple #cancelSubscribe', () => {
let endpoint = '/iap/ios/subscribe/cancel?noRedirect=true';
let user;
beforeEach(async () => {
user = await generateUser();
});
describe('success', () => {
let cancelStub;
beforeEach(async () => {
cancelStub = sinon.stub(applePayments, 'cancelSubscribe').returnsPromise().resolves({});
});
afterEach(() => {
applePayments.cancelSubscribe.restore();
});
it('cancels the subscription', async () => {
user = await generateUser({
'profile.name': 'sender',
'purchased.plan.paymentMethod': 'Apple',
'purchased.plan.customerId': 'customer-id',
'purchased.plan.planId': 'basic_3mo',
'purchased.plan.lastBillingDate': new Date(),
balance: 2,
});
await user.get(endpoint);
expect(cancelStub).to.be.calledOnce;
expect(cancelStub.args[0][0]._id).to.eql(user._id);
expect(cancelStub.args[0][1]['x-api-key']).to.eql(user.apiToken);
expect(cancelStub.args[0][1]['x-api-user']).to.eql(user._id);
});
});
});

View File

@@ -0,0 +1,40 @@
import {generateUser} from '../../../../../helpers/api-integration/v3';
import applePayments from '../../../../../../website/server/libs/applePayments';
describe('payments : apple #verify', () => {
let endpoint = '/iap/ios/verify';
let user;
beforeEach(async () => {
user = await generateUser();
});
describe('success', () => {
let verifyStub;
beforeEach(async () => {
verifyStub = sinon.stub(applePayments, 'verifyGemPurchase').returnsPromise().resolves({});
});
afterEach(() => {
applePayments.verifyGemPurchase.restore();
});
it('makes a purchase', async () => {
user = await generateUser({
balance: 2,
});
await user.post(endpoint, {
transaction: {
receipt: 'receipt',
}});
expect(verifyStub).to.be.calledOnce;
expect(verifyStub.args[0][0]._id).to.eql(user._id);
expect(verifyStub.args[0][1]).to.eql('receipt');
expect(verifyStub.args[0][2]['x-api-key']).to.eql(user.apiToken);
expect(verifyStub.args[0][2]['x-api-user']).to.eql(user._id);
});
});
});

View File

@@ -0,0 +1,55 @@
import {generateUser, translate as t} from '../../../../../helpers/api-integration/v3';
import applePayments from '../../../../../../website/server/libs/applePayments';
describe('payments : apple #subscribe', () => {
let endpoint = '/iap/ios/subscribe';
let user;
beforeEach(async () => {
user = await generateUser();
});
it('verifies sub key', async () => {
await expect(user.post(endpoint)).to.eventually.be.rejected.and.eql({
code: 400,
error: 'BadRequest',
message: t('missingSubscriptionCode'),
});
});
describe('success', () => {
let subscribeStub;
beforeEach(async () => {
subscribeStub = sinon.stub(applePayments, 'subscribe').returnsPromise().resolves({});
});
afterEach(() => {
applePayments.subscribe.restore();
});
it('makes a purchase', async () => {
user = await generateUser({
'profile.name': 'sender',
'purchased.plan.customerId': 'customer-id',
'purchased.plan.planId': 'basic_3mo',
'purchased.plan.lastBillingDate': new Date(),
balance: 2,
});
let sku = 'com.habitrpg.ios.habitica.subscription.3month';
await user.post(endpoint, {
sku,
receipt: 'receipt',
});
expect(subscribeStub).to.be.calledOnce;
expect(subscribeStub.args[0][0]).to.eql(sku);
expect(subscribeStub.args[0][1]._id).to.eql(user._id);
expect(subscribeStub.args[0][2]).to.eql('receipt');
expect(subscribeStub.args[0][3]['x-api-key']).to.eql(user.apiToken);
expect(subscribeStub.args[0][3]['x-api-user']).to.eql(user._id);
});
});
});

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