Commit Graph

1099 Commits (dc06fe2215c6a14b70e0076eb9bd609a4eaf1c4f)

Author SHA1 Message Date
Julian Lam a0b7a82350
feat(api): account deletion routes for the Write API ()
* feat(api): account deletion routes for the Write API

* refactor: rewrite client-side calls to account deletion to use api

* style: apply DRY
Opliko 6e43086558
resolve - Allow nested objects in translations ()
* feat:  Allow nested objects in translations

* feat:  Allow nested objects in translations

* style: don't change formatting

* fix: don't use the first string match if key isn't finished

* feat:  Allow nested objects in translations

* feat:  Allow nested objects in translations

* style: don't change formatting

* fix: don't use the first string match if key isn't finished

* feat: add nested translations test
Barış Soner Uşaklı 7928036a1b feat: add test for custom translations
gasoved 3ccebf112e
feat: invites regardless of registration type, invite privilege, groups to join on acceptance ()
* feat: allow invites in normal registration mode + invite privilege

* feat: select groups to join from an invite

* test: check if groups from invitations have been joined

* fix: remove unused variable

* feat: write API versions of socket calls

* docs: openapi specs for the new routes

* test: iron out mongo redis difference

* refactor: move inviteGroups endpoint into write API

* refactor: use GET /api/v3/users/:uid/invites/groups

Instead of GET /api/v3/users/:uid/inviteGroups

* fix: no need for /api/v3 prefix when using api module

* fix: tests

* refactor: change POST /api/v3/users/invite

To POST /api/v3/users/:uid/invites

* refactor: make helpers.invite awaitable

* fix: restrict invite API to self-use only

* fix: move invite groups controller to write api, +tests

* fix: tests

Co-authored-by: Julian Lam <julian@nodebb.org>
Julian Lam 0a0b4661be
chore: remove debug log
Barış Soner Uşaklı e4d2764d4c fix: , remove header/footer cache
Julian Lam b3e00489c8 fix: add back test timeout for exports
Julian Lam bcccb331db docs: openapi schema for user/group exist check, session deletion
Julian Lam 97842c43d3 test: new api test to ensure each path's parameters are defined in context
Julian Lam 319cfeaa1c test: updated test name to be more specific
Julian Lam ee4d90f68f fix: test breakage from f300c933a5
Julian Lam f300c933a5 refactor: move session revocation route to write api
Barış Soner Uşaklı 3f5f38dd89 fix: clear header-cache after each suite
Barış Soner Uşaklı 255cf43ea9 fix: show msg on fail
Barış Soner Uşaklı f1f9b225b0
feat: , cache refactor ()
* feat: , cache refactor

ability to disable caches
ability to download contents of cache
refactor cache modules to remove duplicated code

* fix: remove duplicate hit/miss tracking

check cacheEnabled in getUncachedKeys
Julian Lam 512f6de6de
feat: allow passwords with length > 73 characters ()
* feat: allow passwords longer than 73 characters

Context: A bcrypt/blowfish limitation means that password length is capped at 72 characters. We can get around this without compromising on security
by hashing all incoming passwords with SHA512, and then sending that to bcrypt.

https://dropbox.tech/security/how-dropbox-securely-stores-your-passwords

* feat: add additional test for passwords > 73 chars

* fix: remove 'password-too-long' error message and all invocations

* test: added test to show that a super long password won't bring down NodeBB

* fix: remove debug log

* Revert "fix: remove 'password-too-long' error message and all invocations"

This reverts commit 1e312bf7ef7e119fa0f1bd3517d756ca013d5e79.

* fix: added back password length checks, but at 512 chars

As processing a large string still uses a lot of memory
Barış Soner Uşaklı b6d8687837 chore: add info log into tests
Julian Lam cc1c722092 fix: breaking test from 0db0231cff
Also lowered export timeout to 5s
Julian Lam 04185d94c1 fix: indentation
Julian Lam 8e7914ff72 fix: add back derpy 20 second sleep
Julian Lam 14e5c24ec5 fix(openapi): final fixes to schemas
Julian Lam 3ebb3a3479 fix: missing method in test error output
Julian Lam b092f65d95 fix(writeapi): tests
Julian Lam 843aff582d refactor: api test suite to accept methods other than GET
Julian Lam b156b8b573 feat: wip, write api tests framework
re-using read api tests if possible
Barış Soner Uşaklı a05905f196
performance improvements ()
* perf: nconf/winston/render

cache nconf.get calls
modify middleware.pageView to call next earlier
don't call winston.verbose on every hook see https://github.com/winstonjs/winston/issues/1669
translate header/footer separately and cache results for guests

