Compare commits

...
371 Commits
Author SHA1 Message Date
871d3f80c1 [CORL-1230] corrects logic for editing comments with media attachments (#3063)
* correctly attach media to edited comments

* ensure media can be removed in edits

* fix: updates to support repeat post

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-07-31 18:03:54 +00:00
Wyatt Johnson f7d01174d7 fix: fixed overflow scrollbar appearing in dropdown (#3062) 2020-07-31 13:30:08 -04:00
Nick Funk 6966bb8d12 Replace positive/negative naming for success/error (#3058)
CORL-1200
2020-07-31 15:40:48 +00:00
Tessa Thornton 40ad2ed0cb remove hook causing crash from conversation modal replies (#3057) 2020-07-31 14:37:05 +00:00
802f656caa Stream UI bugfixes (#3041)
* fix: various ui fixes

* fix: tooltip button active color

* fix: teal color

* fix: RTE borders

* fix: snapshots

* fix: reduce padding of show more of this conversation button

* Fix font weight fallback values

* Replace RTE validation messages with v3 CallOuts

CORL-1213

* More styling classnames

* chore: remove not used style

* fix: reaction button primary color

* fix snapshots

* harmonize data-variant on buttons

* [CORL-1215] Install Style Tweaks (#3046)

* fix logic around repeat posts with or without media embeds: (#3042)

* fix: restore ReportCommentEvent (#3037)

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>

* fix: fixed issue with graphiql (#3043)

* README.md Update (#3045)

* chore: update README.md

* fix: removed README from doctoc

* fix: replaced emoji codes with emjoi

* fix: removed emoji's due to browser rendering issues

* fix: fixed bugs with install styles

Co-authored-by: Tessa Thornton <tessathornton@gmail.com>
Co-authored-by: Vinh <vinh@vinh.tech>

* fix: remove lineheight css variables and make them relative

* fix: adjust line-heights

* fix: update snapshots

* More css bindings for client styling

Set bindable class on community guidelines
Set bindable classname on "Comment on" label

* fix: more tweaks

* fix: snapshots

* fix: lint and tests

Co-authored-by: nick-funk <nick.funk@outlook.com>
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
Co-authored-by: Tessa Thornton <tessathornton@gmail.com>
2020-07-31 00:19:59 +02:00
dfdea2b9d2 [CORL-1150] Discussions Tab (#3050)
* feat: Added Site.topStories edge

* feat: Added User.ongoingDiscussions edge

* connect discussions tab to relay

* style discussions tab

* add message if no ongoing discussions

* style site name in story row

* fix: make line-heights relative

* add custom class hooks

* feat: condition display based on feature flag

* add target attribute to story links

* fix: expose some featureFlags

* fix: fixed sorting

* fix: copy fixes

Co-authored-by: tessalt <tessathornton@gmail.com>
Co-authored-by: Chi Vinh Le <vinh@vinh.tech>
2020-07-30 17:18:59 -04:00
Wyatt Johnson 9a9c92d360 Site Moderator Fixes (#3054)
* fix: disable banning for site moderators

* fix: fixed redirect issue for site moderators
2020-07-30 16:04:28 +00:00
ceadcc7ae1 fix warning about media key in tests (#3048)
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-07-29 23:29:51 +00:00
Kim GardnerandWyatt Johnson e0db803a21 Bump version 6.3.1 (#3053)
* Bump version 6.3.1

* chore: bump version in package-lock.json

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-07-29 19:12:05 -04:00
Tessa ThorntonandWyatt Johnson 7a099bbf05 don't save clientMutationId when creating announcement (#3049)
* don't save clientMutationId when creating announcement

* move mutationId filtering from resolver to mutation

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-07-29 21:38:12 +00:00
Wyatt Johnson 51112a11c0 [CORL-1219] Media Type Fixes (#3051)
* fix: better graphql types

* fix: fixed tests

* fix: fixed tests
2020-07-29 21:11:53 +00:00
Wyatt Johnson 6e50b28d8b [CORL-1149] Active Stories (#3040)
* fix: removed type assertions in place of stricter types

* fix: fixed bug with module ordering

* feat: support for story activity jsonp route
2020-07-28 16:34:05 +00:00
Tessa Thornton 1f72cdbfb3 ensure preloaded css is actually used (#3047) 2020-07-28 08:42:39 -04:00
Wyatt Johnson 87aba459d6 README.md Update (#3045)
* chore: update README.md

* fix: removed README from doctoc

* fix: replaced emoji codes with emjoi

* fix: removed emoji's due to browser rendering issues
2020-07-24 19:06:33 +00:00
Wyatt Johnson 9aa4591655 fix: fixed issue with graphiql (#3043) 2020-07-24 17:19:08 +00:00
VinhandWyatt Johnson 87d32680f0 fix: restore ReportCommentEvent (#3037)
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-07-24 16:48:02 +00:00
Tessa Thornton 25a1dcdf8d fix logic around repeat posts with or without media embeds: (#3042) 2020-07-23 15:36:08 -06:00
Tessa ThorntonandWyatt Johnson e90272aa58 remove debug style from comment stream (#3038)
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-07-22 23:32:27 +00:00
Tessa ThorntonandWyatt Johnson bbbff98270 pass custom stream css url through to html (#3039)
* pass custom stream css url through to html

* rename streamcssURL to customCSSURL

* only enable custom css query on stream route

* Update src/core/server/app/router/client.ts

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>

* simplify template for client html

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-07-22 18:57:47 +00:00
Nick Funkandkodiakhq[bot] fe19ffd7e1 Show nice error message on network time out (#3036)
Shows "Network error. Please refresh your page
and try again." when the retry middleware times
out from too many attempts on failed/timed out
requests.

CORL-1199

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-22 00:02:27 +00:00
Nick Funk 7f98f13990 Send staff comments to Slack with all comments enabled (#3035)
When we set up a Slack channel, you can select to have
"All comments" sent to the slack channel. If we do this
we want staff comments to come through as well.

This wasn't happening before because there is a `staffCreated`
flag instead of `created` when a staff member comments.

So we change the trigger return type to an array, and when
a staff comment appears, return `staffCreated` as well as
`created` so the all filter lets it through.

I also changed `getBlocks(...)` to `getContent(...)` as it
now returns a JSON object with both a `blocks` array and a
`text` string field. This fixes the problem where Slack would
notifications would say "this content cannot be displayed".
Now it will say the text provided.

CORL-1172
2020-07-21 18:01:38 +00:00
Nick Funk 1a9bd27236 Implement TODO for rejected message when replying (#3034)
Implements the proper callout for when a user
submits a comment with a banned word when replying
to another comment.

CORL-1191
2020-07-20 16:44:49 +00:00
dependabot[bot] 536e804d61 chore(deps): bump lodash from 4.17.15 to 4.17.19 (#3033)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-20 14:53:21 +00:00
Tessa Thorntonandkodiakhq[bot] 43d5d56c90 correct dashboard spacing (#3032)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-17 18:53:48 +00:00
Tessa Thorntonandkodiakhq[bot] cdcc991255 [CORL-1195] Fix bug with displaying site dashboards (#3031)
* fix bug where dashboard would not display data for sites beyond first page of results

* remove unused param

* remove unused file

* undo rename

* rename selectedSite to site

* check that sites.edges.length is greater than 0

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-17 17:25:19 +00:00
Tessa Thornton b221baff82 [CORL-1194] correct typo in config (#3030)
* correct typo in config

* update snap
2020-07-17 15:14:52 +00:00
Wyatt Johnsonandkodiakhq[bot] 5b589bfe2b [CORL-1180] Moderation + Editing Improvements (#3020)
* fix: handle moderating edited comments better

* fix: add back deleted audit trail entry

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-16 19:59:51 +00:00
Wyatt Johnsonandkodiakhq[bot] 4f5c0e285c [CORL-1192] Reduced Security Mode (#3027)
* feat: add support for disabling persisted query requirements

* fix: fixed type errors

* fix: rename flag

* fix: fixed logic around validation

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-16 19:34:16 +00:00
Tessa Thorntonandkodiakhq[bot] f26ab60398 [CORL-1185] translate error from iframe embeds (#3026)
* translate error from iframe embeds

* use transtlate function for iframe error message

* fix import order

* Fix typo in translation key

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-16 18:45:03 +00:00
Tessa Thorntonandkodiakhq[bot] e7f395190d [CORL-1183] Fix edit comment form (#3022)
* Fix edit comment form

* clean up editcomment stack for media attachments

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-16 18:29:05 +00:00
Tessa Thorntonandkodiakhq[bot] ace252eb72 continue polling for twitter iframe height longer (#3023)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-16 18:14:14 +00:00
Tessa Thorntonandkodiakhq[bot] 933d82e7c9 use padding-bottom trick to make giphy mp4s responsive (#3024)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-16 17:59:09 +00:00
Wyatt Johnsonandkodiakhq[bot] 6e64e6a01c fix: fixed bug with select dropdown (#3021)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-16 17:45:47 +00:00
Nick Funkandkodiakhq[bot] bb48e1fe33 Tweak up indent level padding/margins (#3025)
CORL-1186

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-16 17:31:55 +00:00
Nick Funkandkodiakhq[bot] 58a91c2e42 Replace Dashboard - staff comments icon (#3028)
The badge icon was removed from material fonts.
There are several icons in this category that are
in flux on material's site. Lets keep a close eye
on this as it could mean other icons stop working
in future as well.

CORL-1184

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-07-16 17:18:07 +00:00
Nick Funk 6a5a18e3a4 Enforce max width on mod card embeds (#3019)
Some gifs are too wide for the mod cards. Set
a max-width and force it on the media/iframe
so that it doesn't push out mod card controls.

CORL-1179
2020-07-16 16:18:02 +00:00
Wyatt Johnson d43fbe357a fix: add 'self' to the frame-ancestors directive (#3018) 2020-07-15 18:47:07 +00:00
Nick FunkandChi Vinh Le 5c863f1307 [CORL-1155] Fix theming for rebranded stream/admin (#3012)
* Repair theming and CSS variables for the rebrand

This separates the CSS variables into three sections
for admin, stream, as well as a shared set between
them.

This also adds injection of the raw colours from the
design team into post css variables.

Lastly, this re-maps the existing theme variables to
a new consolidated set with fallbacks for compatibility.

Since this is a singular commit from various WIP commits,
I am crediting @cvle as well as myself for this work.

Thank you all who helped make this rebrand with theming
possible!

CORL-1155

Co-authored-by: Chi Vinh Le <vinh@vinh.tech>

* Convert old css variables in CallOut

* Rename postive/negative => success/error

CORL-1155

* Change some CSS Variable names

* fix TextField/PasswordField colors

Co-authored-by: Chi Vinh Le <vinh@vinh.tech>
2020-07-15 18:20:25 +00:00
Tessa ThorntonandWyatt Johnson d4cb9cde9b [CORL-1174] Set height on iframe embeds in moderate cards (#3017)
* set height on iframe embeds in moderate cards

* fix: removed stripTags from server code

Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
2020-07-15 14:58:24 +00:00
c59c345756 [CORL-1108] Media Embeds (#3010)
* Create Twitter and YouTube embed components

Uses the `/api/oembed` endpoint to proxy the
oembed requests that the embed components drop
into an iframe.

CORL-1012

* Create preliminary embed link parsing/storage

CORL-1012

* Create preliminary embed section on comments

CORL-1012

* Preliminarily add admin embed config options

CORL-1012

* Show a "missing" message when embed is unavailable

CORL-1012

* Simplify naming of embeds in schema

embedLinks -> embed

CORL-1012

* Rename oEmbedHandler to oembedHandler

CORL-1012

* add backend services for giphy

* search gifs on frontend

* display selected gif

* show gif previews

* display giphy attribution and no results text

* save a gif to a comment

* use embeds feature for gif embeds

* clean up gif/video/tweet display

* style and configure post comment form

* preview and confirm twitter and youtube embeds

* moderate embeds on server

* update reply and edit forms

* update snaps

* fix some of the tests

* fix tests and types

* fix tests

* fix types

* show gifs in moderate cards

* correctly attach embeds to comments

* make gif rating configurable

* make gif rating configurable

* configure giphy api key

* refactor comment form

* only allow embeds if settings enabled

* scale youtube

* resize embeds if necessary

* make tweets and videos responsive

* set maxwidth on tweet embeds

* update copy for embed config

* force gif search results to fit container

* prevent double posting of gifs

* undo hiding html if empmty because now it doesn't contain random break tags

* use downsampled preview images

* update fixtures and snapshots

* remove unused css

* add i18n string

* remove console logs

* Fix styles on logged-out comment form

* click to pause gif in moderation

* style youtube and twitter embeds in mod stream"

* use mp4s for stream gifs

* use mp4 for moderation gifs

* clean up commentform

* fix dom tests

* update rte

* import oembed module with correct casing

* bump rte

* add correct return type for setInterval

* add migration for embeds config

* catch errors from gif search

* return early from iframe container size calculation if width and height are set

* remove unused classnames

* make giphy api key protected

* reorganize tenant embed settings schema

* update schema on backend to support single comment embed instead of array

* move findEmbedLinks to common

* wrap error

* return function for linkify instead of ternary

* remove unused url param

* clean up oembed service

* remove conditional in repeat post check

* use joi to validate giphy responses

* fix types for embeds

* fix optimistic responses

* move attachEmbeds function

* update snapshots

* fix: improved repeatPost checking

* force case change on oembed

* force rename file name

* feat: Rename Embed -> Media

* fix: cleanup of service functions

* fix: moved types

* fix: fixed logic bug

* fix: fixed translation

* show embeds on history comments

* fix: fixed iframe csp and query param bug

* correct validation for twitter oembed

* feat: save youtube still

* fix: typeerror

* fix: fixed errors related to final form

* fix: fixed issue with types

* fix: added docs to the schema

* fix: linting + tests

Co-authored-by: nick-funk <nick.funk@outlook.com>
Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
2020-07-15 02:16:06 +00:00
Wyatt Johnson f8234e53ed fix: added Other as flagging reason to ui (#3014) 2020-07-13 22:23:54 +00:00
Wyatt Johnson 7b2cdbad49 [CORL-1134] Site Moderators (#2995)
* feat: added server support for site moderators

* feat: added unscoped property to @auth directive

* feat: added frontend support for site moderator feature

* feat: added site moderator support to stream

* fix: linting

* fix: updated snapshots
2020-07-13 18:19:22 +00:00
Wyatt Johnson 00e074d49d fix: increased body size limit, added config option (#3011) 2020-07-09 22:02:01 +00:00
Natalie StroudandNatalie Stroud d848fc193e Fixed Spanish translation typo (#3008)
* Changed Envira to Enviar

* Changed Envira to Enviar

Co-authored-by: Natalie Stroud <stroudn1@nku.edu>
2020-06-30 01:48:24 +00:00
Vinhandkodiakhq[bot] 2acc761a5d [CORL-1074] Upgrade dependencies (#2999)
* chore: upgrade eslint, typescript

* chore: upgrade deps

* chore: revert upgrade ts-node-dev

* chore: revert unneeded comments

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-26 22:38:52 +00:00
Wyatt Johnsonandkodiakhq[bot] 0db5bc846d fix: use [contenthash] for more consistancy (#3002)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-26 22:09:23 +00:00
Wyatt Johnsonandkodiakhq[bot] e57940c418 fix: fixed usernames not displaying (#3005)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-26 21:51:13 +00:00
Wyatt Johnsonandkodiakhq[bot] ccb8f1defa fix: fixed anchor link for view conversation (#3006)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-06-26 21:36:10 +00:00
Wyatt Johnson 878c3bb3c0 fix: updated copy to reflect data (#3007) 2020-06-26 21:20:10 +00:00
Wyatt Johnson 86c81c7b9f feat: added kodiak config (#3003) 2020-06-26 19:47:25 +00:00
Wyatt Johnson 302613a185 Merge branch 'release/6.2' 2020-06-25 13:08:56 -06:00
Wyatt Johnson bf04b4c2a6 [CORL-1156] Q&A Feature Flag Fix (#3000)
* fix: fixed bug with feature flag handling

* chore: version bump
2020-06-25 18:59:03 +00:00
Wyatt Johnson f3ef9ef778 Replace nodemailer with emailjs (#2983)
* chore: replace nodemailer with emailjs

* fix: bumped version
2020-06-24 22:24:37 +00:00
Wyatt Johnson db8c9de0e7 Bump 6.3.0 (#2996)
* chore: bump version 6.3.0

* chore: upgrade mongodb
2020-06-23 17:05:00 +00:00
VinhandWyatt Johnson f2bf026740 [CORL-1129] Form initialization and reset bug (#2991)
* fix: form initialization and reset bug

* fix: test

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-06-22 23:39:07 +00:00
Wyatt Johnson 625c38a758 Merge branch 'release/6.2' 2020-06-22 10:35:23 -06:00
Wyatt Johnson 9022532525 [CORL-1148] Chrome Local Storage Issues (#2994)
* fix: moved storage access inside try/catch

* chore: version bump
2020-06-22 16:29:06 +00:00
Nick Funk caa4895b97 Clear session token on tenant install (#2990)
CORL-1122
2020-06-16 21:24:00 +00:00
dependabot[bot]andWyatt Johnson d1ee7d39f3 chore(deps): bump apollo-server-express from 2.11.0 to 2.14.2 (#2977)
* chore(deps): bump apollo-server-express from 2.11.0 to 2.14.2

Bumps [apollo-server-express](https://github.com/apollographql/apollo-server) from 2.11.0 to 2.14.2.
- [Release notes](https://github.com/apollographql/apollo-server/releases)
- [Changelog](https://github.com/apollographql/apollo-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/apollographql/apollo-server/compare/apollo-server-express@2.11.0...apollo-server-express@2.14.2)

Signed-off-by: dependabot[bot] <support@github.com>

* fix: adapted for module upgrade

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
2020-06-16 14:59:09 +00:00
feaf4858df [CORL-1126] Run regex in a sandbox so it can time out (#2988)
* Run regex in a sandbox so it can time out

If it times out, we flag it and system withhold
it for future analysis.

CORL-1126

* Pass regex and test string into wordList sandbox

Allows us to use the pre-cached regex instead of
regenerating it via an in-line script copy.

CORL-1126

* feat: improve script reuse

* fix: renamed some functions

* fix: improve script performance

* feat: added testString to log output if it times out

* fix: fixed issue with form alert not showing

* fix: use a timeout from config

Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-06-12 18:09:37 +00:00
ebe7731222 Stream Rebranding (#2926)
* [CORL-901] Rebrand comment actions and body (#2889)

* [ADR] Use Relay over Apollo (#2881)

* chore: ADR on Relay and Apollo

* chore: typo

* chore: add neg cons

* chore: add another pos

* chore: remove neg, because apollo needed an introspection query as a build step too..

* chore: fix number

* chore: deco

* chore: typo

* chore: clarification

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>

* chore: bump 6.0.0 (#2891)

* fix: added more checks to migration (#2894)

* Update stream username to new branding variables

CORL-901

* Update badges/tags to use new v2 controls

CORL-901

* Update timestamps to use new branding stream side

CORL-901

* Update stream edit action to new branding

CORL-901

* Update comment html body to new branding

CORL-901

* Update comment action buttons to new branding

CORL-901

* Update responsive styles for action buttons

CORL-901

* Set comment link colors to new branding blue

CORL-901

* Add children prop on ButtonsBar to align with tests

CORL-901

* Make Reported button text bolded and vivid red

CORL-901

* Make reaction buttons stream blue when reacted

CORL-901

* Make user badges bold text

CORL-901

* Set margins on comment action buttons

CORL-901

* Set aria-labels on reaction buttons

Ensures that we always have a usable aria
even when the reaction button is just an icon.

CORL-901

* Set aria-label's on Reply and Share button's

CORL-901

* Update tests to match stream branding changes

CORL-901

* Update color of "Read More of this conversation"

CORL-901

Co-authored-by: Vinh <vinh@vinh.tech>
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>

* [CORL-942] In-Stream Mod rebranding (#2902)

* [ADR] Use Relay over Apollo (#2881)

* chore: ADR on Relay and Apollo

* chore: typo

* chore: add neg cons

* chore: add another pos

* chore: remove neg, because apollo needed an introspection query as a build step too..

* chore: fix number

* chore: deco

* chore: typo

* chore: clarification

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>

* chore: bump 6.0.0 (#2891)

* fix: added more checks to migration (#2894)

* Update stream username to new branding variables

CORL-901

* Update badges/tags to use new v2 controls

CORL-901

* Update timestamps to use new branding stream side

CORL-901

* Update stream edit action to new branding

CORL-901

* Update comment html body to new branding

CORL-901

* Update comment action buttons to new branding

CORL-901

* Update responsive styles for action buttons

CORL-901

* Set comment link colors to new branding blue

CORL-901

* Add children prop on ButtonsBar to align with tests

CORL-901

* Make Reported button text bolded and vivid red

CORL-901

* Make reaction buttons stream blue when reacted

CORL-901

* Make user badges bold text

CORL-901

* Set margins on comment action buttons

CORL-901

* Set aria-labels on reaction buttons

Ensures that we always have a usable aria
even when the reaction button is just an icon.

CORL-901

* Set aria-label's on Reply and Share button's

CORL-901

* Update tests to match stream branding changes

CORL-901

* Update color of "Read More of this conversation"

CORL-901

* Update caret container to new branding

CORL-942

* Update moderation menu buttons to new branding

CORL-942

* Update in-stream ban popover to new branding

CORL-942

* Update reject tombstone to new branding

CORL-942

Co-authored-by: Vinh <vinh@vinh.tech>
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>

* [CORL-939] Rebrand RTE and reply (#2904)

* [ADR] Use Relay over Apollo (#2881)

* chore: ADR on Relay and Apollo

* chore: typo

* chore: add neg cons

* chore: add another pos

* chore: remove neg, because apollo needed an introspection query as a build step too..

* chore: fix number

* chore: deco

* chore: typo

* chore: clarification

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>

* chore: bump 6.0.0 (#2891)

* fix: added more checks to migration (#2894)

* Update stream username to new branding variables

CORL-901

* Update badges/tags to use new v2 controls

CORL-901

* Update timestamps to use new branding stream side

CORL-901

* Update stream edit action to new branding

CORL-901

* Update comment html body to new branding

CORL-901

* Update comment action buttons to new branding

CORL-901

* Update responsive styles for action buttons

CORL-901

* Set comment link colors to new branding blue

CORL-901

* Add children prop on ButtonsBar to align with tests

CORL-901

* Make Reported button text bolded and vivid red

CORL-901

* Make reaction buttons stream blue when reacted

CORL-901

* Make user badges bold text

CORL-901

* Set margins on comment action buttons

CORL-901

* Set aria-labels on reaction buttons

Ensures that we always have a usable aria
even when the reaction button is just an icon.

CORL-901

* Set aria-label's on Reply and Share button's

CORL-901

* Update tests to match stream branding changes

CORL-901

* Update color of "Read More of this conversation"

CORL-901

* Update caret container to new branding

CORL-942

* Update moderation menu buttons to new branding

CORL-942

* Update in-stream ban popover to new branding

CORL-942

* Update reject tombstone to new branding

CORL-942

* Update replyTo and rte to new branding

CORL-939

Co-authored-by: Vinh <vinh@vinh.tech>
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>

* Update message box to new branding

CORL-981

* Update user profile comment history to new branding

CORL-983

* Update stream tabs to new branding

CORL-982

* Update my profile tab bar to new branding

CORL-902

* Update download comments to new branding

CORL-902

* The Lord of the Buttons: Return of the Buttons

* Update the notification settings area to new branding

CORL-984

* Update the ignored users area to new branding

CORL-984

* Update change username to new branding

CORL-984

* Fixing snaps after rebase

* Use label instead of div for InputLabel's

Root element is now a label so that axe
will stop complaining that it can't find
the 'for' id on the label elements.

CORL-984

* More spacing tweaks for change username

CORL-903

* Update change email address to new branding

CORL-984

* Update change password to new branding

CORL-984

* Flesh out colour styles for v3 buttons

CORL-984

* Preliminarily update delete account to new branding

CORL-984

* Ensure client CSS style compatibility

CORL-984

* Update delete flow to new branding

CORL-984

* Add client classes to the delete account modal

CORL-984

* Further tweaks to the delete account modal

Modal callouts updated to new branding.
Deletion request callout updated to new
branding.
Fixing up tests that somehow were passing
before?
Fixing some margins and spacing around
deletion section.

* Move the account deletion callout to top

Puts it at the top of the my profile tab
so that it's clearly visible you are
deleting your account.

CORL-998

* Add first-class icon and title support to callouts

CORL-969

* Bold checkbox text when checked

CORL-984

* Finalize v3 buttons to match spec

This should be the last major change to
v3 buttons as the spec seems to have
solidified.

CORL-969

* Add in new stream red to colours

Use it for the negative v3 callouts

CORL-969

* Touch up some spacing on delete account

CORL-984

* Create tombstone component

Use it for ignored and deleted account
tombstones instead of the old callout.

CORL-969

* Use new tombstones in comment stream

CORL-969

* Update banned callout to new branding

CORL-969

* Set callout body text to regular font weight

CORL-969

* Update suspended callout to new branding

CORL-969

* Update closed stream callouts to new branding

CORL-969

* Update in-moderation callouts to new branding

CORL-969

* Update stream validation message to v3

CORL-969

* Improve ignored commenter management

Show "you are no longer ignoring" a
commenter when you choose to no longer
ignore them.

CORL-457

* Prettier cleanup after rebase off master

Somehow this was missed, probably needed to
kill and reload VSCode before I committed the
rebase.

* Switch previous callouts to use icon and title

CORL-969

* Update configure checkboxes to new branding

CORL-903

* Update Config > Q&A to new branding

CORL-903

* Update Config > Open/Close Stream to new branding

CORL-903

* Add validation message to config stream checkboxes

CORL-903

* Remove double list handling for Pref>Ignored

CORL-969

* Show experimental tag beside Q&A config

CORL-1051

* Move live update setting to its own section

CORL-903

* Remove moderation link from config area

CORL-903

* De-capitalize all the labels in configure

CORL-903

* Update message box config to new branding

Also moves it to new location in config.

CORL-903

* Re-brand the sign in/out field on the stream

CORL-1042

* Update tests for add message flow

CORl-903

* Rebrand Sign In/Up modals

CORL-999

* Re-brand SSO sign in/up modals

CORL-999

* Re-brand stream sorting controls

CORL-1043

* Create new stream focused colorFromMeta variant

* Rebrand go to moderation buttons

CORL-799

* Rebrand stream moderation drop-down

CORL-799

* Rebrand the report comment flow

Expands the report comment dialogs under
the comment instead of as a popover.
Also adds in the new branding styles.

CORL-941

* Rebrand the main stream tab bar

CORL-799

* Add new abusive reporting options

CORL-1009

* Rebrand featured comments

CORL-968

* Rebrand the community guidelines

CORL-1041

* Rebrand the share button

CORL-940

* Update style names on buttons

marginSize -> paddingSize
textSize -> fontSize

* Rebrand single conversation view

CORL-904

* Make indented comments grey coloured

CORL-904

* Make indented comment borders thinner

CORL-904

* Tweak colours/margins on single conversation view

CORL-904

* Add show comment on single conversation tombstones

CORL-412

* Rebrand single conversation view title

CORL-904

* Add clean target to package.json

Allows us to direct call gulp clean easily.

* Rebrand client side not found page

CORL-1025

* Rebrand password reset flow

CORL-1025

* Rebrand unsubscribe from notifications flow

CORL-1025

* Rebrand email confirmation flow

CORL-1025

* Rebrand download comments flow

CORL-1025

* Fix up account tests after rebrand

CORL-1025

* Add COMMENT_REPORTED_ABUSIVE to moderate card fragment

* Rebrand user ignore flow

Somehow this slipped through the cracks, fixed
it up now

* [CORL 1010] Collapse comment threads (#2976)

* toggle open and closed comment + replies

* show username and date for collapsed comment

* toggle comments and replies open and closed

* keep collapsed state of comments in reply list

* style collapsed comment toggle

* add css class overrides

* style answered comments when collapsed

* adjust spacing on collapse button:

* add hover styles

* add aria labels and update snapshots

* Fix tests and snaps after rebase

* Make main stream tabs visible on mobile (iPhone 5)

* Remove double horizontal rule under My Comments

Horizontal rule wasn't conditionally showing
when we toggled ability to let users download
comments on and off.

* Add aria labelling to main stream tabs

Can now pass in a localization id to assign
aria-label/title to the tab.

* Add localization to account not found

* Update snapshots

Co-authored-by: Vinh <vinh@vinh.tech>
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
Co-authored-by: Tessa Thornton <tessathornton@gmail.com>
2020-06-12 09:23:28 -06:00
Tessa ThorntonandWyatt Johnson 8966dad344 [CORL-1016] Admin Dashboard (#2942)
* count things in redis

* add rest routes for daily comment totals

* add route for new commenters

* retrieve hourly totals for new commenters and comments

* add rate limiting

* add routes and components for dashboard

* add top stories component

* add activity charts

* clean up rest responses

* style dashboard components

* make dashboard site-aware

* change new commenters to new signups

* generate new signups by day chart

* update status pie chart

* update status pie chart

* allow site selection in dashboard

* cache daily signups

* count user bans in redis

* clean up route and method names

* clean up comment statuses chart and change from pie to bar

* fix package lock

* make daily counts time zone aware

* count rejected comments

* clean up today counts

* count comments from site

* store hourly keys in utc

* show daily user signups

* move siteID from params to query params

* add average line for daily comments chart

* make average comments count hourly

* show percent values for rejected comments

* style dashboard

* simplify dashboard rest routes

* style today totals and top stories

* style signup and comment activity chart

* add site selector to nav

* feat: redis/mongo refactor

* fix: some small tweaks

- Added comments to magic numbers
- Added errors for missing input
- Consolidated promise resolutions

* Revert "add site selector to nav"

This reverts commit 1c2b1dee34fb2742b04932079fd45f7f3de98418.

* show first site dashboard by default

* style dashboard site switcher

* updte snapshot

* add dashboard 118n keys

* udpate comment activiyt chart with legend and tooltip

* implement refresh button and loading states

* change colours of charts for today

* adjust today values spacing

* remove unused package

* don't pass redis into oauth strat

* remove unused package

* Revert "remove unused package"

This reverts commit 5b7c83a072604810ce7097865655e9ef8114d9e0.

* fix merge conflicts

* Fix icons bug on smaller screens

* resolve merge conflict

Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
2020-06-12 10:39:28 -04:00
Wyatt Johnson 4179306cd0 fix: fixed naming of config (#2980) 2020-06-12 05:22:23 +00:00
dependabot[bot] 2c0153047e chore(deps): bump graphql-playground-html from 1.6.13 to 1.6.22 (#2984)
Bumps [graphql-playground-html](https://github.com/graphcool/graphql-playground) from 1.6.13 to 1.6.22.
- [Release notes](https://github.com/graphcool/graphql-playground/releases)
- [Commits](https://github.com/graphcool/graphql-playground/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-11 22:28:43 +00:00
Wyatt Johnson 21cd47f6ed [CORL-1077] Rudderstack Integration (#2987)
* feat: added rudderstack support with events

- Added events for
  - Comment Moderated
  - Comment Created
  - Story Created
  - Comment Reaction Created
  - User Flagged Comment

* fix: added logging to event tracking
2020-06-11 22:10:52 +00:00
Nick Funk 2f03b788a4 [CORL-1121] Remove username validation when updated by admin (#2986)
* Use SSO validation for updateUserUsername

CORL-1121

* Remove validation on admin-only user rename

We don't need to validate the user-name as
only admin's will be using this mutator. If
they're updating things incorrectly, that's
up to them to manage with this flow.

CORL-1121
2020-06-10 19:36:56 -04:00
Wyatt Johnson c19f4a35ca Merge branch 'release/6.2' 2020-06-08 17:31:32 -06:00
Wyatt Johnson 0fa27ae41b chore: bump version 2020-06-08 17:30:39 -06:00
Wyatt Johnson 0065875f12 fix: ensure access token is null not undefined (#2981) 2020-06-08 23:28:07 +00:00
dependabot[bot] b39af1f7e6 chore(deps): bump websocket-extensions from 0.1.3 to 0.1.4 (#2979)
Bumps [websocket-extensions](https://github.com/faye/websocket-extensions-node) from 0.1.3 to 0.1.4.
- [Release notes](https://github.com/faye/websocket-extensions-node/releases)
- [Changelog](https://github.com/faye/websocket-extensions-node/blob/master/CHANGELOG.md)
- [Commits](https://github.com/faye/websocket-extensions-node/compare/0.1.3...0.1.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-08 14:42:47 -06:00
Tessa Thornton a949d7e881 [CORL 1031] Story actions (#2975)
* add story actions dropdown with rescrape button

* move open/close story mutation to story actions dropdown

* remove unused props

* fix tests
2020-06-08 14:14:22 -06:00
Wyatt Johnson eee909f05b feat: removed throng and cluster support (#2961) 2020-06-08 13:47:23 -06:00
Vinh 72e1b249b1 [CORL-1029] Better HTML Support (#2956)
* feat: Improve html handling, integrate new @coralproject/rte

* chore: refactor and add comments

* chore: remove obsolete line

* chore: rename `inputId` to `inputID`

* chore: upgrade @coralproject/rte

* fix: update snapshots

* chore: apply review suggestions

* fix: snapshot / tests

* fix: merge issues

* [CORL-1056] Configurable RTE (#2967)

* fix: merge issues

* feat: Configure RTE

* test: add tests

* chore: just a comment

* chore: remove unused translations
2020-06-08 13:24:38 -06:00
Wyatt Johnson ba08447d5e [CORL-1090] Sections Alpha (#2973)
* feat: added section filtering support

* fix: addressed issues around filtering sections

* fix: fixed issue with section filter
2020-06-04 13:32:04 +02:00
Wyatt JohnsonandKim Gardner 92c72f7041 fix: replace insert with push for slack channels (#2965)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-06-01 21:23:15 +00:00
Wyatt JohnsonandKim Gardner 08a9788bcc fix: fixed error with method bindings on strategies (#2971)
- moved request bindings to after the cache handler

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-06-01 17:10:42 -04:00
VinhandWyatt Johnson 3e0241b523 feat: add SignedOutEvent (#2968)
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-06-01 14:11:45 -04:00
Vinh fe8cb90a1c [CORL-1086] Support bodyClassName in embed (#2969)
* feat: support embed config `bodyClassName`

* chore: add comment
2020-05-21 22:27:27 +00:00
Wyatt Johnson 74366bec55 [CORL-1046] Slack Helper Text Fix (#2959)
* fix: moved helper text

* chore: version bump

* chore: update description to match github
2020-05-15 18:28:15 +00:00
Wyatt Johnson ed92f4916d [CORL-810] Custom Moderation Phases (#2901)
* feat: initial implementation

* feat: renamed fields from mutations

* fix: more renaming to streamline {Key,Secret}->SigningSecret

* feat: introduced WrappedInternalError

* feat: enhanced extern payload, more fetch options

- Added tenant.{id,domain} to extern payload
- Added site.id to the extern payload
- Added response size limit to fetch
- Added new SCRAPE_MAX_RESPONSE_SIZE env var for managing the size of
  responses for scraping

* fix: fixed bug with scrape invocation

* feat: added more queries + mutations

- Added Query.externalModerationPhase
- Added Mutation.createExternalModerationPhase
- Added Mutation.updateExternalModerationPhase
- Added Mutation.enableExternalModerationPhase
- Added Mutation.disableExternalModerationPhase
- Added Mutation.deleteExternalModerationPhase
- Added Mutation.rotateExternalModerationPhaseSigningSecret

* feat: added secret management

* fix: linting

* fix: merge conflict fix

* feat: added UI

* fix: linting

* fix: linting

* fix: updated snapshots

* fix: improved docs

* fix: improved docs

* fix: added locales

* review: improve naming

* review: some review changes

- Switched /moderation/phase to /moderation/phases
- Fixed scrolling
- Fixed redirection

* fix: added scroll timeout for webhooks
2020-05-14 19:20:35 +00:00
Wyatt Johnson ceb96dba75 [CORL-1048] Cookie Deprecation (#2944)
* feat: dropped cookie support due to ITP issues

* feat: added improved accessToken handling

* fix: linting

* fix: removed variadic part of JWT

* fix: bump long-settimeout version

* review: removed management classes

* fix: updated snaps

* review: renamed based on review

* review: removed guard clauses around errors surrounding auth
2020-05-13 22:39:22 +00:00
Wyatt JohnsonandVinh f73597d7d1 [CORL-1013] Count Reset (#2960)
* feat: added reset option for count.js

* fix: adjust reset beheviour

* fix: switched to bundlesize2

* fix: added flag to enable github checks

Co-authored-by: Vinh <vinh@vinh.tech>
2020-05-13 16:47:45 +00:00
Vinh 79e0da2c2f fix: bug when posting a comment without ever openened the AllCommentsTab first (#2963) 2020-05-13 17:31:15 +02:00
Wyatt Johnson 1f69bb2f14 [CORL-1075] Metrics Cleanup (#2955)
* feat: added support for metrics on another port

* fix: handle cluster better

* fix: linting
2020-05-11 21:01:53 +00:00
Wyatt JohnsonandVinh d0ab2ef8c5 feat: support auto-pause live updates (#2947)
Co-authored-by: Vinh <vinh@vinh.tech>
2020-05-07 16:21:37 +00:00
Wyatt Johnson 1624787004 i18n Validator (#2953)
* feat: added validate script and docs

* fix: added link
2020-05-07 16:07:07 +00:00
8ea88f9b96 Add flag deleted with value "true" to comments of deleted users (#2952)
* [Fix] Add deleted as true to comments of deleted users

* fix: revert deleted = true

Co-authored-by: hector.melo <hector.melo@corp.globo.com>
Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-05-07 15:46:04 +00:00
Cristian DeanandWyatt Johnson 45873398dd Update pt-BR translation (#2949)
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-05-05 22:07:46 +00:00
Vinh 739d5b6611 fix: always show details on moderation card (#2946) 2020-05-04 11:53:37 -04:00
Kim GardnerandWyatt Johnson 192c3486af [CORL-1050] Add Perspective toxicity support for fr and pt (#2940)
* Add support for fr and pt

* fix: added some more docs

Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
2020-04-24 12:01:44 -06:00
Wyatt Johnson 0e9621c499 fix: Added linting rule to disable use of object prototypes (#2939) 2020-04-17 17:12:36 +00:00
Vinh 5b92f7e968 [CORL-1014] Style comments based on number of reactions (#2930)
* feat: add ability to style comments based on number of reactions

* feat: add coral-indent class

* fix: tests

* fix: snapshots
2020-04-15 18:28:07 +02:00
Vinh c9a0ab8848 [CORL-878] Upgrade dependencies (#2867)
* chore: upgrade fluent

* chore: upgrade metascraper

* chore: upgrade akismet-api

* chore: upgrade apollo-server-express

* chore: upgrade archiver

* chore: upgrade bull

* chore: upgrade express, cheerio, content-security-policy-builder

* chore: upgrade convict

* chore: upgrade cors, cron

* chore: upgrade csv-stringify

* chore: upgrade dompurify

* chore: upgrade dotenv

* chore: upgrade express-static-gzip

* chore: upgrade fs-extra

* chore: upgrade graphql-js

* chore: upgrade graphql packages

* chore: upgrade html-minifier

* chore: upgrade html-to-text

* chore: upgrade ioredis

* chore: upgrade joi

* chore: upgrade jsdom

* chore: upgrade jsonwebtoken

* chore: upgrade juice

* chore: upgrade jwks-rsa ad linkifyjs

* chore: upgrade lodash

* chore: upgrade luxon

* chore: upgrade metascraper

* chore: upgrade mongodb

* chore: upgrade ms

* chore: upgrade node and node-fetch types

* chore: upgrade nodemailer nunjucks and typescript-eslint

* chore: Upgrade passport

* upgrade: prom-client react-helmet source-map-support stack-utils

* chore: upgrade uuid

* chore: upgrade @babel packages

* chore: upgrade types

* chore: upgrade autoprefixer

* chore: upgrade jest

* chore: upgrade ts-jest

* chore: remove linkify.d.ts

* chore: upgrade bowser

* chore: case-sensitive-paths-webpack-plugin

* chore: upgrade classnames

* chore: upgrade commander

* chore: upgrade comment-json

* chore: upgrade cross-spawn compression-webpack-plugin del

* chore: upgrade build and watch related dependencies

* chore: upgrade css-vars-ponyfill

* chore: upgrade eslint and css-vars-ponyfill

* chore: upgrade enzyme and eventemitter2

* fix: form bug

* chore: upgrade farce

* chore: upgrade final form

* chore: upgrade react-popper

* chore: upgrade flat and fork-ts-checker-webpack-plugin

* chore: upgrade husky and gulp related, intersection observer

* chore: upgrade lint-staged

* chore: upgrade marked, loader-utils, mini-css-extract-plugin

* chore: upgrade postcss-nested, proxy-polyfill, pstree.remy

* chore: upgrade prettier

* chore: fix prettier changes, upgrade react

* chore: mute createFactory deprecated message

* chore: upgrade react-copy-to-clipbard, react-axe, react-dom, react-test-renderer, react-timeago

* chore: upgrade react-transistion-group, react-responsive

* chore: upgrade types

* chore: upgrade react-dev-utils, react-error-overlay regenerator-runtime

* chore: upgrade types, sinon, sockjs-client, strip-ansi

* chore: upgrade types, fonts

* chore: upgrade nunjucks, ts-node, typescript-snapshot-plugin, wait-for-expect

* chore: upgrade eslint packages

* chore: upgrade fluent, types

* chore: upgrade jsdom dep

* chore: upgrade mongo

* chore: upgrade deps

* chore: upgrade typescript, recompose

* chore: upgrade prettier

* chore: remove obsolete prettier config

* chore: upgrade jsdom types

* chore: upgrade typescript-eslint

* chore: upgrad deps

* chore: upgrade deps

* chore: upgrade relay related modules

* chore: upgrade docz WIP

* chore: upgrade docz

* chore: add guard

* chore: remove obsolete line

* chore: comment

* chore: refactors

* fix: hook count change error
2020-04-15 18:15:31 +02:00
Wyatt Johnson e180cf87d7 fix: added more details to slack config (#2937) 2020-04-14 22:28:14 +00:00
Kim Gardner de976a5397 Additional Dutch translations (#2936)
* Fix typo

* Add new NL translations
2020-04-14 22:18:34 +00:00
Wyatt Johnson 257830a6c5 [CORL-1035] Moderated By Bug (#2935)
* fix: improved moderated by component

* fix: uncommented line
2020-04-14 21:55:40 +00:00
Tessa Thornton 518056f382 [CORL-1033] don't show view conversation link if callback is not defined (#2934)
* don't show view conversation link if callback is not defined

* remove unnecessary callback
2020-04-13 17:39:17 +00:00
Tessa Thornton 84936ca35c fix error thrown attempting to remove announcements (#2933) 2020-04-13 16:09:33 +00:00
Wyatt Johnson 4194b08a12 [CORL-1002] Queue Improvements (#2931)
* fix: improved count handler for stories not found

* feat: removed performance-now

* feat: cleaned up processors, exposed counts

* feat: increased verb of schd jobs

* fix: removed dead code
2020-04-10 16:15:09 +00:00
Wyatt JohnsonandKim Gardner 98e6a3ccc7 chore: bump version 6.1.0 (#2932)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-04-10 15:25:01 +00:00
Kim GardnerandGilles FRANCOIS 64f5171ff2 [CORL-1003] Add Markdown link to configure page & revert some French translations (#2928)
* french corrections

* Add translations

* Updated FR translations

* More FR fixes

Co-authored-by: Gilles FRANCOIS <gilles@sopress.net>
2020-04-10 10:37:11 -04:00
6711f09a79 [CORL-1001] Wordlist Fixes (#2920)
* fix: improve wordlist highlighting and perf

* fix: updated tests

* fix: implmeneted new regexp lib/patterns

* fix: improve comment body css

* fix: take into account the tree shaking is disabled

See: https://github.com/webpack/webpack/issues/7094

Co-authored-by: Chi Vinh Le <vinh@vinh.tech>
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-04-06 15:04:05 -04:00
Wyatt JohnsonandKim Gardner 8966a8201b fix: removed crossorigin attribute on custom css tags (#2919)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-04-03 17:58:52 -04:00
Tessa ThorntonandKim Gardner 7fc0e2e489 [CORL-974] Add more classnames (#2913)
* wired css

* add more classnames to hook into

* update snaps

* update more snaps

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-04-03 15:54:17 -04:00
Cristian DeanandWyatt Johnson 7c3c510bbc Add tenantDomain to StoryCreatedEventPayload (#2899)
* Add tenantID and siteID to StoryCreatedEventPayload

* fix: added tenantID to payload

* Remove tenantID from StoryCreatedCoralEvent

* Add tenantDomain to webhook schema

* fix: small comment fixes

Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
2020-04-02 21:39:58 +00:00
Wyatt Johnson 94ece10284 [CORL-996] Force SSL Configuration (#2917)
* fix: added new FORCE_SSL config, reverted production SSL handling

* fix: added another test to handle purify testing
2020-03-30 20:35:18 +00:00
ef01f427de Update PT-BR translations after release 6 (#2915)
Co-authored-by: hector.melo <hector.melo@corp.globo.com>
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-30 16:12:34 -04:00
Tessa ThorntonandKim Gardner 5db096942a remove 'mailto:' prefix from links (#2914)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-27 14:09:42 -04:00
Tessa Thornton 4645ed4cd7 [CORL-943] Send test emails (#2882)
* add smtp test email

* disable button if email not enabled

* add error handling

* internationalize strings

* sort imports
2020-03-27 11:46:53 -04:00
7fd524cd6a [CORL-924/CORL-923] show all comments or staff comments in slack (#2872)
* add allcomments option to slack config

* create separate class for hadnling slack event publishing

* add strings

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-26 21:21:09 -04:00
Wyatt JohnsonandKim Gardner 3cb5d0ff9f [CORL-970] CircleCI Version Bump (#2893)
* feat: bump config version

* fix: removed old version tag

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-26 21:04:44 -04:00
Tessa ThorntonandKim Gardner 44216221a4 show badges for suspended and premod users (#2895)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-26 20:34:14 -04:00
Wyatt JohnsonandKim Gardner 0f9b2ba114 feat: added new DEFAULT_QA_STORY_MODE feature flag (#2905)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-26 18:31:48 -04:00
Nick FunkandKim Gardner 071666e8b8 Add more punctuation types to word list rules (#2907)
CORL-957

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-26 18:21:48 -04:00
Tessa ThorntonandKim Gardner 2a9a5099dc update click to copy link button styles (#2912)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-26 17:50:02 -04:00
Wyatt JohnsonandKim Gardner d0f51d8815 fix: added more guard clauses around the endpoint (#2910)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-26 17:29:51 -04:00
Andrew LosowskyandKim Gardner b228725370 Updated text (#2911)
removed mention of Talk, Coral Project, and links to v4 userguides

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-26 14:46:19 -04:00
Tessa Thornton 58f2f71743 [CORL-916] conversation view (#2850)
* show comment counts for stories in story table

* remove debug code

* add modal to view comment

* load converasation view into modal

* style modal header

* style conversation view modal

* style conversation thread in conversation modal

* styles conversation view comments

* show replies to replies on click

* update snaps

* update snap

* pass settings prop through to comment content, set default replies to 5
2020-03-26 13:47:16 -04:00
Wyatt Johnson 8fd266deeb Merge branch 'master' into release/6 2020-03-23 12:20:18 -06:00
Wyatt Johnson 1b73a5fcd7 [CORL-976] Story Closed Fix (#2903)
* fix: fixed issue where `isStoryClosed` can return null

* chore: version bump
2020-03-23 18:02:45 +00:00
Nick FunkandWyatt Johnson 9a58673545 [CORL-929] SSO Key Rotation (Front-end) (#2877)
* feat: initial impl

* Create preliminary SSO rotation components

CORL-929

* Create rotateSSOKey mutation

CORL-929

* Fix sorting by date for SSO keys

CORL-929

* Show tool tips beside expiring/expired statuses

CORL-929

* Hook up Deactivate and Delete SSO key mutations

CORL-929

* Tweak expired tooltip on SSO keys

CORL-929

* Replace old SSO key config with key rotation

CORL-929

* Fix copy button for SSO key's secret

CORL-929

* Refactor SSOKeyCard func's into components

All the func's building the sub-components
were prime targets for component's with props.

CORL-929

* Update tests to match SSO Key rotation

CORL-929

* Fix typo in translation id

CORL-929

* Test key rotation

CORL-929

* Plumb disabled through SSO key rotation

CORL-929

* Remove duplicate input/payload pairs from schema

For some reason it perfectly duplicated the
input/payload pairs for SSO key rotation on
rebase.

CORL-929

* Remove debug logging

CORL-929

* Use switch instead of if's to compute SSO date field

CORL-929

* Use switch to compute SSO action button state

CORL-929

* Use switch to compute SSO StatusField state

CORL-929

* Remove 10 second key rotation option

CORL-929

* Use memo in sorting SSO keys

CORL-929

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-03-20 20:59:59 +00:00
Wyatt Johnson 2dc63d3a27 [CORL-754] SSO Key Management (#2732)
* feat: initial impl

* feat: clean up redis when keys are deleted

* fix: remove test timeout value
2020-03-19 20:57:49 +00:00
Wyatt Johnson 1503b735e5 fix: set SameSite: None for cookies (#2890) 2020-03-19 19:16:50 +00:00
Wyatt Johnson 6db72db837 [CORL-963] Story sorting fix (#2887)
* fix: fixed sorting issues with queries

* review: naming touchups
2020-03-19 18:59:34 +00:00
Wyatt Johnson 18b274a6a9 [CORL-972] Version Linter (#2898)
* fix: added version linting

* chore: bump 6.0.2
2020-03-19 18:44:56 +00:00
Wyatt Johnson 78cfb4cac8 fix: added more checks to migration (#2894) 2020-03-18 20:53:16 +00:00
Wyatt Johnson d513e3807a chore: bump 6.0.0 (#2891) 2020-03-16 15:47:09 +00:00
VinhandWyatt Johnson faf4ad9480 [ADR] Use Relay over Apollo (#2881)
* chore: ADR on Relay and Apollo

* chore: typo

* chore: add neg cons

* chore: add another pos

* chore: remove neg, because apollo needed an introspection query as a build step too..

* chore: fix number

* chore: deco

* chore: typo

* chore: clarification

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-03-13 21:20:24 +00:00
Tessa ThorntonandWyatt Johnson e5ea1ee179 [CORL-959] pass siteID through to approved and rejected route queries (#2884)
* pass siteID through to approved and rejected route queries

* Fix tests

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-03-12 22:19:26 +00:00
Tessa ThorntonandWyatt Johnson 75c0bad073 use getModerationLink helper in moderateSearchBar (#2885)
Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-03-12 18:03:07 +00:00
Nick FunkandWyatt Johnson 8b92878e9b Disable featuring options when a story is in Q&A mode (#2883)
CORL-960

Co-authored-by: Wyatt Johnson <wyattjoh@gmail.com>
2020-03-12 17:48:27 +00:00
Wyatt Johnson 2b2ff7b9c4 [CORL-965] Experimental Notice on Webhooks (#2880)
* fix: added experimental callout message to webhooks

* fix: copy/design review
2020-03-12 17:03:27 +00:00
Wyatt Johnson 2057b750f3 fix: changed copy (#2879) 2020-03-12 16:15:45 +00:00
Wyatt JohnsonandKim Gardner 7abd703f72 fix: addressed issues with cache headers (#2873)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-10 16:46:44 -04:00
Nick Funk 6f1014289b Add flag to optionally enable Q&A (#2878)
CORL-956
2020-03-10 20:22:26 +00:00
Wyatt JohnsonandKim Gardner 45b778c522 feat: expanded regexp generation, locale support, caching (#2869)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-03-10 12:05:44 -04:00
Nick Funk 7d967fc93b [CORL-933] Add additional error handling around logQuery (#2868)
* Add additional error handling around logQuery

We are seeing that sometimes the context has
an undefined logger. We probably want to catch
this case and ensure we don't fail. If it happens
again, we will catch everything we need to know
and that will help us resolve the issue in the
future.

CORL-933

* Simplify logging objects for efficiency

Some of the objects that we were going to log
are too large to be dumped to the logging context.
Instead, prefer simple boolean evaluation of their
existence.

CORL-933
2020-03-02 16:34:17 +00:00
Jan Slusarczyk ae7b0fbb37 polish updates for QA and fixes for #2856 (#2870) 2020-02-28 18:05:16 +00:00
Tessa ThorntonandWyatt Johnson 2478e9a250 [CORL-770] save comment sort order preference in local storage (#2854)
* save comment sort order preference in local storage

* await async localstorage operation

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-02-27 23:28:07 +00:00
Nick FunkandWyatt Johnson fe8b6535a9 Ensure comments are still visible when stream is closed (#2865)
CORL-938

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-02-27 22:40:24 +00:00
Jan Slusarczyk 7989f87d02 q&a fix for consistency of unanswered tab string (#2864) 2020-02-27 22:26:28 +00:00
Nick FunkandWyatt Johnson 769ab2a910 Q&A Fixes (#2866)
* Fix various Q&A moderation/tagging issues

- Allow Staff members to have their questions
answered and appropriately tagged
- Properly filter answering for only top level
questions (comments)
- Add documentation around various moderation
phases and comment creation steps
- Remove unnecessary status filter when setting
the status for a comment

* fix: abstracted out perspective configs

* fix: reworked tag injection

* Fix sorting/unused imports

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-02-27 14:40:01 -07:00
Tessa ThorntonandWyatt Johnson c052d37a6f rename Comments.comment to Comments.visible and allow slack task to load any comment regardless of visibility (#2855)
Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-02-27 18:46:28 +00:00
Wyatt Johnson a059e70d05 [DOCS Day] Contribution Guidelines Update (#2863)
* feat: initial commit with new handbook material

- Adds guides related to creating PR's
- Enhances PR templates

* feat: harmonized docs
2020-02-26 11:29:18 -05:00
Nick FunkandKim Gardner 1a3401710f Q&A Beta (#2845)
* [CORL-863] Allow streams to be converted/configured to Q&A (#2809)

* Create preliminary schema changes for Q&A

Adds a mode and expert User onto the StorySettings.
Adds a mode selection drop down on a story's
Configure tab.

CORL-863

* Allow multiple experts, remove form elements from search

Makes the previous expert user on a Q&A story now
an array of users who can be assigned.

Converts the previous form based search that was
pulled from the admin community area into a set
of events built on callbacks.

CORL-863

* Create addExpertToStory mutation

CORL-863

* Create removeExpertFromStory mutation

CORL-863

* Conditionally show the the expert selection options

CORL-863

* Create a dropdown search control for Q&A experts

CORL-863

* Fixing up tests to match new QA stream options

Adds a few localization fixes to make sure tests
pass.
Updates existing snapshots.

CORL-863

* Add load more button to expert search list

CORL-863

* Update experts query to match react upgrades

CORL-863

* Move the Q&A config to its own section under stream config

Create enable and disable Q&A mutations/button toggle.

CORL-863

* Fix alignment and layout of expert list items

CORL-863

* Define translations and update tests

CORL-863

* Use official copy for Q&A config

CORL-863

* [CORL-856] Show expert badge on comments (#2829)

* Create preliminary schema changes for Q&A

Adds a mode and expert User onto the StorySettings.
Adds a mode selection drop down on a story's
Configure tab.

CORL-863

* Allow multiple experts, remove form elements from search

Makes the previous expert user on a Q&A story now
an array of users who can be assigned.

Converts the previous form based search that was
pulled from the admin community area into a set
of events built on callbacks.

CORL-863

* Create addExpertToStory mutation

CORL-863

* Create removeExpertFromStory mutation

CORL-863

* Conditionally show the the expert selection options

CORL-863

* Create a dropdown search control for Q&A experts

CORL-863

* Fixing up tests to match new QA stream options

Adds a few localization fixes to make sure tests
pass.
Updates existing snapshots.

CORL-863

* Add load more button to expert search list

CORL-863

* Update experts query to match react upgrades

CORL-863

* Move the Q&A config to its own section under stream config

Create enable and disable Q&A mutations/button toggle.

CORL-863

* Fix alignment and layout of expert list items

CORL-863

* Define translations and update tests

CORL-863

* Use official copy for Q&A config

CORL-863

* Show expert badges on comments when Q&A is enabled

CORL-856

* Update mutation responses and tests due to added expert fields

CORL-856

* Use EXPERT user tags to denote expert users

Removes the need for viewerIsExpert and
authorIsExpert loader/resolvers on Stories
and Comments respectively.

CORL-856

* [CORL-879] Add an unanswered tab to stream when in Q&A mode (#2838)

* Create preliminary schema changes for Q&A

Adds a mode and expert User onto the StorySettings.
Adds a mode selection drop down on a story's
Configure tab.

CORL-863

* Allow multiple experts, remove form elements from search

Makes the previous expert user on a Q&A story now
an array of users who can be assigned.

Converts the previous form based search that was
pulled from the admin community area into a set
of events built on callbacks.

CORL-863

* Create addExpertToStory mutation

CORL-863

* Create removeExpertFromStory mutation

CORL-863

* Conditionally show the the expert selection options

CORL-863

* Create a dropdown search control for Q&A experts

CORL-863

* Fixing up tests to match new QA stream options

Adds a few localization fixes to make sure tests
pass.
Updates existing snapshots.

CORL-863

* Add load more button to expert search list

CORL-863

* Update experts query to match react upgrades

CORL-863

* Move the Q&A config to its own section under stream config

Create enable and disable Q&A mutations/button toggle.

CORL-863

* Fix alignment and layout of expert list items

CORL-863

* Define translations and update tests

CORL-863

* Use official copy for Q&A config

CORL-863

* Show expert badges on comments when Q&A is enabled

CORL-856

* Update mutation responses and tests due to added expert fields

CORL-856

* Use EXPERT user tags to denote expert users

Removes the need for viewerIsExpert and
authorIsExpert loader/resolvers on Stories
and Comments respectively.

CORL-856

* Show an unanswered comment stream when Q&A is enabled

CORL-879

* Do not visually show the unanswered tag

CORL-879

* [CORL-859] Convert Featured stream into Answered for Q&A (#2842)

* Create preliminary schema changes for Q&A

Adds a mode and expert User onto the StorySettings.
Adds a mode selection drop down on a story's
Configure tab.

CORL-863

* Allow multiple experts, remove form elements from search

Makes the previous expert user on a Q&A story now
an array of users who can be assigned.

Converts the previous form based search that was
pulled from the admin community area into a set
of events built on callbacks.

CORL-863

* Create addExpertToStory mutation

CORL-863

* Create removeExpertFromStory mutation

CORL-863

* Conditionally show the the expert selection options

CORL-863

* Create a dropdown search control for Q&A experts

CORL-863

* Fixing up tests to match new QA stream options

Adds a few localization fixes to make sure tests
pass.
Updates existing snapshots.

CORL-863

* Add load more button to expert search list

CORL-863

* Update experts query to match react upgrades

CORL-863

* Move the Q&A config to its own section under stream config

Create enable and disable Q&A mutations/button toggle.

CORL-863

* Fix alignment and layout of expert list items

CORL-863

* Define translations and update tests

CORL-863

* Use official copy for Q&A config

CORL-863

* Show expert badges on comments when Q&A is enabled

CORL-856

* Update mutation responses and tests due to added expert fields

CORL-856

* Use EXPERT user tags to denote expert users

Removes the need for viewerIsExpert and
authorIsExpert loader/resolvers on Stories
and Comments respectively.

CORL-856

* Show an unanswered comment stream when Q&A is enabled

CORL-879

* Create preliminary schema changes for Q&A

Adds a mode and expert User onto the StorySettings.
Adds a mode selection drop down on a story's
Configure tab.

CORL-863

* Do not visually show the unanswered tag

CORL-879

* Allow multiple experts, remove form elements from search

Makes the previous expert user on a Q&A story now
an array of users who can be assigned.

Converts the previous form based search that was
pulled from the admin community area into a set
of events built on callbacks.

CORL-863

* Create addExpertToStory mutation

CORL-863

* Create removeExpertFromStory mutation

CORL-863

* Create a dropdown search control for Q&A experts

CORL-863

* Fixing up tests to match new QA stream options

Adds a few localization fixes to make sure tests
pass.
Updates existing snapshots.

CORL-863

* Add load more button to expert search list

CORL-863

* Update experts query to match react upgrades

CORL-863

* Move the Q&A config to its own section under stream config

Create enable and disable Q&A mutations/button toggle.

CORL-863

* Fix alignment and layout of expert list items

CORL-863

* Define translations and update tests

CORL-863

* Show expert badges on comments when Q&A is enabled

CORL-856

* Use official copy for Q&A config

CORL-863

* Update mutation responses and tests due to added expert fields

CORL-856

* Use EXPERT user tags to denote expert users

Removes the need for viewerIsExpert and
authorIsExpert loader/resolvers on Stories
and Comments respectively.

CORL-856

* Create the answered stream for Q&A

CORL-859

* Sort the Q&A on Most Voted by default

CORL-859

* Fix type mismatch between post comment form and fragments

CORL-859

* Adding localizations for Q&A tags

* Hide feature flags in Q&A streams

* Allow experts to clear answered questions

Can click a button that shows up in the unanswered
tab under answered questions to refresh the stream,
clearing the answered questions from that tab.

* Show arrow upvote icon when in Q&A mode

Also localized the upvote text so it can
be translated.

* Hide mod/report buttons on answered questions

* Remove unnecessary fragment container

* Remove errant debug console log

* Make story mode required on story settings

* Make remove button outlined, not filled

* Further schema changes around Q&A and experts

Rename add/remove story expert to removeStoryExpert
and addStoryExpert naming.

Replace enableQA and disableQA mutators with single
updateStoryMode mutator.

* Remove story mode from UpdateStorySettings

* Replace inline string val's with enum

* add dependencies to useEffect

* docs cleanup around tags.type index check

* Approve a question when it is answered in Q&A

Approves using the author's id as the moderator

* Add comment around use of TAG on comments edge

* Use tagFilter instead of $elemMatch to filter by tags

* Improve responsive styles for expert list items

* Update copy to "Done" from "Remove answered questions"

* Text styling for no users found text

Styles the expert search list to have proper
text styling when no users are found for the
search keyword.

* Remove duplicate checks around story experts

Not necessary as Mongo does this for us.

* Fix a missed "sort imports" during rebase

* Refactor Q&A moderation phases for clarity

Simplify logic and update comments.
Rename: "answered" -> "tagExpertAnswers"
Rename: "unanswered" -> "tagUnansweredQuestions"

* Remove username & email from add expert mutation

* Format expert list emails with Localized

* Break out no comments logic into fragment

* Remove ref handling from expert search field

Use value assignment on TextField instead.

* Replace Box with Flex and CSS

* Show Q&A tooltip on Answered tab

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-02-25 20:10:25 -05:00
Nick FunkandWyatt Johnson 184f145c4a Add a contributing section to our README (#2860)
- Define how to contribute to our public docs
- Define schema types and their conventions

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-02-25 23:35:06 +00:00
dcb2a10e72 [CORL-845] Account Linking (#2818)
* feat: added new linking backend

* feat: added duplicateEmail to hash

* fix: stored the duplicate email on the user

* feat: initial implmentation of account linking in auth

* test: fix unit tests

* fix+test: translations and tests added

* chore+test: rename view to LINK_ACCOUNT + more tests

* feat+test: account linking admin + more tests

* feat: Handle incomplete accounts

* chore: add some comments

* feat: expose duplicateEmail through graphql and impl for stream

* feat: admin to use duplicateEmail from graphql

* fix: no need to validate password for account linking

* fix: dont validate password

* fix: no need to render error message when account was incomplete

* chore: log to console when encountering incomplete account

* chore: adjust comment

* chore: simplify + add comments

* chore: wording

* chore: comments

Co-authored-by: Vinh <vinh@vinh.tech>
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-02-25 15:46:32 -05:00
Jan Slusarczyk 7497e33046 pl translation updated strings and fixes (#2853)
* Polish translation updates

* polish translation fixes and updates

* Typo fix
2020-02-23 12:37:11 -05:00
Tessa ThorntonandKim Gardner 330c30f1b3 [CORL-883] show comment counts for stories in story table (#2847)
* show comment counts for stories in story table

* remove debug code

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-02-21 14:07:22 -05:00
Tessa Thornton e2185a33f5 [CORL-918] make siteID required in site query (#2851)
* make siteID required in site query

* update specs and snaps

* remove unnecessary comment
2020-02-21 12:46:40 -05:00
Tessa Thornton d6db287c55 [CORL-882] option to reject all a user's comments when banning (#2827)
* show comment counts for stories in story table

* remove debug code

* add rejector task

* connect comment rejection job to user banning

* localize strings

* remove debug code

* remove debug code

* resolve merge conflicts

* add documentation to rejectExistingComments

* clean up rejector task

* add TODO about broker

* make rejectExistingComments nullable
2020-02-21 12:38:40 -05:00
Jan Slusarczyk ca52cc3253 Polish translation updates (#2852) 2020-02-21 11:28:37 -05:00
Wyatt Johnson c2dadcc034 feat: consolidated migrations for 6.0.0 release (#2831) 2020-02-20 22:42:05 +00:00
Jan Slusarczyk 6865a71684 polish (pl) translation - initial version (#2849)
* pl translation

* fix spaces at the end of a tag in test
2020-02-20 16:24:10 -05:00
Tessa Thornton 33556044a8 [CORL-919] approved queue (#2848)
* show comment counts for stories in story table

* remove debug code

* add 'approved' moderation queue to moderation tabs

* add site/story specific routes

* Revert "remove debug code"

This reverts commit ed3a44304d225c79336423f34d0bde57a998cd69.

* Revert "show comment counts for stories in story table"

This reverts commit 61eb00c70c873fd2d10f1476601c7a69ae12651d.
2020-02-19 16:37:51 -05:00
Tessa ThorntonandVinh d883ab029c [CORL-920] use SHORT_NUMBER fluent function to format comment counts (#2846)
* use SHORT_NUMBER fluent function to format comment counts

* fix: short number algo

* chore: remove whitespace

* chore: rename var

Co-authored-by: Vinh <vinh@vinh.tech>
2020-02-19 15:13:16 -05:00
Tessa Thornton 4b637a2dd5 [CORL-761] stream-side account tab for sso (#2834)
* move download comments to my comments tab

* only show download comments if available

* move ignored users management to same tab as notifications, rename to preferences

* fix query and ts defs

* add url to jwt

* make account tab go to external url if provided

* ensure url is an optional jwt field

* update tabs for stream profile

* update classnames for tabs

* fix tests
2020-02-19 14:39:58 -05:00
e42c2b925d [CORL-687] Webhooks (#2738)
* feat: initial webhook impl

* feat: added support for key rotation

* feat: harmonized fetcher

* feat: added expired secrets cleaning

* feat: event system refactor

* feat: added story event

* feat: simplfiied webhook handler

* feat: added ref's to locations where user events can be added

* feat: added UI to support webhooks

* fix: renaming some Webhook -> WebhookEndpoint

* fix: review comments to adjuist flow

* feat: added localizations

* fix: linting, updated snapshots

* fix: adapted for new fluent

* fix: rearranged folders

* fix: linting

* feat: added webhooks documentation

* feat: improved toc generation

* feat: added some tests to webhooks

* fix: chain transition hooks

* feat: added tests around webhook ui

* fix: renamed events

* fix: adjusted circle markdown linting

* fix: adjusted doctoc script call

* review: review fixes

* review: review comments

* review: adjusted signing secret confirmation

* review: adjusted styles to harmonize button usage

* fix: updated snapshots and tests

* review: move form out of webhooks

Moved the form out of the webhooks by relocating the layout used for the
route associated with the configure routes.

* fix: fixed bugs and snapshots with tests

* feat: revised slack message format to use block api

* fix: fixed a small text bug

Co-authored-by: Vinh <vinh@vinh.tech>
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-02-18 13:25:48 -05:00
Tessa Thornton 34ba2da88d update perspective models docs link (#2844) 2020-02-18 10:31:48 -05:00
Wyatt Johnson cec76e0046 fix: fixes autofill issues in chrome (#2837) 2020-02-13 13:49:44 -05:00
Tessa ThorntonandWyatt Johnson 707d65a119 Support multisite (#2799)
* resovle import error by removing useContext from ui component

* update snaps

* create useUIContext hook

* add site and community models

* create sites and communities on install

* add site name to install wizard

* add site id to stories

* pass site id to stream query in embed

* fix spec

* add sites query

* list sites in organization config

* add route for new sites

* add create site mutation

* view and update sites

* show embed codes for sites

* add site id to comments

* allow filtering moderation queues by site id

* add site selector to queue

* move sites config routes

* Revert "move sites config routes"

This reverts commit 4ed5345d3e1df6263f8390b64214956c43c4d8cd.

* update sites routes

* show site name in moderate card

* remove site selector from queue selector

* style create site form

* edit site form

* clean up ts

* move :storyID paths to /storeis/:storyID

* make queues respect site id

* add site switcher

* styles for site selector

* add global notifications

* style app notifications

* clear notifications after x miliseconds

* use notification component in add site form

* fix types

* make notifications dismissable

* dismiss site created notification

* remove button letter spacing if lowercase

* filter stories by site in search

* add site name to story search results

* add site column to stories table

* filter stories table by site

* make sure notification displays after site creation

* paginate sites table

* paginage site selector

* add paginated site filter to stories table

* fix merge conflicts

* sort by createdAt

* default to 20 sites

* delete comments

* add translation tags

* make site ID not mandatory

* Fix tests and specs

* only include site id in embed code for multisite

* update tenant cache when adding first site

* only show site selector if multiple sites

* use story url instead of site id for story upsert

* update snaps

* make ui conditional on multisite

* update snaps and remove unnecessary site ID

* sloppily calculate counts for filtered queues

* get origins of allowed domains

* add migration

* enable migration

* only show permitted domains if mulltisite is false

* remove site id from embed code

* update snaps

* undo updates to singletonresolver

* remove refernces to communities

* fix mints

* remove community reference

* update copy in installation

* use sites services in installer

* remove unused loader

* correct error text for useNotification

* order sites by name

* make multisite a computed property

* use map/filter instead of for/of for url origins

* add missing/incorrect translations

* remove references to siteID

* remove references to tenant isURLpermitted

* add comments to schema updates

* simplify filtering stories by site

* remove domains config from advanced

* fix: adjusted CSP header generation

* add migration to create indexes on site

* clear notifications on navigate

* remove count for filtering by site

* throw duplicate error for allowed domains

* handle errors for create/update sites

* remove contacturl and contactemail from sites

* fix types for counts

* sort imports

* ensure props get passed down to link version of button component

* add url and email fields back into organization config

* sort imports

* fix moderation queues resolver types

* fix appearance of sites dropdown

* add status role to notificaiton

* remove duplicate layout file

* fix: rename allowedDomains -> allowdOrigins

* move Link conditional from button to basebutton component

* fix merge conflict

* fix mutation optimistic response

* make sure to prop gets passed to link

* change labels on install steps

* show story's site in site selector when moderating by story

* feat: support site counting

* update snap

* remove multisite from settings

* move paginated select to admin/components

* fix circular import errors

* remove uicontext component from v2 timestamp

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-02-12 09:22:07 -05:00
Sami Safatli 014aa2d86a Update translation pt br files (#2833)
* Update translations of admin pt-BR file

* Update server files translations pt-BR
2020-02-10 20:28:27 -05:00
Wyatt Johnson 94e1c75c0b chore: bump version 5.5.1 (#2832) 2020-02-10 17:11:14 +00:00
Hector NievaandWyatt Johnson 3014017976 Fix regexp mathing of banned word list by exchanging .test() with .match() (#2828)
* [Fix] Use .match instead of .test to avoid false positives when matching regex returned groups

* Add test to assure memoized regexp for banned words will match properly

* fix: fixes bug with wordlist matching

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-02-08 00:28:08 +00:00
Sami Safatli 1388e0bc5e Update translation pt-BR (#2826) 2020-02-06 13:38:55 -05:00
Wyatt Johnson 86191e388a feat: added support for customUserAgent (#2825) 2020-02-05 16:35:57 +00:00
Wyatt JohnsonandKim Gardner 2bf3e34218 chore: bump 5.5.0 (#2822)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-02-04 15:10:10 -05:00
Vinh 75818cf808 Use absolute graphql url to fix ie11 bug (#2823)
* fix: use absolute graphql to fix ie11 bug

* fix: improved url composition
2020-02-04 19:16:36 +00:00
Tessa Thornton 503eb0b06a fix styling of icons and text in stream announcement (#2821) 2020-02-04 12:53:27 -05:00
Wyatt Johnson 9cc3a57295 fix: fixed subheader text color (#2820) 2020-02-04 17:04:43 +00:00
Wyatt Johnson e42cb59661 feat: added config variable for perspective timeout (#2817)
Added a configuration timeout variable for changing the perspective
timeout number.
2020-02-04 00:21:14 +00:00
Tessa ThorntonandKim Gardner a1a8652f7e [CORL 547] org-wide announcements (#2813)
* CRUD announcements

* only show announcement if not disabled

* make announcements dismissable

* add announcement mutations

* update announcement form logic

* style announcements on stream

* update snap

* localize strings

* close form if announcement is removed

* move announcement config below sitewide commenting config

* move date calculation inside useMemo

* move announcementconfig code to announcementconfigcontainer

* use coralContext for localStorage

* fix type of announcement createdAt

* move announcement form to modal

* remove payload pruning from configure route

* simplify announcement display logic

* make validation message full width

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-02-03 13:12:25 -05:00
Wyatt JohnsonandKim Gardner a7b2af85fc fix: fixes bug related to migration error (#2816)
When a user did not have any comments when the migration 1575649180000
hits, they are not migrated to get a `commentCounts` property. This
migration finds those users without `commentCounts` and sets them to the
empty comment counts.

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-01-30 18:53:34 -05:00
VinhandKim Gardner 516611e289 fix: set access token only once (#2815)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-01-30 18:37:26 -05:00
Tessa Thornton 190010c898 change marker variant for suspect word badge (#2814) 2020-01-30 18:23:42 -05:00
Vinh 2b1c9aea78 [CORL-832] IE11 Compatibility for the Embed Stream (#2801)
* IE11 support

* fix: types and tests

* chore+fix: optimise polyfills and bugfixes for ie11

* chore+fix: fix docz, radically cleanup babel configs

* fix: ie11 proxy bug

* feat: normalize rte html

* fix: css issues in ie11

* chore: improve bundle size

* chore: upgrade coral rte

* feat: make counts work in ie11

* fix: remove native password reveal in ie11

* fix: markdowneditor icons in ie11

* fix: ie11 brittleness in auth popup

* fix: callout width in ie11

* test: fix snapshots
2020-01-29 17:42:32 -05:00
Felix DandKim Gardner 9c4a9753bb New language swedish (#2798)
* Adding Swedish translation

* updated snap file for Swedish translation

* Translated sv/auth.ftl and partially translated install.ftl and errors.ftl to swedish

* Translated server/error completly and removed the swedish translation file install

* Fixed merge conflict with Finnish language that was added before this PR was completed

* Fixed wrong semi colon and white space

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-01-28 15:51:22 -05:00
Dan Zajdband e43a3ddf75 Spanish translation fixes (#2812) 2020-01-28 10:58:20 -05:00
jpkilpi 6364eced63 Finnish translation (#2811)
* Initial Finnish translation

* Added Finnish translation to test configuration
2020-01-23 12:45:23 -05:00
DzarrandKim Gardner 62ce3a2c49 Translations of server locales in french (#2807)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-01-21 17:22:25 -05:00
Nick Funk 48d815aebb Refactor v2 css variable names into post css variables (#2791)
We don't want to clog up the variables list with every
design token from AirTable. Instead, more efficient to
use Post CSS var's that compile down into the CSS bundle
more efficiently.

CORL-748
2020-01-20 21:09:10 +00:00
Nick Funk 38ccbd0ef8 Show new message when no comments and story closed (#2792)
Show "There are no comments on this story." instead
of "There are no comments yet. Why don't you write one?"

CORL-787
2020-01-20 20:56:54 +00:00
Nick Funk cfebe7733e Fix radio button positioning on Firefox (#2805)
Remove the top: 6px since it's unnecessary
to vertically align the dot in the radio
button.

CORL-873
2020-01-20 18:27:44 +00:00
Nick FunkandWyatt Johnson e7b83c6b39 [CORL-875] Semi-bold selected text on radio buttons (#2804)
* Semi-bold selected text on radio buttons

Makes it very obvious which item is selected.

CORL-875

* fix: updated snapshots

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-20 18:13:11 +00:00
Nick Funk 5c46884a97 Change load amounts for comments (#2800)
Load 20 comments initially and on load more.
Load 3 replies initially and on load more.

CORL-864
2020-01-20 17:54:34 +00:00
Nick Funk 4bd929f3f0 [CORL-748] Update admin login to match new branding styles (#2788)
* Update admin login to match new branding styles

CORL-748

* Update admin login to match new branding styles

CORL-748
2020-01-20 17:43:40 +00:00
Nick FunkandWyatt Johnson 785735d36a [CORL-874] Align the sidebar and config content in Admin>Configure (#2803)
* Align the sidebar and config content in Admin>Configure

CORL-874

* fix: updated snapshots

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-20 17:27:37 +00:00
Wyatt Johnson 20da16331e fix: renamed migration file to ms format (#2802) 2020-01-17 18:59:50 +00:00
Wyatt Johnson a95694dff6 [CORL-867] Version SSL Bypass (#2797)
* fix: move /api/version outside SSL wrap

* chore: bump version
2020-01-15 23:22:37 +00:00
Wyatt Johnson f58f65c7ae [CORL-867] Health SSL Bypass (#2796)
* fix: bypass enforceHTTPS for /api/health

* chore: version bump
2020-01-15 20:11:28 +00:00
Nick FunkandWyatt Johnson 22516457ef Fix text field adornments to use correct font (#2795)
Font styling for text field adornments now
matches the text field input.

CORL-849

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-14 22:48:06 +00:00
Nick FunkandWyatt Johnson 533d7633e1 [CORL-846] Restructure the slack comment message format (#2794)
* Restructure the slack comment message format

CORL-846

* feat: removed all comments

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-14 22:26:33 +00:00
Tessa ThorntonandWyatt Johnson e8fb234838 [CORL-850] use pngs for logo (#2790)
* use png instead of svg for logo

* update snap

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-14 17:26:56 +00:00
Wyatt Johnson 9b8ab6de5f 5.4.0 Release Bug Fixes (#2789)
* fix: addresses CORL-848

Fixed copy for new commenters feature.

* fix: address CORL-847

Revert the line hight changes on select fields for now.

* fix: addressed CORL-851

Changed copy on CSS field.

* fix: addressed CORL-840

Changed deletion window to 24 hours.
Refactored durations to use TIME enum.
2020-01-14 16:39:21 +00:00
Nick FunkandWyatt Johnson a88644d98e [CORL-836] Create activeStories endpoint (#2787)
* Create activeStories GraphQL query endpoint

Set lastCommentedAt on stories when they are
commented upon.
Use lastCommentedAt to retrieve the activeStories.
Create a migration to partial index
lastCommentedAt on stories to make retrieval fast.

CORL-836

* fix: adjusted query to use index, more @auth directives

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-10 23:55:22 +00:00
Wyatt Johnson 745fb4056c fix: fixed tag styling due to localization (#2785) 2020-01-10 18:32:15 +00:00
vladimir04andWyatt Johnson a582773e1d I18n ro translation (#2786)
* add Romanian translation

* add further RO translations

* update locales.ts file

* add common.ftl RO translations

* fix: linting

* fix: updated snapshots

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-10 18:04:52 +00:00
Wyatt Johnson 6057edcb07 Heroku Build Fix (#2784)
* fix: pinned node and npm versions

* fix: addressed issues with package upgrades
2020-01-10 01:10:15 +00:00
Wyatt JohnsonandKim Gardner 852466e9a1 feat: add additional log messages, added nudge to metadata (#2781)
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2020-01-08 19:43:10 +00:00
Nick Funk f53db233ce [CORL-829] Bump line-height on select fields (#2779)
* Bump line-height on select to account for hanging font characters

Prevents characters like "g" or "j" being cut off at the
bottom of the select.

CORL-829

* Create new tall line height

Use it for the select boxes to allow for dangling
characters like 'g' and 'j'.

CORL-829
2020-01-08 11:06:16 -07:00
Nick Funk 31cf9a4f7d [CORL-818] Add validation and placeholder for Slack hook url field (#2782)
* Add a placeholder for Slack hook url field

CORL-818

* Validate slack hook url's before saving

CORL-818
2020-01-08 10:49:33 -07:00
Nick Funk 81338d1386 [CORL-825-cp] Allow sending of moderation decisions to Google (#2783)
* Allow sending of moderation decisions to Google

If enabled in the config, moderation decisions can
be sent to Google.

Simplify OnOffField test id's

Consolidate guard clauses

Reconstruct tenant url's when sending perspective feedback

Use the comment revision id when sending perspective feedback

Use retrieveStory instead of findStory

Clarify logging warning levels on perspective feedback

Clean html tags from sent comment body

Fix include to match new graph context refactors

CORL-825

* Handle asynchronous perspective operation more cleanly

CORL-825
2020-01-08 10:32:24 -07:00
Nick FunkandWyatt Johnson 84bbc3d0c3 [CORL-688] Refactor: Consolidate the tenant and common context together (#2780)
* feat: initial impl

* Create preliminary comment moderation slices

CORL-688

* Move slices logic into stacks

CORL-688

* Create user comment counts

CORL-688

* Create naive mutation that initializes user comment counts

CORL-688

* Use bulk updates in user counts migration

CORL-688

* fix: review

* fix: fixed issue with aggregation

* Migrate creating comment into stacks

CORL-688

* Migrate editing a comment to the stacks

CORL-688

* Break publishing comment status out of updateAllCounts

CORL-688

* review: removed variable scoping in favor of export

* revert: feb8e8196cd448f5cd24f1ca2eb0b91fe9bd43c7

* review: simplification of stacks implementation

This simplifies the stacks implementation to better reuse code related
to count management and event publishing. This can be used to great
effect with the upcomming events PR #2738.

* Consolidate the tenant and common context together

CORL-688

* review: removed variable scoping in favor of export

* revert: feb8e8196cd448f5cd24f1ca2eb0b91fe9bd43c7

* review: simplification of stacks implementation

This simplifies the stacks implementation to better reuse code related
to count management and event publishing. This can be used to great
effect with the upcomming events PR #2738.

* fix: check if authorID is null before update user counts

CORL-688

* Consolidate common/tenant context supporting files

CORL-688

* feat: renamed TenantContext -> GraphContext

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-08 17:07:25 +00:00
d26e331a4f [CORL-664] Threshold moderate new commenters (#2752)
* add new commenters config

* fix specs and fixtures, add translation strings

* save whether a commenter is new

* fix specs and snaps

* add admin role to new config options

* Update copy

* remvoe unused ref

* feat: initial impl

* Create preliminary comment moderation slices

CORL-688

* Move slices logic into stacks

CORL-688

* Create user comment counts

CORL-688

* Create naive mutation that initializes user comment counts

CORL-688

* Use bulk updates in user counts migration

CORL-688

* fix: review

* fix: fixed issue with aggregation

* Migrate creating comment into stacks

CORL-688

* Migrate editing a comment to the stacks

CORL-688

* Break publishing comment status out of updateAllCounts

CORL-688

* review: removed variable scoping in favor of export

* revert: feb8e8196cd448f5cd24f1ca2eb0b91fe9bd43c7

* review: simplification of stacks implementation

This simplifies the stacks implementation to better reuse code related
to count management and event publishing. This can be used to great
effect with the upcomming events PR #2738.

* Remove un-necessary isNew flags on users

CORL-664

* review: removed variable scoping in favor of export

* revert: feb8e8196cd448f5cd24f1ca2eb0b91fe9bd43c7

* review: simplification of stacks implementation

This simplifies the stacks implementation to better reuse code related
to count management and event publishing. This can be used to great
effect with the upcomming events PR #2738.

* fix: check if authorID is null before update user counts

CORL-688

* fix: addressed bug in shared count retrival

Co-authored-by: Tessa Thornton <tessathornton@gmail.com>
Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-07 14:38:50 -07:00
Nick FunkandWyatt Johnson e3e2e0f52e [CORL-688] Add user comment count tracking (#2744)
* feat: initial impl

* Create preliminary comment moderation slices

CORL-688

* Move slices logic into stacks

CORL-688

* Create user comment counts

CORL-688

* Create naive mutation that initializes user comment counts

CORL-688

* Use bulk updates in user counts migration

CORL-688

* fix: review

* fix: fixed issue with aggregation

* Migrate creating comment into stacks

CORL-688

* Migrate editing a comment to the stacks

CORL-688

* Break publishing comment status out of updateAllCounts

CORL-688

* review: removed variable scoping in favor of export

* revert: feb8e8196cd448f5cd24f1ca2eb0b91fe9bd43c7

* review: simplification of stacks implementation

This simplifies the stacks implementation to better reuse code related
to count management and event publishing. This can be used to great
effect with the upcomming events PR #2738.

* fix: check if authorID is null before update user counts

CORL-688

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2020-01-07 21:00:25 +00:00
Wyatt Johnson 0dc3e8968a fix: package upgrade (#2777)
Upgraded some packages to latest. This should resolve #2774. Fixes were
also applied after types upgrades that helped discover other errors.
2020-01-06 16:14:56 +00:00
Hans Sprecher f900050ef4 2772: swapping a Perspective API link from a dead one to the README on their repo. (#2773) 2019-12-23 17:42:45 -05:00
0f456330c5 [CORL-827/828] Scrub downloaded comments of html tags, rename archive (#2767)
* Prefix comment download filename with "coral"

CORL-827

* Scrub html tags from downloaded comment data

CORL-828

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
2019-12-20 23:46:24 +00:00
Wyatt Johnson 9d050e8b51 [CORL-800] Fluent Upgrade (#2739)
* feat: upgraded fluent libraries

* fix: adjustments to support fluent upgrade
2019-12-20 23:18:49 +00:00
Wyatt JohnsonandKim Gardner 7581f0201d fix: improved the count management (#2769)
Count management has been adjusted to instead preserve the zero values
of the counts. Old count maintainence functions were also removed
because they were untested and not used.

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2019-12-20 18:07:29 -05:00
Nick Funk 86b2ec1e56 Fix incorrectly set tabID on moderate card details (#2768)
CORL-826
2019-12-20 17:55:56 -05:00
Nick FunkandKim Gardner fd1ee39db4 Fix story message boxes to wrap text properly (#2761)
Need to set the message content width so that
the text knows how to wrap. Also accounts for
when the icon is present to set width to the
correct value so it doesn't shift past the edge
of the message box container.

CORL-802

Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2019-12-20 17:25:55 -05:00
8c6f12c24d Improve pt-BR translation (#2757)
Update src/locales/pt-BR/admin.ftl

Co-Authored-By: Wyatt Johnson <accounts+github@wyattjoh.ca>

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
Co-authored-by: Kim Gardner <kgardnr@gmail.com>
2019-12-20 17:15:31 -05:00
Nick Funk 11a4a5ebe3 Update logo to match new Vox Media branding (#2766)
The Vox Media text now has reduced spacing.

CORL-804
2019-12-20 17:03:07 -05:00
Wyatt Johnson f3ecbf5dc6 [CORL-824] Feature Flags (#2756)
* feat: implemented feature flag

* fix: support deprecated enums
2019-12-20 18:06:30 +00:00
Tessa Thornton 116d3c0c81 fix jsdoc warnings (#2750) 2019-12-12 11:41:57 -05:00
Tessa Thornton 3358cef433 [CORL-746] updated branding: buttons (#2748)
* new button component

* update specs

* fix up markers

* fix docz so it renders

* clean up buttons implementation

* update snaps

* clean up slack buttons

* update snaps
2019-12-09 18:03:30 -05:00
Nick Funk ec93789cff [CORL-645] Resolve mismanaged branch merging (#2746)
* Create preliminary schema for setting Slack channels

CORL-645

* Implement preliminary slack notification using tenant slack channels

CORL-645

* Very preliminarily get data loading with FieldArray's for slack channels

CORL-645

* Update settings input on schema to allow saving Slack settings to tenant

CORL-645

* Filter off UNMODERATED queue events from slack channels

We don't send these to slack through our filters, we only care
about pending, reported, and featured

CORL-645

* Include a moderation link in comments pushed to Slack

CORL-645

* Hook up proper callback functions for adding/removing slack channels

CORL-645

* Add missing translation for Slack navigation item

CORL-645

* Update snapshots for preliminary Slack configuration changes

CORL-645

* Add some FormField wrappers around slack config elements

Makes the UI appear a little nicer

CORL-645

* Set up slack config to only provide one slack channel

We need to do this until we can get ArrayField's working
in final-form.

CORL-645

* Disable the other trigger checkboxes when "All Comments" is checked

CORL-645

* Clean up the formatting of Slack messages

CORL-645

* Add error handling around sending comments to Slack

CORL-645

* Add links to external Slack setup documentation

CORL-645

* Replace form state with wrapped field element

CORL-645

* Clean up fetch request sending Slack notifications

CORL-645

* Prefer global string replacement over RegEx

CORL-645

* Use URL class to construct comment URL's

CORL-645

* Require slack configuration in schema

CORL-645

* Initialize Slack in fixtures

Also fix up a flaky test that wasn't waiting
on form submission and on-change events.

CORL-645

* Preliminarily fix up styles to match other config pages

CORL-645

* Create placeholder add/remove buttons

* Convert SlackConfigContainer to FunctionalComponent

CORL-645

* Add name field to slack channels

CORL-645

* Disable inner fields on Slack channel when not enabled

CORL-645

* Improve the delete channel button

CORL-645

* Use pureMerge to extract slack channel settings

CORL-645

* Do a bit of cleanup on the add channel button

CORL-645

* Update the styling of the Slack config

- Use sub header for channel headings
- Update add channel button text
- Move the remove channel button down
- Other minor spacing tweaks

CORL-645
2019-12-09 16:29:57 -05:00
Tessa Thornton f60fac651b use correct timestamp component (#2747) 2019-12-09 16:20:24 -05:00
Tessa Thornton 514a549a77 update markers to make sure they're legible (#2745) 2019-12-09 16:11:12 -05:00
Wyatt Johnson 88f6cad840 fix: resolved issue with incorrect moderation url being generated (#2743) 2019-12-06 18:46:54 +00:00
Vinh 7615dc2aaf [CORL-720] Integratejest-axe (#2741)
* feat: axe checks for tests

* test: add another axe check

* fix: tests
2019-12-05 16:44:16 -05:00
Wyatt Johnson 51bfde8cf8 feat: added toxicity multi-language support (#2737) 2019-12-05 13:17:07 -05:00
Wyatt Johnson 5ebc39a2e1 chore: bump 5.4.0 (#2742) 2019-12-03 22:12:30 +00:00
Nick Funk d5020efa70 [CORL-758] Show new comments in stream when sorting by oldest (#2740)
* Handle comment insertion in stream when sort by oldest

Push the comment to the end of current cursored
comment stream so it shows up.

CORL-758

* Make commenstOrderBy a client only mutation parameter

CORL-758

* fix: addressed linting issue
2019-12-03 21:57:41 +00:00
Wyatt Johnson a396efef0d Security Headers (#2736)
* feat: added more security headers

* fix: added option to disable forcing SSL

* fix: linting
2019-12-03 21:47:36 +00:00
Tessa Thornton 9618e5dab1 show a message to user if comment is rejected on submission (#2733) 2019-12-03 21:35:57 +00:00
Nick Funk 54296fa484 [CORL-645] Add Slack support for v5 (#2713)
* Create preliminary schema for setting Slack channels

CORL-645

* Implement preliminary slack notification using tenant slack channels

CORL-645

* Very preliminarily get data loading with FieldArray's for slack channels

CORL-645

* Update settings input on schema to allow saving Slack settings to tenant

CORL-645

* Filter off UNMODERATED queue events from slack channels

We don't send these to slack through our filters, we only care
about pending, reported, and featured

CORL-645

* Include a moderation link in comments pushed to Slack

CORL-645

* Hook up proper callback functions for adding/removing slack channels

CORL-645

* Add missing translation for Slack navigation item

CORL-645

* Update snapshots for preliminary Slack configuration changes

CORL-645

* Add some FormField wrappers around slack config elements

Makes the UI appear a little nicer

CORL-645

* Set up slack config to only provide one slack channel

We need to do this until we can get ArrayField's working
in final-form.

CORL-645

* Disable the other trigger checkboxes when "All Comments" is checked

CORL-645

* Clean up the formatting of Slack messages

CORL-645

* Add error handling around sending comments to Slack

CORL-645

* Add links to external Slack setup documentation

CORL-645

* Replace form state with wrapped field element

CORL-645

* Clean up fetch request sending Slack notifications

CORL-645

* Prefer global string replacement over RegEx

CORL-645

* Use URL class to construct comment URL's

CORL-645

* Require slack configuration in schema

CORL-645

* Initialize Slack in fixtures

Also fix up a flaky test that wasn't waiting
on form submission and on-change events.

CORL-645

* Preliminarily fix up styles to match other config pages

CORL-645

* Create placeholder add/remove buttons

* Convert SlackConfigContainer to FunctionalComponent

CORL-645

* Add name field to slack channels

CORL-645

* Disable inner fields on Slack channel when not enabled

CORL-645

* Improve the delete channel button

CORL-645

* Use pureMerge to extract slack channel settings

CORL-645

* Do a bit of cleanup on the add channel button

CORL-645
2019-12-03 16:06:38 -05:00
Tessa Thornton c109188efe better unsaved changes error message (#2734) 2019-12-02 19:03:10 -05:00
Dzarr 08ead49629 adding french translations to all of src/locales files (#2720)
* adding french translations to all of src/locales files

* Fix formatting and update snapshots

* Update snapshots
2019-12-02 18:11:03 -05:00
Vinh bc27d7fbec [CORL-729] Upgrade Final Form & improve tests (#2735)
* CORL-729 Upgrade final form, fix and improve tests

This is a squashed rebase from these commits:
a300b31c23ab11e5e6f0668bc03ece7697360aaa feat: error on optimisic response warnings during test
dd8a9776865ec41d346e23ae0743d0d4fb0caa21 fix: turn off @typescript-eslint/prefer-regexp-exec rule
b995daacf1722cace60d755e672cb6a3a20d6bc2 feat: mute false warnings in test
e44f9e28307cd63a82c1fb7ac013667dd7b7bc46 fix: wrap remaining tests with act
afbd4329b97f3dbc9f873ea4ff234d98bb651ccf feat: fail when act(async () => ...) without await warnings
51dfb60b7d75411ba2e1a28db33f4aba5cf84de1 feat: fail tests with act warnings
97f93546ed8113e207882411eb4cdb7675b0796c fix: mock window.resizeTo globally in tests
850958b8c4d2fc0aca67ae580296433af223f8ab fix: more tests with act
24c05ab88e9a416e4962acc3f20f2c764ba07657 fix: wrap charCountEditComment test in acts
ed590b82d147470bba74055dc682e6b70d2e76fb fix signInWithEmail
4a2b9402cb6ce9565d99ae1a950eaa422ff603c3 fix: PostCommentFormContainer
815ebe6ef364d954d4bd0a35495934c9d014170b fix: use final form initialize instead of reset and remove obsolete
d3101f2112ed3ffe8d06609620e31e6655d2cf6d Merge branch 'feature/CORL-729-final-form' of https://github.com/coralproject/talk into feature/CORL-729-final-form
a0658da610a5f39b6fae78ffb8dd291b22d54e50 fix: addEmailAddress
60f7fc99a44dfa49dfd401a0ef49c60973b3e8e3 fix: use proper act pattern in renderConfigure.spec.tsx
d66bdfc2245c2b1ee03a1b3a3a56f1d5ba14ddc4 Stop propagation of Modal content click events (#2706)
ec6689594136e22a5b9f05ea284162702dc4955d fix: use proper act pattern in createUsername.spec.tsx
ef239496964a5f9a91ee1c4424ad81537c4f47fe fix: stream configuration
c7e06a0c6aef6b299c41392af81f8a20855028bf fix: user proper act pattern in streamConfiguration
9712e659e394a898500ed649464ff14d4870e589 Merge branch 'feature/CORL-729-final-form' of https://github.com/coralproject/talk into feature/CORL-729-final-form
9e5cfbaf3593615b457055de23f187fa07edd4c4 fix: signIn test
99b44a4a1bbb7ff2cd44c6821ad33b80f90c4a99 fix: user proper act pattern in stories.spec.tsx
ed7c1a92f93ab9aaa85ff92837b0ed21560cb358 fix: user proper act pattern in addEmailAddress
a04b392cb2148b9a24791b062027796c409d053e fix: remove obsolete snapshots
59df67c0f9b9d26c74e2cca7d333f5868b0b202d fix: signUp test
7656f179df95b4cd96b37afbc88a1c3a2944fdf4 fix: use proper act pattern on createPassword
85246fbf1f9ab49ad3a09c11ab79bf537059b548 fix: use correct act() pattern in createUsername.spec.tsx
d5239373a2d1bbed0bfe8c1ca62ef6a70ef5c7d9 fix: the correct way to use act on form submit :-)
d84ecd168354f4acb422a5ddb725fb8faf9c3184 fix: moderation test
d8df62ab1a6486144684ff917c47e6e375ffbe03 fix: reportComment test
2756e3184bb292168e8d34e201f340c3799941e6 fix: auth tests
a28695dbdd313a7bc3dade9ac1f92d6ef0061526 Properly handle final-form actions in tests
2fafc8ea3458c5b15b66f3d65f0947672dd1a516 Update snapshots now that final form isn't overwriting props
1f9bbaec8678a7653124898ba4a2e84ddc1ef243 fix: prevent final form from overwriting field props
f6c66c003d1917db2dcb3f757e8a303266c381fa fix: prevent final form fields overwrite out props
48d1fc7318ee4ba7bf72839127e9a0b1487c1729 chore: rename translation string
728373da5728a4e7c039bd0c3a3cf0037e9f5177 fix: purge relay metadata from request
7cdea925087a6b9b6e318bbb1b31b798be87dc2f fix: radiobuttons
9735bae79222219a81a28d458976a596201b650b chore: revert obsolete checks
0b556e1693584430a5814e81d87b0f233efd1a30 fix: refactor admin configure
b245afc7b196035bcb454e031c966e63c77ce522 fix: implement withForm HOC
5787400051211f5d2e1773d7207f32b66b02a2a1 Update the Configure page form state to properly load form values
8c2af3e22a96a3d2e50e7f06fb45d1fb79cf0c8e Replace form.reset() with setTimeout(form.reset)
27d9c90e3f0166cc2db45db461619be15a3cb950 Update radio buttons and on/off fields to work with final-form updates
b852dd14af85b14ff8e0d2823e1e83bf278b29b9 Replace any on OnSubmit with typed form submission interfaces
f049a70aaf4872825ac3b2aa62dc5cb7f945290a (f) Preliminarily get Coral compiling with latest final-form libraries

* feat: act is now actAndReturn

* fix: print original filename and line number in custom console impl

* feat: trace process warnings

* fix: server warnings about potentially memory leak with too many listeners
2019-12-03 01:07:50 +07:00
Tessa Thornton 4ee8cf7c96 new admin branding (#2692)
* add comment revisions

* add strings

* update fixtures

* fix fixtures

* [CORL-629] Update admin moderation containers to use new branding tokens (#2600)

* Convert the moderation card components to use new styles

CORL-629

* Style the details area in the moderate card using new font and color styles

CORL-629

* Update FlagDetails on Moderate Card to match new branding styles

CORL-629

* Remove typography from ModerateCard Username

CORL-629

* Remove unnecessary new typography tokens created while experimenting

CORL-629

* Update background colors of username buttons on moderate card

CORL-629

* Update approve reject buttons to use new colors

CORL-629

* Fix alignment of username and "Reply to" in InReplyTo component

CORL-629

* Update moderated by on moderate card to match new branding

CORL-629

* Create distinct admin marker and counter components with new branding styles

Update moderate card components to use these distinct newly branded styles.

CORL-629

* Create independent Tabs control with new styling for admin area

Use it on the moderate card details area.

CORL-629

* Remove letter spacing from moderate card styles

CORL-629

* Update "DETAILS" tab on moderate card to be named "INFO"

CORL-629

* Update some missing v2 css variables

CORL-629

* Tweak the spacing of the COMMENT link and title on the moderate card

CORL-629

* Update details font color on moderate card

CORL-629

* Update spacing on newly styled Admin Tab component

CORL-629

* Update spacing of reply to username on the moderate card

CORL-629

* Update moderate card comment text area minimum width and height

CORL-629

* Update vertical divider on moderate card to updated branding

CORL-629

* Introduce new bold open sans font face

Downgrades all existing bold's to semi-bold as they were equivalent before.

CORL-629

* Update moderate card details tabs to use new bold open sans font

CORL-629

* Create an admin specific timestamp control that implements new branding

CORL-629

* Migrate shared moderate card styles into child component files

CORL-629

* [CORL-631] Update admin side main navigation to new branding styles (#2625)

* Convert the moderation card components to use new styles

CORL-629

* Style the details area in the moderate card using new font and color styles

CORL-629

* Update FlagDetails on Moderate Card to match new branding styles

CORL-629

* Remove typography from ModerateCard Username

CORL-629

* Remove unnecessary new typography tokens created while experimenting

CORL-629

* Update background colors of username buttons on moderate card

CORL-629

* Update approve reject buttons to use new colors

CORL-629

* Fix alignment of username and "Reply to" in InReplyTo component

CORL-629

* Update moderated by on moderate card to match new branding

CORL-629

* Create distinct admin marker and counter components with new branding styles

Update moderate card components to use these distinct newly branded styles.

CORL-629

* Create independent Tabs control with new styling for admin area

Use it on the moderate card details area.

CORL-629

* Remove letter spacing from moderate card styles

CORL-629

* Update "DETAILS" tab on moderate card to be named "INFO"

CORL-629

* Update some missing v2 css variables

CORL-629

* Tweak the spacing of the COMMENT link and title on the moderate card

CORL-629

* Update details font color on moderate card

CORL-629

* Update spacing on newly styled Admin Tab component

CORL-629

* Update spacing of reply to username on the moderate card

CORL-629

* Update moderate card comment text area minimum width and height

CORL-629

* Update vertical divider on moderate card to updated branding

CORL-629

* Introduce new bold open sans font face

Downgrades all existing bold's to semi-bold as they were equivalent before.

CORL-629

* Update moderate card details tabs to use new bold open sans font

CORL-629

* Create an admin specific timestamp control that implements new branding

CORL-629

* Migrate shared moderate card styles into child component files

CORL-629

* Update main navigation admin side to use new branding styles

CORL-631

* Bring in some preliminary color and font styles for the search bar

This helps it match navigation, but does not update all the sub-styles of
the search bar's many child components.

CORL-631

* [CORL-694] use new styles for decision history (#2644)

* use new styles for decision history

* remove reference to nonexistent variable

* update snaps

* [CORL 695] admin branding - user menu (#2650)

* update user menu, popover, and dropdown to new design tokens

* fix feature button colours

* use v2 spacing vars

* admin branding: tables (#2651)

* update user menu, popover, and dropdown to new design tokens

* fix feature button colours

* use v2 spacing vars

* style stories and users table

* update snap

* update user status font weight

* remove duplicate declaration

* fix line height references

* update design tokens for text inputs and selects (#2658)

* use box shadow instead of outline for focus states

* Update snapshots to adjust for resolved merge conflicts

* Bring new branding styles to button components (#2667)

* Create preliminary filled and outline buttons that match branding

* Add adornment button variant to newly branded button

* Add the ghost variant to the newly branded button component

* Add underlined variant to the newly branded button component

* Remove external Icon composes property

* Convert camel-case button variables to kebab-case

* [CORL-672] Configuration pages new branding (#2673)

* style config side nav

* general configuration tab branding

* organization tab branding

* moderation configuration branding

* banned/suspect words config branding

* email config branding

* advanced settings branding

* auth config branding

* move helpertext and fieldset components

* add textarea component

* add back gutters on table search

* update snaps

* fix header component to accept labels

* use new spacing form components

* use spacing components for advanced config

* fix tests

* fix line height of radio buttons

* update validation message branding

* update snaps

* fix paths casing

* try lowercase then

* add docs for new form components

* move description component

* update snaps

* move components to /ui/v2

* [CORL-673] Update the moderate area search menu to use new branding styles (#2672)

* Create preliminary filled and outline buttons that match branding

* Add adornment button variant to newly branded button

* Add the ghost variant to the newly branded button component

* Add underlined variant to the newly branded button component

* Remove external Icon composes property

* Convert camel-case button variables to kebab-case

* Preliminarily migrate raw components into v2 to prep for branding updates

CORL-673

* Preliminarily update the search results bar to use new branding tokens

CORL-673

* Update styles to new branding on migrated v2 client-ui components

CORL-673

* Update see all and moderate all search option icons

CORL-673

* style config side nav

* general configuration tab branding

* organization tab branding

* moderation configuration branding

* banned/suspect words config branding

* email config branding

* advanced settings branding

* auth config branding

* move helpertext and fieldset components

* add textarea component

* add back gutters on table search

* update snaps

* fix header component to accept labels

* use new spacing form components

* use spacing components for advanced config

* fix tests

* fix line height of radio buttons

* update validation message branding

* update snaps

* fix paths casing

* try lowercase then

* add docs for new form components

* move description component

* update snaps

* move components to /ui/v2

* Set size="md" on the Icon component and not the Localized component

CORL-673

* tag component

* [CORL-669] user drawer + misc branding (#2686)

* tag component

* top of user drawer branding

* recent history in drawer

* add tooltips component

* use correct spacing prop

* history tabs

* user history and rejected comments

* move callout component'

* moderator notes components

* account history table

* table user row

* swap in tabs components

* remove overflow:hidden on buttons

* update snaps

* replace overflow scroll with auto

* clean up from rebasing vs master

* fix ts

* sort exports

* fix confusing linting errors

* update snaps

* clean up nav bar design

* adjust nav hover colors

* comment content component

* update nav hover styles

* fix search bar border

* clean up moderate card components

* more user drawer cleanup

* user role switcher

* update textfield vars and variants

* update components in community page

* move clickoutside component

* clean up stories table

* moderate route components

* single moderate view

* queue components

* delay component

* relative time component

* decision history components

* user drawer components cleanup

* configure components

* clean up buttons

* update snaps

* add all exports

* [CORL-674] admin branding: modals (#2695)

* update hotkeys modal components

* hotkeys modal

* user status change modals

* user status change modals

* invite users modal

* fix tests

* fix incorrect i18n string

* resolve merge conflicts

* move fonts to devdeps

* Fix username props interface

* fix dom nesting in components

* update formatting in strings

* rewrite delay component as functional component

* remove tslint comments

* change configure header component props
2019-11-26 11:26:53 -05:00
Tessa ThorntonandWyatt Johnson 0e15bc46d2 [CORL-353] show error if network request fails (#2731)
* show error if network request fails

* remove commented code

* Update src/core/client/admin/routes/AuthCheck/NetworkError.tsx

Co-Authored-By: Wyatt Johnson <wyattjoh@gmail.com>

* spell occurred correctly
2019-11-26 15:46:56 +00:00
Tessa Thornton 9bc41ad020 [CORL-575] allow line breaks in stream tabs (#2726)
* allow line breaks in stream tabs

* update snaps

* fix specs

* rearrange stream tabs for better mutliline support
2019-11-26 10:01:05 -05:00
Nick Funk f1cdcb149b [CORL-625] Create link details in the moderation card details tabs (#2721)
* Create link details in the moderation card details tabs

CORL-625

* Use getURLWithCommentID and getLocationOrigin to generate URLs

CORL-625
2019-11-22 23:50:52 +00:00
Wyatt Johnson bf89fc2b3e [chore] NodeJS 12 (#2722)
* chore: upgraded node 12, more log lines

- upgraded from 10 LTS to 12 LTS
- added log line with userID to GraphQL
  log entry

* fix: adjusted some intl formats
2019-11-22 22:46:16 +00:00
Vinh 7c2e56b751 [CORL-719] A11y runtime checks using react-axe (#2725)
* feature: use react-axe and fix some a11y issues in stream

* fix: adapt snapshots

* chore: fix axe warnings in auth and account bundle

* chore: improve accessibility in install bundle

* chore: add some comments
2019-11-22 19:10:51 +00:00
Vinh 4542dbdb43 feat: hide deprecated events behind a flag (#2728) 2019-11-22 18:48:33 +00:00
Wyatt Johnson 787f1c68e7 fix: introduced scraper timeout (#2724)
- fixes #2716
2019-11-22 18:16:41 +00:00
Tessa Thornton 09cf8c5490 [CORL-732] allow navigation via j/k in single comment view (#2712)
* allow navigation via j/k in single comment view

* update snaps
2019-11-22 17:59:46 +00:00
Wyatt Johnson ddedf4dc7e [CORL-797] Moderate this stream (#2729)
* feat: added moderate this stream button

* fix: removed origin

* fix: revised based on feedback from design
2019-11-22 17:50:09 +00:00
Vinh ca811a3496 Bring back deprecated events temporarily (#2727)
* fix: bring back deprecated events

* chore: update version number
2019-11-21 20:04:42 +00:00
Wyatt Johnson 10719bd874 [CORL-793] Scheduled Indexes (#2723)
* fix: modified digesting to use index

* fix: added index for deletion

* review: cleaning up

* review: fixed log copy
2019-11-21 17:24:09 +00:00
Wyatt Johnson bb23c80004 feat: generalized rate limiting for graphql (#2709) 2019-11-19 14:20:36 -07:00
Wyatt Johnson 2491445579 feat: improved logging (#2719) 2019-11-19 19:36:46 +00:00
Wyatt Johnson 3642c642d6 fix: fixed migration script bugs (#2718) 2019-11-19 19:18:28 +00:00
Wyatt Johnson fce7b08ca0 chore: version bump (#2717) 2019-11-18 23:27:25 +00:00
Wyatt Johnson aa9dcb4e04 [CORL-750] SSO Migration Script Bug (#2715)
* fix: fixed bug with sso migration script

* feat: refactored sso schema

* fix: resolved issue with data race and migration/install ordering
2019-11-18 23:11:20 +00:00
Wyatt Johnson 9e9c016f4b fix: adjusted i18n keys (#2708) 2019-11-13 17:50:40 +00:00
Nick Funk 40b247350b [CORL-766] Update copy on SSO key regeneration and account deletion (#2707)
* Update acknowledgment copy for downloading user comment data

CORL-766

* Update copy for 30 day leniency on SSO tokens

CORL-766
2019-11-13 09:50:56 -07:00
Nick Funk 2945184b07 Stop propagation of Modal content click events (#2706)
This prevents the click event from propagating out to
the backdrop parent and auto-closing the modal on any
content click.

CORL-765
2019-11-13 11:00:55 -05:00
Wyatt Johnson a55472e086 fix: adjusted onsubmit handlers (#2705) 2019-11-13 10:42:32 -05:00
Wyatt Johnson 033433549a fix: fixed docs, graphql type (#2704) 2019-11-12 14:00:51 -05:00
Wyatt Johnson 2ef07429c2 fix: improvements to scraping (#2702)
- fixes #2690
2019-11-12 17:25:41 +00:00
Wyatt Johnson b83d737530 chore: version bump (#2700) 2019-11-08 17:00:41 -05:00
Vinh 18346d1683 [CORL-666] Viewer Events (#2681)
* feat: viewer event system

* feat: more events

* feat: MORE events

* fix: tests

* fix: rte focus events

* chore: add comments

* fix: remove listening to events

* chore: update RTE

* fix: tests

* feature: generate event docs

* fix: remove obsolete line in docs

* chore: improve docs

* chore: improve formatting

* feature: protect events.md from getting out of sync

* chore: small improvements

* fix: removing redundant lambda
2019-11-08 17:17:01 +00:00
Wyatt Johnson ce4a3408fc [CORL-628] CLI Support (#2646)
* feat: improved api for reloading tenants for cli

* fix: cleaned up merge beheviour

* feat: added support for stream/story edge

* feat: support tenant install

* fix: updated snapshot

* fix: fixed tests
2019-11-08 00:40:56 +00:00
Wyatt Johnson 2dbba52fbd feat: added initial server sso key rotation semantics (#2696) 2019-11-07 16:53:28 -05:00
Wyatt Johnson 59b8dfccda fix: improved search field serialization (#2697) 2019-11-07 16:45:57 -05:00
Wyatt Johnson 3394628f27 [CORL-744] Index Optimizations (#2694)
* fix: added comment moderation index

* fix: improved user indexing
2019-11-07 16:32:38 -05:00
Vinh 8ee74b7d24 [CORL-743] Fix sort menu on small screens (#2698)
* fix: sort menu on small screens

* chore: add comments
2019-11-07 15:32:49 -05:00
Vinh f85af8e88f [CORL-684] Fix scrolling bug in overflowing modal (#2682)
* fix: scrolling bug in overflowing modal

* fix: tests
2019-11-07 13:44:10 -05:00
Kim Gardner 9d6592feef Update PR template (#2685) 2019-11-01 14:00:04 -04:00
Kim Gardner 53c87118db Update Feature Request template (#2684) 2019-11-01 13:53:08 -04:00
Kim Gardner bdc9c5f05c Update Bug Report template (#2683) 2019-11-01 13:31:18 -04:00
Tessa Thornton e334c3266a update hotkeys legend to match implemented hotkeys (#2679) 2019-10-29 10:13:34 -04:00
Wyatt Johnson a31ee3bc96 Version Bumps (#2677)
* chore: upgraded versions

* chore: linting

* fix: updated snap
2019-10-28 23:45:21 +00:00
Wyatt Johnson a7eb757be7 fix: fixed issue with directive resolver (#2674) 2019-10-25 15:53:30 +00:00
Wyatt Johnson 4038fcbcd6 fix: handle redirection loop (#2662) 2019-10-24 17:15:53 +00:00
Wyatt Johnson 5714f441bb [CORL-735] Scraper support for JSON Linked Data (#2671)
* feat: add support for application/json+ld parsing

- upgraded scraper packages to use new jsonld parser
- waiting on https://github.com/microlinkhq/metascraper/pull/225
  for merging
- fixes #2670

* chore: metascraper upgrades
2019-10-24 16:08:15 +00:00
Wyatt Johnson ac96e5e312 chore: bump version (#2668) 2019-10-23 11:59:39 -04:00
Wyatt Johnson e91da1c9a3 fix: check if auth params exist in hash before clearing it (#2666) 2019-10-22 17:25:47 -04:00
Wyatt Johnson e816f8e019 fix: adjusted copy, added translation support (#2664) 2019-10-22 13:33:15 -04:00
Wyatt Johnson 121469ade5 feat: readme simplication (#2649) 2019-10-22 17:09:49 +00:00
Cristian Dean 1d6e9e38b0 pt-BR translation some missing phrases (#2661) 2019-10-22 10:04:49 -04:00
Wyatt Johnson 626d46d813 [CORL-726] Repeat Comment Fix (#2655)
* fix: strip tags when comparing for repeat

- share the stripped tag version of the comment
- share the logger to improve pipeline clarity

* fix: renamed variables based on review
2019-10-21 18:34:41 +00:00
Wyatt Johnson 24915be712 fix: repaired translation key name (#2657) 2019-10-21 17:15:52 +00:00
Tessa Thornton 044cbd39f1 Revert "ensure tab text doesn't get cut off if tab titles are long (#2619)" (#2654)
This reverts commit 8409dbb4ea.
2019-10-18 20:58:14 +00:00
Wyatt Johnson cd6a1db85b chore: version bump (#2653) 2019-10-18 19:08:57 +00:00
Wyatt Johnson 8bee5ae1f3 [CORL-721] SSO Logout Fix (#2652)
* fix: hide logout button when jti is undefined

* fix: improved local state init
2019-10-18 18:48:46 +00:00
Cristian Dean 153c910de7 Fix pt-BR moderate-comment-deleted-body translation (#2647) 2019-10-18 12:44:41 -04:00
Wyatt Johnson 990a70d6f9 [CORL-680] Persist Fragment Access Tokens in sessionStorage (#2643)
* feat: persist access tokens passed via fragment to sessionStorage

* fix: review comments
2019-10-18 16:08:43 +00:00
Allan Assis 9aa39bf842 Fix pt-BR translations (#2645) 2019-10-17 15:22:05 -04:00
Wyatt Johnson d169d3dd51 fix: allow unknown fields (#2640) 2019-10-16 18:52:33 -04:00
Wyatt Johnson b38a4f117b [CORL-667] Constraint Directive (#2641)
* feat: added constraints

* fix: fixes bug with index creation

- fixes #2612

* fix: added default resolver

* fix: added defaultTo to handle defaulting
2019-10-16 18:44:44 -04:00
Tessa Thornton ea71230b90 [CORL_653] throw error if inviting existing users (#2637)
* throw error if inviting existing users

* check for existing users before sending out any invites

* fix lints
2019-10-16 16:28:49 -04:00
Vinh 2dac5f29c1 Typescript-eslint bug with new or renamed files in IDE (#2642)
* fix: workaround for eslint typescript bug when creating or renaming files.

* fix: downgrade

* fix: do not lint during build

* fix: no need to permanently show eslint status in vscode.
2019-10-17 02:48:48 +07:00
Tessa Thornton 9df473178b [CORL-8] prevent repeat comments (#2632)
* prevent users from reposting the same comment

* fix tests

* fix lints

* update comments for users service

* make updates based on review
2019-10-16 15:51:34 +00:00
Tessa Thornton 1f7fdb0d00 change keyboard shortcuts for approve/reject (#2635) 2019-10-15 23:04:31 +00:00
Vinh 3bfcc509d2 [CORL-678] Transition to eslint (#2634)
* chore: setup eslint

* chore: tslint checks with types & check for import order

* chore: complete eslint transition

* fix: tests

* fix: linting after rebase, faster lint for lint-staged

* chore: remove line

* fix: lint rules

* feat: add a11y linter and fix errors

* fix: tests
2019-10-15 22:56:38 +00:00
Cristian Dean b0e0ba6633 Remove canChangeStatus condition (#2631) 2019-10-15 22:28:16 +00:00
Cristian Dean 0fbfdac846 Add CHANGE_STORY_STATUS permission to Moderators (#2630) 2019-10-15 22:16:08 +00:00
Wyatt Johnson 8d08382aea feat: skip username validation for SSO users (#2627) 2019-10-15 21:56:47 +00:00
Tessa Thornton 8409dbb4ea ensure tab text doesn't get cut off if tab titles are long (#2619) 2019-10-15 20:49:37 +00:00
Sami Safatli bae88f476e Fix Typo (#2629) 2019-10-09 11:07:28 -04:00
Wyatt Johnson 918ba10867 [CORL-681] Configurable Staff Badges (#2620)
* feat: added configurable staff badge

* fix: removed ambigous styles
2019-10-04 20:22:31 +00:00
Wyatt Johnson e7ab0b27f9 fix: fixed looping effect (#2626) 2019-10-04 19:53:14 +00:00
Wyatt Johnson 191687335b [CORL-682] OIDC Email and setEmail mutation (#2623)
* fix: make email optional for oidc, fix schema perms

- fixes #2622

* fix: adjust defaults for heroku
2019-10-04 17:00:25 +00:00
Tessa Thornton 33487be0ce [CORL-469] keyboard shortcuts (#2588)
* make comments selectable in queue

* manage focus

* switching focus works

* keyboard navigation sort of works

* scroll into view

* prev, next, approve, reject

* shortcuts for queue switching

* ban modal?

* focus search bar with ctrl f

* keyboards shortcuts modal

* zen mode

* single comment view

* ban users from moderate cards

* clean up ts and lints

* update snaps

* add strings

* update smaps

* remove single comment view shortcut

* add single comment view to moderation queue

* clean up types

* fix deps for useEffect/useCallback hooks

* feat: added toggable help
2019-10-03 23:22:24 +00:00
Sami Safatli e56793f2fb Updated email templates (#2621) 2019-10-03 20:28:28 +00:00
Wyatt Johnson 6fe4646755 [CORL-668] User Comment Rate Limiting (#2616)
* feat: added user comment rate limiting

* fix: change 30 second to 3 second

* fix: moved file

* fix: services cleanup

* fix: changes based on review
2019-10-03 19:33:52 +00:00
Tessa Thornton dd45f46b19 update email templates (#2615) 2019-10-03 17:03:03 +00:00
Tessa Thornton 4a1492e88d [CORL-90] moderator notes (#2601)
* add moderator notes and mutations

* add create moderator note mutation

* add components for moderator notes

* style moderator notes

* update styles

* prevent warning about optimistic update unused fields

* fix incorrect comment

* fix optimistic response shape

* fix create note payload type

* add migration for moderator notes

* updates from feedback

* add border width for firefox
2019-10-02 18:41:53 +00:00
Wyatt Johnson 3a4eae87ad [CORL-661] Encode Story ID (#2614)
* fix: encode story ID's for URL

* fix: use shared method
2019-10-02 16:21:49 +00:00
Tessa Thornton fa3d442b36 [CORL-624] add note about word list case-sensitivity (#2607)
* add note about word list case-sensitivity:

* fix: removed unused keys

* fix: removed unused components

* fix: linting and key fix
2019-10-01 22:24:56 +00:00
Tessa Thornton 6edb411175 [CORL-650] remove duplicate text in invite form (#2608)
* remove duplicate text in invite form

* fix: reused message key

- message change consituted a grammar change
  that wasn't reflected in other translated languages
2019-10-01 20:54:50 +00:00
Tessa Thornton 6dbc724f31 [CORL-619] update search results copy (#2606)
* update search results copy

* fix: removed unused messages
2019-10-01 20:43:50 +00:00
Cristian Dean d0df6bc849 Add missing translations pt-BR (#2604) 2019-10-01 19:37:25 +00:00
Vinh 808b355a27 [CORL-181] Comment Count Injection (#2581)
* feat: inject comment counts

* fix: tests

* feat: integrate stream embed with coral counts

* chore: refactor constants

* test: test for count bundle

* test: test live comment count integration with stream embed

* feat: use defer

* fix: snapshot

* feat: auto add count.js in when calling Coral.createStreamEmbed

* fix: tests

* fix: rm duplicate test

* chore: remove unuse file
2019-10-01 19:22:15 +00:00
Wyatt Johnson 53fa5f43e5 [CORL-325] Comment Search API (#2578)
* feat: added comment search support

* fix: updated readme

* Update README.md
2019-10-01 18:57:50 +00:00
Wyatt Johnson c045f52daa [CORL-649] Migrations (#2597)
* feat: added migration framework

* chore: added premod user status migration

* feat: enhanced error handling of migrations

* fix: added missing argument from abstract method

* fix: another templating blunder

* fix: removed debug code

* feat: enhanced migration tracking

* fix: remove skipping migrations

* feat: moved indexing to migration system

* fix: linting
2019-10-01 16:00:27 +00:00
Cristian Dean b3b26bd9f3 Remove X-Powered-By header (#2605) 2019-10-01 15:35:32 +00:00
Wyatt Johnson 0af2fec31b fix: include tenantID in query operation to improve index use (#2596) 2019-09-30 16:25:55 +00:00
Wyatt Johnson 139c1eb01f fix: fixed readme to reflect correct docker image tag (#2593) 2019-09-30 16:15:31 +00:00
Tessa Thornton 941a385d53 [CORL-51] show comment revisions (#2590)
* add comment revisions

* reverse history order

* add strings

* update fixtures

* fix fixtures
2019-09-30 09:18:34 -04:00
Tessa Thornton e61e62a238 [CORL-174] premod user (#2572)
* add types for setting user premod

* add types, fields, and mutations for user premod

* enforce premoderation on users marked premod

* add user premod to dropdown

* update specs

* fix tests

* update premod workflow to match v4

* allow user filtering by premod status

* add premod user history to account actions drawer

* update snaps

* fix permissions on new premod fields

* update strings

* fix tests

* clean up formatting and copy

* fix: nullable fixes pre-migration
2019-09-25 21:31:12 +00:00
Tessa Thornton a5c3e94751 [CORL-544] use react helmet to add favicon declarations to head (#2595)
* use react helmet to add favicon declarations to head

* rename adminHead to head

* fix: case
2019-09-25 20:22:32 +00:00
Wyatt Johnson 5c1eb57d3e chore: cleaned up package.json (#2591) 2019-09-24 19:54:05 +00:00
Wyatt Johnson 7b5b260a18 chore: version bump (#2589) 2019-09-24 18:08:05 +00:00
Kim Gardner 1c24060f94 Add no comments copy in danish (#2586) 2019-09-24 17:57:31 +00:00
Vinh 4e4986fc03 fix: some form fields are not nullable (#2577) 2019-09-23 21:36:24 +00:00
Cristian Dean 37e39ff8c5 Avoid compute metrics with 404 status code (#2587) 2019-09-23 21:26:47 +00:00
Wyatt Johnson fe2d78f1f7 [CORl-640] User Registration Race (#2583)
*  fix: fixes user registration endpoints

- fixes #2579

* feat: cleanup from review

- Added seperate create function
- Moved some validation around

* fix: linting
2019-09-23 21:11:16 +00:00
Kim Gardner 43844bca18 Danish translation fixes (#2582)
* Update da files for email and errors

* Update da translations

* Add errors translations
2019-09-23 15:03:44 -04:00
Wyatt Johnson 6fb772944c feat: expanded allowed characters in usernames to support accents (#2585) 2019-09-23 14:55:38 -04:00
Tessa Thornton b3064c89de [CORL-623] add live updates for comments moving from premod to approved (#2571)
* add live updates for comments moving from premod to approved

* rename disposables

* check if comment is system withheld as well as premod to publish event
2019-09-20 20:11:05 +00:00
Nick Funk e4bfbbc1f8 Update COMMENT_DETECTED_SPAM marker text to Spam Detected (#2576)
Since this is used by Akismet and other spam detection tools, this
wording matches what Wordpress users will expect when seeing comments
detected as spam.

CORL-395
2019-09-20 19:48:00 +00:00
Wyatt Johnson 25c7f89b31 [CORL-620] Persisted Query Improvements (#2567)
* fix: resolves #2566

* fix: improved retry logic
2019-09-19 18:49:57 +00:00
Wyatt Johnson 921461008e [CORL-621] Auth Fixes (#2569)
* fix: resolve error with redirects

- fixes #2529

* fix: apply validations to username for oidc

* fix: converted components to function components

* fix: snapshots
2019-09-18 14:01:06 -04:00
Wyatt Johnson 64f102e6d4 [CORL-540] Logging improvements (#2565)
* fix: enhanced errors around story creation

* feat: enhanced child loggers

* feat: logging enhancements
2019-09-18 13:07:42 -04:00
Nick Funk 741739bc16 Un-feature a comment when it is rejected (#2555)
Also decrements the featured count for the story if rejected using the
in-stream moderation.

CORL-554
2019-09-18 12:17:31 -04:00
Sami Safatli 2cc32d4332 Translation pt-BR (#2542) 2019-09-18 11:47:34 -04:00
Tessa Thornton 867f0993cc [CORL 581] toggleable timestamp (#2561)
* toggle between relative and absolute timestamps

* make one common timestamp component

* remove unused timestamp component from /admin
2019-09-17 17:11:52 -04:00
Nick Funk 24a27ca958 Show the viewer's username in "moderated by" on moderation cards (#2573)
If a mod is looking at a card they themselves moderated, we want their
username to show up under "moderated by". This helps them recognize cards
they themselves moderated.

CORL-615
2019-09-17 10:59:03 -06:00
Nick Funk d03b180a30 Set createdAt in optimistic response during SuspendUserMutation steps (#2575)
CORL-616
2019-09-17 09:51:43 -06:00
Tessa Thornton 72ef65577b [CORL-605] remove user agent margin on safari search bar (#2559)
* remove user agent padding on safari search bar

* remove margin on other text fields too

* add margin reset to TextField
2019-09-13 20:29:01 +00:00
Tessa Thornton 8ef366f132 move toxic comment detection ahead of recent history in moderation pipeline (#2562) 2019-09-13 20:21:23 +00:00
Tessa Thornton 3114727410 [CORL-606] fix incorrect translation string (#2560)
* fix incorrect translation string

* update snap
2019-09-12 16:59:22 +00:00
Tessa Thornton a89dc4675a [CORL-516] forgot password flow in admin (#2558)
* add forgot password page and link to admin

* add translations

* update snaps

* fix: install patch

* fix: adapted localizations

* fix: added email type to email field

* fix: updated snapshots
2019-09-12 16:30:19 +00:00
Vinh 2559d1c0e8 fix: turn off bidi characters in favor of <bidi> tags (#2557) 2019-09-12 16:10:17 +00:00
Tessa Thornton ea3c1e3b58 fix safari user drawer display bugs (#2554) 2019-09-12 16:01:58 +00:00
Wyatt Johnson 457644c45b fix: fixed heroku install button (#2551) 2019-09-10 19:40:18 +00:00
Nick Funk 1b9a72c2f0 Show text field selection border on Firefox (#2550)
CORL-515
2019-09-10 19:28:03 +00:00
dependabot[bot] 47834a82bb chore(deps): bump lodash.merge from 4.6.1 to 4.6.2 (#2549)
Bumps [lodash.merge](https://github.com/lodash/lodash) from 4.6.1 to 4.6.2.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2019-09-10 16:14:30 +00:00
dependabot[bot] a8976a2141 chore(deps): bump lodash.template from 4.4.0 to 4.5.0 (#2548)
Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2019-09-10 15:57:40 +00:00
dependabot[bot] 718bd2758f chore(deps-dev): bump lodash-es from 4.17.11 to 4.17.14 (#2547)
Bumps [lodash-es](https://github.com/lodash/lodash) from 4.17.11 to 4.17.14.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.14)

Signed-off-by: dependabot[bot] <support@github.com>
2019-09-10 15:46:26 +00:00
Kim Gardner 721b2e7d67 [CORL-527] English copy tweaks (#2546)
* English copy tweaks

* fix: unit tests

* Use reactions to be more general

* fix: snapshots
2019-09-10 20:55:34 +07:00
Nick Funk f9e1bf144e [CORL-523] Document GraphQL mutations for managing accounts (#2544)
* Create preliminary endpoint for updating user names via API

CORL-523

* Create preliminary endpoint for updating user emails via API

CORL-523

* Create preliminary endpoint for deleting users via the API

CORL-523

* Hook up the delete, update email, and update user name endpoints

CORL-523

* Update readme to include preliminary GDPR endpoint instructions

CORL-523

* Uncomment limiters on updateEmail endpoint

My mistake leaving these commented while testing, should not have been committed.

CORL-523

* Run DocToc on the README to generate table of contents

CORL-523

* feat: enhanced documentation on account management edges

* fix: prevent double delete of user account

* fix: swapped order of params

* Update README.md

* Update README.md

* fix: remove unknown field title

* fix: remove unknown field title on story
2019-09-10 20:16:40 +07:00
Tessa Thornton e86e9d2c68 [CORL-586] update logos to match new branding (#2540)
* update logos to match new branding

* update styles of logo

* move version number to bottom of admin

* update specs
2019-09-10 09:02:35 -04:00
Kim Gardner d031df38f6 Add new da translations (#2543) 2019-09-10 10:27:53 +00:00
Nick Funk 8d368b03ec Add call out placeholder for comment stream empty state (#2545)
CORL-567
2019-09-10 10:18:36 +00:00
Tessa Thornton 3e64aa1193 [CORL-591] add reactions to my comments history (#2541)
* add reactions to my comments history

* remove unused field

* fix lanaguage for reactions
2019-09-10 09:52:05 +00:00
Tessa Thornton f84c3e4a60 [CORL-595] move notification settings update button (#2538)
* move notification settings update button

* move settings save button

* fix: version bump in package lock file
2019-09-10 08:13:14 +00:00
Tessa Thornton 36225e443b [CORL-556] Allow session length configuration (#2530)
* make session duration configurable by tenant

* fix expiration date calculation

* add form field for session length

* use constant for default session

* update spec

* update fixtures

* add missing translation

* update snap

* fix: use shared variable instead of hardcoded value for tests

* fix: adjusted missing expires in parameter
2019-09-10 08:06:07 +00:00
Tessa Thornton ed8be75774 fix styling on radio inputs for long labels (#2539) 2019-09-09 12:06:25 -04:00
Tessa Thornton f8cf4e94d3 change button style for change username box (#2537)
* change button style for change username box

* fix lints
2019-09-09 11:53:28 -04:00
Tessa Thornton 1a69f48087 show cancel button for ignore commenters config (#2536) 2019-09-09 11:39:55 -04:00
Nick Funk e0ab799c84 Add hover state to navigation links in Admin > Config (#2533) 2019-09-09 09:03:30 -06:00
Nick Funk aa8e1e2d7a [CORL-560] Update Admin > Config area to match new designs (#2514)
* Add solid background to Moderate > Config area headers

CORL-560

* Update Config > General section text and font weight

CORL-560

* Update ordering of Config > Moderation page items

CORL-560

* Update text and font weights in Configure > Moderation page

CORL-560

* Update text and font weight on Configure > Organization page

CORL-560

* Update text and font weight on Configure > Banned and Suspect Words page

CORL-560

* Update text and font weight on Configure > Authentication page

CORL-560

* Update text and font weights on Configure > Email page

CORL-560

* Update text and font weights on Configure > Advanced page

CORL-560

* Repair tests around the styling changes made to the moderation config area

CORL-560

* Fix capitalization on the Config > General page

CORL-560

* Make email checkbox light themed so its text shows up on new headers

CORL-560

* Update Header width to account for padding

Prevents it from sticking out over the edge of the page layout

CORL-560

* Align "Sort by" text to the drop down in Admin > Config > General > Reactions

CORL-560

* Update Admin > Config > General snapshot to adjust for vertical aligned text

Vertical flex aligned the "Sort by" text to a combo box in a previous changed

CORL-560

* Rename "Perspective Toxic Comment Filter" header to "Toxic Comment Filter"

CORL-560

* Use overlay scrolling if available to prevent scroll bar width popping

CORL-560

* Remove overflow-y: overlay

CORL-560

* Rename Akismet Spam Detection to Spam Detection

CORL-560

* Make all non-complex text fields full width in Admin > Config

CORL-560

* Remove Authentication Integrations header

Area underneath was empty

CORL-560

* Re-arrange SSO Key Field layout

CORL-560

* Create new typography types for bodyShort and fieldDescription

CORL-560

* Update Admin > Config to use bodyShort, fieldDescription typography

CORL-560

* Add a slight padding on InputLabel

CORL-560

* Add padding on either side of Admin > Config section content

CORL-560
2019-09-06 12:29:27 -06:00
Tessa Thornton d2af78d3d7 [CORL 568] more user drawer links (#2532)
* add drawer links for in reply to and moderated by

* fix ts

* update spec
2019-09-06 14:01:19 -04:00
Tessa Thornton 9bd38db61a allow organization url config (#2531) 2019-09-06 13:52:48 -04:00
Tessa Thornton ac203607ae [CORL-561, CORL-562] Comment stream and account profile styling cleanup (#2517)
* update styles for comment stream

* more comment styling fixes

* reconfigure settings tab and account settings in stream

* add new button variant

* style settings tab

* style change username/email/password

* clean up settings tab

* integrate account deletion to account settings

* update comment history styles

* more history comment styles

* update snaps

* move userbox

* fix tests

* fix delete account tests

* update message box styling

* update snap

* update snaps

* fix lints

* update snaps again

* userbox styles

* history comment styling

* update snaps

* fix ts

* Integrate notifications settings

* clean up account setting styles

* update snaps and tests

* fix lints

* fix: PENDING_DELETION permissions

* chore: sync stable classnames, rename settings to account

* simplify css

* update snaps
2019-09-06 13:41:55 -04:00
Nick Funk e49905c5ad [CORL-571] Filter empty strings from banned and suspect word lists (#2521)
* Filter empty strings from banned and suspect word lists

CORL-571

* fix: changed form
2019-09-05 21:36:09 +00:00
Kim Gardner 15d41f1ae8 Typo fixes and bump Coral version to 5.0.0 (#2528)
* Typo fixes and bump package version

* fix: tests
2019-09-05 17:15:40 -04:00
Wyatt Johnson 60a1f43d51 fix: wrap queries in quotes (#2527) 2019-09-05 18:06:12 +00:00
Wyatt Johnson 3c9ebcf1a1 feat: added moderation email notifications (#2525) 2019-09-05 17:33:49 +00:00
Wyatt Johnson e35978096f feat: added featured comment notifications (#2524) 2019-09-05 17:10:03 +00:00
Wyatt Johnson 04c56b3fb5 [CORL-406] Tenant Locale Selection (#2450)
* feat: added preload config

* feat: support changing locale

* fix: name case

* fix: removed unused code

* feat: added translations for default reactions

* fix: do not translate icon

* fix: shorter i18n keys
2019-09-05 17:02:06 +00:00
Tessa Thornton 5bf4f22931 [CORL-392] add settings config for story configuration on advanced panel (#2499)
* add settings config for story configuration on advanced panel

* include external link in proxy description

* update copy

* update copy

* fix lints

* update snap
2019-09-05 11:35:16 -04:00
Tessa Thornton 1550377f39 update durationfield component to not use lifecycle methods (#2502)
* update durationfield component to not use lifecycle methods

* fix: default param cleanup
2019-09-05 09:51:51 -04:00
Wyatt Johnson efea0e8e1c [CORL-498, CORL-495, CORL-539, CORL-496, CORL-494] Email Notifications Support & Framework (#2498)
* chore: renamed old templates

* feat: initial notifications support

* feat: email enhancements

* fix: linting

* feat: initial digesting beheviour

* feat: added notification configuration

* feat: added unsubscribe routes

* fix: fixed failing snapshots/tests bc random ids

* feat: adjusted the save beheviour, added tests

* feat: added tests

* feat: added staff replies

* feat: renamed E-Mail to Email

* feat: enhanced cron processing

* fix: linting + updating tests

* feat: enhanced cron context

* fix: added staff replies back in
2019-09-05 07:02:26 +00:00
2933 changed files with 161474 additions and 74509 deletions
+1
View File
@@ -0,0 +1 @@
src/docs/architecture/decisions
+19 -13
View File
@@ -1,19 +1,19 @@
# job_environment will setup the environment for any job being executed.
job_environment: &job_environment
NODE_ENV: test
WEBPACK_MAX_CORES: 4
NODE_OPTIONS: --max-old-space-size=8192
NODE_ENV: "test"
WEBPACK_MAX_CORES: "4"
NODE_OPTIONS: "--max-old-space-size=8192"
# job_defaults applies all the defaults for each job.
job_defaults: &job_defaults
working_directory: ~/coralproject/talk
resource_class: large
docker:
- image: circleci/node:10
- image: circleci/node:12
environment:
<<: *job_environment
version: 2
version: 2.1
jobs:
# npm_dependencies will install the dependencies used by all other steps.
npm_dependencies:
@@ -49,7 +49,8 @@ jobs:
- ~/.npm
- persist_to_workspace:
root: .
paths: node_modules
paths:
- node_modules
# lint will perform file linting.
lint:
@@ -65,18 +66,20 @@ jobs:
name: Lint Source Code
command: npm run lint
- run:
name: Lint README.md
name: Lint Markdown
command: |
cp README.md README.md.orig
npm run doctoc
diff -q README.md README.md.orig
git diff --exit-code
- run:
name: Lint Versions
command: npx @coralproject/package-version-lint
# unit_tests will run the unit tests.
unit_tests:
<<: *job_defaults
environment:
<<: *job_environment
CI: true
CI: "true"
JEST_JUNIT_OUTPUT: "reports/junit/js-test-results.xml"
steps:
- checkout
@@ -113,14 +116,15 @@ jobs:
no_output_timeout: 30m
- run:
name: Verify Bundle Size
command: npx bundlesize
command: npx bundlesize2 --enable-github-checks
- save_cache:
key: v1-build-cache-{{ .Branch }}-{{ .Revision }}
paths:
- ./dist
- persist_to_workspace:
root: .
paths: dist
paths:
- dist
# docker_tests will test that the docker build process completes.
docker_tests:
@@ -142,6 +146,9 @@ jobs:
<<: *job_defaults
steps:
- checkout
- run:
name: Verify release version
command: npx @coralproject/package-version-lint --expect ${CIRCLE_TAG/#v}
- setup_remote_docker
- deploy:
name: Deploy the code
@@ -168,7 +175,6 @@ filter_develop: &filter_develop
- next
workflows:
version: 2
build-test:
jobs:
- docker_tests:
-1
View File
@@ -27,4 +27,3 @@ yarn.lock
dist
*.css.d.ts
__generated__
README.md.orig
+3
View File
@@ -0,0 +1,3 @@
*.d.ts
*.graphql.ts
**/__generated__/**
+240
View File
@@ -0,0 +1,240 @@
const typescriptEslintRecommended = require("@typescript-eslint/eslint-plugin/dist/configs/eslint-recommended")
.overrides[0];
const typescriptRecommended = require("@typescript-eslint/eslint-plugin/dist/configs/recommended.js");
const typescriptRecommendedTypeChecking = require("@typescript-eslint/eslint-plugin/dist/configs/recommended-requiring-type-checking.js");
const typescriptEslintPrettier = require("eslint-config-prettier/@typescript-eslint");
const react = require("eslint-plugin-react").configs.recommended;
const jsxA11y = require("eslint-plugin-jsx-a11y").configs.recommended;
const reactPrettier = require("eslint-config-prettier/react");
const typescriptOverrides = {
files: ["*.ts", "*.tsx"],
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
plugins: [
"@typescript-eslint",
"@typescript-eslint/tslint",
"react",
"jsx-a11y",
],
settings: {
react: {
version: "detect",
},
},
rules: Object.assign(
typescriptEslintRecommended.rules,
typescriptRecommended.rules,
typescriptEslintPrettier.rules,
react.rules,
jsxA11y.rules,
reactPrettier.rules,
{
"@typescript-eslint/adjacent-overload-signatures": "error",
// TODO: (cvle) change `readonly` param to `array-simple` when upgraded typescript.
"@typescript-eslint/array-type": [
"error",
{ default: "array-simple", readonly: "generic" },
],
"@typescript-eslint/ban-types": [
"error",
{
types: {
"{}": false,
object: false,
extendDefaults: true,
},
},
],
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
overrides: {
constructors: "off",
},
},
],
"@typescript-eslint/indent": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ args: "none", ignoreRestSiblings: true },
],
"@typescript-eslint/no-use-before-define": "off", // TODO: (cvle) Should be on?
"@typescript-eslint/no-use-before-declare": "off",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "off",
"@typescript-eslint/unified-signatures": "error",
// (cvle) disabled, because the way we use labels in our code cause to many
// false positives.
"jsx-a11y/label-has-associated-control": "off",
"react/display-name": "error",
"react/prop-types": "off",
"react/no-unescaped-entities": "off",
"no-empty-function": "off",
// (tessalt) disabled because video elements are only used to display gifs, which have no audio
"jsx-a11y/media-has-caption": "off",
}
),
};
const jestTypeCheckingOverrides = {
files: ["test/**/*.ts", "test/**/*.tsx"],
rules: {
"@typescript-eslint/no-floating-promises": "off",
},
};
const typescriptTypeCheckingOverrides = {
files: ["*.ts", "*.tsx"],
parserOptions: {
project: [
"./tsconfig.json",
"./src/tsconfig.json",
"./src/core/client/tsconfig.json",
],
// TODO: (cvle) this is a workaround, see: https://github.com/typescript-eslint/typescript-eslint/issues/1091.
createDefaultProgram: true,
},
rules: Object.assign(typescriptRecommendedTypeChecking.rules, {
"@typescript-eslint/tslint/config": [
"error",
{
rules: {
"ordered-imports": {
options: {
// Legacy sorting until this is fixed: https://github.com/SoominHan/import-sorter/issues/60
"import-sources-order": "case-insensitive-legacy",
"module-source-path": "full",
"named-imports-order": "case-insensitive-legacy",
},
},
},
},
],
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-return": "off",
// 28.11.19: (cvle) Disabled because behavior of regexp.exec seems different than str.match?
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/unbound-method": "off", // 10.10.19: (cvle) seems to give false positive.
}),
overrides: [jestTypeCheckingOverrides],
};
const jestOverrides = {
env: {
jest: true,
},
files: ["test/**/*.ts", "test/**/*.tsx"],
globals: {
expectAndFail: "readonly",
fail: "readonly",
},
};
// Setup the overrides.
const overrides = [jestOverrides, typescriptOverrides];
// Skip type information to make it faster!
if (process.env.FAST_LINT !== "true") {
overrides.push(typescriptTypeCheckingOverrides);
}
module.exports = {
overrides,
env: {
browser: true,
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:jsdoc/recommended",
"plugin:prettier/recommended",
],
parserOptions: {
ecmaVersion: 2018,
},
rules: {
"arrow-body-style": "off",
"arrow-parens": ["off", "as-needed"],
camelcase: "off",
complexity: "off",
"constructor-super": "error",
"spaced-comment": ["error", "always"],
curly: "error",
"dot-notation": "error",
"eol-last": "off",
eqeqeq: "error",
"guard-for-in": "error",
"jsdoc/check-param-names": "off",
"jsdoc/require-jsdoc": "off",
"jsdoc/require-returns": "off",
"jsdoc/require-param": "off",
"jsdoc/require-param-type": "off",
"jsdoc/require-returns-type": "off",
"linebreak-style": "off",
"max-classes-per-file": ["error", 1],
"member-ordering": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": "error",
"no-debugger": "error",
"no-empty": "error",
"no-eval": "error",
"no-extra-semi": "off",
"no-fallthrough": "error",
"no-invalid-this": "off",
"no-irregular-whitespace": "off",
"no-multiple-empty-lines": "off",
"no-new-wrappers": "error",
"no-prototype-builtins": "error",
"no-shadow": "error",
"no-throw-literal": "error",
"no-undef": "off",
"no-undef-init": "error",
"no-unsafe-finally": "error",
"no-unused-expressions": "error",
"no-unused-labels": "error",
"no-unused-vars": ["error", { args: "none", ignoreRestSiblings: true }],
"no-var": "error",
"object-shorthand": "error",
"one-var": "off",
"prefer-arrow-callback": "off",
"prefer-const": "error",
"quote-props": "off",
radix: "error",
"require-atomic-updates": "off",
"space-before-function-paren": "off",
"sort-imports": "off",
"use-isnan": "error",
"valid-typeof": "off",
},
};
+6 -4
View File
@@ -1,15 +1,17 @@
---
name: Bug report
about: Create a report to help us improve
about: Create a bug report to help us improve Coral
labels: "bug"
---
<!--
Please provide as much detail as possible, including a screenshot or copy-paste of any related error messages, logs, or other output that might be related. Places to look for information include your browser console, server console, and network logs. The more information you can give the better.
Please note that but submitting a bug report, you agree to our Code of Conduct: http://code-of-conduct.voxmedia.com/
When submitting a bug report, provide as much detail as possible, including a screenshot or copy-paste of any related error messages, logs, or other output that might be related. Places to look for information include your browser console, server console, and network logs. The more information you can give the better.
Please help us by doing the following steps before logging an issue:
* Search: https://github.com/coralproject/talk/search
* Read the docs: https://docs.coralproject.net
* Search for other similar issues: https://github.com/coralproject/talk/search
* Read our docs: https://docs.coralproject.net
Please fill in the *entire* template below.
-->
+4 -2
View File
@@ -1,13 +1,15 @@
---
name: Feature request
about: Suggest an idea for this project
about: Suggest a feature idea for Coral
labels: "feature idea"
---
<!--
Please note that but submitting a feature request, you agree to our Code of Conduct: http://code-of-conduct.voxmedia.com/
Please help us by doing the following steps before logging an issue:
* Search: https://github.com/coralproject/talk/search
* Search to see if there are similar requests and ideas that are already logged: https://github.com/coralproject/talk/search
-->
+41 -3
View File
@@ -1,10 +1,48 @@
<!--
Thank you for submitting a pull request!
Please verify that:
* [ ] Code is up-to-date with the base branch
Thank you for submitting a pull request! Please note that by contributing to
Coral, you agree to our Code of Conduct: http://code-of-conduct.voxmedia.com/
Before submitting your Pull Request (or PR), please verify that:
* [ ] Your code is up-to-date with the base branch
* [ ] You've successfully run `npm run test` locally
Refer to CONTRIBUTING.MD for more details.
https://github.com/coralproject/talk/blob/master/CONTRIBUTING.md
-->
## What does this PR do?
<!--
In this section, you should be describing what other Github issues or tickets
that this PR is designed to addressed.
Any related Github issue should be linked by adding its URL to this section.
-->
## What changes to the GraphQL/Database Schema does this PR introduce?
<!--
In this section, you should describe any changes to be made to the GraphQL
schema file (located https://github.com/coralproject/talk/blob/master/src/core/server/graph/schema/schema.graphql) or any
database model (located as types in the https://github.com/coralproject/talk/blob/master/src/core/server/models directory).
If no changes were added to the GraphQL/Database Schema as a part of this PR,
simply write "None".
-->
## How do I test this PR?
<!--
In this section, you should be describing any manual testing that can be used to
verify features introduced or bugs fixed in this PR.
-->
-1
View File
@@ -20,5 +20,4 @@ yarn.lock
dist
*.css.d.ts
__generated__
README.md.orig
persisted-queries.json
+1 -1
View File
@@ -1,7 +1,7 @@
{
"projects": {
"tenant": {
"schemaPath": "src/core/server/graph/tenant/schema/schema.graphql"
"schemaPath": "src/core/server/graph/schema/schema.graphql"
}
}
}
+44
View File
@@ -0,0 +1,44 @@
# .kodiak.toml
# Kodiak's configuration file should be placed at `.kodiak.toml` (repository
# root) or `.github/.kodiak.toml`.
# docs: https://kodiakhq.com/docs/config-reference
# version is the only required setting in a kodiak config.
# `1` is the only valid setting for this field.
version = 1
[merge]
# Label to enable Kodiak to merge a PR.
# By default, Kodiak will only act on PRs that have this label. You can disable
# this requirement via `merge.require_automerge_label`.
automerge_label = "🚀 merge it!" # default: "automerge"
# Kodiak will not merge a PR with any of these labels.
blocking_labels = ["don't merge"] # default: [], options: list of label names (e.g. ["wip"])
# Choose merge method for Kodiak to use.
#
# Kodiak will report a configuration error if the selected merge method is
# disabled for a repository.
#
# If you're using the "Require signed commits" GitHub Branch Protection setting
# to require commit signatures, _`"merge"` is the only compatible option_. Any
# other option will cause Kodiak to raise a configuration error.
method = "squash" # default: "merge", options: "merge", "squash", "rebase"
# Once a PR is merged, delete the branch. This option behaves like the GitHub
# repository setting "Automatically delete head branches", which automatically
# deletes head branches after pull requests are merged.
delete_branch_on_merge = true # default: false
# Don't wait for in-progress status checks on a PR to finish before updating the
# branch.
optimistic_updates = false # default: true
[merge.message]
# Strip HTML comments (`<!-- some HTML comment -->`) from merge commit body.
# This setting is useful for stripping HTML comments created by PR templates.
# This option only applies when `merge.message.body_type = "markdown"`.
strip_html_comments = true # default: false
+1 -2
View File
@@ -1,2 +1 @@
10
12
-3
View File
@@ -1,3 +0,0 @@
{
"trailingComma": "es5"
}
+3 -2
View File
@@ -1,8 +1,9 @@
{
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",
"dbaeumer.vscode-eslint",
"kumar-harsh.graphql-for-vscode",
"editorconfig.editorconfig",
"ms-azuretools.vscode-cosmosdb"
"ms-azuretools.vscode-cosmosdb",
"mike-co.import-sorter"
]
}
+42 -5
View File
@@ -10,12 +10,49 @@
"**/.DS_Store": true,
".vs": true
},
"tslint.exclude": "**/node_modules/**",
"tslint.jsEnable": true,
"tslint.enable": false,
"eslint.validate": [
{ "language": "javascript", "autoFix": true },
{ "language": "typescript", "autoFix": true },
{ "language": "typescriptreact", "autoFix": true }
],
"typescript.tsdk": "node_modules/typescript/lib",
"postcss.validate": false,
"javascript.preferences.importModuleSpecifier": "non-relative",
"editor.codeActionsOnSave": {
"source.fixAll.tslint": true
}
"importSorter.importStringConfiguration.quoteMark": "double",
"importSorter.importStringConfiguration.maximumNumberOfImportExpressionsPerLine.count": 80,
"importSorter.sortConfiguration.customOrderingRules.rules": [
{
"type": "importMember",
"regex": "^$",
"orderLevel": 70,
"disableSort": true
},
{
"regex": "__generated__",
"orderLevel": 40
},
{
"regex": "^coral-",
"orderLevel": 30
},
{
"regex": "\\.css$",
"orderLevel": 60,
"disableSort": true
},
{
"regex": "^[.]",
"orderLevel": 50
}
],
"importSorter.importStringConfiguration.maximumNumberOfImportExpressionsPerLine.type": "newLineEachExpressionAfterCountLimitExceptIfOnlyOne",
"importSorter.importStringConfiguration.trailingComma": "multiLine",
"importSorter.importStringConfiguration.tabSize": 2,
"eslint.enable": true,
"importSorter.generalConfiguration.exclude": ["d\\.ts$", "__generated__"],
"search.exclude": {
"package-lock.json": true
},
"debug.node.autoAttach": "off"
}
+610
View File
@@ -0,0 +1,610 @@
# Client Events Guide
This serves as a guide to events emitted by the javascript via the embed events
hook, as described below in [Viewer Events](#viewer-events).
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [Viewer Events](#viewer-events)
- [Viewer Network Events](#viewer-network-events)
- [Event List](#event-list)
- [Index](#index)
- [Events](#events)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Viewer Events
_Viewer Events_ are emitted when the viewer performs certain actions.
They can be subscribed to using the `events` parameter in
`Coral.createStreamEmbed`.
```html
<script>
const CoralStreamEmbed = Coral.createStreamEmbed({
events: function(events) {
events.onAny(function(eventName, data) {
console.log(eventName, data);
});
},
});
</script>
```
Example events:
- `setMainTab {tab: "PROFILE"}`
- `showFeaturedCommentTooltip`
- `viewConversation {from: "FEATURED_COMMENTS", commentID: "c45fb5f5-03f9-49a3-a755-488c698ca0df"}`
### Viewer Network Events
_Viewer Network Events_ are events that involves a network request and thus can succeed or fail. Succeeding events will have a `.success` appended to the event name while failing events have an `.error` appended to the event name.
Moreover _Viewer Network Events_ contains the `rtt` field which indicates the time it needed from initiating the request until the _UI_ has been updated with the response data.
Example events:
```
createComment.success
{
body: "Hello world!",
storyID: "238b95ec-2b80-43f4-ab68-a6ea1f4e2584",
rtt: 307,
success: {
id: "6fecfb11-4d0f-4edc-89b7-878a9928addd"
status: "APPROVED"`
}
}
```
```
createComment.error
{
body: "Hi!",
storyID: "238b95ec-2b80-43f4-ab68-a6ea1f4e2584",
rtt: 229,
error: {
code: "COMMENT_BODY_TOO_SHORT"
message: "Comment body must have at least 10 characters."
}
}
```
## Event List
<!-- START docs:events -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN npm run docs:events -->
### Index
- <a href="#approveComment">approveComment</a>
- <a href="#banUser">banUser</a>
- <a href="#cancelAccountDeletion">cancelAccountDeletion</a>
- <a href="#changeEmail">changeEmail</a>
- <a href="#changePassword">changePassword</a>
- <a href="#changeUsername">changeUsername</a>
- <a href="#closeStory">closeStory</a>
- <a href="#copyPermalink">copyPermalink</a>
- <a href="#createComment">createComment</a>
- <a href="#createCommentFocus">createCommentFocus</a>
- <a href="#createCommentReaction">createCommentReaction</a>
- <a href="#createCommentReply">createCommentReply</a>
- <a href="#editComment">editComment</a>
- <a href="#featureComment">featureComment</a>
- <a href="#gotoModeration">gotoModeration</a>
- <a href="#ignoreUser">ignoreUser</a>
- <a href="#loadMoreAllComments">loadMoreAllComments</a>
- <a href="#loadMoreFeaturedComments">loadMoreFeaturedComments</a>
- <a href="#loadMoreHistoryComments">loadMoreHistoryComments</a>
- <a href="#loginPrompt">loginPrompt</a>
- <a href="#openSortMenu">openSortMenu</a>
- <a href="#openStory">openStory</a>
- <a href="#rejectComment">rejectComment</a>
- <a href="#removeCommentReaction">removeCommentReaction</a>
- <a href="#removeUserIgnore">removeUserIgnore</a>
- <a href="#replyCommentFocus">replyCommentFocus</a>
- <a href="#reportComment">reportComment</a>
- <a href="#requestAccountDeletion">requestAccountDeletion</a>
- <a href="#requestDownloadCommentHistory">requestDownloadCommentHistory</a>
- <a href="#resendEmailVerification">resendEmailVerification</a>
- <a href="#setCommentsOrderBy">setCommentsOrderBy</a>
- <a href="#setCommentsTab">setCommentsTab</a>
- <a href="#setMainTab">setMainTab</a>
- <a href="#setProfileTab">setProfileTab</a>
- <a href="#showAbsoluteTimestamp">showAbsoluteTimestamp</a>
- <a href="#showAllReplies">showAllReplies</a>
- <a href="#showAuthPopup">showAuthPopup</a>
- <a href="#showEditEmailDialog">showEditEmailDialog</a>
- <a href="#showEditForm">showEditForm</a>
- <a href="#showEditPasswordDialog">showEditPasswordDialog</a>
- <a href="#showEditUsernameDialog">showEditUsernameDialog</a>
- <a href="#showFeaturedCommentTooltip">showFeaturedCommentTooltip</a>
- <a href="#showIgnoreUserdDialog">showIgnoreUserdDialog</a>
- <a href="#showModerationPopover">showModerationPopover</a>
- <a href="#showMoreOfConversation">showMoreOfConversation</a>
- <a href="#showMoreReplies">showMoreReplies</a>
- <a href="#showReplyForm">showReplyForm</a>
- <a href="#showReportPopover">showReportPopover</a>
- <a href="#showSharePopover">showSharePopover</a>
- <a href="#showUserPopover">showUserPopover</a>
- <a href="#signOut">signOut</a>
- <a href="#signedIn">signedIn</a>
- <a href="#unfeatureComment">unfeatureComment</a>
- <a href="#updateNotificationSettings">updateNotificationSettings</a>
- <a href="#updateStorySettings">updateStorySettings</a>
- <a href="#viewConversation">viewConversation</a>
- <a href="#viewFullDiscussion">viewFullDiscussion</a>
- <a href="#viewNewComments">viewNewComments</a>
### Events
- <a id="approveComment">**approveComment.success**, **approveComment.error**</a>: This event is emitted when the viewer approves a comment.
```ts
{
commentID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="banUser">**banUser.success**, **banUser.error**</a>: This event is emitted when the viewer bans a user.
```ts
{
userID: string;
commentID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="cancelAccountDeletion">**cancelAccountDeletion.success**, **cancelAccountDeletion.error**</a>: This event is emitted when the viewer cancels the account deletion.
```ts
{
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="changeEmail">**changeEmail.success**, **changeEmail.error**</a>: This event is emitted when the viewer changes its email.
```ts
{
oldEmail: string;
newEmail: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="changePassword">**changePassword.success**, **changePassword.error**</a>: This event is emitted when the viewer changes its password.
```ts
{
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="changeUsername">**changeUsername.success**, **changeUsername.error**</a>: This event is emitted when the viewer changes its username.
```ts
{
oldUsername: string;
newUsername: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="closeStory">**closeStory.success**, **closeStory.error**</a>: This event is emitted when the viewer closes the story.
```ts
{
storyID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="copyPermalink">**copyPermalink**</a>: This event is emitted when the viewer copies the permalink with the button.
```ts
{
commentID: string;
}
```
- <a id="createComment">**createComment.success**, **createComment.error**</a>: This event is emitted when a top level comment is created.
```ts
{
storyID: string;
body: string;
success: {
id: string;
status: COMMENT_STATUS;
};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="createCommentFocus">**createCommentFocus**</a>: This event is emitted when the viewer focus on the RTE to create a comment.
- <a id="createCommentReaction">**createCommentReaction.success**, **createCommentReaction.error**</a>: This event is emitted when the viewer reacts to a comment.
```ts
{
commentID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="createCommentReply">**createCommentReply.success**, **createCommentReply.error**</a>: This event is emitted when a comment reply is created.
```ts
{
body: string;
parentID: string;
success: {
id: string;
status: COMMENT_STATUS;
};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="editComment">**editComment.success**, **editComment.error**</a>: This event is emitted when the viewer edits a comment.
```ts
{
body: string;
commentID: string;
success: {
status: COMMENT_STATUS;
};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="featureComment">**featureComment.success**, **featureComment.error**</a>: This event is emitted when the viewer features a comment.
```ts
{
commentID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="gotoModeration">**gotoModeration**</a>: This event is emitted when the viewer goes to moderation.
```ts
{
commentID: string;
}
```
- <a id="ignoreUser">**ignoreUser.success**, **ignoreUser.error**</a>: This event is emitted when the viewer ignores a user.
```ts
{
userID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="loadMoreAllComments">**loadMoreAllComments.success**, **loadMoreAllComments.error**</a>: This event is emitted when the viewer loads more top level comments into the comment stream.
```ts
{
storyID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="loadMoreFeaturedComments">**loadMoreFeaturedComments.success**, **loadMoreFeaturedComments.error**</a>: This event is emitted when the viewer loads more featured comments.
```ts
{
storyID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="loadMoreHistoryComments">**loadMoreHistoryComments.success**, **loadMoreHistoryComments.error**</a>: This event is emitted when the viewer loads more top level comments into the history comment stream.
```ts
{
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="loginPrompt">**loginPrompt**</a>: This event is emitted when the viewer does an action that will prompt a login dialog.
- <a id="openSortMenu">**openSortMenu**</a>: This event is emitted when the viewer clicks on the sort menu.
- <a id="openStory">**openStory.success**, **openStory.error**</a>: This event is emitted when the viewer opens the story.
```ts
{
storyID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="rejectComment">**rejectComment.success**, **rejectComment.error**</a>: This event is emitted when the viewer rejects a comment.
```ts
{
commentID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="removeCommentReaction">**removeCommentReaction.success**, **removeCommentReaction.error**</a>: This event is emitted when the viewer removes its reaction from a comment.
```ts
{
commentID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="removeUserIgnore">**removeUserIgnore.success**, **removeUserIgnore.error**</a>: This event is emitted when the viewer remove a user from its ignored users list.
```ts
{
userID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="replyCommentFocus">**replyCommentFocus**</a>: This event is emitted when the viewer focus on the RTE to reply to a comment.
- <a id="reportComment">**reportComment.success**, **reportComment.error**</a>: This event is emitted when the viewer reports a comment.
```ts
{
reason: string;
commentID: string;
additionalDetails?: string | undefined;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="requestAccountDeletion">**requestAccountDeletion.success**, **requestAccountDeletion.error**</a>: This event is emitted when the viewer requests to delete its account.
```ts
{
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="requestDownloadCommentHistory">**requestDownloadCommentHistory.success**, **requestDownloadCommentHistory.error**</a>: This event is emitted when the viewer requests to download its comment history.
```ts
{
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="resendEmailVerification">**resendEmailVerification.success**, **resendEmailVerification.error**</a>: This event is emitted when the viewer request another email verification email.
```ts
{
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="setCommentsOrderBy">**setCommentsOrderBy**</a>: This event is emitted when the viewer changes the sort order of the comments.
```ts
{
orderBy: string;
}
```
- <a id="setCommentsTab">**setCommentsTab**</a>: This event is emitted when the viewer changes the tab of the comments tab bar.
```ts
{
tab: string;
}
```
- <a id="setMainTab">**setMainTab**</a>: This event is emitted when the viewer changes the tab of the main tab bar.
```ts
{
tab: string;
}
```
- <a id="setProfileTab">**setProfileTab**</a>: This event is emitted when the viewer changes the tab of the profile tab bar.
```ts
{
tab: string;
}
```
- <a id="showAbsoluteTimestamp">**showAbsoluteTimestamp**</a>: This event is emitted when the viewer clicks on the relative timestamp to show the absolute time.
- <a id="showAllReplies">**showAllReplies.success**, **showAllReplies.error**</a>: This event is emitted when the viewer reveals all replies of a comment.
```ts
{
commentID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="showAuthPopup">**showAuthPopup**</a>: This event is emitted when the viewer requests the auth popup.
```ts
{
view: string;
}
```
- <a id="showEditEmailDialog">**showEditEmailDialog**</a>: This event is emitted when the viewer opens the edit email dialog.
- <a id="showEditForm">**showEditForm**</a>: This event is emitted when the viewer opens the edit form.
```ts
{
commentID: string;
}
```
- <a id="showEditPasswordDialog">**showEditPasswordDialog**</a>: This event is emitted when the viewer opens the edit password dialog.
- <a id="showEditUsernameDialog">**showEditUsernameDialog**</a>: This event is emitted when the viewer opens the edit username dialog.
- <a id="showFeaturedCommentTooltip">**showFeaturedCommentTooltip**</a>: This event is emitted when the viewer clicks to show the featured comment tooltip.
- <a id="showIgnoreUserdDialog">**showIgnoreUserdDialog**</a>: This event is emitted when the viewer opens the ignore user dialog.
- <a id="showModerationPopover">**showModerationPopover**</a>: This event is emitted when the viewer opens the moderation popover.
```ts
{
commentID: string;
}
```
- <a id="showMoreOfConversation">**showMoreOfConversation.success**, **showMoreOfConversation.error**</a>: This event is emitted when the viewer reveals more of the parent conversation thread.
```ts
{
commentID: string | null;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="showMoreReplies">**showMoreReplies**</a>: This event is emitted when the viewer reveals new live replies.
```ts
{
commentID: string;
count: number;
}
```
- <a id="showReplyForm">**showReplyForm**</a>: This event is emitted when the viewer opens the reply form.
```ts
{
commentID: string;
}
```
- <a id="showReportPopover">**showReportPopover**</a>: This event is emitted when the viewer opens the report popover.
```ts
{
commentID: string;
}
```
- <a id="showSharePopover">**showSharePopover**</a>: This event is emitted when the viewer opens the share popover.
```ts
{
commentID: string;
}
```
- <a id="showUserPopover">**showUserPopover**</a>: This event is emitted when the viewer clicks on a username which shows the user popover.
```ts
{
userID: string;
}
```
- <a id="signOut">**signOut.success**, **signOut.error**</a>: This event is emitted when the viewer signs out.
```ts
{
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="signedIn">**signedIn**</a>: This event is emitted when the viewer signed in (not applicable for SSO).
- <a id="unfeatureComment">**unfeatureComment.success**, **unfeatureComment.error**</a>: This event is emitted when the viewer unfeatures a comment.
```ts
{
commentID: string;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="updateNotificationSettings">**updateNotificationSettings.success**, **updateNotificationSettings.error**</a>: This event is emitted when the viewer updates its notification settings.
```ts
{
onReply?: boolean | null | undefined;
onFeatured?: boolean | null | undefined;
onStaffReplies?: boolean | null | undefined;
onModeration?: boolean | null | undefined;
digestFrequency?: "NONE" | "DAILY" | "HOURLY" | null | undefined;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="updateStorySettings">**updateStorySettings.success**, **updateStorySettings.error**</a>: This event is emitted when the viewer updates the story settings.
```ts
{
storyID: string;
live?: {
enabled?: boolean | null | undefined;
} | null | undefined;
moderation?: "POST" | "PRE" | null | undefined;
premodLinksEnable?: boolean | null | undefined;
messageBox?: {
enabled?: boolean | null | undefined;
icon?: string | null | undefined;
content?: string | null | undefined;
} | null | undefined;
success: {};
error: {
message: string;
code?: string | undefined;
};
}
```
- <a id="viewConversation">**viewConversation**</a>: This event is emitted when the viewer changes to the single conversation view.
```ts
{
from: "FEATURED_COMMENTS" | "COMMENT_STREAM" | "COMMENT_HISTORY";
commentID: string;
}
```
- <a id="viewFullDiscussion">**viewFullDiscussion**</a>: This event is emitted when the viewer exits the single conversation.
```ts
{
commentID: string | null;
}
```
- <a id="viewNewComments">**viewNewComments**</a>: This event is emitted when the viewer reveals new live comments.
```ts
{
storyID: string;
count: number;
}
```
<!-- END docs:events -->
+507 -12
View File
@@ -5,20 +5,60 @@ Welcome! We are very excited that you are interested in contributing to Coral.
This document is a companion to help you approach contributing. If it does not
do so, please [let us know how we can improve it](https://github.com/coralproject/talk/issues)!
By contributing to this project you agree to the
[Code of Conduct](CODE_OF_CONDUCT.md).
By contributing to this project you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [What should I Contribute?](#what-should-i-contribute)
- [Writing Code](#writing-code)
- [When should I create an issue?](#when-should-i-create-an-issue)
- [What should I include in my issue?](#what-should-i-include-in-my-issue)
- [When should I create a pull request?](#when-should-i-create-a-pull-request)
- [What should I include in my pull request?](#what-should-i-include-in-my-pull-request)
- [Reviewing pull requests](#reviewing-pull-requests)
- [Ensure contributions are linted and tested](#ensure-contributions-are-linted-and-tested)
- [Review the feature/fixes](#review-the-featurefixes)
- [Review architectural decisions](#review-architectural-decisions)
- [Verify localizations](#verify-localizations)
- [Localization](#localization)
- [Documentation](#documentation)
- [Design Principles](#design-principles)
- [GraphQL](#graphql)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## What should I Contribute?
There are at least three ways to contribute to Coral:
There are at least three different ways to contribute to Coral:
- Writing Code
- Providing Translations
- [Writing Code](#writing-code)
- [Reviewing pull requests](#reviewing-pull-requests)
- [Localization](#localization)
- [Documentation](#documentation)
Typically these take the form of creating a Pull Request for Coral, and
submitting it to be reviewed by a member of our team and the greater Coral
community.
Working on your first Pull Request? You can learn how from this free video
series:
[How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
If you decide to fix an issue, please be sure to check the comment thread in
case somebody is already working on a fix. If nobody is working on it at the
moment, please leave a comment stating that you intend to work on it so other
people dont accidentally duplicate your effort.
If somebody claims an issue but doesnt follow up for more than two weeks, its
fine to take it over but you should still leave a comment.
## Writing Code
Conversation surrounding contributions begins in
[issues](https://github.com/coralproject/talk/issues).
Conversation surrounding contributions begins when you can create an issue
describing your issue or suggestion.
### When should I create an issue?
@@ -26,9 +66,7 @@ File an issue as soon as you have an idea of something you'd like to contribute.
We would love to hear what you're thinking and help refine the idea to make it
into the Coral ecosystem.
Please file issues if you would like to contribute to Coral.
### What should I include?
### What should I include in my issue?
Coral has adopted an iterative, agile development philosophy. All contributions
that make it into the Coral repository should start with a user story in this
@@ -38,8 +76,8 @@ form:
This exercise does two things:
- allows us to ground our technical choices in a clear, simple product need.
- expresses that product need in a way that doesn't imply a specific technical
- Allows us to ground our technical choices in a clear, simple product need.
- Expresses that product need in a way that doesn't imply a specific technical
solution allowing for debate as to the best way to solve the problem.
Please feel free to provide as much detail as possible when filing the issue but
@@ -49,6 +87,72 @@ technical or design solutions.
If you have a specific technical or design solution in mind, please submit it as
the first comment on the thread.
### When should I create a pull request?
File a pull request if you've created an issue in our [issues](https://github.com/coralproject/talk/issues)
page and have heard back from a member or contributor to Coral. This allows our
team to review the proposed changes prior to time being spent if the team
already has the feature/fix in the road map.
### What should I include in my pull request?
When you create a pull request, the template will describe the required
components needed for it to be reviewed by a member of the Coral team. You
should end up filling out:
- What does this PR (pull request) do?
- How do I test this PR?
You should describe what Github issue or ticket that the PR is associated with
to assist the review process. If this PR is resolving a particular bug, a
testing strategy should be described in the testing section. If this PR is
contributing a new feature, a description should describe a scenario to test or
verify the new functionality.
## Reviewing pull requests
Reviewing pull requests in Coral is generally completed by the core Coral team
that is composed of developers employed by Vox Media Inc, but external reviews
or suggestions are also welcomed.
Our review process generally follows a few core principles:
### Ensure contributions are linted and tested
It is the job of CI linting and tests to notify of style issues within the
codebase. If it is not possible for style issues to be encapsulated as a
linting rule, it shouldn't be concretely enforced during the review process.
This can ensure that code reviews contain more meaningful feedback tied to the
contribution rather than nit-picking on stylistic choices.
Reviewers must ensure that linting and tests pass in CI and locally prior to a
review taking place. You can do this by running `npm run generate` followed by
`npm run lint` and `npm run test`.
### Review the feature/fixes
Any new features added to Coral should be reviewed for bugs through a manual
verification process to ensure that they function on your machine. If possible
you should review any automated tests that were added (or not added) related to
the feature.
While the Coral team is not strict on test driven development (or TDD), any
contributions that include tests are greatly appreciated, and preferred over
those that do not.
### Review architectural decisions
Any substantial changes made to the codebase should be reviewed to ensure
that they conform to the current way code/services are laid out.
Architecture Decision Records (or [ADR](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions)) are now being used to describe architectural decisions and can be found in the `src/docs/architecture/decisions` directory.
### Verify localizations
While we don't have any automated tools at the time of writing that will
verify this in CI, any strings being added that are presented to the end user
should be wrapped in localization components to support other languages.
## Localization
We use the [fluent](http://projectfluent.org/) library and store our
@@ -64,3 +168,394 @@ where the string is used.
Once a language has enough coverage, it should be added to
`src/core/common/helpers/i18n/locales.ts`.
The [Perspective API](https://github.com/conversationai/perspectiveapi/blob/master/2-api/methods.md#analyzecomment-request)
also supports comments in specific languages. When the language is supported in
Coral and supported by the Perspective API, the language should be added to the
language map in `src/core/server/services/comments/pipeline/phases/toxic.ts`.
To assist with the translation process, we have a script that is based on the
work by @cristiandean in https://github.com/coralproject/talk/pull/2949 that
will detect missing, new, or changed translation keys for the specified
language. You can use this with:
```sh
# usage: ./scripts/i18n/validate.ts <locale>
./scripts/i18n/validate.ts pt-BR
```
## Documentation
Documentation that is publicly shown on
[docs.coralproject.net](https://docs.coralproject.net/coral/) is stored under
the `release/4` branch as it contains information for versions 4.0 onwards of
Coral.
To contribute new docs, you can either click the "Suggest Edits" in the top
right of each page, or you can edit directly via source. We suggest that for
individual fixes or contributions to the documentation.
If you want to contribute via source files, you can follow the procedure
outlined below:
1. Clone the Talk repository via `git clone https://github.com/coralproject/talk.git`
2. Switch to the `release/4` branch via `git checkout release/4`
3. Follow the procedure outlined on that branch's [CONTRIBUTING.md](https://github.com/coralproject/talk/blob/release/4/CONTRIBUTING.md#contributing-documentation) file for contributing documentation changes
4. Create a pull request to merge your changes back into the `release/4` branch
## Design Principles
### GraphQL
Coral relies heavily on [GraphQL](https://graphql.org) as the query language for
the API and the runtime on the server that powers resolving data from data
sources. This heavily influences a lot of the decisions around how we create and
consume it's API internally and how we expose it to others to interact with.
There are many GraphQL types in our [`schema.graphql`](https://github.com/coralproject/talk/blob/master/src/core/server/graph/schema/schema.graphql)
that define the way we handle data in our API. We'll try to outline a few of
them here with examples to help you understand their uses.
#### Types
Similar to defining an interface or a _struct_ definition, GraphQL has flexible
types that can be used to define data types that are used for querying data from
the API. This retrieval can happen directly via a query, or after executing an
action using a mutation and querying its response result.
An example of these types is the `Comment` and its nested `CommentRevision`
type:
```graphql
"""
Comment is a comment left by a User on an Story or another Comment as a reply.
"""
type Comment {
"""
id is the identifier of the Comment.
"""
id: ID!
"""
body is the content of the Comment, and is an alias to the body of the
`revision.body`.
"""
body: String
"""
revision is the current revision of the Comment's body.
"""
revision: CommentRevision
"""
revisionHistory stores the previous CommentRevision's, with the most recent
edit last.
"""
revisionHistory: [CommentRevision!]!
@auth(
roles: [MODERATOR, ADMIN]
userIDField: "author_id"
permit: [SUSPENDED, BANNED, PENDING_DELETION]
)
"""
status represents the Comment's current status.
"""
status: COMMENT_STATUS!
}
```
Notice how the `Comment` type can nest more custom defined types. A `Comment`
can have a current `CommentRevision` named `revision`. It also has a list of its
historical `revisionHistory`:
```graphql
type CommentRevision {
"""
id is the identifier of the CommentRevision.
"""
id: ID!
"""
comment is the reference to the original Comment associated with the current
Comment.
"""
comment: Comment!
"""
actionCounts stores the counts of all the actions for the CommentRevision
specifically.
"""
actionCounts: ActionCounts! @auth(roles: [MODERATOR, ADMIN])
"""
body is the content of the CommentRevision. If null, it indicates that the
body text was deleted.
"""
body: String
}
```
Another thing to note, see how `CommentRevision` is not only referenced by
`revision` and `revisionHistory` on the `Comment` type. The `CommentRevision`
also references back to its parent `Comment` via the `comment: Comment!`
property. This is how defined types interact between each other in the GraphQL
schema.
Our naming scheme is upper camel case (also known as Pascal Case) for these
types:
- Start with a capital letter
- Following characters are lower case
- Every new word in the type name begins with a new capital letter
- Acronyms are always capitalized (with the only exception being the
`clientMutationId: String!` field in mutation input/payload types)
Some of the properties have an `!` beside their type (i.e `id: ID!`) which
indicates that this property is required and is non-nullable. GraphQL will
validate the input request for these properties and ensure they are provided
during the GraphQL request.
You can learn more about GraphQL types in their documentation:
[Learn GraphQL: Schemas and Types](https://graphql.org/learn/schema/)
#### Enumeration Types
In the previous example with the `Comment` type. We also had a property called
`status` which was of type `COMMENT_STATUS`.
This is another kind of defined type, an [Enumeration Type](https://graphql.org/learn/schema/#enumeration-types),
also called _enums_.
```graphql
enum COMMENT_STATUS {
NONE
APPROVED
REJECTED
PREMOD
SYSTEM_WITHHELD
}
```
Like all enumeration types this definition enumerates out typed, named values
that are reusable for state elsewhere on other types.
Our naming scheme for enumeration types and values in those types as:
- All capital letters
- Spaces delimited with underscores
This is because they are treated as shared constant values across the schema.
Rather than storing strings or numbers to capture selected state, we prefer
using enumeration types because they are much more stricter in terms of value.
You can learn more about GraphQL Enumeration types in their documentation:
[Learn GraphQL: Enumeration Types](https://graphql.org/learn/schema/#enumeration-types)
#### Mutation Types
Mutations are a request to GraphQL to initiate an action which will result in a response. As such,they're broken up into an `Input` and `Payload` pair that matches a mutation's request and response pair.
An example is the `CreateCommentInput` and `CreateCommentPayload`:
```graphql
"""
CreateCommentInput provides the input for the createComment Mutation.
"""
input CreateCommentInput {
"""
storyID is the ID of the Story where we are creating a comment on.
"""
storyID: ID!
"""
nudge when true will instead return an error related to recoverable moderation
faults such as a toxic comment or spam comment to provide user feedback to
nudge the user to correct the comment.
"""
nudge: Boolean = false
"""
body is the Comment body, the content of the Comment.
"""
body: String!
"""
clientMutationId is required for Relay support.
"""
clientMutationId: String!
}
"""
CreateCommentPayload contains the created Comment after the createComment
mutation.
"""
type CreateCommentPayload {
"""
edge is the possibly created comment edge.
"""
edge: CommentEdge!
"""
clientMutationId is required for Relay support.
"""
clientMutationId: String!
}
```
The `CreateCommentInput` type contains some parameters that allow us to execute
the mutation. These are:
- `storyID` - the story we are submitting the comment to.
- `body` - the body of our comment.
- `nudge` - whether we should return validation prompts to the user about
improper comment language.
- `clientMutationId` - the identifier used by Relay to identify this mutation,
our front-end state cache to process the mutation request. This is the only
place in the code-base that we do not capitalize the acronym when written in
camel-case, this is unfortunately due to legacy reasons from within Relay.
The returned response for a mutation is a what we call a Payload, in this case
it's `CreateCommentPayload`. This usually has a response that is the full data
type of whatever was modified by the earlier called mutation action. The
properties on this type are:
- `edge` - we return the full comment edge that was created by the previous
input. This is done so that the mutation request can query whatever it needs
to from the returned input to update state on the client.
- `clientMutationId` - an identifier used by Relay (our front-end client state
cache) to process the mutation request.
#### Access Permissions On Types
Sometimes, you only want specific users to be allowed to view certain
information. For instance, we have roles that are defined in our schema so we
can filter who can have access to what.
These roles are used with directives on our schema that GraphQL then enforces
when trying to resolve requests a user makes. If the user has the specified role
associated with their signed-in account, they are given access to the requested
data.
An example of this is the `revisionHistory` on the `Comment` type:
```graphql
fragment on Comment {
"""
revisionHistory stores the previous CommentRevision's, with the most recent
edit last.
"""
revisionHistory: [CommentRevision!]!
@auth(
roles: [MODERATOR, ADMIN]
userIDField: "author_id"
permit: [SUSPENDED, BANNED, PENDING_DELETION]
)
}
```
Here we see the `@auth` directive. It has documentation describing the various
parameters allowed located in the [`schema.graphql`](https://github.com/coralproject/talk/blob/master/src/core/server/graph/schema/schema.graphql)
file, we'll discuss below what this particular set of parameters can be read as:
- The roles that are allowed to access this information are `MODERATOR` and
`ADMIN` as defined by the `roles` argument.
- We let the directive know that the author of the comment is `author_id` from
the `Comment` by defining the `userIDField`. It's a rule of thumb in Coral if
the Author created the document, they have permission to view it. A Comment
for example is authored by a user, with the underlying field associated with
the id of that author living on the `author_id` field. You can see how this
is related if you look at the resolver for the `Comment` type to see that it
is based off of the `Comment` interface from `src/core/server/models/comment`.
- We permit returning comments when the author has the following conditions
associated with their account: `SUSPENDED`, `BANNED`, or `PENDING_DELETION`.
These directives can be simpler, for example the `metadata` property on the
`CommentRevision`:
```graphql
fragment on CommentRevision {
"""
metadata stores details on a CommentRevision.
"""
metadata: CommentRevisionMetadata! @auth(roles: [ADMIN, MODERATOR])
}
```
Here we see an auth directive with only roles defined. This is sufficient to
make sure that the metadata property is only accessible to `ADMIN` and
`MODERATOR` user roles.
Note: Wondering how the user roles are defined? They're simply an enumeration
type that is also defined in the schema.
```graphql
enum USER_ROLE {
COMMENTER
STAFF
MODERATOR
ADMIN
}
```
#### Arrays of Items
Sometimes you don't want a singular property, your property is instead a
collection of items.
The `revisionHistory` from the `Comment` is again useful as an example:
```graphql
fragment on Comment {
"""
revisionHistory stores the previous CommentRevision's, with the most recent
edit last.
"""
revisionHistory: [CommentRevision!]!
}
```
The interior type `CommentRevision` is required using the `!` and the outer
array is also required using `!`.
We do this for a couple of reasons:
- This ensures that we do not return null/undefined values within the array.
- Why would we return a null when we can just return nothing for null values?
- We want the array to always be defined, if empty, we return and empty array (i.e. `[]`).
- This can be handled nicely in our resolvers. We simply check if the retrieved values is null or undefined and simply return an empty array in its stead.
These little tweaks aren't necessary, but they ease the use of our API by making
the results for arrays predictable and strongly typed.
#### Documenting
As you may have noticed, there is quite a bit of documentation in the schema examples listed here.
We typically follow these two rules in commenting our GraphQL types:
- Always comment the property within a type describing its purpose on its parent type
i.e. `createdAt` on our `Setting` type:
```graphql
fragment on Setting {
"""
createdAt is the time that the Settings was created at.
"""
createdAt: Time! @auth(roles: [ADMIN])
}
```
- Always comment the purpose of each type
i.e. the `Comment` type:
```graphql
"""
Comment is a comment left by a User on an Story or another Comment as a reply.
"""
type Comment { }
```
+272
View File
@@ -0,0 +1,272 @@
# CSS Variables
Coral defines a set of CSS Variables that you can use to broadly customize the
look and feel of your comment stream. For example you can easily redefine the colors
or fonts that are being used.
To change the CSS Variables, use the following example in your custom CSS file:
```
:root {
--font-family-primary: 'Verdana';
--round-corners: 0px;
}
```
The following list contains the CSS Variables that can be customized.
**Info**: *Before 6.3.0 Coral uses a different set of CSS Variables. If you are still using
the old CSS Variables, please upgrade. Currently we have a compatibility layer to bridge the old CSS Variables to the new ones. This mechanism will be removed in the future.*
<!-- START docs:css-variables -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN npm run docs:css-variables -->
### Index
- <a href="#variables">Variables</a>
- <a href="#palette">palette</a>
- <a href="#palette-primary">palette-primary</a>
- <a href="#palette-background">palette-background</a>
- <a href="#palette-text">palette-text</a>
- <a href="#palette-grey">palette-grey</a>
- <a href="#palette-error">palette-error</a>
- <a href="#palette-success">palette-success</a>
- <a href="#palette-warning">palette-warning</a>
- <a href="#font-family">font-family</a>
- <a href="#font-weight">font-weight</a>
- <a href="#font-weight-primary">font-weight-primary</a>
- <a href="#font-weight-secondary">font-weight-secondary</a>
- <a href="#font-size">font-size</a>
- <a href="#shadow">shadow</a>
- <a href="#spacing">spacing</a>
- <a href="#mini-unit">mini-unit</a>
### Variables
Use this to remove round corners or make them more round.
`--round-corners: 3px;`
### palette
`--palette-divider: rgba(0, 0, 0, 0.12);`
#### palette-primary
Color palette that is used as the primary color.
`--palette-primary-100: #EBF6FF; /* Before 6.3.0: --palette-primary-lightest */`
`--palette-primary-200: #B7DCFF; /* Before 6.3.0: --palette-primary-lighter */`
`--palette-primary-300: #61B3FF; /* Before 6.3.0: --palette-primary-light */`
`--palette-primary-400: #2897FF; /* Before 6.3.0: --palette-primary-main */`
`--palette-primary-500: #0070D9; /* Before 6.3.0: --palette-primary-main */`
`--palette-primary-600: #0062BE; /* Before 6.3.0: --palette-primary-main */`
`--palette-primary-700: #005AAE; /* Before 6.3.0: --palette-primary-main */`
`--palette-primary-800: #004688; /* Before 6.3.0: --palette-primary-dark */`
`--palette-primary-900: #00386D; /* Before 6.3.0: --palette-primary-darkest */`
#### palette-background
Color palette that is used for background colors.
`--palette-background-body: #FFFFFF;`
`--palette-background-popover: #FFFFFF;`
`--palette-background-tooltip: #65696B;`
`--palette-background-input: #FFFFFF;`
`--palette-background-input-disabled: #EFEFEF;`
#### palette-text
Color palette that is used for text.
`--palette-text-000: #FFFFFF; /* Before 6.3.0: --palette-text-light */`
`--palette-text-100: #65696B; /* Before 6.3.0: --palette-text-secondary */`
`--palette-text-500: #353F44; /* Before 6.3.0: --palette-text-primary */`
`--palette-text-900: #14171A; /* Before 6.3.0: --palette-text-dark */`
`--palette-text-placeholder: #9FA4A6; /* Before 6.3.0: --palette-grey-lighter */`
`--palette-text-input-disabled: #9FA4A6; /* Before 6.3.0: --palette-grey-lighter */`
#### palette-grey
Color palette that is used for grey shades.
`--palette-grey-100: #F4F7F7; /* Before 6.3.0: --palette-grey-lightest */`
`--palette-grey-200: #EAEFF0; /* Before 6.3.0: --palette-grey-lightest */`
`--palette-grey-300: #CBD1D2; /* Before 6.3.0: --palette-grey-lighter */`
`--palette-grey-400: #9FA4A6; /* Before 6.3.0: --palette-grey-lighter */`
`--palette-grey-500: #65696B; /* Before 6.3.0: --palette-grey-main */`
`--palette-grey-600: #49545C; /* Before 6.3.0: --palette-grey-dark */`
`--palette-grey-700: #32404D; /* Before 6.3.0: --palette-grey-darkest */`
`--palette-grey-800: #202E3E; /* Before 6.3.0: --palette-grey-darkest */`
`--palette-grey-900: #132033; /* Before 6.3.0: --palette-grey-darkest */`
#### palette-error
Color palette that is used for indicating something is error red.
`--palette-error-100: #FCE5D9; /* Before 6.3.0: --palette-error-lightest */`
`--palette-error-200: #FAC6B4; /* Before 6.3.0: --palette-error-lighter */`
`--palette-error-300: #F29D8B; /* Before 6.3.0: --palette-error-lighter */`
`--palette-error-400: #E5766C; /* Before 6.3.0: --palette-error-light */`
`--palette-error-500: #D53F3F; /* Before 6.3.0: --palette-error-main */`
`--palette-error-600: #B72E39; /* Before 6.3.0: --palette-error-main */`
`--palette-error-700: #991F34; /* Before 6.3.0: --palette-error-dark */`
`--palette-error-800: #7B142E; /* Before 6.3.0: --palette-error-darkest */`
`--palette-error-900: #660C2B; /* Before 6.3.0: --palette-error-darkest */`
#### palette-success
Color palette that is used for indicating something is success green.
`--palette-success-100: #D8F9D5; /* Before 6.3.0: --palette-success-lightest */`
`--palette-success-200: #ADF3AD; /* Before 6.3.0: --palette-success-lighter */`
`--palette-success-300: #7CDB85; /* Before 6.3.0: --palette-success-lighter */`
`--palette-success-400: #54B767; /* Before 6.3.0: --palette-success-light */`
`--palette-success-500: #268742; /* Before 6.3.0: --palette-success-main */`
`--palette-success-600: #1B743D; /* Before 6.3.0: --palette-success-main */`
`--palette-success-700: #136138; /* Before 6.3.0: --palette-success-dark */`
`--palette-success-800: #0C4E32; /* Before 6.3.0: --palette-success-darkest */`
`--palette-success-900: #07402E; /* Before 6.3.0: --palette-success-darkest */`
#### palette-warning
Color palette that is used for indicating a warning and is usually yellow.
`--palette-warning-100: #FFFACC; /* Before 6.3.0: --palette-warning-main */`
`--palette-warning-500: #FFE91F; /* Before 6.3.0: --palette-warning-main */`
### font-family
Different font families currently in use.
`--font-family-primary: "Open Sans"; /* Before 6.3.0: --font-family-sans-serif */`
`--font-family-secondary: "Nunito"; /* Before 6.3.0: --font-family-serif */`
### font-weight
Different font weights with matching values for the fonts.
#### font-weight-primary
`--font-weight-primary-bold: 700; /* Before 6.3.0: --font-weight-bold */`
`--font-weight-primary-semi-bold: 600; /* Before 6.3.0: --font-weight-medium */`
`--font-weight-primary-regular: 300; /* Before 6.3.0: --font-weight-light */`
#### font-weight-secondary
`--font-weight-secondary-bold: 700; /* Before 6.3.0: --font-weight-bold */`
`--font-weight-secondary-regular: 300; /* Before 6.3.0: --font-weight-light */`
### font-size
`--font-size-1: 0.75rem;`
`--font-size-2: 0.875rem;`
`--font-size-3: 1rem;`
`--font-size-4: 1.125rem;`
`--font-size-5: 1.25rem;`
`--font-size-6: 1.5rem;`
`--font-size-7: 1.75rem;`
`--font-size-8: 2rem;`
`--font-size-9: 2.25rem;`
`--font-size-icon-xl: 2.25rem;`
`--font-size-icon-lg: 1.5rem;`
`--font-size-icon-md: 1.125rem;`
`--font-size-icon-sm: 0.875rem;`
`--font-size-icon-xs: 0.75rem;`
### shadow
Different shadows that are currently used in Coral.
`--shadow-popover: 1px 0px 4px rgba(0, 0, 0, 0.25); /* Before 6.3.0: --elevation-main */`
### spacing
Different spacing units currenty used in Coral.
`--spacing-1: 4px;`
`--spacing-2: 8px;`
`--spacing-3: 12px;`
`--spacing-4: 16px;`
`--spacing-5: 24px;`
`--spacing-6: 32px;`
`--spacing-7: 44px;`
`--spacing-8: 60px;`
`--spacing-9: 84px;`
### mini-unit
Grid units for smaller and larger screens.
`--mini-unit-small: 4;`
`--mini-unit-large: 8;`
<!-- END docs:css-variables -->
+3 -8
View File
@@ -1,4 +1,4 @@
FROM node:10-alpine
FROM node:12-alpine
# Install build dependancies.
RUN apk --no-cache add git python
@@ -7,9 +7,6 @@ RUN apk --no-cache add git python
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
# Setup the environment for production.
ENV NODE_ENV production
# Bundle application source.
COPY . /usr/src/app
@@ -19,15 +16,13 @@ RUN mkdir -p dist/core/common/__generated__ && \
echo "{\"revision\": \"${REVISION_HASH}\"}" > dist/core/common/__generated__/revision.json
# Install build static assets and clear caches.
RUN NODE_ENV=development npm install && \
npm run generate && \
RUN npm ci && \
npm run build && \
npm prune --production
# Setup the environment
ENV PATH /usr/src/app/bin:$PATH
ENV NODE_ENV production
ENV PORT 5000
EXPOSE 5000
ENV NODE_ENV production
CMD ["npm", "run", "start"]
+240
View File
@@ -0,0 +1,240 @@
# External Moderation Phases Guide
This document is in reference to external moderation phases emitted by Coral.
You can configure external moderation phases on your installation of Coral by
visiting `/admin/configure/moderation/phases`.
Once you've configured a external moderation phase in Coral, you will start to
receive moderation requests in the form of a
[External Moderation Requests](#external-moderation-request) at the provided
callback URL. These will be in the form of `POST` requests with a `JSON`
payload.
When a comment is created or edited, it will be processed by moderation phases in
a predefined order. Any external moderation phase is run last, and only if all
other moderation phases before it do not return a status. The current set of
moderation phases is listed in order [here](https://github.com/coralproject/talk/blob/master/src/core/server/services/comments/pipeline/phases/index.ts).
Once you have received a moderation request, you must respond within the
provided timeout else the phase will be skipped and it will continue. It is
strongly recommended to [verify the request signature](#request-signing).
The external moderation phase must respond with one of the following:
1. Do not moderate the comment, and return a 204 without a body.
2. Perform a moderation action and return a 200 with a [External Moderation Response](#external-moderation-response)
as a `JSON` encoded body containing the operations you want to perform on the
comment.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [Request Signing](#request-signing)
- [Schema](#schema)
- [External Moderation Request](#external-moderation-request)
- [External Moderation Response](#external-moderation-response)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Request Signing
Requests sent by Coral for external moderation phases use the same process as
those used by webhooks. Refer to the [webhooks documentation](WEBHOOKS.md#webhook-signing)
for instructions on how to verify signatures sent by Coral.
## Schema
### External Moderation Request
```ts
interface ExternalModerationRequest {
/**
* action refers to the specific operation being performed. If `NEW`, this
* is referring to a new comment being created. If `EDIT`, then this refers to
* an operation involving an edit operation on an existing Comment.
*/
action: "NEW" | "EDIT";
/**
* comment refers to the actual Comment data for the Comment being
* created/edited.
*/
comment: {
/**
* body refers to the actual body text of the Comment being created/edited.
*/
body: string;
/**
* parentID is the identifier for the parent comment (if this Comment is a
* reply, null otherwise).
*/
parentID: string | null;
};
/**
* author refers to the User that is creating/editing the Comment.
*/
author: {
/**
* id is the identifier for this User.
*/
id: string;
/**
* role refers to the role of this User.
*/
role: "COMMENTER" | "STAFF" | "MODERATOR" | "ADMIN";
};
/**
* story refers to the Story being commented on.
*/
story: {
/**
* id is the identifier for this Story.
*/
id: string;
/**
* url is the URL for this Story.
*/
url: string;
};
/**
* site refers to the Site that the story being commented on belongs to.
*/
site: {
/**
* id is the identifier for this Site.
*/
id: string;
};
/**
* tenantID is the identifer of the Tenant that this Comment is being
* created/edited on.
*/
tenantID: string;
/**
* tenantDomain is the domain that is associated with this Tenant that this
* Comment is being created/edited on.
*/
tenantDomain: string;
}
```
#### Example
New comment on a story:
```json
{
"action": "NEW",
"comment": {
"body": "Here's a comment!",
"parentID": null
},
"author": {
"id": "baf4e943-3594-4fcc-b2ba-3e8de7a76352",
"role": "COMMENTER"
},
"story": {
"id": "245b3856-b0a0-4d2f-a6bb-58c71f18d6a6",
"url": "http://localhost:1313/posts/a-story-url/"
},
"site": {
"id": "a4bede88-2d2c-4424-bc18-4322a9e285a6"
},
"tenantID": "19ba5794-7eeb-4d46-a81b-c00c61672501",
"tenantDomain": "localhost"
}
```
New reply on a comment on a story:
```json
{
"action": "NEW",
"comment": {
"body": "Here's a reply!",
"parentID": "d79b787f-f406-49a0-a179-72e3652e54be"
},
"author": {
"id": "baf4e943-3594-4fcc-b2ba-3e8de7a76352",
"role": "COMMENTER"
},
"story": {
"id": "245b3856-b0a0-4d2f-a6bb-58c71f18d6a6",
"url": "http://localhost:1313/posts/a-story-url/"
},
"site": {
"id": "a4bede88-2d2c-4424-bc18-4322a9e285a6"
},
"tenantID": "19ba5794-7eeb-4d46-a81b-c00c61672501",
"tenantDomain": "localhost"
}
```
### External Moderation Response
```ts
interface ExternalModerationResponse {
/**
* actions is an optional list of any flags to be added to this Comment.
*/
actions?: Array<{
actionType: "FLAG";
reason: "COMMENT_DETECTED_TOXIC" | "COMMENT_DETECTED_SPAM";
}>;
/**
* tags are any listed tags that should be added to the comment.
*/
tags?: Array<"FEATURED" | "STAFF">;
/**
* status when provided decides and terminates the moderation process by
* setting the status of the comment.
*/
status?: "NONE" | "APPROVED" | "REJECTED" | "PREMOD" | "SYSTEM_WITHHELD";
}
```
#### Examples
Add a flag to a comment and do not set a status:
```json
{
"actions": [{ "actionType": "FLAG", "reason": "COMMENT_DETECTED_TOXIC" }]
}
```
Reject a comment:
```json
{
"status": "REJECTED"
}
```
Feature a comment and do not set a status:
```json
{
"tags": ["FEATURED"]
}
```
Approve a comment and mark it as featured:
```json
{
"status": "APPROVED",
"tags": ["FEATURED"]
}
```
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright 2019 Vox Media, Inc
Copyright 2020 Vox Media, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
+36 -411
View File
@@ -1,427 +1,52 @@
# Coral ![CircleCI](https://img.shields.io/circleci/project/github/coralproject/talk/next.svg)
<p align="center">
<a href="https://coralproject.net" target="_blank"><img width="250" src="https://docs.coralproject.net/coral/images/coralproject_by_voxmedia.svg" alt="Coral by Vox Media" /></a>
</p>
Online comments are broken. Our open-source commenting platform, Coral, rethinks
how moderation, comment display, and conversation function, creating the
opportunity for safer, smarter discussions around your work.
[Read more about Coral here](https://coralproject.net/talk).
<p align="center">
A better commenting experience from <a href="https://product.voxmedia.com/" target="_blank">Vox Media</a>.
</p>
Built with <3 by The Coral Project, a part of [Vox Media](https://product.voxmedia.com/).
<p align="center">
<a href="https://circleci.com/gh/coralproject/talk" target="_blank"><img src="https://img.shields.io/circleci/build/gh/coralproject/talk?style=flat-square" alt="CircleCI" /></a>
<a href="https://hub.docker.com/r/coralproject/talk" target="_blank"><img src="https://img.shields.io/docker/v/coralproject/talk?label=docker%20hub&sort=semver&style=flat-square" alt="Docker Image Version" /></a>
<a href="https://hub.docker.com/r/coralproject/talk" target="_blank"><img src="https://img.shields.io/docker/image-size/coralproject/talk?label=docker%20image%20size&sort=semver&style=flat-square" alt="Docker Image Size" /></a>
<a href="https://twitter.com/coralproject" target="_blank"><img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/coralproject?style=flat-square"></a>
</p>
Preview Coral easily by running Coral via a Heroku App:
## Description
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/coralproject/talk/tree/next)
Online comments are broken. Our open-source commenting platform,
[Coral](https://coralproject.net), rethinks how moderation, comment display, and
conversation function, creating the opportunity for safer, smarter discussions
around your work.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
We offer hosting and support packages for Coral, as well as exclusive,
customer-only features. [Contact us](https://coralproject.net/pricing/) for more
information or [sign up for a webinar](https://coralproject.net).
- [Requirements](#requirements)
- [Running](#running)
- [Docker](#docker)
- [Source](#source)
- [Embed On Your Site](#embed-on-your-site)
- [Single Sign On](#single-sign-on)
- [SSO Login Prompts](#sso-login-prompts)
- [Development](#development)
- [Email](#email)
- [Design Language System (UI Components)](#design-language-system-ui-components)
- [Configuration](#configuration)
- [License](#license)
## Documentation
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
If you're new to Coral, the [Coral documentation](https://docs.coralproject.net/)
is a great place to start running and developing with Coral.
## Requirements
Youve installed Coral, and youre preparing to launch it on your site. The real
community work starts now, before you go live. You have a unique opportunity
pre-launch to set your community up for success. Read our
[Community Guides](https://guides.coralproject.net/start-here/) to learn more.
- MongoDB >=3.6
- Redis >=3.2
- NodeJS >=10
- NPM >=6.7
## Support
## Running
We can help you set up Coral, migrate your comments from another system,
integrate your registration platform, pair with your programmers, and help you
with bespoke installs. To learn more, [contact us](https://coralproject.net/pricing/).
You can install Coral using Docker or via Source. We recommend Docker, as it
provides the easiest deployment solution going forward, as all the dependencies
are baked and shipped with the provided
[coralproject/talk:next](https://hub.docker.com/r/coralproject/talk) image.
When v5 releases to master, you'll be able to select it using
`coralproject/talk:5`.
## Contributing
### Docker
Coral is a Apache-2.0 licensed open-source project built with <3 by the Coral
team, a part of [Vox Media](https://product.voxmedia.com/).
The easiest way to get started with Coral is through our published Docker image
and provided example `docker-compose.yml` file. The following assumes that you
have Docker and Docker Compose installed on your local machine:
- Install Docker: https://docs.docker.com/install/
- Install Docker Compose: https://docs.docker.com/compose/install/ (this is typically included in the Docker Desktop editions already)
```bash
# Create directories to persist the data in MongoDB and Redis.
mkdir -p data/{mongo,redis}
# Create the `docker-compose.yml` file to get started.
cat > docker-compose.yml <<EOF
version: "2"
services:
talk:
image: coralproject/talk:next
restart: always
ports:
- "127.0.0.1:3000:5000"
depends_on:
- mongo
- redis
environment:
- MONGODB_URI=mongodb://mongo:27017/coral
- REDIS_URI=redis://redis:6379
- SIGNING_SECRET=<replace me with something secret>
mongo:
image: mongo:3.6
volumes:
- ./data/mongo:/data/db
redis:
image: redis:3.2
volumes:
- ./data/redis:/data
EOF
# Start up Coral using Docker.
docker-compose up -d
```
Then head on over to http://localhost:3000 to install Coral!
### Source
Coral requires NodeJS >=10, we recommend using `nvm` to help manage node
versions: https://github.com/creationix/nvm.
```bash
# Clone and cd into the Coral directory.
git clone https://github.com/coralproject/talk.git
cd talk
# Install dependencies.
npm install
# Build the application dependencies.
# This might take a while.
npm run build
```
This should output all the compiled application code to `./dist`.
Running Coral with default settings assumes that you have:
- MongoDB >=3.6 running on `127.0.0.1:27017`
- Redis >=3.2 running on `127.0.0.1:6379`
If you don't already have these databases running, you can execute the following
assuming you have Docker installed on your local machine:
```bash
docker run -d -p 27017:27017 --restart always --name mongo mongo:3.6
docker run -d -p 6379:6379 --restart always --name redis redis:3.2
```
Then start Coral with:
```bash
# Start the server in production mode.
npm run start
```
Then head on over to http://localhost:3000 to install Coral!
### Embed On Your Site
With Coral setup and running locally you can test embeding the comment stream with this sample embed script:
```
<div id="coral_thread"></div>
<script type="text/javascript">
(function() {
var talk = document.createElement('script'); talk.type = 'text/javascript'; talk.async = true;
var url = '{{ CORAL_DOMAIN_NAME }}';
talk.src = '//' + url + '/assets/js/embed.js';
talk.onload = function() {
Coral.createStreamEmbed({
id: "coral_thread",
autoRender: true,
rootURL: '//' + url,
});
};
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(talk);
})();
</script>
```
> **NOTE:** Replace the value of `{{ CORAL_DOMAIN_NAME }}` with the location of your running instance of Coral.
### Single Sign On
In order to allow seamless connection to an existing authentication system,
Coral utilizes the industry standard [JWT Token](https://jwt.io/) to connect. To
learn more about how to create a JWT token, see [this introduction](https://jwt.io/introduction/).
1. Visit: `https://{{ CORAL_DOMAIN_NAME }}/admin/configure/auth`
2. Scroll to the `Login with Single Sign On` section
3. Enable the Single Sign On Authentication Integration
4. Enable `Allow Registration`
5. Copy the string in the `Key` box
6. Click Save
> **NOTE:** Replace the value of `{{ CORAL_DOMAIN_NAME }}` with the location of your running instance of Coral.
You will then have to generate a JWT with the following claims:
- `jti` (_optional_) - A unique ID for this particular JWT token. We recommend
using a [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier)
for this value. Without this parameter, the logout functionality inside the
embed stream will not work and you will need to call logout on the embed
itself.
- `exp` (_optional_) - When the given SSO token should expire. This is
specified as a unix time stamp in seconds. Once the token has expired, a new
token should be generated and passed into Coral. Without this parameter, the
logout functionality inside the embed stream will not work and you will need
to call logout on the embed itself.
- `iat` (_optional_) - When the given SSO token was issued. This is required to
utilize the automatic user detail update system. If this time is newer than
the time we received the last update, the contents of the token will be used
to update the user.
- `user.id` (**required**) - the ID of the user from your authentication system.
This is required to connect the user in your system to allow a seamless
connection to Coral.
- `user.email` (**required**) - the email address of the user from your
authentication system. This is required to facilitate notification email's
about status changes on a user account such as bans or suspensions.
- `user.username` (**required**) - the username that should be used when being
presented inside Coral to moderators and other users.
- `user.badges` (_optional_) - array of strings to be displayed as badges beside
username inside Coral, visible to other users and moderators. For example, to indicate
a user's subscription status.
- `user.role` (_optional_) - one of "COMMENTER", "STAFF", "MODERATOR", "ADMIN". Will create/update
Coral user with this role.
An example of the claims for this token would be:
```json
{
"jti": "151c19fc-ad15-4f80-a49c-09f137789fbb",
"exp": 1572172094,
"iat": 1562172094,
"user": {
"id": "628bdc61-6616-4add-bfec-dd79156715d4",
"email": "bob@example.com",
"username": "bob"
}
}
```
With the claims provided, you can sign them with the `Key` obtained from the
Coral administration panel in the previous steps with a `HS256` algorithm. This
token can be provided in the above mentioned embed code by adding it to the
`createStreamEmbed` function:
```js
Coral.createStreamEmbed({
// Don't forget to include the parameters from the
// "Embed On Your Site" section.
accessToken: "{{ SSO_TOKEN }}",
});
```
Or by calling the `login/logout` method on the embed object:
```js
var embed = Coral.createStreamEmbed({
// Don't forget to include the parameters from the
// "Embed On Your Site" section.
});
// Login the current embed with the generated SSO token.
embed.login("{{ SSO_TOKEN }}");
// Logout the user.
embed.logout();
```
#### SSO Login Prompts
In order to handle login prompts (e.g. a user clicks on the sign in button) you can listen to the `loginPrompt` event.
```js
var embed = Coral.createStreamEmbed({
// Don't forget to include the parameters from the
// "Embed On Your Site" section.
events: function(events) {
events.on("loginPrompt", function() {
// Redirect user to a login page.
location.href = "http://example.com/login";
});
},
});
```
### Development
Running Coral for development is very similar to installing Coral via Source as
described above.
Coral requires NodeJS >=10, we recommend using `nvm` to help manage node
versions: https://github.com/creationix/nvm.
```bash
# Clone and cd into the Coral directory.
git clone https://github.com/coralproject/talk.git
cd talk
# Install dependencies.
npm install
```
Running Coral with default settings assumes that you have:
- MongoDB >=3.6 running on `127.0.0.1:27017`
- Redis >=3.2 running on `127.0.0.1:6379`
If you don't already have these databases running, you can execute the following
assuming you have Docker installed on your local machine:
```bash
docker run -d -p 27017:27017 --restart always --name mongo mongo:3.6
docker run -d -p 6379:6379 --restart always --name redis redis:3.2
```
We recommend installing [watchman](https://facebook.github.io/watchman/docs/install.html) for better watch
performance.
```bash
# On macOS, you can run the following with Homebrew.
brew update
brew install watchman
```
Then start Coral with:
```bash
# Run the server in development mode in order to facilitate auto-restarting and
# rebuilding when file changes are detected. This might take a while to fully run.
npm run watch
```
When the client code has been built, navigate to http://localhost:8080/install
to start the installation wizard. **Note: Ensure `localhost:8080` is used in the permitted domains list.**
To see the comment stream goto http://localhost:8080/.
To run linting and tests use the following commands:
```bash
# Run the linters.
npm run lint
# Run our unit and integration tests.
npm run test
```
#### Email
To test out the email sending functionality, you can run [inbucket](https://www.inbucket.org/)
which provides a test SMTP server that can visualize emails in the browser:
```bash
docker run -d --name inbucket --restart always -p 2500:2500 -p 9000:9000 inbucket/inbucket
```
You can then configure the email server on Coral
by setting the email settings in
`Configure -> Email` in the admin:
| Field | Value |
| -------------- | -------------------- |
| From Address | `community@test.com` |
| Secure | `No` |
| Host | `localhost` |
| Port | `2500` |
| Authentication | `No` |
Navigate to http://localhost:9000, click the "Monitor" tab. New emails received
on this screen.
#### Design Language System (UI Components)
We use [docz](https://docz.site) to document and develop our Design Language System. To start docz run:
```bash
# Make sure CSS types are generated.
# This is not required when `npm run watch` is already running.
npm run generate:css-types
# Run docz in development.
npm run docz -- dev
```
After compilation has finished you can access docz at http://localhost:3030/.
## Configuration
The following environment variables can be set to configure the Coral Server. You
can expose them in your shell via `export NODE_ENV=development` or by placing
the variables in a `.env` file in the root of the project in a simple
`NODE_ENV=development` format delimited by newlines.
- `NODE_ENV` - Can be one of `production` or `development`. All production
deployments should use `production`. Defaults to `production` when ran with
`npm run start` and `development` when run with `npm run start:development`.
- `PORT` - The port to listen for HTTP and Websocket requests. (Default `3000`)
- `MONGODB_URI` - The MongoDB database URI to connect to.
(Default `mongodb://127.0.0.1:27017/coral`)
- `REDIS_URI` - The Redis database URI to connect to.
(Default `redis://127.0.0.1:6379`)
- `REDIS_OPTIONS` - A JSON string with optional configuration options to be used
when connecting to Redis as specified in the [ioredis](https://github.com/luin/ioredis/blob/1dac50a63753c2afc969315cfe38faf0edc50bc5/API.md#new_Redis_new) documentation.
(Default: `{}`)
- `SIGNING_SECRET` - The shared secret to use to sign JSON Web Tokens (JWT) with
the selected signing algorithm. 🚨 **Don't forget to set this variable!** 🚨
(Default: `keyboard cat`)
- `SIGNING_ALGORITHM` - The signing algorithm to use for signing JWT's.
(Default `HS256`).
- `LOGGING_LEVEL` - The logging level that can be set to one of `fatal`,
`error`, `warn`, `info`, `debug`, or `trace`. (Default `info`)
- `STATIC_URI` - The URI that static assets can be accessed from. This URI can
be to a proxy that uses this Coral server on `PORT` as the upstream. Disabled
by default.
- `DISABLE_TENANT_CACHING` - When `true`, all tenants will be loaded from the
database when needed rather than keeping a in-memory copy in sync via
published events on Redis. (Default `false`)
- `DISABLE_MONGODB_AUTOINDEXING` - When `true`, Coral will not perform indexing
operations when it starts up. This can be desired when you've already
installed Coral on the target MongoDB, but want to improve start performance.
**You should not use this parameter unless you know what you're doing! Upgrades
may introduce additional indexes that the application relies on.**
(Default `false`)
- `LOCALE` - Specify the default locale to use for all requests without a locale
specified. (Default `en-US`)
- `ENABLE_GRAPHIQL` - When `true`, it will enable the `/graphiql` even in
production, use with care. (Default `false`)
- `CONCURRENCY` - The number of worker nodes to spawn to handle web traffic,
this should be tied to the number of CPU's available. (Default
`os.cpus().length`)
- `DEV_PORT` - The port where the Webpack Development server is running on.
(Default `8080`)
- `METRICS_USERNAME` - The username for _Basic Authentication_ at the `/metrics` and `/cluster_metrics`
endpoint.
- `METRICS_PASSWORD` - The password for _Basic Authentication_ at the `/metrics` and `/cluster_metrics`
endpoint.
- `CLUSTER_METRICS_PORT` - If `CONCURRENCY` is more than `1`, the metrics are provided at this port under `/cluster_metrics`. (Default `3001`)
- `DISABLE_LIVE_UPDATES` - When `true`, disables subscriptions for the comment
stream for all stories across all tenants (Default `false`)
- `WEBSOCKET_KEEP_ALIVE_TIMEOUT` - A duration in a parsable format (e.g. `30 seconds`
, `1 minute`) that should be used to send keep alive messages through the
websocket to keep the socket alive (Default `30 seconds`)
- `TRUST_PROXY` - When provided, it configures the "trust proxy" settings for Express (See https://expressjs.com/en/guide/behind-proxies.html)
If you are interested in contributing to Coral, check out our [Contributor's Guide](CONTRIBUTING.md).
## License
Coral is released under the [Apache License, v2.0](/LICENSE).
Coral is [Apache-2.0 licensed](LICENSE).
+220
View File
@@ -0,0 +1,220 @@
# Webhooks Guide
This document is in reference to webhooks emitted by Coral. You can configure
webhooks on your installation of Coral by visiting `/admin/configure/webhooks`.
Once you've configured a webhook endpoint in Coral, you will receive updates
from Coral when those events occur. These will be in the form of `POST` requests
with a `JSON` payload consisting of the schema represented below.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents
- [Webhook Signing](#webhook-signing)
- [How to verify the signature(s)](#how-to-verify-the-signatures)
- [Schema](#schema)
- [Events Listing](#events-listing)
- [Events](#events)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
## Webhook Signing
Each webhook sent by Coral is signed by your webhook endpoint signing secret.
The signature method closely resembles the signing method used by Stripe for
their `v1` signing method. The `X-Coral-Signature` header contains one or more
signatures prefixed by `sha256=`.
If you receive a signature containing multiple signatures, it is typically when
you have rolled the signing secret from the administrative panel, and chosen to
keep the previous secret active for a duration of time.
### How to verify the signature(s)
```js
// Set your signing secret here from the administration panel.
const SIGNING_SECRET = "< YOUR SIGNING SECRET HERE >";
// We're using crypto to verify the signatures.
const crypto = require("crypto");
// We're using express to receive webhooks here.
const app = require("express")();
// Use the body-parser to get the raw body as a buffer so we can use it with the
// hashing functions.
const parser = require("body-parser");
function extractEvent(body, sig) {
// Step 1: Extract signatures from the header.
const signatures = sig
// Split the header by `,` to get a list of elements.
.split(",")
// Split each element by `=` to get a prefix and value pair.
.map(element => element.split("="))
// Grab all the elements with the prefix of `sha256`.
.filter(([prefix]) => prefix === "sha256")
// Grab the value from the prefix and value pair.
.map(([, value]) => value);
// Step 2: Prepare the `signed_payload`.
const signed_payload = body;
// Step 3: Calculate the expected signature.
const expected = crypto
.createHmac("sha256", SIGNING_SECRET)
.update(signed_payload)
.digest()
.toString("hex");
// Step 4: Compare signatures.
if (
// For each of the signatures on the request...
!signatures.some(signature =>
// Compare the expected signature to the signature on in the header. If at
// least one of the match, we should continue to process the event.
crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
)
) {
throw new Error("Invalid signature");
}
// Parse the JSON for the event.
return JSON.parse(body.toString());
}
app.post("/webhook", parser.raw({ type: "application/json" }), (req, res) => {
const sig = req.headers["x-coral-signature"];
let event;
try {
// Parse the JSON for the event.
event = extractEvent(req.body, sig);
} catch (err) {
return res.status(400).send(`Webhook Error: ${err.message}`);
}
// Handle the event.
switch (event.type) {
case "STORY_CREATED":
const data = event.data;
console.log(
`A Story with ID ${data.storyID} and URL ${data.storyURL} was created!`
);
break;
// ... handle other event types.
default:
// Unexpected event type
return response.status(400).end();
}
// Return a response to acknowledge receipt of the event
res.json({ received: true });
});
app.listen(4242, () => console.log("Running on port 4242"));
```
The procedure of how to verify the signatures follows.
#### **Step 1**: Extract signatures from the header
Split the header using `,` as the separator, to get a list of elements. Then
split each of these elements using `=` as the separator, to get a prefix and
value pair. The value for the prefix `sha256` corresponds to the signature(s).
#### **Step 2**: Prepare the `signed_payload` string
You can do this by taking the string contents of the body (before parsing or the
request body).
#### **Step 3**: Calculate the expected signature
Compute an HMAC signature using the SHA256 hash function. You can use the
webhook endpoint's signing secret as the key, and the above calculated
`signed_payload` as the message.
#### **Step 4**: Compare signatures
Compare the signature(s) in the header to the expected signature. To protect
against timing attacks, ensure you use a constant-time string comparison
function when comparing signatures.
## Schema
```ts
{
/**
* id is the identifier for this event, each event
* will have a unique id.
*/
id: string;
/**
* type is the name of this event, this indicates
* what is stored in the following `data` property.
* Refer to the `Events List` below to see what the
* type is for each event.
*/
type: string;
/**
* data is the object representing this particular
* event. Each type of event has a different shape
* to the data property. Refer to the `Events List`
* below to see what the data looks like for each
* event.
*/
data: object;
/**
* createdAt is the ISO 8601 representation of the
* date when this event was created.
*/
createdAt: string;
/**
* tenantID is the ID of the Tenant that this event originated at.
*/
tenantID: string;
/**
* tenantDomain is the domain that is associated with this Tenant that this event originated at.
*/
tenantDomain: string;
}
```
## Events Listing
- [`STORY_CREATED`](#story-created-event)
## Events
- <a id="story-created-event">**STORY_CREATED**</a>
```ts
{
id: string;
type: "STORY_CREATED";
data: {
/**
* storyID is the ID of the newly created Story.
*/
storyID: string;
/**
* storyURL is the URL of the newly created Story.
*/
storyURL: string;
/**
* siteID is the Site that the newly created Story was created on.
*/
siteID: string;
}
createdAt: string;
}
```
+4 -4
View File
@@ -10,10 +10,6 @@
"description": "The shared secret to use to sign JSON Web Tokens (JWT) with the selected signing algorithm.",
"generator": "secret"
},
"CONCURRENCY": {
"description": "The number of worker nodes to spawn to handle traffic.",
"value": "1"
},
"LOCALE": {
"description": "Specify the default locale to use for all requests without a locale specified",
"value": "en-US"
@@ -21,6 +17,10 @@
"ENABLE_GRAPHIQL": {
"description": "When true, this will enable the GraphiQL routes",
"value": "false"
},
"TRUST_PROXY": {
"description": "When set to 1, it instructs Coral to trust up to one proxy, this is needed for authentication support",
"value": "1"
}
},
"addons": [
+10 -18
View File
@@ -1,28 +1,20 @@
/**
* This is a project wide babel configuration.
* https://babeljs.io/docs/en/config-files#project-wide-configuration
*
* We use this file to apply babel configuration to packages in `node_modules`
*/
const lodashOptimizations =
// Note: If Webpack env is set, we are building for the client.
const plugins =
process.env.WEBPACK === "true" ? ["use-lodash-es", "lodash"] : [];
const environment =
process.env.WEBPACK === "true"
? { modules: false }
: { targets: { node: "current" }, modules: "commonjs" };
module.exports = {
babelrcRoots: ["./src/core/client/*"],
env: {
production: {
plugins: [...lodashOptimizations],
},
development: {
plugins: [...lodashOptimizations],
},
test: {
presets: [
["@babel/env", { targets: { node: "current" } }],
"@babel/react",
],
plugins: ["dynamic-import-node"],
},
},
plugins,
presets: [["@babel/env", environment]],
};
+5 -6
View File
@@ -7,7 +7,7 @@ module.exports = {
collectCoverageFrom: ["**/*.{js,jsx,mjs,ts,tsx}"],
coveragePathIgnorePatterns: ["/node_modules/"],
setupFiles: [
"<rootDir>/src/core/build/polyfills.js",
"<rootDir>/src/core/client/test/polyfills.ts",
"<rootDir>/src/core/client/test/setup.ts",
],
setupFilesAfterEnv: ["<rootDir>/src/core/client/test/setupTestFramework.ts"],
@@ -29,6 +29,7 @@ module.exports = {
"^coral-account/(.*)$": "<rootDir>/src/core/client/account/$1",
"^coral-admin/(.*)$": "<rootDir>/src/core/client/admin/$1",
"^coral-auth/(.*)$": "<rootDir>/src/core/client/auth/$1",
"^coral-count/(.*)$": "<rootDir>/src/core/client/count/$1",
"^coral-ui/(.*)$": "<rootDir>/src/core/client/ui/$1",
"^coral-stream/(.*)$": "<rootDir>/src/core/client/stream/$1",
"^coral-framework/(.*)$": "<rootDir>/src/core/client/framework/$1",
@@ -39,11 +40,9 @@ module.exports = {
snapshotSerializers: ["enzyme-to-json/serializer"],
globals: {
"ts-jest": {
useBabelrc: true,
tsConfigFile: path.resolve(
__dirname,
"../../src/core/client/tsconfig.json"
),
babelConfig: true,
tsConfig: path.resolve(__dirname, "../../src/core/client/tsconfig.json"),
},
},
preset: "ts-jest/presets/js-with-babel",
};
+4 -2
View File
@@ -6,6 +6,7 @@ module.exports = {
roots: ["<rootDir>/src"],
collectCoverageFrom: ["**/*.{js,jsx,mjs,ts,tsx}"],
coveragePathIgnorePatterns: ["/node_modules/"],
setupFilesAfterEnv: ["<rootDir>/src/core/server/test/setupTestFramework.ts"],
testMatch: ["**/*.spec.{js,jsx,mjs,ts,tsx}"],
testPathIgnorePatterns: ["/node_modules/", "/client/"],
testEnvironment: "node",
@@ -20,8 +21,9 @@ module.exports = {
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
globals: {
"ts-jest": {
useBabelrc: true,
tsConfigFile: path.resolve(__dirname, "../../src/tsconfig.json"),
babelConfig: true,
tsConfig: path.resolve(__dirname, "../../src/tsconfig.json"),
},
},
preset: "ts-jest",
};
+4 -101
View File
@@ -1,107 +1,10 @@
// Apply all the configuration provided in the .env file.
require("dotenv").config();
const path = require("path");
const fs = require("fs");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const extensions = [".ts", ".tsx", ".js"];
// TODO: There is some weird issue with including paths.ts here
const postCSSConfigPath = "./src/core/build/postcss.config";
const isProduction = process.NODE_ENV === "production";
const appDirectory = fs.realpathSync(process.cwd());
const styleLoader = {
loader: require.resolve("style-loader"),
options: {
sourceMap: true,
hmr: true,
},
};
export default {
title: "Coral 5.0",
source: "./src",
typescript: true,
module.exports = {
title: "Coral 5",
src: "./src",
host: process.env.HOST || "0.0.0.0",
port: parseInt(process.env.DOCZ_PORT, 10) || 3030,
codeSandbox: false, // Too large to create code sandboxes..
modifyBundlerConfig: config => {
config.entry.app.push(
`${appDirectory}/src/core/client/ui/theme/variables.css.ts`
);
config.module.rules.push({
test: /\.css\.ts$/,
use: [
styleLoader,
{
loader: require.resolve("css-loader"),
options: {
modules: true,
importLoaders: 2,
localIdentName: "[name]-[local]-[hash:base64:5]",
sourceMap: true,
},
},
{
loader: require.resolve("postcss-loader"),
options: {
config: {
path: postCSSConfigPath,
},
parser: "postcss-js",
},
},
{
loader: require.resolve("babel-loader"),
options: {
configFile: false,
babelrc: false,
presets: [
"@babel/typescript",
[
"@babel/env",
{ targets: { node: "10.0.0" }, modules: "commonjs" },
],
],
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
},
},
],
});
config.module.rules.push({
test: /\.css$/,
use: [
styleLoader,
{
loader: require.resolve("css-loader"),
options: {
modules: true,
importLoaders: 1,
localIdentName: "[name]-[local]-[hash:base64:5]",
sourceMap: true,
},
},
{
loader: require.resolve("postcss-loader"),
options: {
config: {
path: postCSSConfigPath,
},
},
},
],
});
config.resolve.plugins = [
new TsconfigPathsPlugin({
extensions,
// TODO: There is some weird issue with including paths.ts here
configFile: "./src/core/client/tsconfig.json",
}),
];
// fs.writeFileSync(path.resolve(__dirname, "tmp"), stringify(config, null, 2));
return config;
},
files: "**/*.mdx",
};
+216
View File
@@ -0,0 +1,216 @@
const fs = require("fs");
const path = require("path");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
/** Path to postCSSConfig */
const postCSSConfigPath = path.resolve(
__dirname,
"../src/core/build/postcss.config"
);
const rootDir = path.resolve(__dirname, "../");
const srcDir = path.resolve(rootDir, "./src");
const appTsconfig = path.resolve(rootDir, "./src/core/client/tsconfig.json");
const CSS_PATTERN = /\.css$/;
const MODULE_CSS_PATTERN = /\.module\.css$/;
// Define `RegExp.toJSON` so that we can stringify RegExp.
Object.defineProperty(RegExp.prototype, "toJSON", {
value: RegExp.prototype.toString,
});
const isCssRules = (rule) =>
rule.test &&
(rule.test.toString() === CSS_PATTERN.toString() ||
rule.test.toString() === MODULE_CSS_PATTERN.toString());
const findCssRules = (config) =>
config.module.rules.find(
(rule) => Array.isArray(rule.oneOf) && rule.oneOf.every(isCssRules)
);
exports.onCreateWebpackConfig = ({
stage,
rules,
loaders,
plugins,
actions,
getConfig,
}) => {
// Get webpack config.
const config = getConfig();
if (stage === "develop") {
config.entry.commons.push(
// Add our stream css variables file.
`${srcDir}/core/client/ui/theme/stream.css.ts`
);
}
/*
TODO: (cvle) couldn't get build to work...
if (stage === "build-javascript") {
config.entry.app = [
config.entry.app,
`${appDir}/core/client/ui/theme/stream.css.ts`,
];
}
*/
// Find the gatsby CSS rules.
const cssRules = findCssRules(config);
// Exclude them from our src dir because they are incomaptible with our
// CSS rules.
cssRules.exclude = srcDir;
// Add .tx .tsx to modules
config.resolve.extensions.push(".ts", ".tsx");
actions.replaceWebpackConfig(config);
// Write out webpack config to .docz folder.
fs.writeFileSync(
path.resolve(__dirname, "webpack-" + stage),
JSON.stringify(config, {}, 2)
);
// Turn on sourceMap during develop.
const sourceMap = stage.startsWith("develop");
// CSS loaders to prepend.
const prependCSSLoaders = [];
if (stage === "develop") {
prependCSSLoaders.push(loaders.style());
}
/*
TODO: (cvle) couldn't get build to work...
if (stage === "build-javascript") {
moreLoaders.push(loaders.style());
}
*/
actions.setWebpackConfig({
resolve: {
plugins: [
// Resolve our custom paths.
new TsconfigPathsPlugin({
extensions: [".ts", ".tsx", ".js"],
configFile: path.resolve(rootDir, "./src/core/client/tsconfig.json"),
}),
],
},
module: {
rules: [
{
include: srcDir,
oneOf: [
{
test: /\.css\.ts$/,
use: [
...prependCSSLoaders,
{
loader: require.resolve("css-loader"),
options: {
modules: {
localIdentName: "[name]-[local]-[hash:base64:5]",
},
importLoaders: 2,
sourceMap,
},
},
{
loader: require.resolve("postcss-loader"),
options: {
config: {
path: postCSSConfigPath,
},
parser: "postcss-js",
},
},
{
loader: require.resolve("babel-loader"),
options: {
configFile: false,
babelrc: false,
presets: [
"@babel/typescript",
[
"@babel/env",
{ targets: { node: "current" }, modules: "commonjs" },
],
],
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
},
},
],
},
{
test: /\.css$/,
use: [
...prependCSSLoaders,
{
loader: require.resolve("css-loader"),
options: {
modules: {
localIdentName: "[name]-[local]-[hash:base64:5]",
},
importLoaders: 1,
sourceMap,
},
},
{
loader: require.resolve("postcss-loader"),
options: {
config: {
path: postCSSConfigPath,
},
},
},
],
},
{
test: /\.tsx?$/,
use: [
{
loader: require.resolve("babel-loader"),
options: {
root: rootDir,
// This is a feature of `babel-loader` for webpack (not Babel itself).
// It enables caching results in ./node_modules/.cache/babel-loader/
// directory for faster rebuilds.
cacheDirectory: true,
},
},
{
loader: require.resolve("ts-loader"),
options: {
configFile: appTsconfig,
compilerOptions: {
target: "es2015",
module: "esnext",
jsx: "preserve",
noEmit: false,
},
transpileOnly: true,
// Overwrites the behavior of `include` and `exclude` to only
// include files that are actually being imported and which
// are necessary to compile the bundle.
onlyCompileBundledFiles: true,
},
},
],
},
],
},
],
},
});
// Write out processed webpack config to .docz folder.
fs.writeFileSync(
path.resolve(__dirname, "webpack-" + stage + "-processed"),
JSON.stringify(getConfig(), {}, 2)
);
};
+35881 -16961
View File
File diff suppressed because it is too large Load Diff
+339 -263
View File
@@ -1,9 +1,10 @@
{
"name": "@coralproject/talk",
"version": "5.0.0-beta.8",
"version": "6.3.1",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
"*.css.ts",
"*.css"
],
"repository": {
@@ -11,20 +12,24 @@
"url": "git://github.com/coralproject/talk.git"
},
"engines": {
"node": ">=10.0.0",
"npm": ">=6.9.0"
"node": "^12",
"npm": "^6"
},
"bugs": "https://github.com/coralproject/talk/issues",
"contributors": [
"https://github.com/coralproject/talk/graphs/contributors"
],
"description": "A better commenting experience from Mozilla, The Washington Post, and The New York Times.",
"description": "A better commenting experience from Vox Media.",
"scripts": {
"build": "NODE_ENV=production npm-run-all generate-persist --parallel lint:client build:client build:server",
"build:development": "NODE_ENV=development npm-run-all generate --parallel lint:client build:client build:server",
"clean": "gulp clean",
"build": "NODE_ENV=production npm-run-all generate-persist --parallel build:client build:server",
"build:development": "NODE_ENV=development npm-run-all generate --parallel build:client build:server",
"build:client": "ts-node --transpile-only ./scripts/build.ts",
"build:server": "gulp server",
"doctoc": "doctoc --title='## Table of Contents' --github README.md",
"migration:create": "ts-node --transpile-only ./scripts/migration/create.ts",
"docs:events": "ts-node ./scripts/generateEventDocs.ts ./src/core/client/stream/events.ts ./CLIENT_EVENTS.md",
"docs:css-variables": "ts-node ./scripts/generateCSSVariablesDocs.ts ./src/core/client/ui/theme/streamVariables.ts ./CSS_VARIABLES.md",
"doctoc": "doctoc --maxlevel=3 --title '## Table of Contents' CLIENT_EVENTS.md CONTRIBUTING.md WEBHOOKS.md EXTERNAL_MODERATION_PHASES.md",
"generate": "npm-run-all generate:css-types generate:schema generate:relay",
"generate-persist": "npm-run-all generate:css-types generate:schema generate:relay-persist",
"generate:css-types": "tcm src/core/client/",
@@ -38,15 +43,15 @@
"generate:schema": "node ./scripts/generateSchemaTypes.js",
"docz": "docz",
"start": "NODE_ENV=production node dist/index.js",
"start:development": "NODE_ENV=development CONCURRENCY=${CONCURRENCY:-1} TS_NODE_PROJECT=./src/tsconfig.json ts-node-dev --inspect --transpile-only --no-notify -r tsconfig-paths/register ./src/index.ts",
"start:development": "NODE_ENV=development TS_NODE_PROJECT=./src/tsconfig.json ts-node-dev --inspect --transpile-only --no-notify -r tsconfig-paths/register ./src/index.ts",
"start:webpackDevServer": "ts-node --transpile-only ./scripts/start.ts",
"lint": "npm-run-all --parallel lint:* tscheck:*",
"lint:server": "tslint --project ./src/tsconfig.json",
"lint:client": "tslint --project ./src/core/client/tsconfig.json",
"lint:scripts": "tslint --project ./tsconfig.json",
"lint:graphql": "graphql-schema-linter src/core/server/graph/tenant/schema/schema.graphql",
"lint:server": "eslint 'src/**/*.{js,ts,tsx}' --ignore-pattern 'src/core/client/**'",
"lint:client": "eslint 'src/core/client/**/*.{js,ts,tsx}'",
"lint:scripts": "eslint 'scripts/**/*.{js,ts,tsx}'",
"lint:graphql": "graphql-schema-linter src/core/server/graph/schema/schema.graphql",
"lint-fix": "npm run lint:server -- --fix && npm run lint:client -- --fix && npm run lint:scripts -- --fix",
"test": "node scripts/test.js --env=jsdom",
"test": "node --trace-warnings scripts/test.js --env=jsdom",
"tscheck": "npm-run-all --parallel tscheck:*",
"tscheck:server": "tsc --project ./src/tsconfig.json --noEmit",
"tscheck:client": "tsc --project ./src/core/client/tsconfig.json --noEmit",
@@ -56,332 +61,403 @@
"license": "Apache-2.0",
"dependencies": {
"@coralproject/bunyan-prettystream": "^0.1.4",
"@types/archiver": "^3.0.0",
"@types/cron": "^1.7.1",
"akismet-api": "^4.2.0",
"apollo-server-express": "^2.8.1",
"archiver": "^3.0.3",
"@emotion/core": "^10.0.28",
"@fluent/bundle": "^0.15.0",
"@fluent/dom": "^0.6.0",
"@hapi/joi": "^17.1.1",
"@metascraper/helpers": "^5.11.6",
"@rudderstack/rudder-sdk-node": "0.0.2",
"@types/recharts": "^1.8.9",
"abort-controller": "^3.0.0",
"akismet-api": "^5.0.0",
"apollo-server-core": "^2.14.4",
"apollo-server-express": "^2.14.2",
"archiver": "^3.1.1",
"basic-auth": "^2.0.1",
"bcryptjs": "^2.4.3",
"bull": "^3.8.1",
"bull": "^3.13.0",
"bunyan": "^1.8.12",
"cheerio": "^1.0.0-rc.2",
"common-tags": "^1.8.0",
"bytes": "^3.1.0",
"cheerio": "^1.0.0-rc.3",
"consolidate": "0.14.0",
"content-security-policy-builder": "^2.0.0",
"convict": "^4.3.1",
"content-security-policy-builder": "^2.1.0",
"convict": "^5.2.0",
"cookie": "^0.4.0",
"cookie-parser": "^1.4.4",
"cors": "^2.8.4",
"cron": "^1.7.1",
"csv-stringify": "^5.3.0",
"dataloader": "^1.4.0",
"dompurify": "^1.0.8",
"dotenv": "^6.0.0",
"dotenv-expand": "^4.2.0",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5",
"cron": "^1.8.2",
"csv-stringify": "^5.3.6",
"dataloader": "1.4.0",
"dompurify": "^2.0.8",
"dotenv": "^8.2.0",
"emailjs": "^3.2.0",
"env-rewrite": "^1.0.2",
"express": "^4.16.3",
"express-static-gzip": "^0.3.2",
"farce": "^0.2.6",
"fluent": "^0.10.0",
"fluent-dom": "^0.4.1",
"found": "^0.4.0-alpha.17",
"found-relay": "^0.4.0-alpha.8",
"fs-extra": "^6.0.1",
"graphql": "^0.13.2",
"graphql-config": "^2.0.1",
"graphql-extensions": "^0.2.1",
"graphql-fields": "^1.1.0",
"graphql-playground-html": "^1.6.0",
"graphql-redis-subscriptions": "^2.1.0",
"express": "^4.17.1",
"express-enforces-ssl": "^1.1.0",
"express-static-gzip": "^2.0.6",
"fs-extra": "^8.1.0",
"graphql": "^14.6.0",
"graphql-config": "^2.2.2",
"graphql-extensions": "^0.11.0",
"graphql-fields": "2.0.3",
"graphql-import": "^0.7.1",
"graphql-playground-html": "1.6.13",
"graphql-redis-subscriptions": "^2.2.1",
"graphql-subscriptions": "^1.1.0",
"graphql-tools": "^3.0.5",
"html-minifier": "^3.5.21",
"html-to-text": "^4.0.0",
"ioredis": "^4.9.0",
"joi": "^13.4.0",
"jsdom": "^15.0.0",
"jsonwebtoken": "^8.3.0",
"juice": "^5.2.0",
"jwks-rsa": "^1.3.0",
"linkify-it": "^2.1.0",
"linkifyjs": "^2.1.8",
"lodash": "^4.17.10",
"graphql-tools": "^4.0.7",
"helmet": "^3.22.0",
"html-minifier": "^4.0.0",
"html-to-text": "^5.1.1",
"ioredis": "^4.16.1",
"jsdom": "^16.2.2",
"jsonwebtoken": "^8.5.1",
"juice": "^6.0.0",
"jwks-rsa": "^1.7.0",
"linkifyjs": "^2.1.9",
"lodash": "^4.17.19",
"long-settimeout": "^1.0.1",
"lru-cache": "^5.1.1",
"luxon": "^1.12.0",
"metascraper-author": "^3.11.8",
"metascraper-date": "^3.11.4",
"metascraper-description": "^3.11.8",
"metascraper-image": "^3.11.8",
"metascraper-title": "^3.11.8",
"mongodb": "^3.2.7",
"luxon": "^1.22.2",
"metascraper-author": "^5.11.6",
"metascraper-description": "^5.11.6",
"metascraper-image": "^5.11.6",
"metascraper-title": "^5.11.6",
"mongodb": "^3.5.9",
"mongodb-core": "^3.2.7",
"ms": "^2.1.1",
"node-fetch": "^2.2.0",
"nodemailer": "^4.6.7",
"nunjucks": "^3.1.3",
"ms": "^2.1.2",
"node-fetch": "^2.6.0",
"nunjucks": "^3.2.1",
"on-finished": "^2.3.0",
"passport": "^0.4.0",
"passport-facebook": "^2.1.1",
"passport-google-oauth2": "^0.1.6",
"passport": "^0.4.1",
"passport-facebook": "^3.0.0",
"passport-google-oauth2": "^0.2.0",
"passport-local": "^1.0.0",
"passport-oauth2": "^1.4.0",
"passport-oauth2": "^1.5.0",
"passport-strategy": "^1.0.0",
"performance-now": "^2.1.0",
"permit": "^0.2.4",
"prom-client": "^11.3.0",
"proxy-agent": "^3.1.0",
"querystringify": "^2.1.0",
"react-relay-network-modern": "^4.0.4",
"source-map-support": "^0.5.12",
"stack-utils": "^1.0.2",
"prom-client": "^12.0.0",
"proxy-agent": "^3.1.1",
"querystringify": "^2.1.1",
"react-helmet": "^5.2.1",
"recharts": "^1.8.5",
"source-map-support": "^0.5.16",
"stack-utils": "^2.0.1",
"striptags": "^3.1.1",
"throng": "^4.0.0",
"tlds": "^1.203.1",
"tsscmp": "^1.0.6",
"url-regex": "^5.0.0",
"uuid": "^3.3.2",
"verror": "^1.10.0"
"uuid": "^7.0.3",
"verror": "^1.10.0",
"xregexp": "^4.3.0"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-modules-commonjs": "^7.4.4",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.3.3",
"@babel/core": "^7.10.3",
"@babel/preset-env": "^7.10.3",
"@babel/preset-react": "^7.10.1",
"@babel/preset-typescript": "^7.10.1",
"@babel/runtime-corejs3": "^7.10.3",
"@coralproject/npm-run-all": "^4.1.5",
"@coralproject/rte": "^0.10.15",
"@coralproject/rte": "^1.1.1",
"@fluent/react": "^0.11.1",
"@intervolga/optimize-cssnano-plugin": "^1.0.6",
"@types/agent-base": "^4.2.0",
"@types/basic-auth": "^1.1.2",
"@types/bcryptjs": "^2.4.1",
"@types/bull": "^3.5.12",
"@types/bunyan": "^1.8.4",
"@types/case-sensitive-paths-webpack-plugin": "^2.1.2",
"@types/cheerio": "^0.22.8",
"@types/classnames": "^2.2.7",
"@types/commander": "^2.12.2",
"@types/archiver": "^3.1.0",
"@types/basic-auth": "^1.1.3",
"@types/bcryptjs": "^2.4.2",
"@types/bull": "^3.12.1",
"@types/bunyan": "^1.8.6",
"@types/bytes": "^3.1.0",
"@types/case-sensitive-paths-webpack-plugin": "^2.1.4",
"@types/cheerio": "^0.22.17",
"@types/classnames": "^2.2.10",
"@types/common-tags": "^1.8.0",
"@types/compression-webpack-plugin": "^2.0.0",
"@types/consolidate": "0.0.34",
"@types/convict": "^4.2.0",
"@types/compression-webpack-plugin": "^2.0.1",
"@types/consolidate": "0.14.0",
"@types/convict": "^5.2.1",
"@types/cookie": "^0.3.3",
"@types/cookie-parser": "^1.4.1",
"@types/cors": "^2.8.4",
"@types/cross-spawn": "^6.0.0",
"@types/dotenv": "^4.0.3",
"@types/enzyme": "^3.1.15",
"@types/enzyme-adapter-react-16": "^1.0.3",
"@types/cookie-parser": "^1.4.2",
"@types/cors": "^2.8.6",
"@types/cron": "^1.7.2",
"@types/cross-spawn": "^6.0.1",
"@types/dompurify": "^2.0.1",
"@types/enzyme": "^3.10.5",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/eventemitter2": "^4.1.0",
"@types/express": "^4.16.0",
"@types/flat": "0.0.28",
"@types/fs-extra": "^5.0.4",
"@types/graphql": "^0.13.3",
"@types/html-minifier": "^3.5.2",
"@types/express": "^4.17.4",
"@types/express-enforces-ssl": "^1.1.1",
"@types/express-serve-static-core": "^4.17.3",
"@types/flat": "^5.0.0",
"@types/fs-extra": "^8.1.0",
"@types/hapi__joi": "^16.0.12",
"@types/helmet": "^0.0.45",
"@types/html-minifier": "^3.5.3",
"@types/html-minifier-terser": "^5.0.0",
"@types/html-to-text": "^1.4.31",
"@types/html-webpack-plugin": "^3.2.0",
"@types/ioredis": "^4.0.10",
"@types/jest": "^24.0.13",
"@types/joi": "^13.0.8",
"@types/jsdom": "^12.2.3",
"@types/jsonwebtoken": "^7.2.7",
"@types/linkify-it": "^2.1.0",
"@types/linkifyjs": "^2.1.1",
"@types/lodash": "^4.14.118",
"@types/html-webpack-plugin": "^3.2.3",
"@types/ioredis": "^4.14.9",
"@types/jest": "^26.0.3",
"@types/jest-axe": "^3.2.2",
"@types/jsdom": "^16.2.0",
"@types/jsonwebtoken": "^8.3.8",
"@types/linkifyjs": "^2.1.3",
"@types/lodash": "^4.14.149",
"@types/lru-cache": "^5.1.0",
"@types/luxon": "^1.12.0",
"@types/marked": "^0.6.0",
"@types/mini-css-extract-plugin": "^0.2.0",
"@types/mongodb": "^3.1.22",
"@types/ms": "^0.7.30",
"@types/node": "^10.5.2",
"@types/node-fetch": "^2.3.3",
"@types/nodemailer": "^4.6.2",
"@types/nunjucks": "^3.1.1",
"@types/luxon": "^1.22.0",
"@types/marked": "^0.7.3",
"@types/mini-css-extract-plugin": "^0.9.1",
"@types/mongodb": "3.1.22",
"@types/ms": "^0.7.31",
"@types/node": "^12.12.34",
"@types/node-fetch": "^2.5.5",
"@types/nunjucks": "^3.1.3",
"@types/on-finished": "^2.3.1",
"@types/passport": "^0.4.6",
"@types/passport-facebook": "^2.1.8",
"@types/passport": "^1.0.3",
"@types/passport-facebook": "^2.1.9",
"@types/passport-local": "^1.0.33",
"@types/passport-oauth2": "^1.4.5",
"@types/passport-strategy": "^0.2.33",
"@types/passport-oauth2": "^1.4.8",
"@types/passport-strategy": "^0.2.35",
"@types/permit": "^0.2.1",
"@types/prop-types": "^15.5.8",
"@types/react": "^16.8.15",
"@types/react-copy-to-clipboard": "^4.2.6",
"@types/react-dom": "^16.8.4",
"@types/react-relay": "^1.3.14",
"@types/react-responsive": "^3.0.1",
"@types/react-test-renderer": "^16.8.1",
"@types/react-transition-group": "^2.0.14",
"@types/recompose": "^0.26.5",
"@types/relay-runtime": "^1.3.12",
"@types/prettier": "^1.19.1",
"@types/react": "^16.9.31",
"@types/react-axe": "^3.1.0",
"@types/react-copy-to-clipboard": "^4.3.0",
"@types/react-dom": "^16.9.6",
"@types/react-helmet": "^5.0.15",
"@types/react-relay": "^7.0.3",
"@types/react-responsive": "^8.0.2",
"@types/react-test-renderer": "^16.9.2",
"@types/react-transition-group": "^4.2.4",
"@types/recompose": "^0.30.7",
"@types/relay-runtime": "^8.0.7",
"@types/sane": "^2.0.0",
"@types/shallow-equals": "^1.0.0",
"@types/simplemde": "^1.11.7",
"@types/sinon": "^7.0.11",
"@types/source-map-support": "^0.5.0",
"@types/sinon": "^7.5.2",
"@types/source-map-support": "^0.5.1",
"@types/stack-trace": "0.0.29",
"@types/stack-utils": "^1.0.1",
"@types/throng": "^4.0.2",
"@types/tlds": "^1.199.0",
"@types/uuid": "^3.4.4",
"@types/uuid": "^7.0.2",
"@types/verror": "^1.10.3",
"@types/vinyl": "^2.0.2",
"@types/webpack": "^4.4.31",
"@types/webpack-assets-manifest": "^3.0.0",
"@types/webpack-bundle-analyzer": "^2.13.1",
"@types/webpack-dev-server": "^3.1.5",
"@types/ws": "^5.1.2",
"acorn": "^6.1.1",
"ansi-styles": "^3.2.0",
"autoprefixer": "^9.5.1",
"@types/vinyl": "^2.0.4",
"@types/webpack": "^4.41.17",
"@types/webpack-assets-manifest": "^3.0.1",
"@types/webpack-bundle-analyzer": "^3.8.0",
"@types/webpack-dev-server": "^3.11.0",
"@types/ws": "^7.2.3",
"@types/xregexp": "^4.3.0",
"@typescript-eslint/eslint-plugin": "^3.4.0",
"@typescript-eslint/eslint-plugin-tslint": "^3.4.0",
"@typescript-eslint/parser": "^3.4.0",
"autoprefixer": "^9.7.5",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.5",
"babel-plugin-dynamic-import-node": "^2.2.0",
"babel-jest": "^26.1.0",
"babel-loader": "^8.1.0",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-module-resolver": "^3.2.0",
"babel-plugin-relay": "^4.0.0",
"babel-plugin-module-resolver": "^4.0.0",
"babel-plugin-relay": "^9.1.0",
"babel-plugin-use-lodash-es": "^0.2.0",
"babel-preset-react-optimize": "^1.0.1",
"bowser": "^1.9.4",
"case-sensitive-paths-webpack-plugin": "^2.2.0",
"chalk": "^2.4.2",
"chokidar": "^3.0.0",
"bowser": "^2.9.0",
"case-sensitive-paths-webpack-plugin": "^2.3.0",
"chalk": "^3.0.0",
"chokidar": "^3.3.1",
"classnames": "^2.2.6",
"commander": "^2.20.0",
"comment-json": "^1.1.3",
"compression-webpack-plugin": "^2.0.0",
"copy-webpack-plugin": "^5.0.3",
"cross-spawn": "^6.0.5",
"css-loader": "^1.0.1",
"del": "^4.1.1",
"commander": "^5.0.0",
"comment-json": "^3.0.2",
"common-tags": "^1.8.0",
"compression-webpack-plugin": "^3.1.0",
"core-js": "^3.6.4",
"cross-spawn": "^7.0.1",
"css-loader": "^3.4.2",
"css-vars-ponyfill": "^2.2.1",
"del": "^5.1.0",
"doctoc": "^1.4.0",
"docz": "^0.13.7",
"docz-theme-default": "^0.13.7",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.12.1",
"enzyme-to-json": "^3.3.5",
"eventemitter2": "^5.0.1",
"final-form": "4.11.0",
"flat": "^4.1.0",
"docz": "^v2.3.0-alpha.14",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"enzyme-to-json": "^3.5.0",
"eslint": "^7.3.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jsdoc": "^28.5.1",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.0",
"eventemitter2": "^6.3.1",
"farce": "^0.2.8",
"final-form": "4.18.6",
"final-form-arrays": "^3.0.2",
"flat": "^5.0.0",
"fluent-intl-polyfill": "^0.1.0",
"fluent-langneg": "^0.1.1",
"fluent-react": "^0.8.4",
"fork-ts-checker-webpack-plugin": "^1.3.0",
"graphql-schema-linter": "^0.2.0",
"graphql-schema-typescript": "^1.2.9",
"fork-ts-checker-webpack-plugin": "^4.1.2",
"found": "^0.4.10",
"found-relay": "^0.7.0",
"graphql-schema-linter": "^0.4.0",
"graphql-schema-typescript": "^1.3.2",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-cli": "^2.2.0",
"gulp-cli": "^2.3.0",
"gulp-sourcemaps": "^2.6.5",
"gulp-typescript": "^5.0.1",
"html-webpack-plugin": "^4.0.0-beta.5",
"husky": "^2.2.0",
"intersection-observer": "^0.6.0",
"jest": "^24.8.0",
"jest-junit": "^6.4.0",
"jest-localstorage-mock": "^2.4.0",
"jest-mock-console": "^1.0.0",
"lint-staged": "^8.1.6",
"loader-utils": "^1.2.3",
"lodash-es": "^4.17.11",
"marked": "^0.6.0",
"gulp-typescript": "^6.0.0-alpha.1",
"html-webpack-plugin": "^4.0.4",
"husky": "^4.2.3",
"intersection-observer": "^0.7.0",
"jest": "^26.1.0",
"jest-axe": "^3.4.0",
"jest-junit": "^11.0.1",
"jest-localstorage-mock": "^2.4.2",
"jest-mock-console": "^1.0.1",
"keymaster": "^1.6.2",
"lint-staged": "^10.2.11",
"loader-utils": "^2.0.0",
"lodash-es": "^4.17.15",
"marked": "^0.8.2",
"material-design-icons": "^3.0.1",
"mini-css-extract-plugin": "^0.6.0",
"postcss-advanced-variables": "^3.0.0",
"postcss-css-variables": "^0.11.0",
"postcss-flexbugs-fixes": "^4.1.0",
"postcss-font-magician": "^2.2.1",
"postcss-import": "^11.1.0",
"postcss-js": "^2.0.1",
"mini-css-extract-plugin": "^0.9.0",
"postcss-advanced-variables": "^3.0.1",
"postcss-calc-function": "^1.1.0",
"postcss-flexbugs-fixes": "^4.2.0",
"postcss-font-magician": "^2.3.1",
"postcss-import": "^12.0.1",
"postcss-js": "^2.0.3",
"postcss-loader": "^3.0.0",
"postcss-mixins": "^6.2.1",
"postcss-nested": "^4.1.1",
"postcss-mixins": "^6.2.3",
"postcss-nested": "^4.2.1",
"postcss-prepend-imports": "^1.0.1",
"postcss-preset-env": "^6.5.0",
"prettier": "^1.17.0",
"prop-types": "^15.6.2",
"pstree.remy": "^1.1.6",
"postcss-preset-env": "^6.7.0",
"prettier": "^2.0.2",
"proxy-polyfill": "^0.3.1",
"pstree.remy": "^1.1.7",
"pym.js": "^1.3.2",
"raw-loader": "^0.5.1",
"react": "^16.9.0-alpha.0",
"react-copy-to-clipboard": "^5.0.1",
"react-dev-utils": "^9.0.0",
"react-dom": "^16.9.0-alpha.0",
"react-error-overlay": "^5.1.6",
"react-final-form": "4.0.2",
"react-popper": "^1.3.2",
"react-relay": "^4.0.0",
"react-responsive": "^7.0.0",
"react-test-renderer": "^16.9.0-alpha.0",
"react-timeago": "^4.1.9",
"react-transition-group": "^2.9.0",
"react-with-state-props": "^2.0.4",
"recompose": "0.27.1",
"relay-compiler": "^4.0.0",
"relay-compiler-language-typescript": "^4.1.0",
"raw-loader": "^4.0.0",
"react": "^16.13.1",
"react-axe": "^3.4.1",
"react-copy-to-clipboard": "^5.0.2",
"react-dev-utils": "^10.2.1",
"react-dom": "^16.13.1",
"react-error-overlay": "^6.0.7",
"react-final-form": "6.3.0",
"react-final-form-arrays": "^3.1.1",
"react-popper": "^1.3.7",
"react-relay": "^9.0.0",
"react-relay-network-modern": "^4.6.1",
"react-responsive": "^8.0.3",
"react-test-renderer": "^16.13.1",
"react-timeago": "^4.4.0",
"react-transition-group": "^4.3.0",
"recompose": "^0.30.0",
"regenerator-runtime": "^0.13.5",
"relay-compiler": "^9.0.0",
"relay-compiler-language-typescript": "^12.0.3",
"relay-local-schema": "^0.8.0",
"relay-runtime": "^4.0.0",
"relay-runtime": "^9.0.0",
"resize-observer-polyfill": "^1.5.1",
"sane": "^4.1.0",
"shallow-equals": "^1.0.0",
"simplemde": "^1.11.2",
"simulant": "^0.2.2",
"sinon": "^7.3.2",
"sockjs-client": "^1.3.0",
"strip-ansi": "^5.2.0",
"style-loader": "^0.23.1",
"sinon": "^9.0.1",
"sockjs-client": "^1.4.0",
"stack-trace": "^0.0.10",
"strip-ansi": "^6.0.0",
"style-loader": "^1.1.3",
"subscriptions-transport-ws": "^0.9.16",
"terser-webpack-plugin": "^1.2.3",
"thread-loader": "^2.1.2",
"terser-webpack-plugin": "^2.3.5",
"thread-loader": "^2.1.3",
"timekeeper": "^2.2.0",
"ts-jest": "<23.10.0",
"ts-loader": "^6.0.0",
"ts-node": "^8.1.0",
"ts-node-dev": "^1.0.0-pre.37",
"tsconfig-paths": "^3.8.0",
"ts-jest": "26.1.1",
"ts-loader": "^7.0.5",
"ts-node": "^8.10.2",
"ts-node-dev": "1.0.0-pre.44",
"tsconfig-paths": "^3.9.0",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"tslint": "^5.16.0",
"tslint-config-prettier": "^1.18.0",
"tslint-plugin-prettier": "^2.0.1",
"tslint-react": "^4.0.0",
"typed-css-modules": "^0.4.2",
"typeface-manuale": "^0.0.71",
"typeface-source-sans-pro": "^0.0.54",
"typescript": "3.3.4000",
"typescript-snapshots-plugin": "^1.6.0",
"wait-for-expect": "^1.1.1",
"webpack": "^4.30.0",
"tslint": "^6.1.2",
"typed-css-modules": "^0.6.4",
"typeface-manuale": "^1.1.4",
"typeface-nunito": "^1.1.3",
"typeface-open-sans": "^0.0.75",
"typeface-source-sans-pro": "^1.1.5",
"typescript": "^3.9.5",
"typescript-snapshots-plugin": "^1.7.0",
"wait-for-expect": "^1.3.0",
"webpack": "^4.43.0",
"webpack-assets-manifest": "^3.1.1",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "3.2.1",
"webpack-bundle-analyzer": "^3.8.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"whatwg-fetch": "^3.0.0"
},
"dependencies-pins-documentation": {
"ts-node-dev@1.0.0-pre.44": [
"Newer versions unbearibly slow"
],
"ts-jest@25.4.0": [
"Newer versions require every definition file to be included",
"in tsconfig.json in the `files` field. This is cumbersome and",
"here is a discussion of it: https://github.com/kulshekhar/ts-jest/issues/1604"
],
"wait-for-expect@1.x.x": [
"Newer versions breaks the use of jest fake timers"
],
"consolidate@14.0.0": [
"Newer versions has problems with using nunjucks.",
"Update when the following issue is resolved:",
"https://github.com/tj/consolidate.js/issues/244"
],
"final-form@4.18.6": [
"Newer versions has problems with resetting forms.",
"Update when the following issue is resolved:",
"https://github.com/final-form/final-form/issues/317"
],
"react-final-form@6.3.0": [
"Newer versions has problems with radio and checkbox fields.",
"Update when the following issue is resolved:",
"https://github.com/final-form/react-final-form/issues/683"
],
"graphql-playground-html@1.6.13": [
"A template was broken in a release.",
"Update when the following issue is resolved:",
"https://github.com/prisma-labs/graphql-playground/pull/1238"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "FAST_LINT=true lint-staged"
}
},
"lint-staged": {
"*.{j,t}s{,x}": [
"tslint"
"eslint"
],
"src/core/server/graph/tenant/schema/schema.graphql": [
"src/core/server/graph/schema/schema.graphql": [
"graphql-schema-linter"
],
"{src/core/client/stream/events.ts,scripts/generateEventDocs.ts,CLIENT_EVENTS.md}": [
"npm run docs:events -- --verify"
],
"{src/core/client/ui/theme/sharedVariables.ts,src/core/client/ui/theme/streamVariables.ts,scripts/generateCSSVariablesDocs.ts,CSS_VARIABLES.md}": [
"npm run docs:css-variables -- --verify"
],
"{CLIENT_EVENTS,CONTRIBUTING,WEBHOOKS,EXTERNAL_MODERATION_PHASES}.md": [
"npm run doctoc"
]
},
"bundlesize": [
{
"path": "./dist/static/assets/js/embed.js",
"maxSize": "15 kB"
},
{
"path": "./dist/static/assets/js/count.js",
"maxSize": "2 kB"
}
],
"graphql-schema-linter": {
"rules": [
"types-are-capitalized"
]
}
},
"browsers": [
">1%",
"last 4 versions",
"Firefox ESR",
"IE 11",
"not dead"
]
}
+15 -14
View File
@@ -12,7 +12,7 @@
*/
"use strict";
// tslint:disable:no-console
/* eslint-disable no-console */
const address = require("address");
const url = require("url");
@@ -21,21 +21,20 @@ const clearConsole = require("react-dev-utils/clearConsole");
const formatWebpackMessages = require("react-dev-utils/formatWebpackMessages");
const typescriptFormatter = require("react-dev-utils/typescriptFormatter");
const forkTsCheckerWebpackPlugin = require("react-dev-utils/ForkTsCheckerWebpackPlugin");
const Stats = require("webpack/lib/Stats");
// (cvle): Changed to false as we are sharing the tty with other processes.
// const isInteractive = process.stdout.isTTY && false;
const isInteractive = false;
function prepareUrls(protocol, host, port) {
const formatUrl = hostname =>
const formatUrl = (hostname) =>
url.format({
protocol,
hostname,
port,
pathname: "/",
});
const prettyPrintUrl = hostname =>
const prettyPrintUrl = (hostname) =>
url.format({
protocol,
hostname,
@@ -142,15 +141,15 @@ function createCompiler({
});
let isFirstCompile = true;
let tsMessagesPromises = [];
const tsMessagesPromises = [];
if (useTypeScript) {
compiler.compilers.forEach(singleCompiler => {
compiler.compilers.forEach((singleCompiler) => {
let tsMessagesPromise;
let tsMessagesResolver;
singleCompiler.hooks.beforeCompile.tap("beforeCompile", () => {
tsMessagesPromise = new Promise(resolve => {
tsMessagesResolver = msgs => resolve(msgs);
tsMessagesPromise = new Promise((resolve) => {
tsMessagesResolver = (msgs) => resolve(msgs);
});
tsMessagesPromises.push(tsMessagesPromise);
});
@@ -171,13 +170,15 @@ function createCompiler({
(diagnostics, lints) => {
console.log("RECEIVED");
const allMsgs = [...diagnostics, ...lints];
const format = message =>
const format = (message) =>
`${message.file}\n${typescriptFormatter(message, true)}`;
tsMessagesResolver({
errors: allMsgs.filter(msg => msg.severity === "error").map(format),
errors: allMsgs
.filter((msg) => msg.severity === "error")
.map(format),
warnings: allMsgs
.filter(msg => msg.severity === "warning")
.filter((msg) => msg.severity === "warning")
.map(format),
});
}
@@ -187,7 +188,7 @@ function createCompiler({
// "done" event fires when Webpack has finished recompiling the bundle.
// Whether or not you have warnings or errors, you will get this event.
compiler.hooks.done.tap("done", async stats => {
compiler.hooks.done.tap("done", async (stats) => {
if (isInteractive) {
clearConsole();
}
@@ -204,7 +205,7 @@ function createCompiler({
...config.stats,
};
if (Array.isArray(config)) {
statOptions.children = config.map(c => c.stats || {});
statOptions.children = config.map((c) => c.stats || {});
}
const statsData = stats.toJson(statOptions);
@@ -221,7 +222,7 @@ function createCompiler({
const results = await Promise.all(tsMessagesPromises);
clearTimeout(delayedMsg);
results.forEach(msgs => {
results.forEach((msgs) => {
statsData.errors.push(...msgs.errors);
statsData.warnings.push(...msgs.warnings);
+5 -3
View File
@@ -17,7 +17,7 @@ import paths from "../config/paths";
import config from "../src/core/build/config";
import createWebpackConfig from "../src/core/build/createWebpackConfig";
// tslint:disable: no-console
/* eslint-disable no-console */
process.env.WEBPACK = "true";
process.env.NODE_ENV = process.env.NODE_ENV || "production";
@@ -31,7 +31,7 @@ const isProduction = process.env.NODE_ENV === "production";
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on("unhandledRejection", err => {
process.on("unhandledRejection", (err) => {
throw err;
});
@@ -117,7 +117,9 @@ function build(previousFileSizes: any) {
return reject(err);
}
const messages = formatWebpackMessages(
stats.toJson({ children: webpackConfig.map(c => c.stats || {}) as any })
stats.toJson({
children: webpackConfig.map((c) => c.stats || {}) as any,
})
);
if (messages.errors.length) {
// Only keep the first error. Others are often indicative
+9 -6
View File
@@ -19,29 +19,29 @@ program
.parse(process.argv);
if (!program.schema) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.error("Schema identifier not provided");
process.exit(1);
}
if (!program.src) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.error("Src not provided");
process.exit(1);
}
if (!config.projects) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.error("Missing projects key in .graphqconfig");
process.exit(1);
}
if (!config.projects[program.schema]) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.error(`Project ${program.schema} not found in .graphqconfig`);
process.exit(1);
}
if (!config.projects[program.schema].schemaPath) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.error(
`SchemaPath for project ${program.schema} not found in .graphqconfig`
);
@@ -52,6 +52,9 @@ const args = [
"--language",
"typescript",
"--no-watchman",
"--customScalars.Time=String",
"--customScalars.Cursor=unknown",
"--customScalars.Locale=string",
"--src",
program.src,
"--artifactDirectory",
@@ -74,7 +77,7 @@ if (persist) {
if (fs.existsSync(persist)) {
// Create the new filename.
const name = path.basename(program.src);
const generated = "./src/core/server/graph/tenant/persisted/__generated__";
const generated = "./src/core/server/graph/persisted/__generated__";
// Create the generated directory if it doesn't exist.
fs.ensureDirSync(generated);
+306
View File
@@ -0,0 +1,306 @@
import { stripIndent } from "common-tags";
import fs from "fs";
import { kebabCase, trim } from "lodash";
import path from "path";
import ts from "typescript";
import colors from "../src/core/client/ui/theme/colors";
/** We collect inforamtion from the AST and put it into DocEntry */
interface DocEntry {
/** Name of property */
key: string;
/** Documentation if available */
docs?: string;
/** Value if it is a leaf */
value?: string;
/** Children if it is a node */
children?: DocEntry[];
}
/**
* We use this regexp to find a previous block that we
* are going to update in the readme file.
*/
const BLOCK_REGEXP = /<!-- START docs:css-variables -->(.|\n)*<!-- END docs:css-variables -->/gm;
/** Sort doc entries will sort childrenless entries first */
function sortDocEntries(data: DocEntry[]) {
data.forEach((d) => {
if (d.children) {
d.children = sortDocEntries(d.children);
}
});
return data.sort((a, b) => {
if (a.children && !b.children) {
return 1;
}
if (b.children && !a.children) {
return -1;
}
return 0;
});
}
/** Generate documentation for all classes in a set of .ts files */
function gatherEntries(
fileName: string,
options: ts.CompilerOptions
): DocEntry[] {
// Build a program using the set of root file names in fileNames
const program = ts.createProgram([fileName], options);
// Get the checker, we will use it to find more about classes
const checker = program.getTypeChecker();
const data: DocEntry[] = [];
const currentSourceFile = program.getSourceFile(fileName)!;
ts.forEachChild(currentSourceFile, visit);
return sortDocEntries(data);
/** visit nodes finding css variables */
function visit(node: ts.Node) {
if (ts.isVariableStatement(node)) {
// TODO (cvle) - Currently the variable name is hardcoded. We might want to change that.
if (!node.getFullText().includes("streamVariables")) {
return;
}
const firstChild = node.declarationList.declarations[0];
if (ts.isVariableDeclaration(firstChild)) {
const symbol = checker.getSymbolAtLocation(firstChild.name);
if (symbol) {
const type = checker.getTypeOfSymbolAtLocation(
symbol,
symbol.valueDeclaration
);
type.getProperties().forEach((property) => {
serializePropertySymbol(property);
});
}
}
}
}
/** This will evaluate `symbol` and addthe doc entries */
function serializePropertySymbol(symbol: ts.Symbol, parent?: DocEntry) {
const entry: DocEntry = { key: symbol.name };
const pt = checker.getTypeOfSymbolAtLocation(
symbol,
symbol.valueDeclaration
);
if (pt.symbol?.name === "__object") {
pt.getProperties().forEach((p2) => {
serializePropertySymbol(p2, entry);
});
} else {
entry.value = symbol.valueDeclaration
// Last child contains value.
.getChildAt(symbol.valueDeclaration.getChildCount() - 1)!
.getFullText();
}
entry.docs = ts.displayPartsToString(
symbol.getDocumentationComment(checker)
);
if (parent) {
if (parent.children) {
parent.children.push(entry);
} else {
parent.children = [entry];
}
} else {
data.push(entry);
}
}
}
/**
* Finds any references to `object` by `variableName` and replaces the text
* with the actual value.
*
* E.g. `replaceObjectVariablesInText("colors.teal100", colors, "colors") === "#E2FAF7"`;
*/
function replaceObjectVariablesInText(
text: string,
object: any,
variableName: string
) {
let result = text;
Object.keys(object).forEach((c: string) => {
if (typeof object[c] === "object") {
result = replaceObjectVariablesInText(
result,
object[c],
`${variableName}.${c}`
);
} else {
result = result.replace(`${variableName}.${c}`, object[c]);
}
});
return result;
}
/**
* transforms value to be used in the documentation.
*/
function transformValue(value: string) {
let compat = "";
value = trim(value);
// Detect compat value.
if (value.startsWith("compat")) {
const result = /compat\((.*), *"(.*)"\)/.exec(value);
if (!result) {
throw new Error("Unrecognized compat format");
}
value = result[1];
compat = result[2];
}
// If it's a raw string, evaluate it to get rid of the initial quotes.
if (value[0] === '"' || value[0] === "'") {
// eslint-disable-next-line no-eval
value = eval(value);
}
// Replace all references to colors.
value = replaceObjectVariablesInText(value, colors, "colors");
if (compat) {
// add compat information.
return `${value}; /* Before 6.3.0: --${compat} */`;
}
return `${value};`;
}
function prefixLines(text: string, prefix: string) {
return text.split("\n").join(`\n${prefix}`);
}
function entries2Summary(
entries: DocEntry[],
keyprefix = "",
nestprefix = ""
): string {
let doc = "";
entries.forEach((entry) => {
if (!entry.children) {
return;
}
const header = kebabCase(keyprefix + entry.key);
doc += `${nestprefix}- <a href="#${header}">${header}</a>\n`;
if (entry.children) {
doc += entries2Summary(
entry.children,
keyprefix + entry.key + "-",
nestprefix + " "
);
}
});
return doc;
}
function entries2Doc(entries: DocEntry[], header = "###", prefix = ""): string {
let doc = "";
entries.forEach((entry) => {
if (entry.children) {
doc += `\n${header} ${kebabCase(prefix + entry.key)}\n`;
if (entry.docs) {
doc += `\n${entry.docs}\n`;
}
doc += entries2Doc(
entry.children,
header + "#",
`${prefix}${entry.key}-`
);
} else {
if (entry.docs) {
doc += `\n${entry.docs}\n`;
}
doc += `\n\`--${kebabCase(prefix + entry.key)}: ${transformValue(
entry.value!
)}\`\n`;
}
});
return doc;
}
/**
* Append or update previous documention in markdownFile.
*
* @param markdownFile The markdown file we want to inject the docs too.
* @param entries data as returned by gatherEntries.
*/
function emitDocs(markdownFile: string, entries: DocEntry[], verify = false) {
const previousContent = fs.existsSync(markdownFile)
? fs.readFileSync(markdownFile).toString()
: "";
const summary = entries2Summary(entries, "", " ");
const list = entries2Doc(entries);
const output = stripIndent`
<!-- START docs:css-variables -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN npm run docs:css-variables -->
### Index
- <a href="#variables">Variables</a>
${prefixLines(summary, " ")}
### Variables
${prefixLines(list, " ")}
<!-- END docs:css-variables -->
`;
let newContent;
// Find previous block.
if (BLOCK_REGEXP.test(previousContent)) {
newContent = previousContent.replace(BLOCK_REGEXP, output);
} else {
newContent = previousContent + "\n" + output;
}
if (previousContent === newContent) {
// eslint-disable-next-line no-console
console.log(`${markdownFile} is up to date`);
return;
}
if (verify) {
// eslint-disable-next-line no-console
console.error(
`${markdownFile} is outdated, please run \`npm run docs:css-variables\``
);
process.exit(1);
}
fs.writeFileSync(markdownFile, newContent);
// eslint-disable-next-line no-console
console.log(`Successfully injected documentation into ${markdownFile}`);
}
function main() {
if (process.argv.length < 4) {
throw new Error("Must provide path to css variables and a markdown file.");
}
const variableFile = process.argv[2];
const markdownFile = process.argv[3];
// Find tsconfig file.
const configFile = ts.findConfigFile(variableFile, fs.existsSync);
if (!configFile) {
throw new Error("tsconfig file not found");
}
const configText = fs.readFileSync(configFile).toString();
const result = ts.parseConfigFileTextToJson(configFile, configText);
if (result.error) {
throw result.error;
}
// Parse the JSON raw data into actual consumable compiler options.
const config = ts.parseJsonConfigFileContent(
result.config,
ts.sys,
path.dirname(configFile)
);
const entries = gatherEntries(variableFile, config.options);
emitDocs(markdownFile, entries, process.argv[4] === "--verify");
}
main();
+277
View File
@@ -0,0 +1,277 @@
/* eslint-disable no-bitwise */
import { codeBlock, stripIndent } from "common-tags";
import fs from "fs";
import path from "path";
import ts from "typescript";
interface DocEntry {
name: string;
docs?: string;
type: "ViewerNetworkEvent" | "ViewerEvent";
text?: string;
}
/**
* We use this regexp to find a previous block that we
* are going to update in the readme file.
*/
const BLOCK_REGEXP = /<!-- START docs:events -->(.|\n)*<!-- END docs:events -->/gm;
/** Build flags that affects AST generation */
const buildFlags =
// Do not truncate output.
ts.NodeBuilderFlags.NoTruncation |
// Use multiline object literals format.
ts.NodeBuilderFlags.MultilineObjectLiterals;
/** Generate documentation for all classes in a set of .ts files */
function gatherEntries(
fileNames: string[],
options: ts.CompilerOptions
): DocEntry[] {
// Build a program using the set of root file names in fileNames
const program = ts.createProgram(fileNames, options);
const printer = ts.createPrinter({
noEmitHelpers: true,
omitTrailingSemicolon: true,
removeComments: false,
});
// Get the checker, we will use it to find more about classes
const checker = program.getTypeChecker();
const data: DocEntry[] = [];
/** Hold a pointer to the sourcefile we are currently processing. */
let currentSourceFile: ts.SourceFile;
// Visit every sourceFile in the program
for (const sourceFile of program.getSourceFiles()) {
if (!sourceFile.isDeclarationFile) {
currentSourceFile = sourceFile;
// Walk the tree to search for classes
ts.forEachChild(sourceFile, visit);
}
}
const sorted = data.sort((a, b) => {
if (a.name > b.name) {
return 1;
}
if (b.name > a.name) {
return -1;
}
return 0;
});
return sorted;
/** visit nodes finding exported events */
function visit(node: ts.Node) {
// Only consider exported nodes
if (!isNodeExported(node)) {
return;
}
if (ts.isVariableStatement(node)) {
if (
!node.getFullText().includes("createViewerNetworkEvent") &&
!node.getFullText().includes("createViewerEvent")
) {
return;
}
const firstChild = node.declarationList.declarations[0];
if (ts.isVariableDeclaration(firstChild)) {
const symbol = checker.getSymbolAtLocation(firstChild.name);
if (symbol) {
serializeEventSymbol(symbol);
}
}
}
}
function serializeEventSymbol(symbol: ts.Symbol) {
const type = checker.getTypeOfSymbolAtLocation(
symbol,
symbol.valueDeclaration
);
const typeNode = checker.typeToTypeNode(type, undefined, buildFlags)!;
const typeName = symbol.getName();
const entry: DocEntry = {
name: typeName,
docs: ts.displayPartsToString(symbol.getDocumentationComment(checker)),
type: type.getSymbol()!.getName() as DocEntry["type"],
};
typeNode.forEachChild((ch) => {
if (ts.isTypeLiteralNode(ch)) {
const text = printer.printNode(
ts.EmitHint.Unspecified,
ch,
currentSourceFile
);
if (text !== "{}") {
entry.text = text;
}
/*
Go through each parameter.
ch.members.forEach(m => {
if (ts.isPropertySignature(m)) {
if (ts.isIdentifier(m.name)) {
data.parameters[m.name.text] = printer.printNode(
ts.EmitHint.Unspecified,
m.type!,
currentSourceFile
);
}
}
});
*/
}
});
data.push(entry);
}
/** True if this is visible outside this file, false otherwise */
function isNodeExported(node: ts.Node): boolean {
return (
// eslint-disable-next-line no-bitwise, @typescript-eslint/no-unnecessary-type-assertion
(ts.getCombinedModifierFlags(node as ts.Declaration) &
ts.ModifierFlags.Export) !==
0 ||
(!!node.parent && node.parent.kind === ts.SyntaxKind.SourceFile)
);
}
}
function prefixLines(text: string, prefix: string) {
return text.split("\n").join(`\n${prefix}`);
}
function getEventName(typeName: string) {
return (
typeName[0].toLocaleLowerCase() +
typeName.slice(1, typeName.length - "Event".length)
);
}
/**
* Removes "%future added value" from text. This is a placeholder type
* added by Relay to help with future proofness.
*/
function removeFutureAddedValue(text: string) {
return text
.replace(': "%future added value" | ', ": ")
.replace(' | "%future added value"', "");
}
/**
* Append or update previous documention in markdownFile.
*
* @param markdownFile The markdown file we want to inject the docs too.
* @param entries data as returned by gatherEntries.
*/
function emitDocs(markdownFile: string, entries: DocEntry[], verify = false) {
const previousContent = fs.existsSync(markdownFile)
? fs.readFileSync(markdownFile).toString()
: "";
const summary = stripIndent`
- ${entries
.map(
(e) => `<a href="#${getEventName(e.name)}">${getEventName(e.name)}</a>`
)
.join("\n - ")}
`;
const list = entries
.map(
(e) =>
codeBlock`
- ${
e.type === "ViewerEvent"
? `<a id="${getEventName(e.name)}">**${getEventName(e.name)}**</a>`
: `<a id="${getEventName(e.name)}">**${getEventName(
e.name
)}.success**, **${getEventName(e.name)}.error**</a>`
}: ${e.docs ? e.docs.replace("\n", " ") : ""}
${
e.text
? codeBlock`
\`\`\`ts
${removeFutureAddedValue(e.text)}
\`\`\`
`
: ""
}
`
)
.join("\n");
const output = stripIndent`
<!-- START docs:events -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN npm run docs:events -->
### Index
${prefixLines(summary, " ")}
### Events
${prefixLines(list, " ")}
<!-- END docs:events -->
`;
let newContent;
// Find previous block.
if (BLOCK_REGEXP.test(previousContent)) {
newContent = previousContent.replace(BLOCK_REGEXP, output);
} else {
newContent = previousContent + "\n" + output;
}
if (previousContent === newContent) {
// eslint-disable-next-line no-console
console.log(`${markdownFile} is up to date`);
return;
}
if (verify) {
// eslint-disable-next-line no-console
console.error(
`${markdownFile} is outdated, please run \`npm run docs:events\``
);
process.exit(1);
return;
}
fs.writeFileSync(markdownFile, newContent);
// eslint-disable-next-line no-console
console.log(`Successfully injected documentation into ${markdownFile}`);
}
function main() {
if (process.argv.length < 4) {
throw new Error("Must provide path to events and a markdown file.");
}
const eventFile = process.argv[2];
const markdownFile = process.argv[3];
// Find tsconfig file.
const configFile = ts.findConfigFile(eventFile, fs.existsSync);
if (!configFile) {
throw new Error("tsconfig file not found");
}
const configText = fs.readFileSync(configFile).toString();
const result = ts.parseConfigFileTextToJson(configFile, configText);
if (result.error) {
throw result.error;
}
// Parse the JSON raw data into actual consumable compiler options.
const config = ts.parseJsonConfigFileContent(
result.config,
ts.sys,
path.dirname(configFile)
);
const entries = gatherEntries([eventFile], config.options);
emitDocs(markdownFile, entries, process.argv[4] === "--verify");
}
main();
+8 -9
View File
@@ -1,4 +1,3 @@
const { Linter, Configuration } = require("tslint");
const { generateTSTypesAsString } = require("graphql-schema-typescript");
const { getGraphQLConfig } = require("graphql-config");
const path = require("path");
@@ -13,12 +12,12 @@ async function main() {
name: "tenant",
fileName: path.join(
__dirname,
"../src/core/server/graph/tenant/schema/__generated__/types.ts"
"../src/core/server/graph/schema/__generated__/types.ts"
),
config: {
contextType: "TenantContext",
contextType: "GraphContext",
importStatements: [
'import TenantContext from "coral-server/graph/tenant/context";',
'import GraphContext from "coral-server/graph/context";',
'import { Cursor } from "coral-server/models/helpers";',
],
customScalarType: { Cursor: "Cursor", Time: "Date" },
@@ -48,7 +47,7 @@ async function main() {
}
// Create the types for this file.
const types = await generateTSTypesAsString(schema, {
const types = await generateTSTypesAsString(schema, file.fileName, {
tabSpaces: 2,
typePrefix: "GQL",
strictNulls: false,
@@ -67,14 +66,14 @@ if (require.main === module) {
// Only run the main module on file load if this is the main module (we're
// executing this file directly).
main()
.then(files => {
.then((files) => {
for (const { fileName } of files) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.log(`Generated ${fileName}`);
}
})
.catch(err => {
// tslint:disable-next-line:no-console
.catch((err) => {
// eslint-disable-next-line no-console
console.error(err);
});
}
+153
View File
@@ -0,0 +1,153 @@
#!/usr/bin/env ./node_modules/.bin/tsnd
//
// Based on the script written by @cristiandean
//
// Source: https://gist.github.com/cristiandean/8196bc2b965f9acf9ad8f9e4530011c1
//
import { FluentResource } from "@fluent/bundle";
import fs from "fs";
import path from "path";
const PROJECT_ROOT = path.resolve(__dirname, "..", "..");
const LOCALE_DIRECTORIES = [
path.join(PROJECT_ROOT, "src/locales"),
path.join(PROJECT_ROOT, "src/core/server/locales"),
];
const wrap = (color: string) => (msg: string) => {
if (!msg) {
return;
}
// eslint-disable-next-line no-console
console.log(`${color}%s\x1b[0m`, msg);
};
const log = {
red: wrap("\x1b[31m"),
green: wrap("\x1b[32m"),
plain: wrap("\x1b[0m"),
};
interface LocaleFileListing {
locale: string;
files: LocaleFile[];
}
interface LocaleFile {
fileName: string;
directory: string;
filePath: string;
keys: Set<string>;
}
function loadLocale(locale: string) {
const listing: LocaleFileListing = { locale, files: [] };
for (const directory of LOCALE_DIRECTORIES) {
// Resolve the directory with the language code, this should be a folder
// containing language files for the specified context.
const localeDirectory = path.join(directory, locale);
if (!fs.existsSync(localeDirectory)) {
continue;
}
// The folder exists, list all files in this directory and begin loading
// them.
const localeFiles = fs.readdirSync(localeDirectory);
for (const fileName of localeFiles) {
const filePath = path.join(localeDirectory, fileName);
// Load the file.
const source = fs.readFileSync(filePath, "utf-8").toString();
// Create the resource based on the file.
const resource = new FluentResource(source);
// Iterate over the ids to create the set of ID's.
const keys = new Set<string>();
for (const entry of resource.body) {
if (entry.id.startsWith("-")) {
// Identifiers starting with a `-` define terms, these are not used
// for this as we're only comparing messages.
continue;
}
keys.add(entry.id);
}
// Add the new file.
listing.files.push({ fileName, directory, filePath, keys });
}
}
return listing;
}
function diffSet(a: Set<string>, b: Set<string>): Set<string> {
const n = new Set(a);
for (const e of b) {
n.delete(e);
}
return n;
}
function prefixDiffSet(prefix: string, a: Set<string>, b: Set<string>) {
return [...diffSet(a, b).values()]
.map((value) => `${prefix}${value}`)
.join("\n");
}
function diff(from: LocaleFileListing, to: LocaleFileListing) {
for (const f of from.files) {
// Log the header information for this file.
log.plain(`* From: ${f.filePath}`);
// Find the associated "to" file.
const t = to.files.find(
(file) => file.fileName === f.fileName && file.directory === f.directory
);
if (!t) {
log.red(
`* To: ${path.join(f.directory, to.locale, f.fileName)} (missing)`
);
log.plain("-".repeat(60));
continue;
}
log.plain(`* To: ${t.filePath}`);
log.green(prefixDiffSet(" + ", f.keys, t.keys));
log.red(prefixDiffSet(" - ", t.keys, f.keys));
log.plain("-".repeat(60));
}
}
function main() {
try {
if (process.argv.length < 3) {
throw new Error("usage: ./scripts/i18n/missingTranslations.ts <locale>");
}
// Load the target translation.
const to = loadLocale(process.argv[2]);
// Load the base language (US English).
const from = loadLocale("en-US");
// Report the difference in key existence.
diff(from, to);
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);
process.exit(1);
}
}
main();
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env ts-node
/**
* This script can be invoked via:
*
* npm run migration:create <migration name>
*
* To create new database migrations.
*/
/* eslint-disable no-console */
import fs from "fs-extra";
import lodash from "lodash";
import path from "path";
const templateFilePath = path.resolve(
path.join(
__dirname,
"../../src/core/server/services/migrate/migration_sample.ts"
)
);
const argv = process.argv.slice(2);
if (argv.length !== 1) {
console.error("usage: npm run migration:create <migration name>");
process.exit(1);
}
// Get the name of the new migration.
const name = lodash.snakeCase(argv[0]);
// Get the version of the new migration.
const version = Date.now();
// Get the filePath of the new migration.
const filePath = path.resolve(
path.join(
__dirname,
`../../src/core/server/services/migrate/migrations/${version}_${name}.ts`
)
);
if (fs.existsSync(filePath)) {
console.error(`migration already exists at: ${filePath}`);
process.exit(1);
}
// Write the template out to the file.
fs.copyFileSync(templateFilePath, filePath);
console.log(`created new migration at: ${filePath}`);
+3 -2
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env ts-node
import dotenv from "dotenv";
// Apply all the configuration provided in the .env file if it isn't already in
@@ -14,7 +15,7 @@ import createDevServerConfig from "../config/webpackDevServer.config";
import config from "../src/core/build/config";
import createWebpackConfig from "../src/core/build/createWebpackConfig";
// tslint:disable: no-console
/* eslint-disable no-console */
// Enforce environment to be development.
config.validate().set("env", "development");
@@ -26,7 +27,7 @@ process.env.NODE_ENV = "development";
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on("unhandledRejection", err => {
process.on("unhandledRejection", (err) => {
throw err;
});
+2 -2
View File
@@ -17,14 +17,14 @@ process.env.NODE_ENV = "test";
// Makes the script crash on unhandled rejections instead of silently
// ignoring them. In the future, promise rejections that are not handled will
// terminate the Node.js process with a non-zero exit code.
process.on("unhandledRejection", err => {
process.on("unhandledRejection", (err) => {
throw err;
});
const paths = require("../config/paths.ts").default;
const jest = require("jest");
let argv = process.argv.slice(2);
const argv = process.argv.slice(2);
argv.push("--config", paths.appJestConfig);
// Watch unless on CI or in coverage mode
+5 -3
View File
@@ -1,5 +1,6 @@
import chokidar from "chokidar";
import path from "path";
import { Watcher, WatchOptions } from "./types";
function prependRootDir(
@@ -23,9 +24,10 @@ export default class ChokidarWatcher implements Watcher {
let firstError: Error | null = null;
// If this is set, a pending promise is waiting for the next result.
let pending:
| ({ resolve: (result: string) => void; reject: (error: Error) => void })
| null = null;
let pending: {
resolve: (result: string) => void;
reject: (error: Error) => void;
} | null = null;
// Only start client if we have something to watch.
if (paths.length) {
+4 -4
View File
@@ -21,8 +21,8 @@ export default class CommandExecutor implements Executor {
private args?: ReadonlyArray<string>;
private spawnMultiple: boolean;
private runOnInit: boolean;
private isRunning: boolean = false;
private shouldRespawn: boolean = false;
private isRunning = false;
private shouldRespawn = false;
private spawnProcessDebounced?: (() => void) & Cancelable;
constructor(cmd: string, opts: CommandExecutorOptions = {}) {
@@ -67,7 +67,7 @@ export default class CommandExecutor implements Executor {
child.on("close", (code: number) => {
this.isRunning = false;
if (code !== 0 && code !== null) {
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log(chalk.red(`Command exited with ${code}`));
}
if (this.shouldRespawn) {
@@ -76,7 +76,7 @@ export default class CommandExecutor implements Executor {
});
}
public execute(filePath: string) {
public execute(filePath: string): void {
this.spawnProcessPotentiallyDebounced();
}
}
+6 -6
View File
@@ -17,8 +17,8 @@ export default class LongRunningExecutor implements Executor {
private cmd: string;
private args?: ReadonlyArray<string>;
private process: ChildProcess | null = null;
private isRunning: boolean = false;
private shouldRestart: boolean = false;
private isRunning = false;
private shouldRestart = false;
private restartDebounced: (() => void) & Cancelable;
constructor(cmd: string, opts: LongRunningExecutorOptions = {}) {
@@ -37,11 +37,11 @@ export default class LongRunningExecutor implements Executor {
shell: !this.args,
});
this.process!.on("exit", (code: number) => {
this.process.on("exit", (code: number) => {
this.isRunning = false;
if (code !== 0 && code !== null) {
// tslint:disable-next-line: no-console
// eslint-disable-next-line no-console
console.log(chalk.red(`Command exited with ${code}`));
return;
}
@@ -99,14 +99,14 @@ export default class LongRunningExecutor implements Executor {
}
// This is called before exiting.
public async onCleanup() {
public async onCleanup(): Promise<void> {
this.restartDebounced.cancel();
if (this.isRunning) {
await this.kill();
}
}
public execute(filePath: string) {
public execute(filePath: string): void {
if (this.isRunning) {
this.restartDebounced();
return;
+3 -3
View File
@@ -18,7 +18,7 @@ function canUseWatchman(): boolean {
try {
execSync("watchman --version", { stdio: ["ignore"] });
return true;
// tslint:disable-next-line:no-empty
// eslint-disable-next-line no-empty
} catch (e) {}
return false;
}
@@ -34,7 +34,7 @@ export default class SaneWatcher implements Watcher {
// Autodetect watchman.
if (this.watchman === undefined && canUseWatchman()) {
this.watchman = true;
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.log(chalk.grey(`Watchman detected`));
}
}
@@ -48,7 +48,7 @@ export default class SaneWatcher implements Watcher {
const queue: string[] = [];
// If this is set, a pending promise is waiting for the next result.
let pending: ({ resolve: (result: string) => void }) | null = null;
let pending: { resolve: (result: string) => void } | null = null;
// Only start client if we have something to watch.
if (paths.length) {
+3 -3
View File
@@ -14,7 +14,7 @@ async function run(
throw new Error("Config file not specified");
}
// tslint:disable-next-line:no-var-requires
// eslint-disable-next-line @typescript-eslint/no-var-requires
let config: any = require(path.resolve(configFile));
if (config.__esModule) {
config = config.default;
@@ -30,8 +30,8 @@ const cmd = program
.description("Run watchers defined in <configFile>")
.parse(process.argv);
run(cmd.args, cmd.opts()).catch(err => {
// tslint:disable-next-line:no-console
run(cmd.args, cmd.opts()).catch((err) => {
// eslint-disable-next-line no-console
console.error(err);
process.exit(1);
});
+4 -14
View File
@@ -1,4 +1,4 @@
import Joi from "joi";
import Joi from "@hapi/joi";
export interface WatchOptions {
ignore?: ReadonlyArray<string>;
@@ -44,23 +44,13 @@ export const configSchema = Joi.object({
watchers: Joi.object().pattern(
/.*/,
Joi.object({
paths: Joi.array()
.items(Joi.string())
.unique(),
ignore: Joi.array()
.items(Joi.string())
.unique()
.optional(),
paths: Joi.array().items(Joi.string()).unique(),
ignore: Joi.array().items(Joi.string()).unique().optional(),
executor: Joi.object(),
})
),
defaultSet: Joi.string().optional(),
sets: Joi.object()
.pattern(
/.*/,
Joi.array()
.items(Joi.string())
.unique()
)
.pattern(/.*/, Joi.array().items(Joi.string()).unique())
.optional(),
}).with("defaultSet", "sets");
+14 -11
View File
@@ -1,5 +1,5 @@
import Joi from "@hapi/joi";
import chalk from "chalk";
import Joi from "joi";
import { pickBy } from "lodash";
import SaneWatcher from "./SaneWatcher";
@@ -21,14 +21,14 @@ async function beginWatch(
await executor.onInit();
}
for await (const filePath of watcher.watch(rootDir, paths, { ignore })) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.log(chalk.cyanBright(`Execute "${key}"`));
executor.execute(filePath);
}
}
function setupCleanup(watcher: Watcher, config: Config) {
["SIGINT", "SIGTERM"].forEach(signal =>
["SIGINT", "SIGTERM"].forEach((signal) =>
process.once(signal as any, async () => {
const cleanups = [];
if (watcher.onCleanup) {
@@ -50,7 +50,7 @@ function resolveSets(
value: ReadonlyArray<string>
) {
const resolved: string[] = [];
value.forEach(v => {
value.forEach((v) => {
if (v in sets) {
resolved.push(...sets[v]);
return;
@@ -66,13 +66,13 @@ function filterOnly(
sets?: Record<string, ReadonlyArray<string>>
): Config["watchers"] {
const resolved = sets ? resolveSets(sets, only) : only;
const unknown = resolved.filter(r => !(r in watchers));
const unknown = resolved.filter((r) => !(r in watchers));
if (unknown.length) {
throw new Error(`Watcher Configuration or Set for ${unknown} not found`);
}
return pickBy(watchers, (value, key) => {
if (resolved.indexOf(key) === -1) {
// tslint:disable-next-line:no-console
if (!resolved.includes(key)) {
// eslint-disable-next-line no-console
console.log(chalk.grey(`Disabled watcher "${key}"`));
return false;
}
@@ -80,7 +80,10 @@ function filterOnly(
}) as Config["watchers"];
}
export default async function watch(config: Config, options: Options = {}) {
export default async function watch(
config: Config,
options: Options = {}
): Promise<void> {
Joi.assert(config, configSchema);
const watcher: Watcher = config.backend || new SaneWatcher();
const rootDir = config.rootDir || process.cwd();
@@ -98,11 +101,11 @@ export default async function watch(config: Config, options: Options = {}) {
}
for (const key of Object.keys(watchersConfigs)) {
// tslint:disable-next-line:no-console
// eslint-disable-next-line no-console
console.log(chalk.cyanBright(`Start watcher "${key}"`));
const watcherConfig = watchersConfigs[key];
beginWatch(watcher, key, watcherConfig, rootDir).catch(err => {
// tslint:disable-next-line:no-console
beginWatch(watcher, key, watcherConfig, rootDir).catch((err) => {
// eslint-disable-next-line no-console
console.error(err);
process.exit(1);
});
+5 -4
View File
@@ -7,7 +7,7 @@
"use strict";
// tslint:disable:no-console
/* eslint-disable */
// This alternative WebpackDevServer combines the functionality of:
// https://github.com/webpack/webpack-dev-server/blob/webpack-1/client/index.js
@@ -24,7 +24,8 @@ var url = require("url");
var launchEditorEndpoint = require("react-dev-utils/launchEditorEndpoint");
var formatWebpackMessages = require("react-dev-utils/formatWebpackMessages");
var ErrorOverlay = require("react-error-overlay");
var { debounce } = require("lodash");
var lodash = require("lodash");
var debounce = lodash.debounce;
ErrorOverlay.setEditorHandler(function editorHandler(errorLocation) {
// Keep this sync with errorOverlayMiddleware.js
@@ -124,7 +125,7 @@ function handleWarnings(warnings) {
// TODO: remove this workaround when we can upgrade to WebpackDevServer >= v3.3.0,
// which includes proper `warningsFilter` support.
warnings = warnings.filter(w => !/export .* was not found in/.test(w));
warnings = warnings.filter(function(w){ return !/export .* was not found in/.test(w)});
function printWarnings() {
// Print warnings to the console.
@@ -198,7 +199,7 @@ function handleAvailableHash(hash) {
mostRecentCompilationHash = hash;
}
const debouncedReload = debounce(() => {
const debouncedReload = debounce(function() {
window.location.reload();
}, 1000);
+11 -1
View File
@@ -1,4 +1,7 @@
import convict from "convict";
import os from "os";
import { LOCALES } from "../common/helpers/i18n/locales";
const config = convict({
env: {
@@ -21,6 +24,12 @@ const config = convict({
env: "DEV_PORT",
arg: "dev-port",
},
defaultLocale: {
doc: "Specify the default locale to use",
format: LOCALES,
default: "en-US",
env: "LOCALE",
},
generateReport: {
doc: "Generate a report using webpack-bundle-analyzer",
format: Boolean,
@@ -59,7 +68,7 @@ const config = convict({
maxCores: {
doc: "Set maximum of available cores",
format: "nat",
default: require("os").cpus().length,
default: os.cpus().length,
env: "WEBPACK_MAX_CORES",
arg: "maxCores",
},
@@ -69,6 +78,7 @@ export type Config = typeof config;
export const createClientEnv = (c: Config) => ({
NODE_ENV: c.get("env"),
WEBPACK: "true",
});
// Setup the base configuration.
+62 -46
View File
@@ -7,7 +7,6 @@ import HtmlWebpackPlugin from "html-webpack-plugin";
import { identity } from "lodash";
import MiniCssExtractPlugin from "mini-css-extract-plugin";
import path from "path";
import typescriptFormatter from "react-dev-utils/typescriptFormatter";
import WatchMissingNodeModulesPlugin from "react-dev-utils/WatchMissingNodeModulesPlugin";
import TerserPlugin from "terser-webpack-plugin";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
@@ -18,8 +17,7 @@ import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
// TODO: import form coral-common/version, for some reason this fails currently.
// Try again when we have a chance to upgrade typescript.
import { version } from "../common/version";
import { Config } from "./config";
import { createClientEnv } from "./config";
import { Config, createClientEnv } from "./config";
import paths from "./paths";
/**
@@ -83,42 +81,38 @@ export default function createWebpackConfig(
const styleLoader = {
loader: require.resolve("style-loader"),
options: {
sourceMap: !disableSourcemaps,
hmr: watch,
},
};
const localesOptions = {
pathToLocales: paths.appLocales,
// Default locale if non could be negotiated.
defaultLocale: "en-US",
// Default locale if none was specified.
defaultLocale: config.get("defaultLocale"),
// Fallback locale if a translation was not found.
// If not set, will use the text that is already
// in the code base.
fallbackLocale: "en-US",
fallbackLocale: config.get("defaultLocale"),
// Common fluent files are always included in the locale bundles.
commonFiles: ["framework.ftl", "common.ftl", "ui.ftl"],
// Locales that come with the main bundle. Others are loaded on demand.
bundled: ["en-US"],
bundled: [config.get("defaultLocale")],
// All available locales can be loadable on demand.
// To restrict available locales set:
// availableLocales: ["en-US"],
// availableLocales: [config.get("defaultLocale")],
};
const additionalPlugins = [
...ifBuild(
new MiniCssExtractPlugin({
filename: isProduction
? "assets/css/[name].[hash].css"
? "assets/css/[name].[contenthash].css"
: "assets/css/[name].css",
chunkFilename: isProduction
? "assets/css/[id].[hash].css"
? "assets/css/[id].[contenthash].css"
: "assets/css/[id].css",
}),
isProduction &&
@@ -223,10 +217,10 @@ export default function createWebpackConfig(
// Generated JS file names (with nested folders).
// There will be one main bundle, and one file per asynchronous chunk.
filename: isProduction
? "assets/js/[name].[chunkhash].js"
? "assets/js/[name].[contenthash].js"
: "assets/js/[name].js",
chunkFilename: isProduction
? "assets/js/[name].[chunkhash].chunk.js"
? "assets/js/[name].[contenthash].chunk.js"
: "assets/js/[name].chunk.js",
// We inferred the "public path" (such as / or /my-project) from homepage.
publicPath,
@@ -357,7 +351,7 @@ export default function createWebpackConfig(
options: {
limit: 10000,
name: isProduction
? "assets/media/[name].[hash].[ext]"
? "assets/media/[name].[contenthash].[ext]"
: "assets/media/[name].[ext]",
},
},
@@ -368,9 +362,10 @@ export default function createWebpackConfig(
{
loader: require.resolve("css-loader"),
options: {
modules: true,
modules: {
localIdentName: "[name]-[local]-[contenthash]",
},
importLoaders: 2,
localIdentName: "[name]-[local]-[contenthash]",
sourceMap: !disableSourcemaps,
},
},
@@ -392,7 +387,7 @@ export default function createWebpackConfig(
"@babel/typescript",
[
"@babel/env",
{ targets: { node: "10.0.0" }, modules: "commonjs" },
{ targets: { node: "current" }, modules: "commonjs" },
],
],
// This is a feature of `babel-loader` for webpack (not Babel itself).
@@ -450,19 +445,11 @@ export default function createWebpackConfig(
{
test: /\.js$/,
include: /node_modules\//,
exclude: /node_modules\/(@babel|babel|core-js|regenerator-runtime)/,
use: [
{
loader: require.resolve("babel-loader"),
options: {
// This will ensure that all packages in node_modules that
// import lodash do so in a way that supports tree shaking.
plugins: ["lodash"],
presets: [
[
"@babel/env",
{ targets: "last 2 versions", modules: false },
],
],
cacheDirectory: true,
},
},
@@ -480,9 +467,10 @@ export default function createWebpackConfig(
{
loader: require.resolve("css-loader"),
options: {
modules: true,
modules: {
localIdentName: "[name]-[local]-[contenthash]",
},
importLoaders: 1,
localIdentName: "[name]-[local]-[hash:base64:5]",
sourceMap: !disableSourcemaps,
},
},
@@ -510,13 +498,8 @@ export default function createWebpackConfig(
exclude: [/\.(js|ts|tsx)$/, /\.html$/, /\.json$/],
loader: require.resolve("file-loader"),
options: {
// Because the resources loaded via CSS can sometimes be loaded
// directly from a CSS file, this will ensure that they are
// relative to those referencing files.
publicPath: (loaderPublicPath: string) =>
"../../" + loaderPublicPath,
name: isProduction
? "assets/media/[name].[hash:8].[ext]"
? "assets/media/[name].[contenthash].[ext]"
: "assets/media/[name].[ext]",
},
},
@@ -530,20 +513,15 @@ export default function createWebpackConfig(
// TODO: (cvle) this should work in build too but for some reasons it terminates the build afterwards.
// Preventing from running post build steps.
...ifWatch(
// We run tslint in a separate process to have a quicker build.
// We run eslint in a separate process to have a quicker build.
new ForkTsCheckerWebpackPlugin({
tslint: true,
eslint: true,
typescript: require.resolve("typescript"),
async: true,
// TODO: (cvle) For some reason if incremental build is turned on it does not find lint errors during initial build.
useTypescriptIncrementalApi: false,
checkSyntacticErrors: true,
tsconfig: paths.appTsconfig,
watch: paths.appSrc,
// TODO: (cvle) ForkTsCheckerWebpackPlugin are currently not working, so we resort to default reporting.
silent: false,
// The formatter is normally invoked directly in WebpackDevServerUtils during development
formatter: typescriptFormatter,
})
),
// Makes some environment variables available to the JS code, for example:
@@ -712,8 +690,7 @@ export default function createWebpackConfig(
sideEffects: true,
},
entry: [
/* Use minimal amount of polyfills (for IE) */
"intersection-observer", // also for Safari
// Polyfills are in the index.ts file.
paths.appEmbedIndex,
],
output: {
@@ -752,5 +729,44 @@ export default function createWebpackConfig(
),
]),
},
/* Webpack config for count */
{
...baseConfig,
optimization: {
...baseConfig.optimization,
// Ensure that we never split the count into chunks.
splitChunks: {
chunks: "async",
},
// We can turn on sideEffects here as we don't use
// css here and don't run into: https://github.com/webpack/webpack/issues/7094
sideEffects: true,
},
entry: [paths.appCountIndex],
output: {
...baseConfig.output,
// don't hash the count, cache-busting must be completed by the requester
// as this lives in a static template on the embed site.
filename: "assets/js/count.js",
},
plugins: filterPlugins([
...baseConfig.plugins!,
...ifWatch(
// Generates an `embed.html` file with the <script> injected.
new HtmlWebpackPlugin({
filename: "count.html",
template: paths.appCountHTML,
inject: "body",
})
),
...ifBuild(
new WebpackAssetsManifest({
output: "count-asset-manifest.json",
entrypoints: true,
integrity: true,
})
),
]),
},
];
}
+12 -13
View File
@@ -40,7 +40,7 @@ function getFiles(target, pathToLocale, context) {
const files = fs.readdirSync(pathToLocale);
files.forEach(f => {
files.forEach((f) => {
if (commonFiles.includes(f)) {
common.push(f);
return;
@@ -59,16 +59,15 @@ function generateTarget(target, context) {
defaultLocale,
fallbackLocale,
pathToLocales,
resourcePath,
locales,
bundled,
} = context;
const getLocalePath = locale => path.join(pathToLocales, locale);
const getLocaleFiles = memoize(locale =>
const getLocalePath = (locale) => path.join(pathToLocales, locale);
const getLocaleFiles = memoize((locale) =>
getFiles(target, getLocalePath(locale), context)
);
const loadables = locales.filter(locale => !bundled.includes(locale));
const loadables = locales.filter((locale) => !bundled.includes(locale));
return `
var ret = {
@@ -82,22 +81,22 @@ function generateTarget(target, context) {
// Bundled locales are directly available in the main bundle.
${bundled
.map(
locale => `
(locale) => `
{
var suffixes = ${JSON.stringify(getLocaleFiles(locale).suffixes)};
var contents = [];
${getLocaleFiles(locale)
.common.map(
file => `
(file) => `
contents.push(require(${JSON.stringify(
path.join(getLocalePath(locale), file).replace(/\\/g, "/")
)}));
)}).default);
`
)
.join("\n")}
contents = contents.concat(suffixes.map(function(suffix) { return require("${path
.join(getLocalePath(locale), target)
.replace(/\\/g, "/")}" + suffix); }));
.replace(/\\/g, "/")}" + suffix).default; }));
ret.bundled[${JSON.stringify(locale)}] = contents.join("\\n");
}
`
@@ -107,13 +106,13 @@ function generateTarget(target, context) {
// Loadables are in a separate bundle, that can be easily loaded.
${loadables
.map(
locale => `
(locale) => `
ret.loadables[${JSON.stringify(locale)}] = function() {
var suffixes = ${JSON.stringify(getLocaleFiles(locale).suffixes)};
var promises = [];
${getLocaleFiles(locale)
.common.map(
file => `
(file) => `
promises.push(
import(
/* webpackChunkName: ${JSON.stringify(
@@ -148,7 +147,7 @@ function generateTarget(target, context) {
`;
}
module.exports = function(source) {
module.exports = function (source) {
const options = Object.assign(
{},
DEFAULT_QUERY_VALUES,
@@ -166,7 +165,7 @@ module.exports = function(source) {
let locales = fs.readdirSync(pathToLocales);
if (availableLocales) {
availableLocales.forEach(locale => {
availableLocales.forEach((locale) => {
if (!locales.includes(locale)) {
throw new Error(`locale ${fallbackLocale} not available`);
}
+7 -2
View File
@@ -16,11 +16,13 @@ export default {
appLoaders: resolveSrc("core/build/loaders"),
appSrc: resolveSrc("."),
appTsconfig: resolveSrc("core/client/tsconfig.json"),
appPolyfill: resolveSrc("core/build/polyfills.js"),
appPolyfill: resolveSrc("core/build/polyfills.ts"),
appPublicPath: resolveSrc("core/build/publicPath.js"),
appLocales: resolveSrc("locales"),
appThemeVariables: resolveSrc("core/client/ui/theme/variables.ts"),
appThemeVariablesCSS: resolveSrc("core/client/ui/theme/variables.css"),
appSassLikeVariables: resolveSrc("core/client/ui/theme/sassLikeVariables.ts"),
appThemeStreamCSS: resolveSrc("core/client/ui/theme/stream.css"),
appThemeAdminCSS: resolveSrc("core/client/ui/theme/admin.css"),
appThemeMixinsCSS: resolveSrc("core/client/ui/theme/mixins.css"),
appStreamHTML: resolveSrc("core/client/stream/index.html"),
@@ -34,6 +36,9 @@ export default {
appAuthCallbackHTML: resolveSrc("core/client/auth-callback/index.html"),
appAuthCallbackIndex: resolveSrc("core/client/auth-callback/index.ts"),
appCountHTML: resolveSrc("core/client/count/index.html"),
appCountIndex: resolveSrc("core/client/count/index.ts"),
appInstallHTML: resolveSrc("core/client/install/index.html"),
appInstallLocalesTemplate: resolveSrc("core/client/install/locales.ts"),
appInstallIndex: resolveSrc("core/client/install/index.tsx"),
-2
View File
@@ -1,2 +0,0 @@
require("@babel/polyfill");
require("intersection-observer");
+6
View File
@@ -0,0 +1,6 @@
import polyfillNodeListForEach from "../client/framework/helpers/polyfillNodeListForEach";
import "core-js/stable";
import "regenerator-runtime/runtime";
polyfillNodeListForEach();
+18 -23
View File
@@ -3,10 +3,10 @@ require("ts-node/register");
const kebabCase = require("lodash/kebabCase");
const mapKeys = require("lodash/mapKeys");
const mapValues = require("lodash/mapValues");
const pickBy = require("lodash/pickBy");
const flat = require("flat");
const paths = require("./paths").default;
const autoprefixer = require("autoprefixer");
const postcssCalcFunction = require("postcss-calc-function").default;
const postcssFontMagician = require("postcss-font-magician");
const postcssFlexbugsFixes = require("postcss-flexbugs-fixes");
const postcssPresetEnv = require("postcss-preset-env");
@@ -16,29 +16,28 @@ const postcssMixins = require("postcss-mixins");
const postcssPrependImports = require("postcss-prepend-imports");
const postcssAdvancedVariables = require("postcss-advanced-variables");
delete require.cache[paths.appThemeVariables];
const variables = require(paths.appThemeVariables).default;
const flatKebabVariables = mapKeys(
mapValues(flat(variables, { delimiter: "-" }), v => v.toString()),
delete require.cache[paths.appSassLikeVariables];
const sassLikeVariables = require(paths.appSassLikeVariables).default;
const kebabs = mapKeys(
mapValues(flat(sassLikeVariables, { delimiter: "-" }), (v) => v.toString()),
(_, k) => kebabCase(k)
);
// These are the default css standard variables.
const cssVariables = pickBy(
flatKebabVariables,
(v, k) => !k.startsWith("breakpoints-")
);
// These are sass style variables used in media queries.
const mediaQueryVariables = mapValues(
pickBy(flatKebabVariables, (v, k) => k.startsWith("breakpoints-")),
// Generate sass-style variables to inject into css
const postCssVariables = mapValues(kebabs, (value, key) => {
// Add unit to breakpoints.
// Add 1 to support mobile first approach where we start
// with the smallest screen and gradually add styling for the
// next bigger screen. This is realized using `min-width` without
// ever using `max-width`.
v => `${Number.parseInt(v, 10) + 1}px`
);
if (key.toString().startsWith("breakpoints-")) {
return `${Number.parseInt(value, 10) + 1}px`;
}
// Default return the raw value
return value;
});
module.exports = {
// Necessary for external CSS imports to work
@@ -57,7 +56,9 @@ module.exports = {
// Support nesting.
postcssNested(),
// Sass style variables to be used in media queries.
postcssAdvancedVariables({ variables: mediaQueryVariables }),
postcssAdvancedVariables({ variables: postCssVariables }),
// Reduce some calc()
postcssCalcFunction(),
// Provides a modern CSS environment.
postcssPresetEnv(),
// Does all the font handling logic.
@@ -66,12 +67,6 @@ module.exports = {
postcssFlexbugsFixes,
// Vendor prefixing.
autoprefixer({
browsers: [
">1%",
"last 4 versions",
"Firefox ESR",
"not ie < 9", // React doesn't support IE8 anyway
],
flexbox: "no-2009",
}),
],
+1 -1
View File
@@ -1,2 +1,2 @@
__webpack_public_path__ =
JSON.parse(document.getElementById("config").innerText) || "/";
JSON.parse(document.getElementById("config").innerText).staticURI || "/";
-17
View File
@@ -1,20 +1,3 @@
const lodashOptimizations = ["use-lodash-es", "lodash"];
module.exports = {
presets: ["@babel/react"],
plugins: ["@babel/syntax-dynamic-import"],
env: {
production: {
presets: [["@babel/env", { targets: "last 2 versions", modules: false }]],
plugins: [...lodashOptimizations],
},
development: {
presets: [["@babel/env", { targets: "last 2 versions", modules: false }]],
plugins: [...lodashOptimizations],
},
test: {
presets: [["@babel/env", { targets: { node: "current" } }]],
plugins: ["@babel/transform-modules-commonjs"],
},
},
};
+3
View File
@@ -2,4 +2,7 @@
body {
margin: 0;
}
input::-ms-clear, input::-ms-reveal {
display: none;
}
}
+12 -11
View File
@@ -1,10 +1,10 @@
import TransitionControl from "coral-framework/testHelpers/TransitionControl";
import { BrowserProtocol, queryMiddleware } from "farce";
import { createFarceRouter, ElementsRenderer } from "found";
import { Resolver } from "found-relay";
import React, { FunctionComponent } from "react";
import { CoralContextConsumer } from "coral-framework/lib/bootstrap/CoralContext";
import TransitionControl from "coral-framework/testHelpers/TransitionControl";
import routeConfig from "../routeConfig";
import NotFound from "../routes/NotFound";
@@ -16,16 +16,17 @@ const Router = createFarceRouter({
historyProtocol: new BrowserProtocol(),
historyMiddlewares: [queryMiddleware],
routeConfig,
renderReady: ({ elements }) => (
<>
<ElementsRenderer elements={elements} />
{// this enables router transition control when writing tests.
process.env.NODE_ENV === "test" && <TransitionControl />}
</>
),
renderError: ({ error }) => (
<div>{error.status === 404 ? <NotFound /> : "Error"}</div>
),
renderReady: function FarceRouterReady({ elements }) {
return (
<>
<ElementsRenderer elements={elements} />
{process.env.NODE_ENV === "test" && <TransitionControl />}
</>
);
},
renderError: function FarceRouterError({ error }) {
return <div>{error.status === 404 ? <NotFound /> : "Error"}</div>;
},
});
const EntryContainer: FunctionComponent = () => (
+2 -2
View File
@@ -1,10 +1,10 @@
.bar {
height: calc(6 * var(--mini-unit));
background-color: var(--palette-text-primary);
background-color: var(--palette-text-500);
}
.centered {
margin: 10% auto;
padding: 0 calc(0.5 * var(--mini-unit));
box-sizing: border-box;
}
}
@@ -1,6 +1,6 @@
import React, { FunctionComponent } from "react";
import { Delay, Flex, Spinner } from "coral-ui/components";
import { Delay, Flex, Spinner } from "coral-ui/components/v2";
const Loading: FunctionComponent = () => (
<Flex justifyContent="center">
+1 -1
View File
@@ -4,7 +4,7 @@
<title>Coral - Account</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta name="viewport" content="width=device-width" />
</head>
<body>
+9 -4
View File
@@ -1,19 +1,24 @@
import { createManaged } from "coral-framework/lib/bootstrap";
import React, { FunctionComponent } from "react";
import ReactDOM from "react-dom";
import injectConditionalPolyfills from "coral-framework/helpers/injectConditionalPolyfills";
import potentiallyInjectAxe from "coral-framework/helpers/potentiallyInjectAxe";
import { createManaged } from "coral-framework/lib/bootstrap";
import App from "./App";
import { initLocalState } from "./local";
import localesData from "./locales";
// Import css variables.
import "coral-ui/theme/variables.css";
import "coral-ui/theme/stream.css";
async function main() {
await injectConditionalPolyfills();
// Potentially inject react-axe for runtime a11y checks.
await potentiallyInjectAxe();
const ManagedCoralContextProvider = await createManaged({
initLocalState,
localesData,
userLocales: navigator.languages,
});
const Index: FunctionComponent = () => (
@@ -25,4 +30,4 @@ async function main() {
ReactDOM.render(<Index />, document.getElementById("app"));
}
main();
void main();
@@ -1,5 +1,6 @@
import { Environment } from "relay-runtime";
import { AuthState } from "coral-framework/lib/auth";
import { CoralContext } from "coral-framework/lib/bootstrap";
import { initLocalBaseState } from "coral-framework/lib/relay";
@@ -8,7 +9,8 @@ import { initLocalBaseState } from "coral-framework/lib/relay";
*/
export default async function initLocalState(
environment: Environment,
context: CoralContext
context: CoralContext,
auth?: AuthState
) {
await initLocalBaseState(environment, context);
initLocalBaseState(environment, context, auth);
}
+1
View File
@@ -6,4 +6,5 @@
*/
import { LocalesData } from "coral-framework/lib/i18n";
export default {} as LocalesData;
+4
View File
@@ -3,6 +3,7 @@ import React from "react";
import DownloadRoute from "./routes/download/Download";
import ConfirmRoute from "./routes/email/Confirm";
import UnsubscribeRoute from "./routes/notifications/Unsubscribe";
import ResetRoute from "./routes/password/Reset";
export default makeRouteConfig(
@@ -14,5 +15,8 @@ export default makeRouteConfig(
<Route path="confirm" {...ConfirmRoute.routeConfig} />
</Route>
<Route path="download" {...DownloadRoute.routeConfig} />
<Route path="notifications">
<Route path="unsubscribe" {...UnsubscribeRoute.routeConfig} />
</Route>
</Route>
);
@@ -0,0 +1,11 @@
.content {
font-family: var(--font-family-secondary);
font-style: normal;
font-weight: var(--font-weight-secondary-bold);
font-size: var(--font-size-6);
line-height: 1.17;
color: var(--palette-text-500);
text-align: center;
}
+9 -3
View File
@@ -1,9 +1,15 @@
import { HorizontalGutter, Typography } from "coral-ui/components";
import { Localized } from "@fluent/react/compat";
import React, { FunctionComponent } from "react";
import { HorizontalGutter } from "coral-ui/components/v2";
import styles from "./NotFound.css";
const NotFound: FunctionComponent = () => (
<HorizontalGutter>
<Typography variant="heading3">Not Found</Typography>
<HorizontalGutter container="main">
<Localized id="notFound">
<div className={styles.content}>Not Found</div>
</Localized>
</HorizontalGutter>
);
@@ -1,12 +1,13 @@
.title {
font-family: var(--font-family-serif);
font-weight: 600;
font-family: var(--font-family-secondary);
font-style: normal;
font-size: calc(48rem / var(--rem-base));
line-height: calc(42em / 48);
text-align: center;
font-weight: var(--font-weight-secondary-bold);
font-size: var(--font-size-6);
line-height: 1.17;
color: var(--palette-common-black);
color: var(--palette-text-500);
padding-left: var(--spacing-2);
}
.content {
@@ -18,14 +19,15 @@
}
.sectionText {
font-family: var(--font-family-sans-serif);
font-weight: normal;
font-family: var(--font-family-primary);
font-style: normal;
font-size: calc(24rem / var(--rem-base));
line-height: calc(34em / 24);
letter-spacing: 0.3px;
font-weight: var(--font-weight-primary-regular);
font-size: var(--font-size-3);
line-height: 1.25;
color: var(--palette-text-primary);
color: var(--palette-text-500);
margin-bottom: var(--spacing-3);
}
.list {
@@ -34,7 +36,7 @@
}
.list li {
margin-bottom: calc(16em / 24);
margin-bottom: 0.75rem;
}
.listContent {
@@ -43,6 +45,6 @@
.bullet {
display: inline-block;
min-width: 24px;
min-width: 16px;
margin-right: var(--spacing-2);
}
}
@@ -1,8 +1,8 @@
import { Localized } from "@fluent/react/compat";
import cn from "classnames";
import { Localized } from "fluent-react/compat";
import React, { FunctionComponent } from "react";
import { Flex, HorizontalGutter, Icon, Typography } from "coral-ui/components";
import { Flex, HorizontalGutter, Icon } from "coral-ui/components/v2";
import styles from "./DownloadDescription.css";
@@ -10,84 +10,72 @@ const DownloadDescription: FunctionComponent = () => {
return (
<HorizontalGutter size="double">
<Localized id="download-landingPage-title">
<div className={styles.title}>Download Your Comment History</div>
<h1 className={styles.title}>Download your comment history</h1>
</Localized>
<div className={styles.content}>
<div className={styles.section}>
<Localized id="download-landingPage-description">
<Typography variant="bodyCopy" className={styles.sectionText}>
<div className={styles.sectionText}>
Your comment history will be downloaded into a .zip file. After
your comment history is unzipped you will have a comma separated
value (or .csv) file that you can easily import into your favorite
spreadsheet application.
</Typography>
</div>
</Localized>
</div>
<div className={styles.section}>
<Localized id="download-landingPage-contentsDescription">
<Typography variant="bodyCopy" className={styles.sectionText}>
<div className={styles.sectionText}>
For each of your comments the following information is included:
</Typography>
</div>
</Localized>
<ul className={styles.list}>
<li>
<Flex alignItems="center">
<Icon size="lg" className={styles.bullet}>
<Flex alignItems="flex-start">
<Icon size="md" className={styles.bullet}>
check
</Icon>
<Localized id="download-landingPage-contentsDate">
<Typography
variant="bodyCopy"
className={cn(styles.sectionText, styles.listContent)}
>
<div className={cn(styles.sectionText, styles.listContent)}>
When you wrote the comment
</Typography>
</div>
</Localized>
</Flex>
</li>
<li>
<Flex alignItems="center">
<Icon size="lg" className={styles.bullet}>
<Flex alignItems="flex-start">
<Icon size="md" className={styles.bullet}>
check
</Icon>
<Localized id="download-landingPage-contentsUrl">
<Typography
variant="bodyCopy"
className={cn(styles.sectionText, styles.listContent)}
>
<div className={cn(styles.sectionText, styles.listContent)}>
The permalink URL for the comment
</Typography>
</div>
</Localized>
</Flex>
</li>
<li>
<Flex alignItems="center">
<Icon size="lg" className={styles.bullet}>
<Flex alignItems="flex-start">
<Icon size="md" className={styles.bullet}>
check
</Icon>
<Localized id="download-landingPage-contentsText">
<Typography
variant="bodyCopy"
className={cn(styles.sectionText, styles.listContent)}
>
<div className={cn(styles.sectionText, styles.listContent)}>
The comment text
</Typography>
</div>
</Localized>
</Flex>
</li>
<li>
<Flex alignItems="center">
<Icon size="lg" className={styles.bullet}>
<Flex alignItems="flex-start">
<Icon size="md" className={styles.bullet}>
check
</Icon>
<Localized id="download-landingPage-contentsStoryUrl">
<Typography
variant="bodyCopy"
className={cn(styles.sectionText, styles.listContent)}
>
<div className={cn(styles.sectionText, styles.listContent)}>
The URL on the article or story where the comment appears
</Typography>
</div>
</Localized>
</Flex>
</li>
@@ -1,8 +1,3 @@
.form {
text-align: center;
}
.downloadButton {
font-size: calc(18rem / var(--rem-base));
line-height: calc(23em / 18);
}
@@ -1,7 +1,8 @@
import { Localized } from "fluent-react/compat";
import { Localized } from "@fluent/react/compat";
import React, { FunctionComponent, useCallback, useState } from "react";
import { Button, HorizontalGutter } from "coral-ui/components";
import { HorizontalGutter } from "coral-ui/components/v2";
import { Button } from "coral-ui/components/v3";
import styles from "./DownloadForm.css";
@@ -11,8 +12,9 @@ interface Props {
const DownloadForm: FunctionComponent<Props> = ({ token }) => {
const [submitted, setSubmitted] = useState(false);
const onClick = useCallback(() => {
const onSubmit = useCallback(() => {
setSubmitted(true);
return true;
}, [setSubmitted]);
return (
@@ -21,18 +23,19 @@ const DownloadForm: FunctionComponent<Props> = ({ token }) => {
className={styles.form}
method="post"
action="/api/account/download"
onSubmit={onSubmit}
>
<input name="token" type="hidden" value={token} />
<Localized id="download-landingPage-downloadComments ">
<Localized id="download-landingPage-download">
<Button
type="submit"
variant="filled"
color="primary"
paddingSize="medium"
disabled={submitted}
onClick={onClick}
className={styles.downloadButton}
upperCase
>
Download My Comment History
Download
</Button>
</Localized>
</form>
@@ -6,11 +6,11 @@
.root {
display: inline-block;
max-width: calc(70 * var(--mini-unit));
max-width: calc(70 * var(--spacing-2));
@media (min-width: $breakpoints-xs) {
max-width: calc(90 * var(--mini-unit));
max-width: calc(60 * var(--spacing-2));
}
text-align: left;
}
}
@@ -6,7 +6,7 @@ import { useToken } from "coral-framework/hooks";
import { createFetch } from "coral-framework/lib/relay";
import { withRouteConfig } from "coral-framework/lib/router";
import { parseHashQuery } from "coral-framework/utils";
import { HorizontalGutter } from "coral-ui/components";
import { HorizontalGutter } from "coral-ui/components/v2";
import DownloadDescription from "./DownloadDescription";
import DownloadForm from "./DownloadForm";
@@ -32,42 +32,44 @@ const DownloadRoute: FunctionComponent<Props> = ({ token }) => {
if (state === "UNCHECKED") {
return (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<HorizontalGutter size="double">
<Loading />
</HorizontalGutter>
</div>
</div>
</main>
);
}
if (state !== "VALID" || error) {
return (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<HorizontalGutter size="double">
<DownloadDescription />
<Sorry />
</HorizontalGutter>
</div>
</div>
</main>
);
}
return (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<DownloadDescription />
<DownloadForm token={token!} />
</div>
</div>
</main>
);
};
const enhanced = withRouteConfig<Props>({
render: ({ match, Component }) => (
<Component token={parseHashQuery(match.location.hash).downloadToken} />
),
render: function DownloadRouteRender({ match, Component }) {
return (
<Component token={parseHashQuery(match.location.hash).downloadToken} />
);
},
})(DownloadRoute);
export default enhanced;
@@ -1,7 +0,0 @@
.icon {
margin-right: var(--spacing-2);
}
.callout {
justify-content: left;
}
@@ -1,22 +1,21 @@
import { Localized } from "@fluent/react/compat";
import React, { FunctionComponent } from "react";
import { CallOut, Flex, Icon } from "coral-ui/components";
import { Localized } from "fluent-react/compat";
import styles from "./Sorry.css";
import { Icon } from "coral-ui/components/v2";
import { CallOut } from "coral-ui/components/v3";
const Sorry: FunctionComponent = () => {
return (
<CallOut color="error" fullWidth className={styles.callout}>
<Flex>
<Icon size="md" className={styles.icon}>
error
</Icon>
<CallOut
color="error"
icon={<Icon>error</Icon>}
titleWeight="semiBold"
title={
<Localized id="download-landingPage-sorry">
Your download link is invalid.
</Localized>
</Flex>
</CallOut>
}
/>
);
};
@@ -0,0 +1,52 @@
.title {
font-family: var(--font-family-secondary);
font-style: normal;
font-weight: var(--font-weight-secondary-bold);
font-size: var(--font-size-6);
line-height: 1.17;
color: var(--palette-text-500);
margin-bottom: var(--spacing-2);
}
.description {
font-family: var(--font-family-primary);
font-style: normal;
font-weight: var(--font-weight-primary-regular);
font-size: var(--font-size-3);
line-height: 1.25;
color: var(--palette-text-500);
margin-bottom: var(--spacing-3);
}
.label {
font-family: var(--font-family-primary);
font-style: normal;
font-weight: var(--font-weight-primary-bold);
font-size: var(--font-size-2);
line-height: 1.14;
color: var(--palette-text-500);
margin-bottom: var(--spacing-1);
}
.labelDescription {
font-family: var(--font-family-primary);
font-style: normal;
font-weight: var(--font-weight-primary-regular);
font-size: var(--font-size-2);
line-height: 1.285;
color: var(--palette-text-100);
margin-bottom: var(--spacing-2);
}
.submit {
margin-top: var(--spacing-5);
margin-bottom: var(--spacing-1);
}
@@ -1,14 +1,16 @@
import { Localized } from "@fluent/react/compat";
import { FORM_ERROR } from "final-form";
import { Localized } from "fluent-react/compat";
import React, { useCallback } from "react";
import { Form } from "react-final-form";
import { InvalidRequestError } from "coral-framework/lib/errors";
import { useMutation } from "coral-framework/lib/relay";
import { Button, HorizontalGutter, Typography } from "coral-ui/components";
import { Button } from "coral-ui/components/v3";
import ConfirmMutation from "./ConfirmMutation";
import styles from "./Confirm.css";
interface Props {
token: string;
disabled?: boolean;
@@ -33,18 +35,18 @@ const ConfirmForm: React.FunctionComponent<Props> = ({ onSuccess, token }) => {
<Form onSubmit={onSubmit}>
{({ handleSubmit, submitting }) => (
<form autoComplete="off" onSubmit={handleSubmit}>
<HorizontalGutter size="double">
<HorizontalGutter>
<Localized id="confirmEmail-emailConfirmation">
<Typography variant="heading1">Email Confirmation</Typography>
<div>
<div>
<Localized id="confirmEmail-confirmYourEmailAddress">
<div className={styles.title}>Confirm your email address</div>
</Localized>
<Localized id="confirmEmail-pleaseClickToConfirm">
<Typography variant="bodyCopy">
<div className={styles.description}>
Click below to confirm your email address.
</Typography>
</div>
</Localized>
</HorizontalGutter>
<HorizontalGutter>
</div>
<div>
<Localized id="confirmEmail-confirmEmail">
<Button
type="submit"
@@ -52,12 +54,14 @@ const ConfirmForm: React.FunctionComponent<Props> = ({ onSuccess, token }) => {
color="primary"
disabled={submitting}
fullWidth
upperCase
className={styles.submit}
>
Confirm email
</Button>
</Localized>
</HorizontalGutter>
</HorizontalGutter>
</div>
</div>
</form>
)}
</Form>
@@ -35,43 +35,45 @@ const ConfirmRoute: React.FunctionComponent<Props> = ({ token }) => {
if (state === "UNCHECKED") {
return (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<Loading />
</div>
</div>
</main>
);
}
if (state !== "VALID" || error) {
return (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<Sorry reason={error} />
</div>
</div>
</main>
);
}
return !finished ? (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<ConfirmForm token={token!} onSuccess={onSuccess} />
</div>
</div>
</main>
) : (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<Success />
</div>
</div>
</main>
);
};
const enhanced = withRouteConfig<Props>({
render: ({ match, Component }) => (
<Component token={parseHashQuery(match.location.hash).confirmToken} />
),
render: function ConfirmRouteRender({ match, Component }) {
return (
<Component token={parseHashQuery(match.location.hash).confirmToken} />
);
},
})(ConfirmRoute);
export default enhanced;
@@ -1,7 +1,9 @@
import { Localized } from "fluent-react/compat";
import { Localized } from "@fluent/react/compat";
import React from "react";
import { CallOut, HorizontalGutter, Typography } from "coral-ui/components";
import { CallOut } from "coral-ui/components/v3";
import styles from "./Confirm.css";
interface Props {
reason: React.ReactNode;
@@ -9,23 +11,27 @@ interface Props {
const Sorry: React.FunctionComponent<Props> = ({ reason }) => {
return (
<HorizontalGutter size="double">
<div>
<Localized id="confirmEmail-oopsSorry">
<Typography variant="heading1">Oops Sorry!</Typography>
<div className={styles.title}>Oops Sorry!</div>
</Localized>
<CallOut color="error" fullWidth>
{reason ? (
reason
) : (
<Localized id="account-tokenNotFound">
<span data-testid="invalid-link">
The specified link is invalid, check to see if it was copied
correctly.
</span>
</Localized>
)}
</CallOut>
</HorizontalGutter>
<CallOut
color="error"
titleWeight="semiBold"
title={
reason ? (
reason
) : (
<Localized id="account-tokenNotFound">
<span data-testid="invalid-link">
The specified link is invalid, check to see if it was copied
correctly.
</span>
</Localized>
)
}
/>
</div>
);
};
@@ -1,20 +1,18 @@
import { Localized } from "fluent-react/compat";
import { Localized } from "@fluent/react/compat";
import React from "react";
import { HorizontalGutter, Typography } from "coral-ui/components";
import styles from "./Confirm.css";
const Success: React.FunctionComponent = () => {
return (
<HorizontalGutter size="double">
<div>
<Localized id="confirmEmail-successfullyConfirmed">
<Typography variant="heading1">Email successfully confirmed</Typography>
<div className={styles.title}>Email successfully confirmed</div>
</Localized>
<Localized id="confirmEmail-youMayClose">
<Typography variant="bodyCopy">
You may now close this window.
</Typography>
<div className={styles.description}>You may now close this window.</div>
</Localized>
</HorizontalGutter>
</div>
);
};
@@ -0,0 +1,38 @@
import { Localized } from "@fluent/react/compat";
import React from "react";
import { CallOut } from "coral-ui/components/v3";
import styles from "./Unsubscribe.css";
interface Props {
reason: React.ReactNode;
}
const Sorry: React.FunctionComponent<Props> = ({ reason }) => {
return (
<div>
<Localized id="unsubscribe-oopsSorry">
<div className={styles.title}>Oops Sorry!</div>
</Localized>
<CallOut
color="error"
titleWeight="semiBold"
title={
reason ? (
reason
) : (
<Localized id="account-tokenNotFound">
<span data-testid="invalid-link">
The specified link is invalid, check to see if it was copied
correctly.
</span>
</Localized>
)
}
/>
</div>
);
};
export default Sorry;
@@ -0,0 +1,21 @@
import { Localized } from "@fluent/react/compat";
import React from "react";
import styles from "./Unsubscribe.css";
const Success: React.FunctionComponent = () => {
return (
<div data-testid="success">
<Localized id="unsubscribe-unsubscribedSuccessfully">
<div className={styles.title}>
Unsubscribed successfully from email notifications
</div>
</Localized>
<Localized id="unsubscribe-youMayNowClose">
<div className={styles.description}>You may now close this window</div>
</Localized>
</div>
);
};
export default Success;
@@ -0,0 +1,52 @@
.title {
font-family: var(--font-family-secondary);
font-style: normal;
font-weight: var(--font-weight-secondary-bold);
font-size: var(--font-size-6);
line-height: 1.17;
color: var(--palette-text-500);
margin-bottom: var(--spacing-2);
}
.description {
font-family: var(--font-family-primary);
font-style: normal;
font-weight: var(--font-weight-primary-regular);
font-size: var(--font-size-3);
line-height: 1.25;
color: var(--palette-text-500);
margin-bottom: var(--spacing-3);
}
.label {
font-family: var(--font-family-primary);
font-style: normal;
font-weight: var(--font-weight-primary-bold);
font-size: var(--font-size-2);
line-height: 1.14;
color: var(--palette-text-500);
margin-bottom: var(--spacing-1);
}
.labelDescription {
font-family: var(--font-family-primary);
font-style: normal;
font-weight: var(--font-weight-primary-regular);
font-size: var(--font-size-2);
line-height: 1.285;
color: var(--palette-text-100);
margin-bottom: var(--spacing-2);
}
.submit {
margin-top: var(--spacing-5);
margin-bottom: var(--spacing-1);
}
@@ -0,0 +1,77 @@
import { Localized } from "@fluent/react/compat";
import { FORM_ERROR } from "final-form";
import React, { useCallback } from "react";
import { Form } from "react-final-form";
import { InvalidRequestError } from "coral-framework/lib/errors";
import { useMutation } from "coral-framework/lib/relay";
import { Button, CallOut } from "coral-ui/components/v3";
import UnsubscribeNotificationsMutation from "./UnsubscribeNotificationsMutation";
import styles from "./Unsubscribe.css";
interface Props {
token: string;
disabled?: boolean;
onSuccess: () => void;
}
const UnsubscribeForm: React.FunctionComponent<Props> = ({
onSuccess,
token,
}) => {
const unsubscribe = useMutation(UnsubscribeNotificationsMutation);
const onSubmit = useCallback(async () => {
try {
await unsubscribe({ token });
onSuccess();
} catch (error) {
if (error instanceof InvalidRequestError) {
return error.invalidArgs;
}
return { [FORM_ERROR]: error.message };
}
return;
}, [token]);
return (
<div data-testid="unsubscribe-form">
<Form onSubmit={onSubmit}>
{({ handleSubmit, submitting, submitError }) => (
<form onSubmit={handleSubmit}>
<div>
<Localized id="unsubscribe-unsubscribeFromEmails">
<div className={styles.title}>
Unsubscribe from email notifications
</div>
</Localized>
<Localized id="unsubscribe-clickToConfirm">
<div className={styles.description}>
Click below to confirm that you want to unsubscribe from all
notifications.
</div>
</Localized>
{submitError && <CallOut color="error" title={submitError} />}
<Localized id="unsubscribe-submit-unsubscribe">
<Button
type="submit"
variant="filled"
paddingSize="medium"
color="primary"
disabled={submitting}
upperCase
fullWidth
className={styles.submit}
>
Unsubscribe
</Button>
</Localized>
</div>
</form>
)}
</Form>
</div>
);
};
export default UnsubscribeForm;
@@ -0,0 +1,14 @@
import { Environment } from "relay-runtime";
import { createMutation } from "coral-framework/lib/relay";
const UnsubscribeNotificationsMutation = createMutation(
"unsubscribeNotifications",
async (environment: Environment, variables: { token: string }, { rest }) =>
await rest.fetch<void>("/account/notifications/unsubscribe", {
method: "DELETE",
token: variables.token,
})
);
export default UnsubscribeNotificationsMutation;
@@ -0,0 +1,16 @@
.container {
width: 100%;
text-align: center;
}
.root {
display: inline-block;
max-width: calc(70 * var(--mini-unit));
@media (min-width: $breakpoints-xs) {
max-width: calc(42 * var(--mini-unit));
}
text-align: left;
}
@@ -0,0 +1,79 @@
import React, { useCallback, useState } from "react";
import { Environment } from "relay-runtime";
import Loading from "coral-account/components/Loading";
import { useToken } from "coral-framework/hooks";
import { createFetch } from "coral-framework/lib/relay";
import { withRouteConfig } from "coral-framework/lib/router";
import { parseHashQuery } from "coral-framework/utils";
import Sorry from "./Sorry";
import Success from "./Success";
import UnsubscribeForm from "./UnsubscribeForm";
import styles from "./UnsubscribeRoute.css";
const fetcher = createFetch(
"unsubscribeToken",
async (environment: Environment, variables: { token: string }, { rest }) =>
await rest.fetch<void>("/account/notifications/unsubscribe", {
method: "GET",
token: variables.token,
})
);
interface Props {
token: string | undefined;
}
const UnsubscribeRoute: React.FunctionComponent<Props> = ({ token }) => {
const [finished, setFinished] = useState(false);
const onSuccess = useCallback(() => {
setFinished(true);
}, []);
const [state, error] = useToken(fetcher, token);
if (state === "UNCHECKED") {
return (
<main className={styles.container}>
<div className={styles.root}>
<Loading />
</div>
</main>
);
}
if (state !== "VALID" || error) {
return (
<main className={styles.container}>
<div className={styles.root}>
<Sorry reason={error} />
</div>
</main>
);
}
return !finished ? (
<main className={styles.container}>
<div className={styles.root}>
<UnsubscribeForm token={token!} onSuccess={onSuccess} />
</div>
</main>
) : (
<main className={styles.container}>
<div className={styles.root}>
<Success />
</div>
</main>
);
};
const enhanced = withRouteConfig<Props>({
render: function UnsubscribeRouteRender({ match, Component }) {
return (
<Component token={parseHashQuery(match.location.hash).unsubscribeToken} />
);
},
})(UnsubscribeRoute);
export default enhanced;
@@ -0,0 +1 @@
export { default, default as UnsubscribeRoute } from "./UnsubscribeRoute";
@@ -0,0 +1,52 @@
.title {
font-family: var(--font-family-secondary);
font-style: normal;
font-weight: var(--font-weight-secondary-bold);
font-size: var(--font-size-6);
line-height: 1.17;
color: var(--palette-text-500);
margin-bottom: var(--spacing-2);
}
.description {
font-family: var(--font-family-primary);
font-style: normal;
font-weight: var(--font-weight-primary-regular);
font-size: var(--font-size-3);
line-height: 1.25;
color: var(--palette-text-500);
margin-bottom: var(--spacing-3);
}
.label {
font-family: var(--font-family-primary);
font-style: normal;
font-weight: var(--font-weight-primary-bold);
font-size: var(--font-size-2);
line-height: 1.14;
color: var(--palette-text-500);
margin-bottom: var(--spacing-1);
}
.labelDescription {
font-family: var(--font-family-primary);
font-style: normal;
font-weight: var(--font-weight-primary-regular);
font-size: var(--font-size-2);
line-height: 1.285;
color: var(--palette-text-100);
margin-bottom: var(--spacing-2);
}
.submit {
margin-top: var(--spacing-5);
margin-bottom: var(--spacing-1);
}
@@ -1,29 +1,23 @@
import { Localized } from "@fluent/react/compat";
import { FORM_ERROR } from "final-form";
import { Localized } from "fluent-react/compat";
import React, { useCallback } from "react";
import { Field, Form } from "react-final-form";
import { InvalidRequestError } from "coral-framework/lib/errors";
import { colorFromMeta, ValidationMessage } from "coral-framework/lib/form";
import { colorFromMeta } from "coral-framework/lib/form";
import { useMutation } from "coral-framework/lib/relay";
import {
composeValidators,
required,
validatePassword,
} from "coral-framework/lib/validation";
import {
Button,
CallOut,
FormField,
HorizontalGutter,
InputDescription,
InputLabel,
PasswordField,
Typography,
} from "coral-ui/components";
import { FormField, PasswordField } from "coral-ui/components/v2";
import { Button, CallOut, ValidationMessage } from "coral-ui/components/v3";
import ResetPasswordMutation from "./ResetPasswordMutation";
import styles from "./Reset.css";
interface Props {
token: string;
disabled?: boolean;
@@ -60,22 +54,20 @@ const ResetPasswordForm: React.FunctionComponent<Props> = ({
<Form onSubmit={onSubmit}>
{({ handleSubmit, submitting, submitError }) => (
<form autoComplete="off" onSubmit={handleSubmit}>
<HorizontalGutter size="double">
<HorizontalGutter>
<div>
<div>
<Localized id="resetPassword-resetYourPassword">
<Typography variant="heading1">
Reset your password
</Typography>
<div className={styles.title}>Reset your password</div>
</Localized>
<Localized id="resetPassword-pleaseEnterNewPassword">
<Typography variant="bodyCopy">
<div className={styles.description}>
Please enter a new password to use to sign in to your
account. Make sure it is unique and be sure to keep it
secure.
</Typography>
</div>
</Localized>
</HorizontalGutter>
<HorizontalGutter>
</div>
<div>
<Field
name="password"
validate={composeValidators(required, validatePassword)}
@@ -83,15 +75,17 @@ const ResetPasswordForm: React.FunctionComponent<Props> = ({
{({ input, meta }) => (
<FormField>
<Localized id="resetPassword-passwordLabel">
<InputLabel htmlFor={input.name}>Password</InputLabel>
<label className={styles.label} htmlFor={input.name}>
Password
</label>
</Localized>
<Localized
id="resetPassword-passwordDescription"
$minLength={8}
>
<InputDescription>
<div className={styles.labelDescription}>
{"Must be at least {$minLength} characters"}
</InputDescription>
</div>
</Localized>
<Localized
id="resetPassword-passwordTextField"
@@ -107,28 +101,27 @@ const ResetPasswordForm: React.FunctionComponent<Props> = ({
{...input}
/>
</Localized>
<ValidationMessage meta={meta} fullWidth />
<ValidationMessage meta={meta} />
</FormField>
)}
</Field>
{submitError && (
<CallOut color="error" fullWidth>
{submitError}
</CallOut>
)}
{submitError && <CallOut color="error" title={submitError} />}
<Localized id="resetPassword-resetPassword">
<Button
type="submit"
variant="filled"
color="primary"
paddingSize="medium"
disabled={submitting}
upperCase
fullWidth
className={styles.submit}
>
Reset Password
</Button>
</Localized>
</HorizontalGutter>
</HorizontalGutter>
</div>
</div>
</form>
)}
</Form>
@@ -35,43 +35,43 @@ const ResetRoute: React.FunctionComponent<Props> = ({ token }) => {
if (state === "UNCHECKED") {
return (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<Loading />
</div>
</div>
</main>
);
}
if (state !== "VALID" || error) {
return (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<Sorry reason={error} />
</div>
</div>
</main>
);
}
return !finished ? (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<ResetPasswordForm token={token!} onSuccess={onSuccess} />
</div>
</div>
</main>
) : (
<div className={styles.container}>
<main className={styles.container}>
<div className={styles.root}>
<Success />
</div>
</div>
</main>
);
};
const enhanced = withRouteConfig<Props>({
render: ({ match, Component }) => (
<Component token={parseHashQuery(match.location.hash).resetToken} />
),
render: function ResetRouteRender({ match, Component }) {
return <Component token={parseHashQuery(match.location.hash).resetToken} />;
},
})(ResetRoute);
export default enhanced;
@@ -1,7 +1,9 @@
import { Localized } from "fluent-react/compat";
import { Localized } from "@fluent/react/compat";
import React from "react";
import { CallOut, HorizontalGutter, Typography } from "coral-ui/components";
import { CallOut } from "coral-ui/components/v3";
import styles from "./Reset.css";
interface Props {
reason: React.ReactNode;
@@ -9,23 +11,27 @@ interface Props {
const Sorry: React.FunctionComponent<Props> = ({ reason }) => {
return (
<HorizontalGutter size="double">
<div>
<Localized id="resetPassword-oopsSorry">
<Typography variant="heading1">Oops Sorry!</Typography>
<div className={styles.title}>Oops Sorry!</div>
</Localized>
<CallOut color="error" fullWidth>
{reason ? (
reason
) : (
<Localized id="account-tokenNotFound">
<span data-testid="invalid-link">
The specified link is invalid, check to see if it was copied
correctly.
</span>
</Localized>
)}
</CallOut>
</HorizontalGutter>
<CallOut
color="error"
titleWeight="semiBold"
title={
reason ? (
reason
) : (
<Localized id="account-tokenNotFound">
<span data-testid="invalid-link">
The specified link is invalid, check to see if it was copied
correctly.
</span>
</Localized>
)
}
/>
</div>
);
};
@@ -1,21 +1,21 @@
import { Localized } from "fluent-react/compat";
import { Localized } from "@fluent/react/compat";
import React from "react";
import { HorizontalGutter, Typography } from "coral-ui/components";
import styles from "./Reset.css";
const Success: React.FunctionComponent = () => {
return (
<HorizontalGutter size="double">
<div>
<Localized id="resetPassword-successfullyReset">
<Typography variant="heading1">Password successfully reset</Typography>
<div className={styles.title}>Password successfully reset</div>
</Localized>
<Localized id="resetPassword-youMayClose">
<Typography variant="bodyCopy">
<div className={styles.description}>
You may now close this window and sign in to your account with your
new password.
</Typography>
</div>
</Localized>
</HorizontalGutter>
</div>
);
};
@@ -10,7 +10,7 @@ exports[`renders form 1`] = `
<div
className="MainLayout-centered"
>
<div
<main
className="ConfirmRoute-container"
>
<div
@@ -20,29 +20,22 @@ exports[`renders form 1`] = `
autoComplete="off"
onSubmit={[Function]}
>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-double"
>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-full"
>
<h1
className="Box-root Typography-root Typography-heading1 Typography-colorTextPrimary"
<div>
<div>
<div
className="Confirm-title"
>
Email Confirmation
</h1>
<p
className="Box-root Typography-root Typography-bodyCopy Typography-colorTextPrimary"
Confirm your email address
</div>
<div
className="Confirm-description"
>
Click below to confirm your email address.
</p>
</div>
</div>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-full"
>
<div>
<button
className="BaseButton-root Button-root Button-sizeRegular Button-colorPrimary Button-variantFilled Button-fullWidth"
data-color="primary"
className="BaseButton-root Button-base Button-filled Button-fontSizeSmall Button-textAlignCenter Button-fontFamilyPrimary Button-fontWeightPrimaryBold Button-paddingSizeSmall Button-colorPrimary Button-upperCase Button-fullWidth Confirm-submit"
data-variant="filled"
disabled={false}
onBlur={[Function]}
@@ -58,7 +51,7 @@ exports[`renders form 1`] = `
</div>
</form>
</div>
</div>
</main>
</div>
</div>
`;
@@ -73,34 +66,45 @@ exports[`renders missing confirm token 1`] = `
<div
className="MainLayout-centered"
>
<div
<main
className="ConfirmRoute-container"
>
<div
className="ConfirmRoute-root"
>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-double"
>
<h1
className="Box-root Typography-root Typography-heading1 Typography-colorTextPrimary"
<div>
<div
className="Confirm-title"
>
Oops Sorry!
</h1>
</div>
<div
className="CallOut-root CallOut-colorError CallOut-fullWidth"
className="CallOut-root CallOut-error CallOut-leftBorder"
>
<div>
<span
data-testid="invalid-link"
<div
className="Box-root Flex-root Flex-flex Flex-justifyFlexStart Flex-alignFlexStart"
>
<div
className="CallOut-content"
>
The specified link is invalid, check to see if it was copied correctly.
</span>
<div
className="CallOut-title CallOut-titleSemiBold"
>
<span
data-testid="invalid-link"
>
The specified link is invalid, check to see if it was copied correctly.
</span>
</div>
<div
className="CallOut-body"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
`;
@@ -10,7 +10,7 @@ exports[`renders form 1`] = `
<div
className="MainLayout-centered"
>
<div
<main
className="ResetRoute-container"
>
<div
@@ -21,41 +21,35 @@ exports[`renders form 1`] = `
autoComplete="off"
onSubmit={[Function]}
>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-double"
>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-full"
>
<h1
className="Box-root Typography-root Typography-heading1 Typography-colorTextPrimary"
<div>
<div>
<div
className="Reset-title"
>
Reset your password
</h1>
<p
className="Box-root Typography-root Typography-bodyCopy Typography-colorTextPrimary"
</div>
<div
className="Reset-description"
>
Please enter a new password to use to sign in to your account.
Make sure it is unique and be sure to keep it secure.
</p>
</div>
</div>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-full"
>
<div>
<div
className="Box-root HorizontalGutter-root FormField-root HorizontalGutter-half"
className="Box-root HorizontalGutter-root FormField-root HorizontalGutter-spacing-2"
>
<label
className="Box-root Typography-root Typography-inputLabel Typography-colorTextPrimary InputLabel-root"
className="Reset-label"
htmlFor="password"
>
Password
</label>
<p
className="Box-root Typography-root Typography-detail Typography-colorTextSecondary"
<div
className="Reset-labelDescription"
>
Must be at least 8 characters
</p>
</div>
<div
className="PasswordField-fullWidth PasswordField-root"
>
@@ -67,6 +61,7 @@ Make sure it is unique and be sure to keep it secure.
autoComplete="new-password"
autoCorrect="off"
className="PasswordField-colorRegular PasswordField-fullWidth PasswordField-input"
data-testid="password-field"
disabled={false}
id="password"
name="password"
@@ -81,6 +76,7 @@ Make sure it is unique and be sure to keep it secure.
<div
className="PasswordField-icon"
onClick={[Function]}
onKeyUp={[Function]}
role="button"
tabIndex={0}
title="Hide password"
@@ -96,8 +92,7 @@ Make sure it is unique and be sure to keep it secure.
</div>
</div>
<button
className="BaseButton-root Button-root Button-sizeRegular Button-colorPrimary Button-variantFilled Button-fullWidth"
data-color="primary"
className="BaseButton-root Button-base Button-filled Button-fontSizeSmall Button-textAlignCenter Button-fontFamilyPrimary Button-fontWeightPrimaryBold Button-paddingSizeMedium Button-colorPrimary Button-upperCase Button-fullWidth Reset-submit"
data-variant="filled"
disabled={false}
onBlur={[Function]}
@@ -114,7 +109,7 @@ Make sure it is unique and be sure to keep it secure.
</form>
</div>
</div>
</div>
</main>
</div>
</div>
`;
@@ -129,34 +124,45 @@ exports[`renders missing reset token 1`] = `
<div
className="MainLayout-centered"
>
<div
<main
className="ResetRoute-container"
>
<div
className="ResetRoute-root"
>
<div
className="Box-root HorizontalGutter-root HorizontalGutter-double"
>
<h1
className="Box-root Typography-root Typography-heading1 Typography-colorTextPrimary"
<div>
<div
className="Reset-title"
>
Oops Sorry!
</h1>
</div>
<div
className="CallOut-root CallOut-colorError CallOut-fullWidth"
className="CallOut-root CallOut-error CallOut-leftBorder"
>
<div>
<span
data-testid="invalid-link"
<div
className="Box-root Flex-root Flex-flex Flex-justifyFlexStart Flex-alignFlexStart"
>
<div
className="CallOut-content"
>
The specified link is invalid, check to see if it was copied correctly.
</span>
<div
className="CallOut-title CallOut-titleSemiBold"
>
<span
data-testid="invalid-link"
>
The specified link is invalid, check to see if it was copied correctly.
</span>
</div>
<div
className="CallOut-body"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
`;
@@ -0,0 +1,109 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders form 1`] = `
<div
data-testid="main-layout"
>
<div
className="MainLayout-bar"
/>
<div
className="MainLayout-centered"
>
<main
className="UnsubscribeRoute-container"
>
<div
className="UnsubscribeRoute-root"
>
<div
data-testid="unsubscribe-form"
>
<form
onSubmit={[Function]}
>
<div>
<div
className="Unsubscribe-title"
>
Unsubscribe from email notifications
</div>
<div
className="Unsubscribe-description"
>
Click below to confirm that you want to unsubscribe from all notifications.
</div>
<button
className="BaseButton-root Button-base Button-filled Button-fontSizeSmall Button-textAlignCenter Button-fontFamilyPrimary Button-fontWeightPrimaryBold Button-paddingSizeMedium Button-colorPrimary Button-upperCase Button-fullWidth Unsubscribe-submit"
data-variant="filled"
disabled={false}
onBlur={[Function]}
onFocus={[Function]}
onMouseOut={[Function]}
onMouseOver={[Function]}
onTouchEnd={[Function]}
type="submit"
>
Unsubscribe
</button>
</div>
</form>
</div>
</div>
</main>
</div>
</div>
`;
exports[`renders missing confirm token 1`] = `
<div
data-testid="main-layout"
>
<div
className="MainLayout-bar"
/>
<div
className="MainLayout-centered"
>
<main
className="UnsubscribeRoute-container"
>
<div
className="UnsubscribeRoute-root"
>
<div>
<div
className="Unsubscribe-title"
>
Oops Sorry!
</div>
<div
className="CallOut-root CallOut-error CallOut-leftBorder"
>
<div
className="Box-root Flex-root Flex-flex Flex-justifyFlexStart Flex-alignFlexStart"
>
<div
className="CallOut-content"
>
<div
className="CallOut-title CallOut-titleSemiBold"
>
<span
data-testid="invalid-link"
>
The specified link is invalid, check to see if it was copied correctly.
</span>
</div>
<div
className="CallOut-body"
/>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
`;
@@ -1,5 +1,7 @@
import sinon from "sinon";
import { ERROR_CODES } from "coral-common/errors";
import { InvalidRequestError } from "coral-framework/lib/errors";
import { GQLResolver } from "coral-framework/schema";
import {
act,
@@ -10,8 +12,6 @@ import {
within,
} from "coral-framework/testHelpers";
import { ERROR_CODES } from "coral-common/errors";
import { InvalidRequestError } from "coral-framework/lib/errors";
import create from "./create";
const token = createAccessToken();
@@ -31,7 +31,9 @@ it("renders missing confirm token", async () => {
replaceHistoryLocation("http://localhost/account/email/confirm");
const { root } = await createTestRenderer();
await waitForElement(() => within(root).getByTestID("invalid-link"));
expect(within(root).toJSON()).toMatchSnapshot();
expect(await within(root).axe()).toHaveNoViolations();
});
it("renders form", async () => {
@@ -51,12 +53,11 @@ it("renders form", async () => {
await act(async () => {
await waitForElement(() =>
within(root).getByText("Email Confirmation", {
exact: false,
})
within(root).getByText("Confirm your email address")
);
});
expect(within(root).toJSON()).toMatchSnapshot();
expect(await within(root).axe()).toHaveNoViolations();
restMock.verify();
});
@@ -98,6 +99,7 @@ it("renders error from server", async () => {
);
});
restMock.verify();
expect(await within(root).axe()).toHaveNoViolations();
}
});
@@ -126,9 +128,7 @@ it("submits form", async () => {
await act(async () => {
await waitForElement(() =>
within(root).getByText("Email Confirmation", {
exact: false,
})
within(root).getByText("Confirm your email address")
);
});
const form = within(root).getByType("form");
@@ -1,5 +1,7 @@
import sinon from "sinon";
import { ERROR_CODES } from "coral-common/errors";
import { InvalidRequestError } from "coral-framework/lib/errors";
import { GQLResolver } from "coral-framework/schema";
import {
act,
@@ -10,8 +12,6 @@ import {
within,
} from "coral-framework/testHelpers";
import { ERROR_CODES } from "coral-common/errors";
import { InvalidRequestError } from "coral-framework/lib/errors";
import create from "./create";
const token = createAccessToken();
@@ -32,6 +32,7 @@ it("renders missing reset token", async () => {
const { root } = await createTestRenderer();
await waitForElement(() => within(root).getByTestID("invalid-link"));
expect(within(root).toJSON()).toMatchSnapshot();
expect(await within(root).axe()).toHaveNoViolations();
});
it("renders form", async () => {
@@ -57,6 +58,7 @@ it("renders form", async () => {
);
});
expect(within(root).toJSON()).toMatchSnapshot();
expect(await within(root).axe()).toHaveNoViolations();
restMock.verify();
});
@@ -98,6 +100,7 @@ it("renders error from server", async () => {
);
});
restMock.verify();
expect(await within(root).axe()).toHaveNoViolations();
}
});

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