docbrown/app/javascript/utilities/moderation.js
Nick Taylor 96f54d02cd
[15 min fix] Fixed an issue with the moderation button not appearing on some posts (#14184)
* Fixed an issue with the moderation button not appearing on some posts.

* Added some E2E tests to ensure moderation button is on posts for trusted users.

* Added some more tests.

* Added a test to ensure moderation button does not appear when logged out.
2021-07-13 10:31:00 +02:00

10 lines
352 B
JavaScript

/**
* Determines whether or not a member is on the moderation page.
*
* @param {String} [path=top.location.pathname] The path to check.
*
* @returns {Boolean} True if the path is the moderation page, false otherwise.
**/
export function isModerationPage(path = top.location.pathname) {
return path.endsWith('/mod') || path.endsWith('/mod/');
}