refs: https://github.com/TryGhost/Toolbox/issues/595
We're rolling out new rules around the node assert library, the first of which is enforcing the use of assert/strict. This means we don't need to use the strict version of methods, as the standard version will work that way by default.
This caught some gotchas in our existing usage of assert where the lack of strict mode had unexpected results:
- Url matching needs to be done on `url.href` see aa58b354a4
- Null and undefined are not the same thing, there were a few cases of this being confused
- Particularly questionable changes in [PostExporter tests](c1a468744b) tracked [here](https://github.com/TryGhost/Team/issues/3505).
- A typo see eaac9c293a
Moving forward, using assert strict should help us to catch unexpected behaviour, particularly around nulls and undefineds during implementation.
- `yarn start:dev` was failing with `error:0308010C:digital envelope routines::unsupported` without the `--openssl-legacy-provider` option on Node 18. Currently react-scripts@4.x doesn't support Node 18, so until we upgrade to use react-scripts@5.x we'll need to pass in this change for build scripts
refs https://github.com/TryGhost/Team/issues/2221
- added guard to `formatNumber` helper used in the `<Count>` component via the `<ContentTitle>` component so a missing count prop is handled gracefully
- Changed all borders to work better in different background colours
- Same goes for main buttons like pagination for main and reply
- Same goes for any secondary text which should help
no issue
refs https://github.com/TryGhost/Team/issues/1780
This commit adds some Cypress tests as a POC to the project. If we decide to go with Cypress, we can add more tests to cover the rest of the codebase. The main reason to have a E2E framework is that some editor related UI is hard to test with the React tests because it uses JSDOM.
no issue
When the state of a comment changes (e.g., after a like) the relative time would update. This is not desirable because it looks glitchy. If the relative time doesn't update every second, then it is better to never update it after the initial render.
ref https://github.com/TryGhost/Team/issues/1772
- all references of "Bio" to "Expertise" for Comments
- this commit is a breaking change as it relies on the API that returns `expertise` instead of `bio`.
refs https://github.com/TryGhost/Team/issues/1858
- PopupBox better reflects that it contains a Popup and is not a Popup
- In line with ContentBox, that contains the iframe with the comments content
refs https://github.com/TryGhost/Team/issues/1858
fixes https://github.com/TryGhost/Team/issues/1789
- Split up the Comment component in many small Components to make it easier to read and maintain
- Added support for synchronous actions, which are required for actions that affect the context state based on the current value (e.g., increasing a value by one) because of the asynchronous nature of setState:
Before this change
```
// Context state: {hello: 0};
dispatchAction('increaseHelloByOne')
dispatchAction('increaseHelloByOne')
```
Could end up having a state `{hello: 1}` instead of the expected `{hello: 2}`, because underlying this would resolve into:
```
// Context state: {hello: 0};
const hello = {hello: 0};
setState({hello: hello + 1});
setState({hello: hello + 1});
```
Instead of
```
// Context state: {hello: 0};
setState(({hello}) => {hello: hello + 1});
setState(({hello}) => {hello: hello + 1});
```
Synchronous actions now support this.
- Removed deprecated `onAction` context state function
- Replaced the boolean based form checking by the more reliable counter based checking that uses synchronous actions (reason we needed synchronous actions) (fixes https://github.com/TryGhost/Team/issues/1789)
- Prevent creating a new `dispatchAction` function every time the context state changes, by using bind. This prevents infinte updates in `useEffect` hooks that depend on `dispatchAction` and also update the context via actions.
refs https://ghost.slack.com/archives/C02G9E68C/p1660323308235919
- When opening and closing a popup very fast, it will stay in DOM, blocking all pointer events.
- The Headless UI component <Transition show={show}> is not removed from DOM when show is set to true, and false very fast
- Fixed this by forcing a popup to get removed from DOM after 250ms after is has been closed.
- Updated HeadlessUI version
- Moved testing packges to dev dependencies
refs https://github.com/TryGhost/Team/issues/1723
- Moved usage from likes_count to count.likes
- Implemented real reply pagination based by an ID filter
- The backend now returns the relations correctly when creating new comments, so we don't need to fix them any longer.
refs https://github.com/TryGhost/Team/issues/1763
We still need to use the pagination for the other checks because these
are based on how many comments are visible, which includes deleted or
hidden comments.
By using the /comments/count API we ensure that any changes to the
calculation of comments is replicated by both the comment_count
helper, as well as the comments-ui
- Added in a new line for further explanation
- Adjusted various text sizes and spacings
- Put back in the bottom border
- Currently has a hardcoded publication name for wiring up
refs https://github.com/TryGhost/Team/issues/1754
- After some trying things out, just removed that now
- There should be no more bottom spacing apart from what's in the iFrame now
refs https://github.com/TryGhost/Team/issues/1747
- There were left over paddings that were present with old design
- Stripping back the paddings to have better placement in more themes without adjustment
refs https://github.com/TryGhost/Team/issues/1747
- This changes the behaviour of the Avatar component to show the icon properly
- This removes a parameter from the Avatar component
refs https://github.com/TryGhost/Team/issues/1746
- This replaces the A that showed which was a bit confusing
- Icon may still change but it feels better than what was there before
- Added new parameter for Avatar component for Blank and Anonymous
refs https://github.com/TryGhost/Team/issues/1746
- Removed only showing bio in modal, now showing both always
- Changed how the modal is called with parameters to focus on bio if clicked
refs https://github.com/TryGhost/Team/issues/1716
- This adds in the bio UI into the modal
- Adds in a simple button for bio under the name in textbox
- Still needs wiring up as it data doesn't save and update yet
refs https://github.com/TryGhost/Team/issues/1716
fixes https://github.com/TryGhost/Team/issues/1725
- ESC to close/blur forms
- CMD + ESC to submit forms
- C to focus and scroll to main comment form
- ESC to close any modals (context menus or dialogs)
- keydown events are passed down from iframes to the main window to prevent having to listen on all iframes + window every time we need these events.
fixes https://github.com/TryGhost/Team/issues/1729
refs https://github.com/TryGhost/Team/issues/1730
Please note that it only works on initial page load for now. Browsers have custom implementations for handling URL hashes/fragments that mess with the scroll position if you reload a page.
We need a special JS based handling of the URL fragment/hash because:
- We should only scroll after the comments have loaded, else we risk landing on a higher position on the page due to content height changes.
- The DIV we scroll to (#ghost-comments-root) is inserted via JS, making it more difficult to scroll to it without JS.
- We cannot wrap the `<script>` tag that loads the comments with a different DIV that has an id where we can scroll to. This would break themes and would make it harder to work with existing CSS grids (tried this first). And we still have the first issue too if we use this.
refs https://github.com/TryGhost/Team/issues/1695
We should allow for an empty string to be passed in as the title,
which means a boolean coercion check is not appropriate, we should
check for null which in this case means to use the default title
no issue
- typography and spacing was a bit off in the signup / upgrade CTA boxes
- the line style was inconsistent with the rest of the comments design
- button sizes and spacings needed also a bit of refinement
no issue
- applied typography changes to bio and date line as they were too strong
- padding and positioning of the comment input form was a bit misaligned
- Before it was static, with an X, but now using the variable available
- Do note, this doesn't seem to be showing the right number
refs https://github.com/TryGhost/Team/issues/1695
refs https://github.com/TryGhost/Team/issues/1710
- if a user is already editing/replying a comment, we shouldn't show other text boxes they can edit as it can be generally confusing
- This removes the global styles on the iFrame
- Changes to comment layout for new bio, new position for date and edited tag
- Lots of design tweaks for desktop and mobile
refs https://github.com/TryGhost/Team/issues/1716
refs https://github.com/TryGhost/Team/issues/1719
- the stylesheet link was prev hardcoded in the app, which made it impossible to configure from Ghost
- fetches styles url from the data attribute on script instead, which allows app to load styles based on config upstream
refs https://github.com/TryGhost/Team/issues/1710
Was caused by: mouseDown triggered on Reply button -> editor blurred -> editor closed itself -> onClick on reply opened the form again