1
0
Fork 0
Commit Graph

483 Commits (97873b618d045811bcb15ecc1454d2db0fe32fa5)

Author SHA1 Message Date
Mike Gerwitz 97873b618d doc: Add information on JS libraries used
* doc/hacking.texi: New file with information on libraries.
* doc/liza.texi: Include it.  Add to menu.
2018-05-04 10:39:46 -04:00
Mike Gerwitz 4ce7ba7545 Server: Add program_id to /init
We need to add API versioning.  But until then...

* src/server/Server.js (_processInit): Return program_id.
2018-05-03 16:11:32 -04:00
Mike Gerwitz ad52dbec9a controller: Only init submit notification if requested
* src/server/daemon/controller.js (exports.init): Do not initialize submit
    notifier if no URL was provided.
2018-05-03 14:39:04 -04:00
Mike Gerwitz b32d4e3d1b MongoServerDao#getDocumentField retrieval fix
* src/server/db/MongoServerDao.js (getDocumentField): Check key on first
  record.
2018-05-02 15:27:35 -04:00
Mike Gerwitz 99e33a5089 RatingServiceSubmitNotify: Do not flag as notified on error
If the submission failed, we probably want to try again next time around.

* src/server/service/RatingServiceSubmitNotify.js
  (_maybeNotify): Extract logic from `#postProcessRaterData'.  Only set
    notification flag in absence of dapi error.
  (postProcessRaterData): Use it.
* test/server/service/RatingServiceSubmitNotifyTest.js: Update tests
    accordingly.
2018-05-02 14:23:39 -04:00
Mike Gerwitz 7a1af0253a Resolve server-side validation internal flag race condition 2018-05-02 14:01:54 -04:00
Mike Gerwitz 458064339d Server: Output assertion failure messages
Previously, it was just trying to serialize an object, which was useless.

* src/server/Server.js (_formatValidationFailures): New method.
  (_doQuoteSave): Use it.
2018-05-01 15:09:22 -04:00
Mike Gerwitz fac64b6ae1 Server: Set program internal flag before assertions
Requests that came in between (for example) a post request and the actual
validation of the posted data would potentially reset the flag, causing
internal assertions to fail.

* src/server/Server.js
  (sendStep): Provide session to #_forwardValidate.
  (_forwardValidate): Set `program.isInternal' immediately before invoking
    event.  Provide session to #quoteFill.
    [session]: New argument.
  (quoteFill): Add `session' argument.  Provide session to hooks.
  (loadProgram): Receive session via #quoteFill hook.  Set
    `program.isInternal' before submit hook.
* src/server/daemon/controller.js (doRoute): Remove `program.isInternal'
    set.
2018-05-01 15:03:55 -04:00
Mike Gerwitz f38d0bf96c Notification support given no rating results 2018-05-01 09:45:01 -04:00
Mike Gerwitz ea30e94527 Integrate noResultsUrl configuration
This is not the ideal implementation.  Instantiation of RatingService and
such should be moved out of the controller entirely, but we don't have the
time for that right now.
2018-05-01 09:44:55 -04:00
Mike Gerwitz 25cb1f62c1 controller: Integrate RatingServiceSubmitNotify
This is not an ideal location.
2018-05-01 09:44:55 -04:00
Mike Gerwitz 3bed93e750 SpoofedNodeHttpImpl: Fix docblocks (User{Session=>Request})
Wrong object!
2018-05-01 09:44:55 -04:00
Mike Gerwitz ae0d9b3862 RatingServiceSubmitNotify: Create dapi dynamically with session
Session information needs to be available for request session spoofing.
2018-05-01 09:44:55 -04:00
Mike Gerwitz d9c442b8e2 QuoteDataApi: Correct constructor argument error 2018-05-01 09:44:55 -04:00
Mike Gerwitz 2d1582059f RatingServiceSubmitNotify: Notify only once
* src/server/db/MongoServerDao.js
  (getDocumentField,setDocumentField): New methods.
* src/server/service/RatingServiceSubmitNotify.js
  (postProcessRaterData): Only notify when notification flag is not set.
  (_getNotifyState, _setNotified): New methods.
* test/server/service/RatingServiceSubmitNotifyTest.js: Modify accordingly.
2018-05-01 09:44:55 -04:00
Mike Gerwitz d8338b50e0 RatingServiceSubmitNotify: Add trait
* src/server/service/RatingServiceSubmitNotify.js: New trait.
* test/server/service/RatingServiceSubmitNotifyTest.js: Respective test.
2018-05-01 09:44:55 -04:00
Jeffrey Fisher 7d0dc97162 Add HttpDataApiUrlData 2018-05-01 09:44:53 -04:00
Jeffrey Fisher 5b410005cd RatingService: ensure #postProcessRaterData is called before save 2018-05-01 09:44:51 -04:00
Mike Gerwitz 6380f610d3 README.hacking=>HACKING with README.md mention 2018-04-19 21:45:15 -04:00
Mike Gerwitz 9ad8cb96b8 Cmatch: Do not fail given __classes question
* src/client/Cmatch.js (handleClassMatch): Rename from
  _handleClassMatch.  Make protected.  Check for truthy `vis'.