* fix: copy paste fail

* refactor: style and fire hook only log in dev mode

* fix: cache key, header changes based on template

* perf: change replace

* fix: add missing await

* perf: category

* perf: lodash clone

* perf: remove escapeRegexChars
Barış Soner Uşaklı 1f43e98f8b fix: allow admins adding users to global moderators
add new test
Barış Soner Uşaklı 75024c3580 refactor: remove console.log, extra require
Barış Soner Uşaklı b26e9b5993 fix: , dont save escaped data when renaming groups
Barış Soner Uşaklı 8fd3c04480 fix: test
Barış Soner Uşaklı bf480ee58b refactor: setupApiRoute signature
Barış Soner Uşaklı b2ff1594b8 fix: redis hget
'node_redis: The HGET command contains a invalid argument type.\n' +
'Only strings, dates and buffers are accepted. Please update your code to use valid argument types.'
Julian Lam e98285dbbb fix: reimplementing isPrivilegedOrSelfAndPasswordMatch
Barış Soner Uşaklı 84a179f48c Merge branch 'master' of https://github.com/NodeBB/NodeBB
Julian Lam 222b4c9533 fix: broken tests from api change
Barış Soner Uşaklı 7d86be2bc2 fix: tests
Barış Soner Uşaklı e367c5403e refactor: move groups.leave, fix some tests
Barış Soner Uşaklı 8ae1f81cf4 feat: refactor groups.delete
Barış Soner Uşaklı d69e503d21 feat: move groups.join to api
Barış Soner Uşaklı 872bacf1c4
Admin/users ()
* feat: wip admin/users

* feat: more work

* feat: more fixes

* feat: , verified/unverified user groups

* feat: add filter

* feat: change user search to use filters array

* refactor: remove unused search call

* fix: tests

* fix: cant join system groups

* fix: upgrade script
psychobunny 7b2301ff9c fix: enable tests
Barış Soner Uşaklı 1ee9384875 fix: , allow all slashes in category route
Barış Soner Uşaklı d76229c061 feat: add checkbox tests
Barış Soner Uşaklı e92d4719cc feat: add test for serialize/deserialize form
Barış Soner Uşaklı 7db224f689 fix: timeago test for dev/prod
Barış Soner Uşaklı cecdd2915e fix: timeago test
Barış Soner Uşaklı ae5fb103ca feat: disable write api tests until fixed
Barış Soner Uşaklı dc29f4dca2 refactor: switch to using slugify module
Barış Soner Uşaklı 3b231360d3 feat: load jquery-form before using
Julian Lam 87e3f26fe4 feat(openapi): schema validation for write api definitions file
Julian Lam ebcb664b41 fix(writeapi): tests
Julian Lam 229eb2c2d8 fix(writeapi): tests
Julian Lam 41f55b7a5a fix(writeapi): tests
psychobunny bf3c1c0878 fix: manifest test + remove duplicate test
psychobunny 5b427a0c3b feat: option in ACP to configure notification/email delay for chats
Timothy Fike 5078a8df25
ttl/pttl ()
Barış Soner Uşaklı ac43cd8b6f fix: , trim email before checking validity
Barış Soner Uşaklı ccddbb15c9 feat: edit test
Barış Soner Uşaklı fe2dc3101e fix: auth tests
Barış Soner Uşaklı 5e8c376115 fix: remove old test
Barış Soner Uşaklı 38d3982bf1 fix:
allow updating other profile fields when username isnt being changed
Barış Soner Uşaklı 4be693f2e7
feat: fullname search ()
* feat: fullname search

* fix: take last element

* fix: attempt to fix psql like query

* feat: upgrade sript, another fix attempt

* fix: psql test

* fix: psql scan

* feat: add debug for test

* feat: test collate

* feat: cleanup

* fix: upgrade script
Barış Soner Uşaklı 9389749b79 feat: sorted set lex test
Julian Lam 885e0ebfde Revert "fix: bypass nbbpm for now"
This reverts commit 33c1bd5f01.
Barış Soner Uşaklı 5f10d67db5
Remove sounds ()
* feat: remove sounds

* feat: remove more sounds

* feat: disable sounds plugin

* fix: openapi
Barış Soner Uşaklı e3a0b4b1c1 fix: tests
Barış Soner Uşaklı 33c1bd5f01 fix: bypass nbbpm for now
Barış Soner Uşaklı 1b7ba2c8f1 feat: force upgrade scripts for test
Julian Lam f743f92088
refactor: socket posts delete/restore/purge so tid is not necessary ()
* refactor: socket posts delete/restore/purge so tid is not necessary

