docbrown/app/javascript/packs/articleModerationTools.js
dependabot[bot] 1a48b3151a
Bump cypress from 6.9.1 to 7.2.0 (#13528)
* Bump cypress from 6.9.1 to 7.2.0

Bumps [cypress](https://github.com/cypress-io/cypress) from 6.9.1 to 7.2.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/commits/v7.2.0)

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

* fix intercept and exception issues causing commentOnArticle specs to fail

* fix a typo while we're here

* stub the minimum search text

* update intercepts on post mention user

* Bump cypress from 6.9.1 to 7.2.0

Bumps [cypress](https://github.com/cypress-io/cypress) from 6.9.1 to 7.2.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](https://github.com/cypress-io/cypress/commits/v7.2.0)

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

* fix unhandled exceptions in initScrolling causing tests to abort

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-04-28 10:09:43 +01:00

31 lines
961 B
JavaScript

/* eslint-disable no-restricted-globals */
/* eslint-disable no-undef */
const user = userData();
const { authorId: articleAuthorId, path } = document.getElementById(
'article-show-container',
).dataset;
const initializeModerationsTools = async () => {
const { initializeActionsPanel } = await import(
'../actionsPanel/initializeActionsPanelToggle'
);
const { initializeFlagUserModal } = await import('./flagUserModal');
// article show page
if (
user?.trusted &&
user?.id !== articleAuthorId &&
!top.document.location.pathname.endsWith('/mod')
) {
initializeActionsPanel(user, path);
initializeFlagUserModal(articleAuthorId);
// dev.to/mod
} else if (user?.trusted && top.document.location.pathname.endsWith('/mod')) {
initializeActionsPanel(user, path);
initializeFlagUserModal(articleAuthorId);
}
};
initializeModerationsTools();
/* eslint-enable no-restricted-globals */
/* eslint-enable no-undef */