980 Commits

Author SHA1 Message Date
FoxxMD
661a0ae440 Merge branch 'edge' 0.11.2 2022-05-26 09:59:32 -04:00
FoxxMD
d59f1b63d1 chore: Bump version 2022-05-26 09:59:17 -04:00
FoxxMD
7542947029 feat(sentiment): More improvements to sentiment and language processing
* Implement separate language detection functionality
* Clearer/simpler sentiment processing
* Add languageHints to help coerce low confidence language detection
* Add test cases for lang detection, sentiment detection, and sentiment tests
* Fix neutral range -- was not using normalized score range
2022-05-25 12:59:37 -04:00
FoxxMD
2d02434e7e feat(sentiment): Better use of NLPjs and more robust language detection
* Build NLP container ad-hoc so only supported languages are included from npm
* Use vader/wink as heuristics for detecting language when content is very short
* Add languageHint option for sentiment config to make coercing a confident sentiment easier
* Refactor lang processing to fail the sentiment test rather than throwing an error when language is not support/not confident -- provides more insight into outcome
2022-05-24 16:34:37 -04:00
FoxxMD
e2824ea94c chore(docker): Remove superfluous dev packages from final docker layer #88
typeorm depends on ts-node as an *optional peer* dependency -- ts-node can be used in the typeorm cli to parse entities and run migrations.

However CM doesn't use typeorm CLI for running production so its not needed. And ts-node depends on typescript so npm install --production always installs both at about ~30MB.

I couldn't find a good way to remove peer deps ONLY for typeorm so instead just manually remove the folders from the prod install in the final layer of the docker.
2022-05-24 10:31:15 -04:00
FoxxMD
1c94548947 chore: Update TS version and move into dev dependencies
Not needed to actually run the app after it has been built so moving to dev-dependencies
2022-05-24 10:26:46 -04:00
FoxxMD
2073e3f650 chore: Update dependencies 2022-05-24 09:37:59 -04:00
FoxxMD
90b8f481ec chore: Remove unused dependencies #88 2022-05-24 09:33:29 -04:00
FoxxMD
9ad9092e9e feat(dispatch): Fix regression introduced when removing processing state from dispatch action lifecycle
Should have removed entire check for processing but only removed part of if condition, resulting in matched activities never being returned
2022-05-23 14:23:16 -04:00
FoxxMD
12adfe9975 fix(approve): Improve activity type detection and add more result output 2022-05-23 14:22:01 -04:00
FoxxMD
83dceddae8 feat(ui): Simplify live stats by moving into browser logic
* Refactor to use interval in browser to call to api proxy endpoint and get live stats directly instead of using websockets. Generally simplifies things.
* Remove empty/superfluous data from cache stats returned for live data
2022-05-23 14:13:28 -04:00
FoxxMD
99b46cb97f fix(polling): Improve logic for returning only 'new' Activities from polling sources
Prevents CM from iterating through n+1 pages of polling sources (mostly unmoderated) due to a source-of-truth change

See comments for scenario this helps avoid
2022-05-23 12:35:42 -04:00
FoxxMD
3ac07cb3e2 fix(cache): Fix cache init bug caused by passing additional (unnecessary) args 2022-05-23 11:12:51 -04:00
FoxxMD
d7f08d4e27 chore: Remove superagent browser dep 2022-05-19 15:49:32 -04:00
FoxxMD
338f393969 feat(logging): Simplify log streaming logic #91
* Get streamed logs directly from api (through proxy) in browser using streaming apis instead of through client websockets
* Use observer visibility to determine which logs to stream
* Timeout and abort any streaming logs if tab hasn't been visible for more than 15 seconds