* refactor: stop trying to be fancy

* fix: tests to not pass in tid into posts.deletePosts

* fix: some more unnecessary tid passing
Barış Soner Uşaklı 9f9164a9be fix:
Julian Lam 563937950a fix: reintroduce 20s delay for api tests
Julian Lam 4737f937ee feat: expose global/admin privileges to all routes
@barisusakli revert if necessary 😬
Julian Lam e047b72c87 feat: additional tests for
Julian Lam 360aa00d5a fix: flag list tests due to breaking change in API
Julian Lam d935f03636 fix(openapi): tests
Julian Lam 334be11382 fix: no-widgets messaging in ACP + copy
Barış Soner Uşaklı 846b7d2430 refactor: change pwd change logic
add one more test
Barış Soner Uşaklı a333cb6ca4 feat: one more test
Barış Soner Uşaklı ecda4ad8ad feat: tests for password change
Peter Jaszkowiak 1d170e0c1c
fix: , remove old deps during upgrade ()
Barış Soner Uşaklı b61a4da50c feat: , add upgrade script test
flush test db after tests are complete
Julian Lam a716a5529c
feat: more discrete commit-on-save instead of commit-on-change w/ confirm modals ()
* feat: privileges save button, , WIP

* fix: disable firefox autocomplete on privilege form fields

* feat: closes  privilege changes commit on save

- new language strings for confirmation and success modals/toasts
- indeterminate privilege handling (/cc @psychobunny)
- added new discard button
- both discard and save buttons now have confirmation dialogs

* fix(tests): remove duplicate template helper test

* fix(tests): broken template helper test

* feat: confirm dialogs for all privilege copy actions

Also, ability to add user to a privilege table without needing
to refresh the privilege table.

* feat: group row addition w/o table refresh

breaking: helpers.getUserPrivileges and helpers.getGroupPrivileges
no longer make socket calls to the following hooks:

- filter:privileges.list, filter:privileges.admin.list,
  filter:privileges.global.list, filter:privileges.groups.list,
  filter:privileges.admin.groups.list,
  filter:privileges.gloval.groups.list

The filters are still called, but done before the helper method
is called, and the results are passed in instead. This change
should only affect you if you directly call the helper methods,
otherwise the change is transparent.

* fix: stale ajaxify data on privilege category switch

* fix: implicit privileges not showing for user privs

* fix: groups, not group, also fix tests

* fix(tests): again

* fix: wrong tpl rendered when adding group to global priv table
Barış Soner Uşaklı 52718ce0ba fix: remove old test
Barış Soner Uşaklı 609e37a67b feat: remove deprecated utils.walk
Julian Lam 55b0e902fb feat: consolidation of flags to reduce flagspam,
Squashed commit of the following:

commit c6d09396208a10c244d7b3d22ffd2d7dd1274d3a
Author: Julian Lam <julian@nodebb.org>
Date:   Fri Jul 24 13:41:32 2020 -0400

    fix: more tests

commit 32f9af2a87a81fa62ecca01e71d6f0d5b9d37ba1
Merge: e50907535 4eae927d1
Author: Julian Lam <julian@nodebb.org>
Date:   Fri Jul 24 10:53:04 2020 -0400

    Merge remote-tracking branch 'origin/master' into singleton-flags

commit e50907535109dbdbe8f15c3e2fcdf22d90b1332a
Author: Julian Lam <julian@nodebb.org>
Date:   Fri Jul 24 10:52:46 2020 -0400

    fix: controllers-admin test

commit fd5af99e303de48a80b0ccc166eee19175cf232b
Author: Julian Lam <julian@nodebb.org>
Date:   Fri Jul 17 17:26:55 2020 -0400

    fix(tests): dummy commit to trigger travisCI

commit c452a6ffcfaef91403de084c4ae16795cb23c60e
Author: Julian Lam <julian@nodebb.org>
Date:   Fri Jul 17 17:05:09 2020 -0400

    fix(openapi): openapi spec changes

commit 8089a74e89128141ab1e6f8ff83447114b3b846b
Author: Julian Lam <julian@nodebb.org>
Date:   Fri Jul 17 15:48:00 2020 -0400

    fix: reversing the order of reports for display purposes

commit a099892b377333561c72f1ad5b6b20ddb4ce8a96
Author: Julian Lam <julian@nodebb.org>
Date:   Fri Jul 17 15:45:44 2020 -0400

    refactor: run all flag creation calls in a single batch