* test/client/CmatchTest.js: Update accordingly.
2018-04-16 15:30:19 -04:00
Mike Gerwitz b5fc56c62c Client: updateFieldData setOptions current value fix 2018-04-05 09:04:38 -04:00
Mike Gerwitz f5f753d3bb Client: updateFieldData setOptions cur fix
* src/client/Client.js (_createProgram): Properly capture current value in
  closure for `setOptions'.
2018-04-03 16:04:30 -04:00
Mike Gerwitz 6733556582 Remove hard-coded skey
This wasn't intended to make its way into a public repo. :)

The existing key was a long-forgotten kluge that was supposed to be
temporary, allowing internal services to create quotes without
authentication.  The chances of this being practically exploited are minimal
in our environment, and it's auditable using webserver logs.

This moves the skey into a configuration file, which allows it to vary by
server and be rotated until a better solution is made available.  skey is
disabled by default (empty string), and when used by us internally, the keys
are now generated using a CSPRNG rather than a brute-forcable 5-byte key
that was hard-coded.

The fact that this appears in webserver logs is a big issue as well.  I
added a task to address that.

* conf/vanilla-server.json (skey): New key.  Default empty.
* src/server/daemon/Daemon.js (start): Provide skey to `#getRouters'.
  (getRouters): Provide skey to `#getProgramController'.
  (getProgramController): Set skey on `controller'.
* src/server/daemon/controller.js (skey): New mutable export (unideal; quick
    change).
  (has_skey): Use it.
2018-04-03 15:29:47 -04:00
Mike Gerwitz 460a533777 MongoServerDao: Always clear quicksave data
quicksave data wouldn't always be cleared on save, meaning it might not be
cleared until the next _empty_ quicksave from the client.

* src/server/db/MongoServerDao.js (saveQuote): Always clear quicksave.
2018-03-14 11:47:50 -04:00
Mike Gerwitz f83dfd0027 GeneralStepUiTest: Fix failing test case in newer version of Node
An error was being thrown outside the stack of the actual test, which
apparently was never noticed until more recent versions of node.  We're
still on a pretty ancient version for local development. :x

* test/ui/step/GeneralStepUiTest.js (createElementStyler)[getAnswerElementByName]:
  Properly return array for stub jQuery element.
2018-03-07 14:12:48 -05:00
Mike Gerwitz c33adee21d client: Truncate diff posted to server after first null
Before this change, since `undefined' is encoded as `null' when serialized,
there was no way for the server to disambiguate between unmodified values
and a truncation point.  For example:

  [ undefined, undefined, null, null, null ]