TODO streaming system logs
2022-05-19 15:21:41 -04:00
FoxxMD
57e930ca8a feat(logging): Only load logs for initially viewed manager #91
* Don't include any logs in 'status' page response data
* Make log api call from browser to retrieve initial logs based on observer
2022-05-19 13:07:18 -04:00
FoxxMD
af3b917b57 feat(logging): Move log formatting for ui into client #91
* Use browserify to include logform functions and triple-beam symbols in client js
* Implement default log transform function in client js
* Remove formatted message and transport data from non-streaming log data sent to client
2022-05-19 12:11:33 -04:00
FoxxMD
d01bcc53fe fix(resource): Fix throwing the wrong type of error 2022-05-17 15:07:49 -04:00
FoxxMD
e2fe2b4745 feat(resources): Add more try-catch blocks for activity caching to make error tracing easier and reduce change of unhandled promise rejection 2022-05-17 15:01:18 -04:00
FoxxMD
785099b20c fix(database): Add missing managerId to premise entities?
Thought this was added automatically by typeorm by a user's logs seem to think otherwise
2022-05-17 15:00:39 -04:00
FoxxMD
726ceb03d2 fix(delay): Improve delayed activities interaction in manager and fix usage in resources
* Fix missing assignment for filtered activities after removing activity
* Remove 'processing' state from delayed activity lifecycle
  * Allows delayed queue to immediately remove activity after pushing to firehose -- simplifies lifecycle since another function (queue) doesn't have to handle this
    * Removing delayed activity function call from queue logic reduces calls to database
  * Likelihood an activity is cancelled while also processing is small (i hope...)
* Re-order item refresh logic in activity handling so delayed items are fetched before any proxy properties are accessed
* Catch errors on adding delayed activities from DB and just log -- not essential function
2022-05-17 14:18:55 -04:00
FoxxMD
1c37771591 chore: Update version constant 2022-05-17 14:12:17 -04:00
FoxxMD
67aeaea5f1 chore(dispatch): Add id manually to activity proxy when hydrated from database 2022-05-17 13:34:36 -04:00
FoxxMD
a8ac4b8497 fix(manager): Change activity property used to track queue meta
Use 'name' since this should *always* be present on a submission/comment -- when snoowrap creates an empty proxy it only includes 'name'.

* Potentially fixes facet of #64
* Fixes shouldRefresh undefined when activity is from delayed activities in database (empty proxy)
2022-05-17 13:33:37 -04:00
FoxxMD
71571d3672 fix(delay): Reduce delayed activities lifecycle complexity
* Refactor from async while depending on queue state into interval that always runs and just checks paused status of queue -- eliminates need to restart while loop if queue state is not running
* Add canary debug output for delayed activities to be able to know if it is actually running
2022-05-17 12:56:29 -04:00
FoxxMD
2799b6caeb fix(delay): Clean up dispatched action fields and parsing in ui
* Use duration field as SECONDS and remove additional time-based field (not necessary)
* Refactor dayjs usage in UI to parse action delay duration and correctly display "time until dispatch" to show if duration is negative
2022-05-17 12:10:23 -04:00
FoxxMD
e8f94ad1be Merge branch 'sentimentRule' into edge 2022-05-13 10:41:40 -04:00
FoxxMD
05f477b67d Merge branch 'edge' 0.11.0 0.11.1 2022-05-12 12:27:51 -04:00
FoxxMD
9080c7bdf4 Some more docs additions for subreddit state 2022-05-12 12:27:18 -04:00
FoxxMD
d418bf50eb Some cleanup on activity window docs 2022-05-12 12:22:48 -04:00
FoxxMD
5c8e73fee0 docs(activity window): Overhaul activity window docs
* Improve existing documentation with simpler language
* Organize/add table of contents
* Add window lifecycle diagram
* Add documentation for filter/fetch properties #55
2022-05-12 12:07:26 -04:00
FoxxMD
4411d1a413 feat(sentiment): Improve scoring and analysis
* Implement english-only scoring with wink https://github.com/winkjs/wink-sentiment (AFINN, emojis)
* Implement english-only scoring with NLP.js https://github.com/axa-group/nlp.js/blob/master/docs/v3/sentiment-analysis.md (AFINN, Senticon, Pattern)
* Refactor language processing into standalone functions for future use
* Add limited multi-langauge support
  * Can run sentiment with NLP.js on english, german, spanish, and french