commit b24999682f9d5a33a08a049749c1f0eb4f00facc
Author: Julian Lam <julian@nodebb.org>
Date:   Fri Jul 17 15:08:23 2020 -0400

    feat: handling multiple reporters per flag, 

commit 08c75c020021ada754bf0e39eae77d631b01dee5
Author: Julian Lam <julian@nodebb.org>
Date:   Thu Jul 16 20:53:18 2020 -0400

    feat: upgrade script for 
Barış Soner Uşaklı 2cdb935f1d feat: remove file.isFileTypeAllowed
Barış Soner Uşaklı b9cff5775c fix: edge case in test
if user is created the other one will be renamed
Barış Soner Uşaklı 844f2b4ed0 feat: , allow editing category of queued topic
Barış Soner Uşaklı 6f889c9c83 fix: try again
Barış Soner Uşaklı a46adb3fd5 fix: more tests
Barış Soner Uşaklı 65395ae59d fix: tests
Barış Soner Uşaklı 2485a55092 feat: , allow editing title before posting from queue
Barış Soner Uşaklı 00d39fb32c feat: , export groups members as csv
Barış Soner Uşaklı 73ddf1cb98 fix: groups.updateCover
Barış Soner Uşaklı c513b88dff feat: , daily downvote limits
Barış Soner Uşaklı c2ca02dfc7 fix:
make isPrimary and isCluster always booleans
they were strings when using ./nodebb start and boolean if they were in config.json and started with node app.js
Barış Soner Uşaklı 02ac44cc5a fix: dont allow searching by ip/banned/flagged for regular users
Barış Soner Uşaklı e95cd28f6f
Zscan ()
* feat: zscan

* fix: mongodb tests

* feat: scan, ip search starts with
Barış Soner Uşaklı 723fe8e8e0
feat: zscan ()
* feat: zscan

* fix: mongodb tests
Barış Soner Uşaklı f0ce309d03 fix: test
Barış Soner Uşaklı c718b7293e feat: , min/max tags per category
Barış Soner Uşaklı 6aecc1770c feat: increase wait
Barış Soner Uşaklı f03ca0867b fix: tests
Barış Soner Uşaklı 48b41debe6
fix: vulnerability in cover and admin uploads ()
* fix: vulnerability in cover and admin uploads

* fix: remove old test

* fix: update tests
Barış Soner Uşaklı bef37e27cb
fix: test lock for user create ()
* fix: test lock for user create

* fix: redis hdel with undefined

* feat: add test for undefined key in deleteObjectFields
Julian Lam f909ed2541 feat: show editor in post diffs if available
Julian Lam d5578c9906 fix: tests breaking due to
Barış Soner Uşaklı 18d892398f fix: add timestamp to initial username history
Barış Soner Uşaklı bb3aa54006 feat: merge changes
allow selecting main topic to merge into
allow specifying a new title for merge topic
upon merge go to correct topic
new tests for merging with options
Barış Soner Uşaklı 3be4d5f7d5 feat: redirect /me to user profile
Julian Lam 6b1d1acb48 fix(style): more switch..case
Barış Soner Uşaklı 75b3a81dad fix: clear error log before checking
fix intermittent test failure due to analytics being written every 10 seconds
Peter Jaszkowiak de7ec47f13
fix: , remove webfonts ()
Julian Lam da90fd562e fix: more tests
Julian Lam a51fff8bd1
refactor: remove general menu from ACP ()
* refactor: remove general menu from ACP

* fix: incorrect translation keys, fixed tests
Julian Lam a66fe01377 fix: test breakages from 8d995d1eb6
Barış Soner Uşaklı 0009f54e6e feat: add getSortedSetMembers
Barış Soner Uşaklı ec5582b53c
feat: add privilege give/rescind hooks ()
* feat: add privilege give/rescind hooks

action:privileges.categories.give/rescind
action:privileges.global.give/rescind

breaking change, privileges.categories.give/rescind and privileges.global.give/rescind use full privilege name for groups ie `groups:find` instead of `find`

* fix: tests, privileges renamed
Barış Soner Uşaklı 3b6d57e497 refactor: move code
Barış Soner Uşaklı 4ee3543ea4 feat: tweak intersection code, add tests
Julian Lam 6f504c4142
Remove allowFileUploads ACP option ()
* feat: allow awaitable upgrade scripts

* feat: allowFileUploads removal upgrade script

* refactor: remove unnecessary ACP option `allowFileUploads`

* fix: updated upgrade script template to not use callback arg

* fix: upgrade script as per @baris

* fix: add missing await