The above array represents two unmodified and three removed indexes.  But
this is serialzed into JSON as:

  [ null, null, null, null, null ]

It isn't possible for the server to determine what the truncation point is
from that diff.  The solution is to therefore truncate the array _before_
sending it to the server, providing a trailing null to indicate that a
truncation has occurred:

  [ null, null, null ]

The above means that the first two indexes are unmodified, and that index 2
and later should all be truncated.

* doc/client.texi (Saving to Server): New section.
* src/client/transport/XhttpQuoteTransport.js (_truncateDiff): New method to
  perform truncation.
  (getBucketDataJson): Use it.
* test/client/transport/XhttpQuoteTransportTest.js: New file with respective
  test case.
2018-03-07 13:46:05 -05:00
Mike Gerwitz 8a01d5fd2e doc: Add @testrefjs macro
* doc/macros.texi (testrefjs): New macro for SRCURI and non-SRCURI.
2018-03-07 13:40:08 -05:00
Mike Gerwitz 9727b9a157 Support default program id if none provided via URL
* src/client/Client.js (_defaultId): New property.
  (__construct)[default_id]: New parameter.  Set `_defaultId'.
  (_getProgramId): Use `_defaultId' if not found in URL.
* src/ui/nav/HashNav.js (_initUrl): Do not require leading program id.
  This technically worked fine before with our URL scheme, but that is not
  guaranteed to be the case generally.
2018-03-01 12:23:35 -05:00
Mike Gerwitz cfadc217cc DslRater: Correct missing raters error message 2018-03-01 12:23:35 -05:00
Mike Gerwitz 79fc82614e ElementStyler: console.warn{ing=>}
Crap.

* src/ui/ElementStyler.js (setValueByName): console.warn{ing=>}
2018-02-12 10:35:23 -05:00
Mike Gerwitz aea22294d1 Correct concurrent show/hide of fields from cmatch (bugfix) 2018-02-09 12:13:46 -05:00
Mike Gerwitz 3b303e50a9 Cmatch: Fix combined show/hide of same field, multi-index
This is something that managed to slip by (but not unnoticed) for almost
exactly one year to this day (028606242a).  It
can only be reproduced by changing classes that result in visibility changes
differing on the same field by index.  The issue hides itself on first
load (because all fields are shown by default) and on refresh.

The problem is that, when one index shows a field but another hides it, the
hide overrode the show indexes, so only the hide took place.

* src/client/Cmatch.js (markShowHide): Make virtual.  New implementation to
    support concurrent show/hide.
  (_handleClassMatch): Use it.
* test/client/CmatchTest.js: New test.
* npm-shrinkwrap.json: ease.js v0.2.{8=>9}.
2018-02-09 11:55:46 -05:00
Mike Gerwitz 0a50b22496 Cmatch: Extract show/hide marking into own method
This is to give us a fairly easy means of testing this logic for a bugfix.

This refactoring also obviates a pretty nasty bug; see docblock.

* src/client/Cmatch.js (_handleClassMatch): Extract show/hide marking.
  (markShowHide): New method.
2018-02-09 11:20:48 -05:00
Mike Gerwitz 4b114d0137 Client: Extract cmatch methods
This makes the minimal number of changes necessary to ensure that all object
references remain available.  It is a mess.

And despite moving all of this, Client is still a massive clusterfuck.

* src/client/Client.js (system): Add import.
  (_cmatch): Now references new Cmatch class instance.
  (_cmatchHidden, _classMatcher): Remove fields.
  (_forceCmatchAction): Rename to `forceCmatchAction'.
  (_hookClassifier, _postProcessCmatch, _cmatchVisFromUi, _handleClassMatch,
    _mergeCmatchHidden, _clearCmatchFields): Extract methods.  Update
    references as necessary.
  (getCmatchData): Remove unused method.
  (_handleError): Rename to `handleError' to make accessible to
    Cmatch.  Update references.