* Normalize all scores to range between -1 and +1
* Improve score accuracy by averaging all scores
2022-05-11 16:09:29 -04:00
FoxxMD
c919532aac Merge branch 'edge' into sentimentRule 2022-05-11 12:42:15 -04:00
FoxxMD
676a3917e7 feat(database): Add planned rule/action types to database types
Getting ahead of the curve to avoid requiring migrations when these are released
2022-05-11 12:42:02 -04:00
FoxxMD
522ba33377 feat(rule): Implement sentiment rule using VADER #83 2022-05-11 12:39:23 -04:00
FoxxMD
3a18cc219f refactor(file organization): Move some comparison functionality into own file 2022-05-11 09:36:11 -04:00
FoxxMD
9cb5c4fe38 feat: More improvements for window functionality and dependency cleanup
* Add deprecation warnings to rules when building if properties should be migrated to window
* Add `debug` option to window to increase verbosity of filter logging. Default to false.
* Fix object assigment when building hash key for window filters
* Further cleanup for circular dependencies by moving some filter and logging functions into respective files
2022-05-10 12:49:56 -04:00
FoxxMD
57700b5e76 chore: Add nvmrc 2022-05-10 12:46:08 -04:00
FoxxMD
52ae16be1c refactor: Reduce circular dependencies 2022-05-09 20:12:08 -04:00
FoxxMD
951fab1070 docs: Add deprecation notices to window-related filters on rules 2022-05-09 16:23:01 -04:00
FoxxMD
0fd57af67e feat(window): More improvements for new window usage and caching
* Fix list function passed from author activities convenience method
* Move author history caching into main activity fetching function
* Do a better job at rehydrating snoowrap objects from cache data -- set as fetched, substitute relationships for non-fetching objects, and remove listing related objects
* Cache key for results based on window and pre-filter only -- post filter can be done after fetching cached results (Should save api calls!)
2022-05-09 15:34:19 -04:00
FoxxMD
3ad5b26be6 fix(ts): Fix TS issue with typings in same folder as regular files preventing schema generation
* Rename interface/types folder
* Move typigns back into folder with same name
2022-05-09 11:09:33 -04:00
FoxxMD
d20c2becc8 feat(window): Refactor window to support subreddit and item filtering, everywhere
* Move some interfaces and types into own files to breakup huge interfaces file
* Refactor window shape for config and "full" usage in app to support subreddit/item filtering
* Refactor author activities into resources class so we can take advantage of caching on subreddit/item filter results
2022-05-09 11:04:08 -04:00
FoxxMD
002bedf4b8 feat: Rebase in old subreddit window filter improvement
* subreddit filtering on window can now use include or exclude
* subreddit resources uses batch/cache retrieval
* temp fix to keep string subreddit name parity check in recent activity self inclusion logic
2022-05-05 23:03:18 -04:00
FoxxMD
11d32de9c5 chore: Bump dependencies for security fixes 2022-05-05 12:42:13 -04:00
FoxxMD
50303dfeb0 fix: Fix dryRun state handling for dispatched actions
Fixes scenario where a dispatched activity does not inherit DR state from currently processing activity

* Add dryrun state to dispatch activity data in app and database
  * Use general DR state for dispatched activity rather than DR for dispatched action
* Defer to explicitly defined DR in Task data when manager/queue handles task
2022-05-05 10:13:21 -04:00
FoxxMD
9b15c88547 fix: Handle more use cases when user is suspended, deleted, or shadowbanned
* Implement a "not serious" property for these errors so we don't report as an error to manager since they not an actual problem with the api or CM
* Check for [deleted] user name before trying to fetch an author
2022-05-04 12:57:16 -04:00
FoxxMD
4042305f49 fix: Fix rule result rendering when rule name is null 2022-05-04 12:02:48 -04:00
FoxxMD
ea9a867b3a fix: Handle scenario where author is suspended
* Throw friendly error when fetching activities
* Fail author criteria that are not present if author is suspended
2022-05-04 11:56:50 -04:00
FoxxMD
ff2415b024 docs: Add more links to main readme 2022-04-27 10:15:40 -04:00