* fix: add missing await
Barış Soner Uşaklı f2907908c9 fix: another test fix
Barış Soner Uşaklı feb748a44d fix: tests
Barış Soner Uşaklı 12c6bc2e07 feat: convert queries so they used indices directly
Barış Soner Uşaklı 7a801abade fix: tests on redis
Barış Soner Uşaklı a032e12b7e fix: tests
Barış Soner Uşaklı 81e33b9391 fix:
Barış Soner Uşaklı bfad457275 feat: add methods for adding/removing tags from topics
Barış Soner Uşaklı 97c086aba9 fix: missing await
Barış Soner Uşaklı edf9fe3b7f feat: add null tests for sorted sets
Barış Soner Uşaklı aad0880f7c feat: add filter:categories.getRecentTopicReplies
pass req.query to getRecentTopicReplies
Barış Soner Uşaklı a969c5cec9 feat: allow activating additional plugins for testing via config.json
Barış Soner Uşaklı 3a23ddaba5 feat: move plugin tests to separate file
Barış Soner Uşaklı a6bb9f4364 fix: , run plugin tests for installed plugins
Barış Soner Uşaklı 3d0db9630f fix: remove deprecated mocha.opts
Barış Soner Uşaklı 9d153fd388 fix: , dont readd user after deletion
don't add user uid back to users:* sorted sets if they are deleted
upgrade script to fix users:* sorted sets
Barış Soner Uşaklı 0391856d7d fix: , rescind notif when its resolved/rejected
Julian Lam ccc6118d30
Testing suite integration for openapi spec ()
* feat: testing suite integration for openapi spec

The testing suite now takes the openapi spec into account. It will
check each route defined, make a call to it, and compare the
response with the defined schema. Any mismatches will cause the
test to fail.

* fix(openapi): removed debug stuff from tests

* fix(openapi): fixed some tests

* fix(openapi): added additional check to tests, test fixes

* fix(openapi): better tests, fixed spec errors

* fix(openapi): bad conditional in test

* fix: oops

* fix(openapi): more tests fixing

* fix(openapi): more tests

* fix(openapi): fix some more tests

* fix: verbose'd an info log

* fix: topic pagination route returns schema-optimized pagination block

* fix(openapi): more test/spec fixes

* fix(openapi): accidentally sending in authenticated jar for anon routes

* fix(openapi): more test/spec fixes

* fix(openapi): more spec fixes

* fix: timestampReadable Invalid Date

* fix(openapi): more tests... almost there

* fix(openapi): more tests fixing

* fix(openapi): finally all tests passing

* fix(openapi): added reverse test to compare response to spec

... and fixed all the tests that broke

* fix: remove tests related to group covers, as route is gone

* fix(openapi): broken test on travis

* fix(openapi): broken test on travis

* fix(openapi): broken test on travis

* fix(openapi): object cache is not present for psql

* fix: tests

Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
Julian Lam 6edf02d4a5 fix: remove upload picture test (avatars)
Julian Lam 442fe65f5a fix: remove tests related to group covers, as route is gone
Julian Lam 8387178b25 feat(openapi): merging openapi-test branch into master
Barış Soner Uşaklı 8e23dec84b fix: lint
Barış Soner Uşaklı e72a29b3fd fix: return null if field does not exist
Andrew Rodrigues 3c9689a5ac
feat: settings sorted list ()
* feat: settings sorted list

see https://github.com/NodeBB/nodebb-plugin-quickstart/pull/9/files for sample
Barış Soner Uşaklı 067034082f fix: , update deleted/restored messages
Barış Soner Uşaklı 4d0636f847 fix: , prevent account deletion
Julian Lam d6e3f3f058
fix: , broken site if no server-side session ()
* fix: , broken site if no server-side session

During the `addHeader` middleware, a check is now done to see if
`req.session.meta` is present. This value is only present if the user
has a valid server-side session.  If it is missing, then it is probably
safe to assume that the server-side session was deleted (either
intentionally or accidentally). In that scenario, the client-side cookie
should be cleared.

Also, there was an issue where the sessionRefresh flag was never cleared
after a successful login, so that was fixed too.

* feat: exported method to get cookie config

* fix: don't clear cookie if cookie is being set

* fix: socket.io tests

Co-authored-by: Barış Soner Uşaklı <barisusakli@gmail.com>
Baris Usakli 87225a90c3 fix: , upgrade mkdirp to 1.0.x
Barış Soner Uşaklı 8c48f94b96 fix: , dont allow restore if not deleted by self
Barış Soner Uşaklı 66febb8071 feat: add test for isOnline