* src/client/ClientDependencyFactory.js (FieldClassMatcher): Remove import.
  (createFieldClassMatcher): Remove method.  See `system/client'.
* src/client/Cmatch.js: New class.
* src/system/client.js (Cmatch, field): Add imports.
  (cmatch): Add export.
2018-02-09 11:20:45 -05:00
Mike Gerwitz cc7370711d Client: Eliminate old event handling system
All of the old events have been removed!

* src/client/Client.js (handleEvent): Remove remainder of old system (after
  last commit, all that was left was error handling).  Correct docblock.
2018-02-08 16:18:46 -05:00
Mike Gerwitz 58533f6d72 Client: Remove unused `reset' event
This event hasn't seen use in ...possibly ever.

* src/client/Client.js (handleEvent): Remove `reset' event.
  Always return `this'.
2018-02-08 16:13:25 -05:00
Mike Gerwitz de578c6e93 ElementStyler: jQuery BC for radios (bugfix)
Of course, the radios are actually checkboxes...radioboxes.

* src/ui/ElementStyler.js (setValueByName): Recognize both jQuery and DOM
  elements.
2018-02-08 09:28:15 -05:00
Mike Gerwitz 70ba408c37 Use highest available source index for set event 2018-02-07 15:04:26 -05:00
Mike Gerwitz 943231ee81 ValueSetEventHandler: New handler for `set' event
The `set' event already existed---this merely extracts it into its own
handler.

* src/client/Client.js (handleEvent): Extract `set' handler.
* src/client/ClientDependencyFactory.js (createClientEventHandler): Add
  `set'.
* src/client/event/ValueSetEventHandler.js: New class.
* test/event/ValueSetEventHandlerTest.js: Associated test case.
2018-02-07 14:59:50 -05:00
Mike Gerwitz f5346bef39 ElementStyler: Ignore noyes/radio/legacyradio when DOM element unknown
* src/ui/ElementStyler.js (setValueByName): Ignore `question' if undefined.
2018-02-07 14:57:51 -05:00
Mike Gerwitz 88e32f3c0d Client: Use last available index for `set' action
This matches the behavior of assertions.

This needs to be refactored into an even handler.

* src/client/Client.js (handleEvent)[set]: Use last available index.
2018-02-07 14:21:02 -05:00
Mike Gerwitz 0282be8903 .gitignore: Ignore *.t2p 2018-02-07 14:16:23 -05:00
Mike Gerwitz 9d0cd5a3f3 ElementStyler: Fix rendering of noyes, radio, legacyradio
* src/ui/ElementStyler.js (setValueByName): Correctly operate on  DOM
  element rather than jQuery object.
2018-02-07 12:02:28 -05:00
Mike Gerwitz 1325dc9a86 ElementStyler: Re-add change_event check as warning
* src/ui/ElementStyler.js (setValueByName)[change_event]: Re-add
  `change_event' check, but as a warning instead of an Error.  This
  shouldn't be used anymore, but let's be certain _without_ breaking
  things.
2018-02-07 12:01:35 -05:00
Mike Gerwitz 51e8c1428f ElementStyler: Remove change_event error
The intent wasn't go have this be permanant, and apparently it _is_ being
used in generated code!

* src/ui/ElementStyler.js (setValueByName): Remove error on `change_event'.
2018-02-06 16:58:58 -05:00
Mike Gerwitz ab7855bff5 README.hacking: Mention of distdir 2018-02-06 15:46:23 -05:00
Mike Gerwitz 21ed6f940c README.hacking: Tag must come first 2018-02-06 15:22:10 -05:00
Mike Gerwitz 5843801120 README.hacking: Version is auto-generated now 2018-02-06 15:22:10 -05:00
Jeffrey Fisher 9ae544fcbd dapi: Updated correct field index 2018-02-06 15:20:09 -05:00
Mike Gerwitz 54e01628bb Prepare for DOM optimizations
Didn't get any actual work done.
2018-02-06 13:21:39 -05:00