From 8c3bfaf59976206265f961d4cba5afe60b332d41 Mon Sep 17 00:00:00 2001 From: rafalp Date: Thu, 25 Jul 2024 23:55:11 +0200 Subject: [PATCH] Remove old threads list React.js components --- .../components/ThreadsList/ThreadsList.jsx | 66 --- .../ThreadsList/ThreadsListEmpty.jsx | 42 -- .../ThreadsList/ThreadsListItem.jsx | 134 ------ .../ThreadsList/ThreadsListItemActivity.jsx | 14 - .../ThreadsList/ThreadsListItemCategory.jsx | 36 -- .../ThreadsList/ThreadsListItemCheckbox.jsx | 18 - .../ThreadsList/ThreadsListItemLastPoster.jsx | 30 -- .../ThreadsListItemNotifications.jsx | 102 ---- .../ThreadsList/ThreadsListItemReadStatus.jsx | 25 - .../ThreadsList/ThreadsListItemStarter.jsx | 30 -- .../ThreadsList/ThreadsListItemTitle.jsx | 44 -- .../ThreadsList/ThreadsListLoader.jsx | 172 ------- .../ThreadsList/ThreadsListUpdatePrompt.jsx | 27 -- frontend/src/components/ThreadsList/index.js | 3 - .../threads/ThreadsCategoryPicker.jsx | 62 --- .../components/threads/ThreadsListPicker.jsx | 25 - .../src/components/threads/ThreadsToolbar.jsx | 115 ----- .../threads/ThreadsToolbarModeration.jsx | 49 -- frontend/src/components/threads/compare.js | 29 -- frontend/src/components/threads/container.js | 56 --- .../components/threads/moderation/controls.js | 454 ------------------ .../threads/moderation/errors-list.js | 56 --- .../components/threads/moderation/merge.js | 396 --------------- .../src/components/threads/moderation/move.js | 180 ------- frontend/src/components/threads/root.js | 90 ---- frontend/src/components/threads/route.js | 369 -------------- frontend/src/components/threads/utils.js | 146 ------ .../src/initializers/components/threads.js | 47 -- misago/static/misago/js/misago.js | 2 +- misago/static/misago/js/misago.js.map | 2 +- 30 files changed, 2 insertions(+), 2819 deletions(-) delete mode 100644 frontend/src/components/ThreadsList/ThreadsList.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListEmpty.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListItem.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListItemActivity.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListItemCategory.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListItemCheckbox.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListItemLastPoster.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListItemNotifications.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListItemReadStatus.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListItemStarter.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListItemTitle.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListLoader.jsx delete mode 100644 frontend/src/components/ThreadsList/ThreadsListUpdatePrompt.jsx delete mode 100644 frontend/src/components/ThreadsList/index.js delete mode 100644 frontend/src/components/threads/ThreadsCategoryPicker.jsx delete mode 100644 frontend/src/components/threads/ThreadsListPicker.jsx delete mode 100644 frontend/src/components/threads/ThreadsToolbar.jsx delete mode 100644 frontend/src/components/threads/ThreadsToolbarModeration.jsx delete mode 100644 frontend/src/components/threads/compare.js delete mode 100644 frontend/src/components/threads/container.js delete mode 100644 frontend/src/components/threads/moderation/controls.js delete mode 100644 frontend/src/components/threads/moderation/errors-list.js delete mode 100644 frontend/src/components/threads/moderation/merge.js delete mode 100644 frontend/src/components/threads/moderation/move.js delete mode 100644 frontend/src/components/threads/root.js delete mode 100644 frontend/src/components/threads/route.js delete mode 100644 frontend/src/components/threads/utils.js delete mode 100644 frontend/src/initializers/components/threads.js diff --git a/frontend/src/components/ThreadsList/ThreadsList.jsx b/frontend/src/components/ThreadsList/ThreadsList.jsx deleted file mode 100644 index 3dc5782f70..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsList.jsx +++ /dev/null @@ -1,66 +0,0 @@ -import React from "react" -import ThreadsListEmpty from "./ThreadsListEmpty" -import ThreadsListItem from "./ThreadsListItem" -import ThreadsListLoader from "./ThreadsListLoader" -import ThreadsListUpdatePrompt from "./ThreadsListUpdatePrompt" - -const ThreadsList = ({ - list, - categories, - category, - threads, - busyThreads, - selection, - isLoaded, - showOptions, - updatedThreads, - applyUpdate, - emptyMessage, -}) => { - if (!isLoaded) { - return - } - - return ( -
- {threads.length > 0 ? ( -
    - {updatedThreads > 0 && ( - - )} - {threads.map((thread) => ( - = 0} - isSelected={selection.indexOf(thread.id) >= 0} - /> - ))} -
- ) : ( -
    - {updatedThreads > 0 && ( - - )} - -
- )} -
- ) -} - -export default ThreadsList diff --git a/frontend/src/components/ThreadsList/ThreadsListEmpty.jsx b/frontend/src/components/ThreadsList/ThreadsListEmpty.jsx deleted file mode 100644 index e270550691..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListEmpty.jsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from "react" - -const ThreadsListEmpty = ({ category, list, message }) => { - if (list.type === "all") { - if (message) { - return ( -
  • -

    {message}

    -
  • - ) - } - - return ( -
  • -

    - {category.special_role - ? pgettext( - "threads list empty", - "There are no threads on this site yet." - ) - : pgettext( - "threads list empty", - "There are no threads in this category." - )} -

    -
  • - ) - } - - return ( -
  • -

    - {pgettext( - "threads list empty", - "No threads matching specified criteria were found." - )} -

    -
  • - ) -} - -export default ThreadsListEmpty diff --git a/frontend/src/components/ThreadsList/ThreadsListItem.jsx b/frontend/src/components/ThreadsList/ThreadsListItem.jsx deleted file mode 100644 index 6e0525577b..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListItem.jsx +++ /dev/null @@ -1,134 +0,0 @@ -import classnames from "classnames" -import React from "react" -import ThreadFlags from "../ThreadFlags" -import ThreadReplies from "../ThreadReplies" -import ThreadsListItemActivity from "./ThreadsListItemActivity" -import ThreadsListItemCategory from "./ThreadsListItemCategory" -import ThreadsListItemCheckbox from "./ThreadsListItemCheckbox" -import ThreadsListItemLastPoster from "./ThreadsListItemLastPoster" -import ThreadsListItemNotifications from "./ThreadsListItemNotifications" -import ThreadsListItemReadStatus from "./ThreadsListItemReadStatus" -import ThreadsListItemStarter from "./ThreadsListItemStarter" -import ThreadsListItemTitle from "./ThreadsListItemTitle" - -const ThreadsListItem = ({ - activeCategory, - categories, - showOptions, - showNotifications, - thread, - isBusy, - isSelected, -}) => { - let parent = null - let category = null - - if (activeCategory.id !== thread.category) { - category = categories[thread.category] - - if ( - category.parent && - category.parent !== activeCategory.id && - categories[category.parent] && - !categories[category.parent].special_role - ) { - parent = categories[category.parent] - } - } - - const hasFlags = - thread.is_closed || - thread.is_hidden || - thread.is_unapproved || - thread.weight > 0 || - thread.best_answer || - thread.has_poll || - thread.has_unapproved_posts - - const isNew = showOptions ? thread.is_new : false - - return ( -
  • -
    - -
    - {showOptions && ( -
    - -
    - )} -
    -
    - - {showOptions && thread.moderation.length > 0 && ( -
    - -
    - )} -
    -
    -
    -
    - -
    - {hasFlags && ( -
    - -
    - )} - {!!category && ( -
    - -
    - )} -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    - {showOptions && showNotifications && ( -
    - -
    - )} - {showOptions && thread.moderation.length > 0 && ( -
    - -
    - )} -
    -
    -
    -
  • - ) -} - -export default ThreadsListItem diff --git a/frontend/src/components/ThreadsList/ThreadsListItemActivity.jsx b/frontend/src/components/ThreadsList/ThreadsListItemActivity.jsx deleted file mode 100644 index 8ce2d9335a..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListItemActivity.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from "react" -import Timestamp from "../Timestamp" - -const ThreadsListItemActivity = ({ thread }) => ( - - - -) - -export default ThreadsListItemActivity diff --git a/frontend/src/components/ThreadsList/ThreadsListItemCategory.jsx b/frontend/src/components/ThreadsList/ThreadsListItemCategory.jsx deleted file mode 100644 index 5a555ccadd..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListItemCategory.jsx +++ /dev/null @@ -1,36 +0,0 @@ -import React from "react" - -const ThreadsListItemCategory = ({ parent, category }) => ( - - {parent && ( - - {parent.short_name || parent.name} - - )} - - {category.short_name || category.name} - - -) - -const getClassName = (category) => { - let className = "threads-list-item-category threads-list-category-label" - - if (category.color) { - className += " threads-list-category-label-color" - } - - return className -} - -export default ThreadsListItemCategory diff --git a/frontend/src/components/ThreadsList/ThreadsListItemCheckbox.jsx b/frontend/src/components/ThreadsList/ThreadsListItemCheckbox.jsx deleted file mode 100644 index a8107f685b..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListItemCheckbox.jsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react" -import * as select from "../../reducers/selection" -import store from "../../services/store" - -const ThreadsListItemCheckbox = ({ checked, disabled, thread }) => ( - -) - -export default ThreadsListItemCheckbox diff --git a/frontend/src/components/ThreadsList/ThreadsListItemLastPoster.jsx b/frontend/src/components/ThreadsList/ThreadsListItemLastPoster.jsx deleted file mode 100644 index 9b3d03b159..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListItemLastPoster.jsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from "react" -import Avatar from "../avatar" - -const ThreadsListItemLastPoster = ({ thread }) => - !!thread.last_poster ? ( - - - - ) : ( - - - - ) - -export default ThreadsListItemLastPoster diff --git a/frontend/src/components/ThreadsList/ThreadsListItemNotifications.jsx b/frontend/src/components/ThreadsList/ThreadsListItemNotifications.jsx deleted file mode 100644 index a3f457cb05..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListItemNotifications.jsx +++ /dev/null @@ -1,102 +0,0 @@ -import React from "react" -import { connect } from "react-redux" -import { patch } from "../../reducers/threads" -import snackbar from "../../services/snackbar" -import { ApiMutation } from "../Api" -import { DropdownSubheader } from "../Dropdown" - -const ThreadsListItemNotifications = ({ dispatch, disabled, thread }) => ( - - {(mutate, { loading }) => { - function setNotifications(notifications) { - if (thread.notifications !== notifications) { - dispatch(patch(thread, { notifications })) - mutate({ - json: { notifications }, - onError: (error) => { - snackbar.apiError(error) - dispatch(patch(thread, { notifications: thread.notifications })) - }, - }) - } - } - - return ( -
    - -
      - - {pgettext("watch thread", "Notify about new replies")} - -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    -
    - ) - }} -
    -) - -const getIcon = (notifications) => { - if (notifications === 2) return "mail" - if (notifications === 1) return "notifications_active" - - return "notifications_none" -} - -const getTitle = (notifications) => { - if (notifications === 2) { - return pgettext("watch thread", "Send e-mail notifications") - } - - if (notifications === 1) { - return pgettext("watch thread", "Without e-mail notifications") - } - - return gettext("Not watching") -} - -const ThreadsListItemNotificationsConnected = connect()( - ThreadsListItemNotifications -) - -export default ThreadsListItemNotificationsConnected diff --git a/frontend/src/components/ThreadsList/ThreadsListItemReadStatus.jsx b/frontend/src/components/ThreadsList/ThreadsListItemReadStatus.jsx deleted file mode 100644 index 01b5698f71..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListItemReadStatus.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from "react" - -const ThreadsListItemReadStatus = ({ thread }) => { - if (thread && !thread.is_read) { - return ( -
    - -
    - ) - } - - return ( -
    - -
    - ) -} - -export default ThreadsListItemReadStatus diff --git a/frontend/src/components/ThreadsList/ThreadsListItemStarter.jsx b/frontend/src/components/ThreadsList/ThreadsListItemStarter.jsx deleted file mode 100644 index 76930dd4a5..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListItemStarter.jsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from "react" -import Avatar from "../avatar" - -const ThreadsListItemStarter = ({ thread }) => - !!thread.starter ? ( - - - - ) : ( - - - - ) - -export default ThreadsListItemStarter diff --git a/frontend/src/components/ThreadsList/ThreadsListItemTitle.jsx b/frontend/src/components/ThreadsList/ThreadsListItemTitle.jsx deleted file mode 100644 index 32a74ebb28..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListItemTitle.jsx +++ /dev/null @@ -1,44 +0,0 @@ -import classnames from "classnames" -import React from "react" - -const ThreadsListItemTitle = ({ thread, isNew }) => ( -
    - - {thread.title} - - {getPagesRange(thread.pages).map((page) => ( - - {page} - - ))} -
    -) - -function getPagesRange(pages) { - const range = [] - if (pages > 3) { - range.push(pages - 2) - } - if (pages > 2) { - range.push(pages - 1) - } - if (pages > 1) { - range.push(pages) - } - return range -} - -export default ThreadsListItemTitle diff --git a/frontend/src/components/ThreadsList/ThreadsListLoader.jsx b/frontend/src/components/ThreadsList/ThreadsListLoader.jsx deleted file mode 100644 index cf9fc44ab5..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListLoader.jsx +++ /dev/null @@ -1,172 +0,0 @@ -import React from "react" -import Avatar from "../avatar" -import { UIPreviewText } from "../UIPreview" -import ThreadsListItemReadStatus from "./ThreadsListItemReadStatus" - -const ThreadsListLoader = ({ showOptions }) => ( -
    -
      -
    • -
      - -
      - {showOptions && ( -
      - -
      - )} -
      -
      - {showOptions && ( -
      - -
      - )} -
      - - {" "} - - -
      -
      -
      -
      -
      - -
      -
      - -
      -
      -
      -
      - -
      -
      - - - -
      -
      - - - -
      -
      - -
      -
      -
      -
      -
    • -
    • -
      - -
      - {showOptions && ( -
      - -
      - )} -
      -
      - {showOptions && ( -
      - -
      - )} -
      - - {" "} - - -
      -
      -
      -
      -
      - -
      -
      - -
      -
      -
      -
      - -
      -
      - - - -
      -
      - - - -
      -
      - -
      -
      -
      -
      -
    • -
    • -
      - -
      - {showOptions && ( -
      - -
      - )} -
      -
      - {showOptions && ( -
      - -
      - )} -
      - - {" "} - - -
      -
      -
      -
      -
      - -
      -
      - -
      -
      -
      -
      - -
      -
      - - - -
      -
      - - - -
      -
      - -
      -
      -
      -
      -
    • -
    -
    -) - -export default ThreadsListLoader diff --git a/frontend/src/components/ThreadsList/ThreadsListUpdatePrompt.jsx b/frontend/src/components/ThreadsList/ThreadsListUpdatePrompt.jsx deleted file mode 100644 index f4571a4787..0000000000 --- a/frontend/src/components/ThreadsList/ThreadsListUpdatePrompt.jsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from "react" - -const ThreadsListUpdatePrompt = ({ threads, onClick }) => ( -
  • - -
  • -) - -export default ThreadsListUpdatePrompt diff --git a/frontend/src/components/ThreadsList/index.js b/frontend/src/components/ThreadsList/index.js deleted file mode 100644 index 2941c15b26..0000000000 --- a/frontend/src/components/ThreadsList/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import ThreadsList from "./ThreadsList" - -export default ThreadsList diff --git a/frontend/src/components/threads/ThreadsCategoryPicker.jsx b/frontend/src/components/threads/ThreadsCategoryPicker.jsx deleted file mode 100644 index c124284c69..0000000000 --- a/frontend/src/components/threads/ThreadsCategoryPicker.jsx +++ /dev/null @@ -1,62 +0,0 @@ -import React from "react" -import { Link } from "react-router" - -const ThreadsCategoryPicker = ({ - allItems, - parentUrl, - category, - categories, - list, -}) => ( -
    - -
      -
    • - {allItems} -
    • -
    • - {categories.map((choice) => ( -
    • - - - label - - {choice.name} - -
    • - ))} -
    -
    -) - -export default ThreadsCategoryPicker diff --git a/frontend/src/components/threads/ThreadsListPicker.jsx b/frontend/src/components/threads/ThreadsListPicker.jsx deleted file mode 100644 index 5c0a058c46..0000000000 --- a/frontend/src/components/threads/ThreadsListPicker.jsx +++ /dev/null @@ -1,25 +0,0 @@ -import React from "react" -import { Link } from "react-router" - -const ThreadsListPicker = ({ baseUrl, list, lists }) => ( -
    - -
      - {lists.map((choice) => ( -
    • - {choice.longName} -
    • - ))} -
    -
    -) - -export default ThreadsListPicker diff --git a/frontend/src/components/threads/ThreadsToolbar.jsx b/frontend/src/components/threads/ThreadsToolbar.jsx deleted file mode 100644 index 5d6941710e..0000000000 --- a/frontend/src/components/threads/ThreadsToolbar.jsx +++ /dev/null @@ -1,115 +0,0 @@ -import React from "react" -import posting from "../../services/posting" -import Button from "../button" -import { Toolbar, ToolbarItem, ToolbarSection, ToolbarSpacer } from "../Toolbar" -import ThreadsCategoryPicker from "./ThreadsCategoryPicker" -import ThreadsListPicker from "./ThreadsListPicker" -import ThreadsToolbarModeration from "./ThreadsToolbarModeration" - -const ThreadsToolbar = ({ - api, - baseUrl, - category, - categories, - categoriesMap, - topCategory, - topCategories, - subCategory, - subCategories, - list, - lists, - threads, - addThreads, - startThread, - freezeThread, - updateThread, - deleteThread, - selection, - moderation, - route, - user, - disabled, -}) => ( - - {topCategories.length > 0 && ( - - - - - {topCategory && subCategories.length > 0 && ( - - - - )} - - )} - {lists.length > 1 && ( - - - - - - )} - - {!!user.id && ( - - - - - {!!moderation.allow && ( - - selection.indexOf(thread.id) !== -1 - )} - addThreads={addThreads} - freezeThread={freezeThread} - updateThread={updateThread} - deleteThread={deleteThread} - selection={selection} - moderation={moderation} - route={route} - user={user} - disabled={disabled} - /> - - )} - - )} - -) - -export default ThreadsToolbar diff --git a/frontend/src/components/threads/ThreadsToolbarModeration.jsx b/frontend/src/components/threads/ThreadsToolbarModeration.jsx deleted file mode 100644 index f2f8b3e5f7..0000000000 --- a/frontend/src/components/threads/ThreadsToolbarModeration.jsx +++ /dev/null @@ -1,49 +0,0 @@ -import React from "react" -import ModerationControls from "./moderation/controls" - -const ThreadsToolbarModeration = ({ - api, - categoriesMap, - categories, - threads, - addThreads, - freezeThread, - updateThread, - deleteThread, - selection, - moderation, - route, - user, - disabled, -}) => ( -
    - - -
    -) - -export default ThreadsToolbarModeration diff --git a/frontend/src/components/threads/compare.js b/frontend/src/components/threads/compare.js deleted file mode 100644 index 7fae42e40c..0000000000 --- a/frontend/src/components/threads/compare.js +++ /dev/null @@ -1,29 +0,0 @@ -export function compareLastPostAge(a, b) { - if (a.last_post > b.last_post) { - return -1 - } else if (a.last_post < b.last_post) { - return 1 - } else { - return 0 - } -} - -export function compareGlobalWeight(a, b) { - if (a.weight === 2 && a.weight > b.weight) { - return -1 - } else if (b.weight === 2 && a.weight < b.weight) { - return 1 - } else { - return compareLastPostAge(a, b) - } -} - -export function compareWeight(a, b) { - if (a.weight > b.weight) { - return -1 - } else if (a.weight < b.weight) { - return 1 - } else { - return compareLastPostAge(a, b) - } -} diff --git a/frontend/src/components/threads/container.js b/frontend/src/components/threads/container.js deleted file mode 100644 index d9a3a47b5a..0000000000 --- a/frontend/src/components/threads/container.js +++ /dev/null @@ -1,56 +0,0 @@ -import React from "react" -import PageContainer from "../PageContainer" -import ThreadsToolbar from "./ThreadsToolbar" - -export default class extends React.Component { - render() { - const { root } = this.props - const { category, categories, categoriesMap } = this.props.route - const topCategory = getTopCategory(root, category, categoriesMap) - - return ( - - cat.parent === root.id)} - subCategories={ - !!topCategory - ? categories.filter((cat) => cat.parent === topCategory.id) - : [] - } - subCategory={category.level === 2 ? category : null} - subcategories={this.props.subcategories} - list={this.props.route.list} - lists={this.props.route.lists} - threads={this.props.threads} - addThreads={this.props.addThreads} - startThread={this.props.startThread} - freezeThread={this.props.freezeThread} - deleteThread={this.props.deleteThread} - updateThread={this.props.updateThread} - selection={this.props.selection} - moderation={this.props.moderation} - route={this.props.route} - user={this.props.user} - disabled={ - !this.props.isLoaded || - this.props.isBusy || - this.props.busyThreads.length - } - /> - {this.props.children} - - ) - } -} - -const getTopCategory = (root, category, categoriesMap) => { - if (!category.parent) return null - if (category.parent === root.id) return category - return categoriesMap[category.parent] -} diff --git a/frontend/src/components/threads/moderation/controls.js b/frontend/src/components/threads/moderation/controls.js deleted file mode 100644 index 2af7952379..0000000000 --- a/frontend/src/components/threads/moderation/controls.js +++ /dev/null @@ -1,454 +0,0 @@ -import React from "react" -import ErrorsModal from "misago/components/threads/moderation/errors-list" -import MergeThreads from "misago/components/threads/moderation/merge" -import MoveThreads from "misago/components/threads/moderation/move" -import * as select from "misago/reducers/selection" -import ajax from "misago/services/ajax" -import modal from "misago/services/modal" -import snackbar from "misago/services/snackbar" -import store from "misago/services/store" - -export default class extends React.Component { - callApi = (ops, successMessage, onSuccess = null) => { - // freeze threads - this.props.threads.forEach((thread) => { - this.props.freezeThread(thread.id) - }) - - // list ids - const ids = this.props.threads.map((thread) => { - return thread.id - }) - - // always return current acl - ops.push({ op: "add", path: "acl", value: true }) - - ajax.patch(this.props.api, { ids, ops }).then( - (data) => { - // unfreeze - this.props.threads.forEach((thread) => { - this.props.freezeThread(thread.id) - }) - - // update threads - data.forEach((thread) => { - this.props.updateThread(thread) - }) - - // show success message and call callback - snackbar.success(successMessage) - if (onSuccess) { - onSuccess() - } - }, - (rejection) => { - // unfreeze - this.props.threads.forEach((thread) => { - this.props.freezeThread(thread.id) - }) - - // escape on non-400 error - if (rejection.status !== 400) { - return snackbar.apiError(rejection) - } - - // build errors list - let errors = [] - let threadsMap = {} - - this.props.threads.forEach((thread) => { - threadsMap[thread.id] = thread - }) - - rejection.forEach(({ id, detail }) => { - if (typeof threadsMap[id] !== "undefined") { - errors.push({ - errors: detail, - thread: threadsMap[id], - }) - } - }) - - modal.show() - } - ) - } - - pinGlobally = () => { - this.callApi( - [ - { - op: "replace", - path: "weight", - value: 2, - }, - ], - pgettext("threads moderation", "Selected threads were pinned globally.") - ) - } - - pinLocally = () => { - this.callApi( - [ - { - op: "replace", - path: "weight", - value: 1, - }, - ], - pgettext( - "threads moderation", - "Selected threads were pinned in category." - ) - ) - } - - unpin = () => { - this.callApi( - [ - { - op: "replace", - path: "weight", - value: 0, - }, - ], - pgettext("threads moderation", "Selected threads were unpinned.") - ) - } - - approve = () => { - this.callApi( - [ - { - op: "replace", - path: "is-unapproved", - value: false, - }, - ], - pgettext("threads moderation", "Selected threads were approved.") - ) - } - - open = () => { - this.callApi( - [ - { - op: "replace", - path: "is-closed", - value: false, - }, - ], - pgettext("threads moderation", "Selected threads were opened.") - ) - } - - close = () => { - this.callApi( - [ - { - op: "replace", - path: "is-closed", - value: true, - }, - ], - pgettext("threads moderation", "Selected threads were closed.") - ) - } - - unhide = () => { - this.callApi( - [ - { - op: "replace", - path: "is-hidden", - value: false, - }, - ], - pgettext("threads moderation", "Selected threads were unhidden.") - ) - } - - hide = () => { - this.callApi( - [ - { - op: "replace", - path: "is-hidden", - value: true, - }, - ], - pgettext("threads moderation", "Selected threads were hidden.") - ) - } - - move = () => { - modal.show( - - ) - } - - merge = () => { - const errors = [] - this.props.threads.forEach((thread) => { - if (!thread.acl.can_merge) { - errors.append({ - id: thread.id, - title: thread.title, - errors: [ - pgettext( - "threads moderation", - "You don't have permission to merge this thread with others." - ), - ], - }) - } - }) - - if (this.props.threads.length < 2) { - snackbar.info( - pgettext( - "threads moderation", - "You have to select at least two threads to merge." - ) - ) - } else if (errors.length) { - modal.show() - return - } else { - modal.show() - } - } - - delete = () => { - if ( - !window.confirm( - pgettext( - "threads moderation", - "Are you sure you want to delete selected threads?" - ) - ) - ) { - return - } - - this.props.threads.map((thread) => { - this.props.freezeThread(thread.id) - }) - - const ids = this.props.threads.map((thread) => { - return thread.id - }) - - ajax.delete(this.props.api, ids).then( - () => { - this.props.threads.map((thread) => { - this.props.freezeThread(thread.id) - this.props.deleteThread(thread) - }) - - snackbar.success( - pgettext("threads moderation", "Selected threads were deleted.") - ) - }, - (rejection) => { - if (rejection.status === 400) { - const failedThreads = rejection.map((thread) => { - return thread.id - }) - - this.props.threads.map((thread) => { - this.props.freezeThread(thread.id) - if (failedThreads.indexOf(thread.id) === -1) { - this.props.deleteThread(thread) - } - }) - - modal.show() - } else { - snackbar.apiError(rejection) - } - } - ) - } - - render() { - const { moderation, threads } = this.props - const noSelection = this.props.selection.length == 0 - - return ( -
      -
    • - -
    • -
    • - -
    • -
    • - {!!moderation.can_pin_globally && ( -
    • - -
    • - )} - {!!moderation.can_pin && ( -
    • - -
    • - )} - {!!moderation.can_pin && ( -
    • - -
    • - )} - {!!moderation.can_move && ( -
    • - -
    • - )} - {!!moderation.can_merge && ( -
    • - -
    • - )} - {!!moderation.can_approve && ( -
    • - -
    • - )} - {!!moderation.can_close && ( -
    • - -
    • - )} - {!!moderation.can_close && ( -
    • - -
    • - )} - {!!moderation.can_unhide && ( -
    • - -
    • - )} - {!!moderation.can_hide && ( -
    • - -
    • - )} - {!!moderation.can_delete && ( -
    • - -
    • - )} -
    - ) - } -} diff --git a/frontend/src/components/threads/moderation/errors-list.js b/frontend/src/components/threads/moderation/errors-list.js deleted file mode 100644 index 99832621ed..0000000000 --- a/frontend/src/components/threads/moderation/errors-list.js +++ /dev/null @@ -1,56 +0,0 @@ -import React from "react" - -export default class extends React.Component { - render() { - return ( -
    -
    -
    - -

    - {pgettext("threads moderation title", "Threads moderation")} -

    -
    -
    -

    - {pgettext( - "threads moderation", - "One or more threads could not be deleted:" - )} -

    - -
      - {this.props.errors.map((item) => { - return ( - - ) - })} -
    -
    -
    -
    - ) - } -} - -export function ThreadErrors({ errors, thread }) { - return ( -
  • -
    {thread.title}
    - {errors.map((message, i) => { - return

    {message}

    - })} -
  • - ) -} diff --git a/frontend/src/components/threads/moderation/merge.js b/frontend/src/components/threads/moderation/merge.js deleted file mode 100644 index dc13256d62..0000000000 --- a/frontend/src/components/threads/moderation/merge.js +++ /dev/null @@ -1,396 +0,0 @@ -import React from "react" -import Button from "misago/components/button" -import Form from "misago/components/form" -import FormGroup from "misago/components/form-group" -import CategorySelect from "misago/components/category-select" -import Select from "misago/components/select" -import misago from "misago/index" -import { filterThreads } from "misago/reducers/threads" -import * as select from "misago/reducers/selection" -import ErrorsModal from "misago/components/threads/moderation/errors-list" -import MergeConflict from "misago/components/merge-conflict" -import ajax from "misago/services/ajax" -import modal from "misago/services/modal" -import snackbar from "misago/services/snackbar" -import store from "misago/services/store" -import * as validators from "misago/utils/validators" - -export default class extends Form { - constructor(props) { - super(props) - - this.state = { - isLoading: false, - - title: "", - category: null, - weight: 0, - is_hidden: 0, - is_closed: false, - - validators: { - title: [validators.required()], - }, - - errors: {}, - } - - this.acl = {} - for (const i in props.user.acl.categories) { - if (!props.user.acl.categories.hasOwnProperty(i)) { - continue - } - - const acl = props.user.acl.categories[i] - this.acl[acl.id] = acl - } - - this.categoryChoices = [] - props.categories.forEach((category) => { - if (category.level > 0) { - const acl = this.acl[category.id] - const disabled = - !acl.can_start_threads || - (category.is_closed && !acl.can_close_threads) - - this.categoryChoices.push({ - value: category.id, - disabled: disabled, - level: category.level - 1, - label: category.name, - }) - - if (!disabled && !this.state.category) { - this.state.category = category.id - } - } - }) - - this.isHiddenChoices = [ - { - value: 0, - icon: "visibility", - label: pgettext("thread hidden switch choice", "No"), - }, - { - value: 1, - icon: "visibility_off", - label: pgettext("thread hidden switch choice", "Yes"), - }, - ] - - this.isClosedChoices = [ - { - value: false, - icon: "lock_outline", - label: pgettext("thread closed switch choice", "No"), - }, - { - value: true, - icon: "lock", - label: pgettext("thread closed switch choice", "Yes"), - }, - ] - } - - clean() { - if (this.isValid()) { - return true - } else { - snackbar.error(gettext("Form contains errors.")) - this.setState({ - errors: this.validate(), - }) - return false - } - } - - send() { - return ajax.post(misago.get("MERGE_THREADS_API"), this.getFormdata()) - } - - getFormdata = () => { - return { - threads: this.props.threads.map((thread) => thread.id), - title: this.state.title, - category: this.state.category, - weight: this.state.weight, - is_hidden: this.state.is_hidden, - is_closed: this.state.is_closed, - } - } - - handleSuccess = (apiResponse) => { - // unfreeze and remove merged threads - this.props.threads.forEach((thread) => { - this.props.freezeThread(thread.id) - this.props.deleteThread(thread) - }) - - // deselect all threads - store.dispatch(select.none()) - - // append merged thread, filter threads - this.props.addThreads([apiResponse]) - store.dispatch( - filterThreads(this.props.route.category, this.props.categoriesMap) - ) - - // hide modal - modal.hide() - } - - handleError = (rejection) => { - if (rejection.status === 400) { - if (rejection.best_answers || rejection.polls) { - modal.show( - - ) - } else { - this.setState({ - errors: Object.assign({}, this.state.errors, rejection), - }) - snackbar.error(gettext("Form contains errors.")) - } - } else if (rejection.status === 403 && Array.isArray(rejection)) { - modal.show() - } else if (rejection.best_answer) { - snackbar.error(rejection.best_answer[0]) - } else if (rejection.poll) { - snackbar.error(rejection.poll[0]) - } else { - snackbar.apiError(rejection) - } - } - - onCategoryChange = (ev) => { - const categoryId = ev.target.value - const newState = { - category: categoryId, - } - - if (this.acl[categoryId].can_pin_threads < newState.weight) { - newState.weight = 0 - } - - if (!this.acl[categoryId].can_hide_threads) { - newState.is_hidden = 0 - } - - if (!this.acl[categoryId].can_close_threads) { - newState.is_closed = false - } - - this.setState(newState) - } - - getWeightChoices() { - const choices = [ - { - value: 0, - icon: "remove", - label: pgettext("thread weight choice", "Not pinned"), - }, - { - value: 1, - icon: "bookmark_border", - label: pgettext("thread weight choice", "Pinned in category"), - }, - ] - - if (this.acl[this.state.category].can_pin_threads == 2) { - choices.push({ - value: 2, - icon: "bookmark", - label: pgettext("thread weight choice", "Pinned globally"), - }) - } - - return choices - } - - renderWeightField() { - if (this.acl[this.state.category].can_pin_threads) { - return ( - - - - ) - } else { - return null - } - } - - renderClosedField() { - if (this.acl[this.state.category].can_close_threads) { - return ( - - - -
    - - - - -
    - - {this.renderWeightField()} - {this.renderHiddenField()} - {this.renderClosedField()} -
    -
    - - -
    - - ) - } - - renderCantMergeMessage() { - return ( -
    -
    - info_outline -
    -
    -

    - {pgettext( - "threads moderation merge", - "You can't merge threads because there are no categories you are allowed to move them to." - )} -

    -

    - {pgettext( - "threads moderation merge", - "You need permission to start threads in category to be able to merge threads to it." - )} -

    - -
    -
    - ) - } - - getClassName() { - if (!this.state.category) { - return "modal-dialog modal-message" - } else { - return "modal-dialog" - } - } - - render() { - return ( -
    -
    -
    - -

    - {pgettext("threads moderation merge title", "Merge threads")} -

    -
    - {this.state.category - ? this.renderForm() - : this.renderCantMergeMessage()} -
    -
    - ) - } -} diff --git a/frontend/src/components/threads/moderation/move.js b/frontend/src/components/threads/moderation/move.js deleted file mode 100644 index e5c773bb69..0000000000 --- a/frontend/src/components/threads/moderation/move.js +++ /dev/null @@ -1,180 +0,0 @@ -import React from "react" -import Form from "misago/components/form" -import FormGroup from "misago/components/form-group" -import CategorySelect from "misago/components/category-select" -import * as select from "misago/reducers/selection" -import { filterThreads } from "misago/reducers/threads" -import modal from "misago/services/modal" -import store from "misago/services/store" - -export default class extends Form { - constructor(props) { - super(props) - - this.state = { - category: null, - } - - const acls = {} - for (const i in props.user.acl.categories) { - if (!props.user.acl.categories.hasOwnProperty(i)) { - continue - } - - const acl = props.user.acl.categories[i] - acls[acl.id] = acl - } - - this.categoryChoices = [] - props.categories.forEach((category) => { - if (category.level > 0) { - const acl = acls[category.id] - const disabled = - !acl.can_start_threads || - (category.is_closed && !acl.can_close_threads) - - this.categoryChoices.push({ - value: category.id, - disabled: disabled, - level: category.level - 1, - label: category.name, - }) - - if (!disabled && !this.state.category) { - this.state.category = category.id - } - } - }) - } - - handleSubmit = (event) => { - // we don't reload page on submissions - event.preventDefault() - - modal.hide() - - const onSuccess = () => { - store.dispatch( - filterThreads(this.props.route.category, this.props.categoriesMap) - ) - - // deselect threads moved outside of visible scope - const storeState = store.getState() - const leftThreads = storeState.threads.map((thread) => thread.id) - store.dispatch( - select.all( - storeState.selection.filter((thread) => { - return leftThreads.indexOf(thread) !== -1 - }) - ) - ) - } - - this.props.callApi( - [ - { op: "replace", path: "category", value: this.state.category }, - { op: "replace", path: "flatten-categories", value: null }, - { op: "add", path: "acl", value: true }, - ], - pgettext("threads moderation move", "Selected threads were moved."), - onSuccess - ) - } - - getClassName() { - if (!this.state.category) { - return "modal-dialog modal-message" - } else { - return "modal-dialog" - } - } - - renderForm() { - return ( -
    -
    - - - -
    -
    - - -
    -
    - ) - } - - renderCantMoveMessage() { - return ( -
    -
    - info_outline -
    -
    -

    - {pgettext( - "threads moderation move", - "You can't move threads because there are no categories you are allowed to move them to." - )} -

    -

    - {pgettext( - "threads moderation move", - "You need permission to start threads in category to be able to move threads to it." - )} -

    - -
    -
    - ) - } - - render() { - return ( -
    -
    -
    - -

    - {pgettext("threads moderation move title", "Move threads")} -

    -
    - {this.state.category - ? this.renderForm() - : this.renderCantMoveMessage()} -
    -
    - ) - } -} diff --git a/frontend/src/components/threads/root.js b/frontend/src/components/threads/root.js deleted file mode 100644 index b54488828f..0000000000 --- a/frontend/src/components/threads/root.js +++ /dev/null @@ -1,90 +0,0 @@ -import { connect } from "react-redux" -import Route from "misago/components/threads/route" -import misago from "misago/index" - -export function getSelect(options) { - return function (store) { - return { - options: options, - selection: store.selection, - threads: store.threads, - tick: store.tick.tick, - user: store.auth.user, - } - } -} - -export function getLists(user) { - let lists = [ - { - type: "all", - path: "", - name: pgettext("threads list", "All"), - longName: gettext("All threads"), - }, - ] - - if (user.id) { - lists.push({ - type: "my", - path: "my/", - name: pgettext("threads list", "My"), - longName: pgettext("threads list", "My threads"), - }) - lists.push({ - type: "new", - path: "new/", - name: pgettext("threads list", "New"), - longName: pgettext("threads list", "New threads"), - }) - lists.push({ - type: "unread", - path: "unread/", - name: pgettext("threads list", "Unread"), - longName: pgettext("threads list", "Unread threads"), - }) - lists.push({ - type: "watched", - path: "watched/", - name: pgettext("threads list", "Watched"), - longName: pgettext("threads list", "Watched threads"), - }) - - if (user.acl.can_see_unapproved_content_lists) { - lists.push({ - type: "unapproved", - path: "unapproved/", - name: pgettext("threads list", "Unapproved"), - longName: pgettext("threads list", "Unapproved content"), - }) - } - } - - return lists -} - -export function paths(user, mode) { - let lists = getLists(user) - let routes = [] - let categoriesMap = {} - - misago.get("CATEGORIES").forEach(function (category) { - lists.forEach(function (list) { - categoriesMap[category.id] = category - - routes.push({ - path: category.url.index + list.path, - component: connect(getSelect(mode))(Route), - - categories: misago.get("CATEGORIES"), - categoriesMap, - category, - - lists, - list, - }) - }) - }) - - return routes -} diff --git a/frontend/src/components/threads/route.js b/frontend/src/components/threads/route.js deleted file mode 100644 index ace71df595..0000000000 --- a/frontend/src/components/threads/route.js +++ /dev/null @@ -1,369 +0,0 @@ -import React from "react" -import Button from "misago/components/button" -import { - compareGlobalWeight, - compareWeight, -} from "misago/components/threads/compare" -import Container from "misago/components/threads/container" -import { - diffThreads, - getModerationActions, - getPageTitle, - getTitle, -} from "misago/components/threads/utils" -import ThreadsList from "misago/components/ThreadsList" -import WithDropdown from "misago/components/with-dropdown" -import misago from "misago/index" -import * as select from "misago/reducers/selection" -import { append, deleteThread, hydrate, patch } from "misago/reducers/threads" -import ajax from "misago/services/ajax" -import polls from "misago/services/polls" -import snackbar from "misago/services/snackbar" -import store from "misago/services/store" -import title from "misago/services/page-title" -import * as sets from "misago/utils/sets" -import { - PageHeaderHTMLMessage, - PageHeaderMessage, - PageHeaderPlain, -} from "../PageHeader" - -export default class extends WithDropdown { - constructor(props) { - super(props) - - this.state = { - isMounted: true, - - isLoaded: false, - isBusy: false, - - diff: { - results: [], - }, - - moderation: [], - busyThreads: [], - - dropdown: false, - subcategories: [], - - next: 0, - } - - let category = this.getCategory() - - if (misago.has("THREADS")) { - this.initWithPreloadedData(category, misago.get("THREADS")) - } else { - this.initWithoutPreloadedData(category) - } - } - - getCategory() { - if (!this.props.route.category.special_role) { - return this.props.route.category.id - } else { - return null - } - } - - initWithPreloadedData(category, data) { - this.state = Object.assign(this.state, { - moderation: getModerationActions(data.results), - subcategories: data.subcategories, - next: data.next, - }) - - this.startPolling(category) - } - - initWithoutPreloadedData(category) { - this.loadThreads(category) - } - - loadThreads(category, next = 0) { - ajax - .get( - this.props.options.api, - { - category: category, - list: this.props.route.list.type, - start: next || 0, - }, - "threads" - ) - .then( - (data) => { - if (!this.state.isMounted) { - // user changed route before loading completion - return - } - - if (next === 0) { - store.dispatch(hydrate(data.results)) - } else { - store.dispatch(append(data.results, this.getSorting())) - } - - this.setState({ - isLoaded: true, - isBusy: false, - - moderation: getModerationActions(store.getState().threads), - - subcategories: data.subcategories, - - next: data.next, - }) - - this.startPolling(category) - }, - (rejection) => { - snackbar.apiError(rejection) - } - ) - } - - startPolling(category) { - polls.start({ - poll: "threads", - url: this.props.options.api, - data: { - category: category, - list: this.props.route.list.type, - }, - frequency: 120 * 1000, - update: this.pollResponse, - }) - } - - componentDidMount() { - this.setPageTitle() - - if (misago.has("THREADS")) { - // unlike in other components, routes are root components for threads - // so we can't dispatch store action from constructor - store.dispatch(hydrate(misago.pop("THREADS").results)) - - this.setState({ - isLoaded: true, - }) - } - - store.dispatch(select.none()) - } - - componentWillUnmount() { - this.state.isMounted = false - polls.stop("threads") - } - - getTitle() { - if (this.props.options.title) { - return this.props.options.title - } - - return getTitle(this.props.route) - } - - setPageTitle() { - if (this.props.route.category.level || !misago.get("THREADS_ON_INDEX")) { - title.set(getPageTitle(this.props.route)) - } else if (this.props.options.title) { - title.set(this.props.options.title) - } else { - if (misago.get("SETTINGS").index_title) { - document.title = misago.get("SETTINGS").index_title - } else { - document.title = misago.get("SETTINGS").forum_name - } - } - } - - getSorting() { - if (this.props.route.category.level) { - return compareWeight - } else { - return compareGlobalWeight - } - } - - // AJAX - - loadMore = () => { - this.setState({ - isBusy: true, - }) - - this.loadThreads(this.getCategory(), this.state.next) - } - - pollResponse = (data) => { - this.setState({ - diff: Object.assign({}, data, { - results: diffThreads(this.props.threads, data.results), - }), - }) - } - - addThreads = (threads) => { - store.dispatch(append(threads, this.getSorting())) - } - - applyDiff = () => { - this.addThreads(this.state.diff.results) - - this.setState( - Object.assign({}, this.state.diff, { - moderation: getModerationActions(store.getState().threads), - - diff: { - results: [], - }, - }) - ) - } - - // Thread state utils - - freezeThread = (thread) => { - this.setState(function (currentState) { - return { - busyThreads: sets.toggle(currentState.busyThreads, thread), - } - }) - } - - updateThread = (thread) => { - store.dispatch(patch(thread, thread, this.getSorting())) - } - - deleteThread = (thread) => { - store.dispatch(deleteThread(thread)) - } - - getMoreButton() { - if (!this.state.next) return null - - return ( -
    - -
    - ) - } - - getClassName() { - let className = "page page-threads" - className += " page-threads-" + this.props.route.list.type - if (isIndex(this.props)) { - className += " page-threads-index" - } - if (this.props.route.category.css_class) { - className += " page-threads-" + this.props.route.category.css_class - } - return className - } - - render() { - const root = this.props.route.categories[0] - const { category, list } = this.props.route - const specialRole = category.special_role - - return ( -
    - {specialRole == "root_category" && - misago.get("THREADS_ON_INDEX") && - misago.get("SETTINGS").index_header && ( - - ) - } - styleName="forum-index" - /> - )} - {specialRole == "root_category" && !misago.get("THREADS_ON_INDEX") && ( - - )} - {specialRole == "private_threads" && ( - -

    {this.props.options.pageLead}

    - - ) - } - styleName="private-threads" - /> - )} - {!specialRole && ( - - ) - } - styleName={category.css_class || "category-threads"} - /> - )} - - - {this.getMoreButton()} - -
    - ) - } -} - -function isIndex(props) { - if (props.route.category.level || !misago.get("THREADS_ON_INDEX")) - return false - if (props.options.title) return false - - return true -} diff --git a/frontend/src/components/threads/utils.js b/frontend/src/components/threads/utils.js deleted file mode 100644 index b805ff83f9..0000000000 --- a/frontend/src/components/threads/utils.js +++ /dev/null @@ -1,146 +0,0 @@ -import misago from "misago/index" - -export function getPageTitle(route) { - if (route.category.level) { - if (route.list.path) { - return { - title: route.list.longName, - parent: route.category.name, - } - } else { - return { - title: route.category.name, - } - } - } else if (misago.get("THREADS_ON_INDEX")) { - if (route.list.path) { - return { - title: route.list.longName, - } - } else { - return null - } - } else { - if (route.list.path) { - return { - title: route.list.longName, - parent: pgettext("threads list title", "Threads"), - } - } else { - return { - title: pgettext("threads list title", "Threads"), - } - } - } -} - -export function getTitle(route) { - if (route.category.level) { - return route.category.name - } else if (misago.get("THREADS_ON_INDEX")) { - if (misago.get("SETTINGS").index_header) { - return misago.get("SETTINGS").index_header - } else { - return misago.get("SETTINGS").forum_name - } - } else { - return pgettext("threads list title", "Threads") - } -} - -export function isThreadChanged(current, fromDb) { - return ( - [ - current.title === fromDb.title, - current.weight === fromDb.weight, - current.category === fromDb.category, - current.last_post === fromDb.last_post, - current.last_poster_name === fromDb.last_poster_name, - ].indexOf(false) >= 0 - ) -} - -export function diffThreads(current, fromDb) { - let currentMap = {} - current.forEach(function (thread) { - currentMap[thread.id] = thread - }) - - return fromDb.filter(function (thread) { - if (currentMap[thread.id]) { - return isThreadChanged(currentMap[thread.id], thread) - } else { - return true - } - }) -} - -export function getModerationActions(threads) { - let moderation = { - allow: false, - - can_approve: 0, - can_close: 0, - can_delete: 0, - can_hide: 0, - can_merge: 0, - can_move: 0, - can_pin: 0, - can_pin_globally: 0, - can_unhide: 0, - } - - threads.forEach(function (thread) { - if ( - thread.is_unapproved && - thread.acl.can_approve > moderation.can_approve - ) { - moderation.can_approve = thread.acl.can_approve - } - - if (thread.acl.can_close > moderation.can_close) { - moderation.can_close = thread.acl.can_close - } - - if (thread.acl.can_delete > moderation.can_delete) { - moderation.can_delete = thread.acl.can_delete - } - - if (thread.acl.can_hide > moderation.can_hide) { - moderation.can_hide = thread.acl.can_hide - } - - if (thread.acl.can_merge > moderation.can_merge) { - moderation.can_merge = thread.acl.can_merge - } - - if (thread.acl.can_move > moderation.can_move) { - moderation.can_move = thread.acl.can_move - } - - if (thread.acl.can_pin > moderation.can_pin) { - moderation.can_pin = thread.acl.can_pin - } - - if (thread.acl.can_pin_globally > moderation.can_pin_globally) { - moderation.can_pin_globally = thread.acl.can_pin_globally - } - - if (thread.is_hidden && thread.acl.can_unhide > moderation.can_unhide) { - moderation.can_unhide = thread.acl.can_unhide - } - - moderation.allow = - moderation.can_approve || - moderation.can_close || - moderation.can_delete || - moderation.can_hide || - moderation.can_merge || - moderation.can_move || - moderation.can_pin || - moderation.can_pin_globally || - moderation.can_unhide - }) - - return moderation -} diff --git a/frontend/src/initializers/components/threads.js b/frontend/src/initializers/components/threads.js deleted file mode 100644 index 0cf908ad10..0000000000 --- a/frontend/src/initializers/components/threads.js +++ /dev/null @@ -1,47 +0,0 @@ -import { paths } from "misago/components/threads/root" -import misago from "misago/index" -import mount from "misago/utils/routed-component" - -const PRIVATE_THREADS_LIST = "misago:private-threads" - -export default function initializer(context) { - if (context.has("THREADS") && context.has("CATEGORIES")) { - mount({ - paths: paths(context.get("user"), getListOptions(context)), - }) - } -} - -export function getListOptions(context) { - const currentLink = context.get("CURRENT_LINK") - if ( - currentLink.substr(0, PRIVATE_THREADS_LIST.length) === PRIVATE_THREADS_LIST - ) { - return { - api: context.get("PRIVATE_THREADS_API"), - startThread: { - mode: "START_PRIVATE", - submit: misago.get("PRIVATE_THREADS_API"), - }, - title: pgettext("private threads title", "Private threads"), - pageLead: pgettext( - "private threads list", - "Private threads are threads which only those that started them and those they have invited may see and participate in." - ), - emptyMessage: pgettext( - "private threads list empty", - "You aren't participating in any private threads." - ), - } - } - - return { - api: context.get("THREADS_API"), - } -} - -misago.addInitializer({ - name: "component:threads", - initializer: initializer, - after: "store", -}) diff --git a/misago/static/misago/js/misago.js b/misago/static/misago/js/misago.js index ad7789d127..c20d9f2454 100644 --- a/misago/static/misago/js/misago.js +++ b/misago/static/misago/js/misago.js @@ -1,2 +1,2 @@ -(()=>{var e,t,a,n={60642:(e,t,a)=>{"use strict";a.d(t,{b:()=>v,D:()=>f});var n=a(15861),i=a(15671),s=a(43144),o=a(97326),r=a(79340),l=a(6215),c=a(61120),u=a(4942),d=a(64687),p=a.n(d),h=a(57588),m=a.n(h);var v=function(e){(0,r.Z)(h,e);var t,a,d=(t=h,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function h(e){var t;return(0,i.Z)(this,h),t=d.call(this,e),(0,u.Z)((0,o.Z)(t),"hasCache",(function(e){return t.props.cache&&t.props.cache[e]})),(0,u.Z)((0,o.Z)(t),"getCache",function(){var e=(0,n.Z)(p().mark((function e(a){var n;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.props.cache[a],t.setState({loading:!1,error:null,data:n}),!t.props.onData){e.next=5;break}return e.next=5,t.props.onData(n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),(0,u.Z)((0,o.Z)(t),"setCache",(function(e,a){t.props.cache&&(t.props.cache[e]=a)})),(0,u.Z)((0,o.Z)(t),"request",(function(e){t.setState({loading:!0}),fetch(e,{method:"GET",credentials:"include",signal:t.signal}).then(function(){var a=(0,n.Z)(p().mark((function a(n){var i,s;return p().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(e!==t.props.url){a.next=18;break}if(200!=n.status){a.next=12;break}return a.next=4,n.json();case 4:if(i=a.sent,t.setState({loading:!1,error:null,data:i}),t.setCache(e,i),!t.props.onData){a.next=10;break}return a.next=10,t.props.onData(i);case 10:a.next=18;break;case 12:if(s={status:n.status},"application/json"!==n.headers.get("Content-Type")){a.next=17;break}return a.next=16,n.json();case 16:s.data=a.sent;case 17:t.setState({loading:!1,error:s});case 18:case"end":return a.stop()}}),a)})));return function(e){return a.apply(this,arguments)}}(),(function(a){e===t.props.url&&t.setState({loading:!1,error:{status:0,rejection:a}})}))})),(0,u.Z)((0,o.Z)(t),"refetch",(function(){t.request(t.props.url)})),(0,u.Z)((0,o.Z)(t),"update",(function(e){t.setState((function(t){return{data:e(t.data)}}))})),t.state={data:null,loading:!1,error:null},t.controller=new AbortController,t.signal=t.controller.signal,t}return(0,s.Z)(h,[{key:"componentDidMount",value:function(){this.props.url&&!this.props.disabled&&this.request(this.props.url)}},{key:"componentDidUpdate",value:function(e){var t=this.props.url,a=t&&t!==e.url,n=this.props.disabled!=e.disabled;(a||n)&&(this.props.disabled?this.controller.abort():this.hasCache(t)?this.getCache(t):(this.controller.abort(),this.controller=new AbortController,this.signal=this.controller.signal,this.request(t)))}},{key:"componentWillUnmount",value:function(){this.controller.abort()}},{key:"render",value:function(){return this.props.children(Object.assign({refetch:this.refetch,update:this.update},this.state))}}]),h}(m().Component);var f=function(e){(0,r.Z)(h,e);var t,a,d=(t=h,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function h(e){var t;return(0,i.Z)(this,h),t=d.call(this,e),(0,u.Z)((0,o.Z)(t),"mutate",(function(e){t.setState({loading:!0}),fetch(t.props.url,{method:t.props.method||"POST",credentials:"include",headers:Z(e),body:g(e)}).then(function(){var a=(0,n.Z)(p().mark((function a(n){var i,s;return p().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(200!=n.status){a.next=10;break}return a.next=3,n.json();case 3:if(i=a.sent,t.setState({loading:!1,data:i}),!e.onSuccess){a.next=8;break}return a.next=8,e.onSuccess(i);case 8:a.next=26;break;case 10:if(204!=n.status){a.next=17;break}if(t.setState({loading:!1}),!e.onSuccess){a.next=15;break}return a.next=15,e.onSuccess();case 15:a.next=26;break;case 17:if(s={status:n.status},"application/json"!==n.headers.get("Content-Type")){a.next=22;break}return a.next=21,n.json();case 21:s.data=a.sent;case 22:if(t.setState({loading:!1,error:s}),!e.onError){a.next=26;break}return a.next=26,e.onError(s);case 26:case"end":return a.stop()}}),a)})));return function(e){return a.apply(this,arguments)}}(),function(){var a=(0,n.Z)(p().mark((function a(n){var i;return p().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(i={status:0,rejection:n},t.setState({loading:!1,error:i}),!e.onError){a.next=5;break}return a.next=5,e.onError(i);case 5:case"end":return a.stop()}}),a)})));return function(e){return a.apply(this,arguments)}}())})),t.state={data:null,loading:!1,error:null},t}return(0,s.Z)(h,[{key:"render",value:function(){return this.props.children(this.mutate,this.state)}}]),h}(m().Component);function Z(e){return e.json?{"Content-Type":"application/json; charset=utf-8","X-CSRFToken":b()}:{"X-CSRFToken":b()}}function g(e){if(e.json)return JSON.stringify(e.json)}function b(){var e=window.misago_csrf;if(-1!==document.cookie.indexOf(e)){var t=new RegExp(e+"=([^;]*)"),a=document.cookie.match(t)[0];return a?a.split("=")[1]:null}return null}},49021:(e,t,a)=>{"use strict";a.d(t,{Lt:()=>m,YV:()=>Z,kE:()=>g,Aw:()=>b,Xi:()=>y,KE:()=>_,iC:()=>N});var n=a(15671),i=a(43144),s=a(97326),o=a(79340),r=a(6215),l=a(61120),c=a(4942),u=a(94184),d=a.n(u),p=a(57588),h=a.n(p);var m=function(e){(0,o.Z)(p,e);var t,a,u=(t=p,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,l.Z)(t);if(a){var i=(0,l.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,r.Z)(this,e)});function p(e){var t;return(0,n.Z)(this,p),t=u.call(this,e),(0,c.Z)((0,s.Z)(t),"handleClick",(function(e){t.state.isOpen&&(!t.root.contains(e.target)||t.menu.contains(e.target)&&e.target.closest("a"))&&t.setState({isOpen:!1})})),(0,c.Z)((0,s.Z)(t),"toggle",(function(){t.setState((function(e){return{isOpen:!e.isOpen}}))})),(0,c.Z)((0,s.Z)(t),"close",(function(){t.setState({isOpen:!1})})),t.state={isOpen:!1},t.root=null,t.dropdown=null,t}return(0,i.Z)(p,[{key:"componentDidMount",value:function(){window.addEventListener("click",this.handleClick)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("click",this.handleClick)}},{key:"componentDidUpdate",value:function(e,t){t.isOpen!==this.state.isOpen&&(this.state.isOpen&&this.props.onOpen&&this.props.onOpen(this.root),!this.state.isOpen&&this.props.onClose&&this.props.onClose(this.root))}},{key:"render",value:function(){var e=this,t=this.state.isOpen;return h().createElement("div",{id:this.props.id,className:d()("dropdown",{open:t},this.props.className),ref:function(t){t&&!e.element&&(e.root=t)}},this.props.toggle({isOpen:t,toggle:this.toggle,aria:v(t)}),h().createElement("div",{className:d()("dropdown-menu",{"dropdown-menu-right":this.props.menuAlignRight},this.props.menuClassName),ref:function(t){t&&!e.menu&&(e.menu=t)},role:"menu"},this.props.children({isOpen:t,close:this.close})))}}]),p}(h().Component);function v(e){return{"aria-haspopup":"true","aria-expanded":e?"true":"false"}}var f=a(22928);function Z(e){var t=e.className;return(0,f.Z)("li",{className:d()("divider",t)})}function g(e){var t=e.children;return e.listItem?(0,f.Z)("li",{className:"dropdown-footer"},void 0,t):(0,f.Z)("div",{className:"dropdown-footer"},void 0,t)}function b(e){var t=e.className,a=e.children;return(0,f.Z)("div",{className:d()("dropdown-header",t)},void 0,a)}function y(e){var t=e.className,a=e.children;return(0,f.Z)("li",{className:d()("dropdown-menu-item",t)},void 0,a)}function _(e){var t=e.className,a=e.children;return(0,f.Z)("div",{className:d()("dropdown-pills",t)},void 0,a)}function N(e){var t=e.className,a=e.children;return(0,f.Z)("li",{className:d()("dropdown-subheader",t)},void 0,a)}},98936:(e,t,a)=>{"use strict";a.d(t,{gq:()=>o,Z6:()=>r,kw:()=>l});var n=a(22928),i=a(94184),s=a.n(i);a(57588);const o=function(e){var t=e.children,a=e.className;return(0,n.Z)("div",{className:s()("flex-row",a)},void 0,t)},r=function(e){var t=e.children,a=e.className,i=e.shrink;return(0,n.Z)("div",{className:s()("flex-row-col",a,{"flex-row-col-shrink":i})},void 0,t)},l=function(e){var t=e.auto,a=e.children,i=e.className;return(0,n.Z)("div",{className:s()("flex-row-section",{"flex-row-section-auto":t},i)},void 0,a)}},66398:(e,t,a)=>{"use strict";a.d(t,{NX:()=>r,PB:()=>c,Zn:()=>u,WI:()=>l,WE:()=>d,j0:()=>p});var n,i=a(22928),s=a(94184),o=a.n(s);function r(e){var t=e.className,a=e.children;return(0,i.Z)("ul",{className:o()("list-group",t)},void 0,a)}function l(e){var t=e.className,a=e.children;return(0,i.Z)("li",{className:o()("list-group-item",t)},void 0,a)}function c(e){var t=e.className,a=e.icon,n=e.message;return(0,i.Z)(l,{className:o()("list-group-empty",t)},void 0,!!a&&(0,i.Z)("div",{className:"list-group-empty-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,a)),(0,i.Z)("p",{className:"list-group-empty-message"},void 0,n))}function u(e){var t=e.className,a=e.icon,n=e.message,s=e.detail;return(0,i.Z)(l,{className:o()("list-group-error",t)},void 0,!!a&&(0,i.Z)("div",{className:"list-group-error-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,a)),(0,i.Z)("p",{className:"list-group-error-message"},void 0,n),!!s&&(0,i.Z)("p",{className:"list-group-error-detail"},void 0,s))}function d(e){var t=e.className,a=e.message;return(0,i.Z)(l,{className:o()("list-group-loading",t)},void 0,(0,i.Z)("p",{className:"list-group-loading-message"},void 0,a),n||(n=(0,i.Z)("div",{className:"list-group-loading-progress"},void 0,(0,i.Z)("div",{className:"list-group-loading-progress-bar"}))))}function p(e){var t=e.className,a=e.icon,n=e.message,s=e.detail;return(0,i.Z)(l,{className:o()("list-group-message",t)},void 0,!!a&&(0,i.Z)("div",{className:"list-group-message-icon"},void 0,(0,i.Z)("span",{className:"material-icon"},void 0,a)),(0,i.Z)("p",{className:"list-group-message-message"},void 0,n),!!s&&(0,i.Z)("p",{className:"list-group-message-detail"},void 0,s))}a(57588)},4517:(e,t,a)=>{"use strict";a.d(t,{Z:()=>l});var n=a(22928),i=(a(57588),a(37424)),s=a(35486),o=a(60642);function r(e,t){var a=misago.get("NOTIFICATIONS_API")+"?limit=30";return a+="&filter="+e,t&&(t.after&&(a+="&after="+t.after),t.before&&(a+="&before="+t.before)),a}const l=(0,i.$j)((function(e){var t=e.auth;return t.user?{unreadNotifications:t.user.unreadNotifications}:{unreadNotifications:null}}))((function(e){var t=e.children,a=e.filter,i=e.query,l=e.dispatch,c=e.unreadNotifications,u=e.disabled;return(0,n.Z)(o.b,{url:r(a,i),disabled:u,onData:function(e){e.unreadNotifications!=c&&l((0,s.yH)({unreadNotifications:e.unreadNotifications}))}},void 0,(function(e){var a=e.data,n=e.loading,i=e.error,s=e.refetch;return t({data:a,loading:n,error:i,refetch:s})}))}))},63026:(e,t,a)=>{"use strict";a.d(t,{Z:()=>n});const n=a(4517).Z},66462:(e,t,a)=>{"use strict";a.d(t,{uE:()=>y,lb:()=>_,Pu:()=>N});var n=a(22928),i=(a(57588),a(66398));function s(e){var t=e.filter;return(0,n.Z)(i.PB,{icon:"unread"===t?"sentiment_very_satisfied":"notifications_none",message:o(t)})}function o(e){return"read"===e?pgettext("notifications list","You don't have any read notifications."):"unread"===e?pgettext("notifications list","You don't have any unread notifications."):pgettext("notifications list","You don't have any notifications.")}var r=a(94184),l=a.n(r);function c(e){var t=e.className,a=e.children;return(0,n.Z)("div",{className:l()("notifications-list",t)},void 0,(0,n.Z)(i.NX,{},void 0,a))}var u,d,p,h=a(19605);function m(e){var t=e.notification;return t.actor?(0,n.Z)("a",{href:t.actor.url,className:"notifications-list-item-actor",title:t.actor.username},void 0,(0,n.Z)(h.ZP,{size:30,user:t.actor})):(0,n.Z)("span",{className:"threads-list-item-last-poster",title:t.actor_name||null},void 0,u||(u=(0,n.Z)(h.ZP,{size:30})))}function v(e){var t=e.notification;return(0,n.Z)("a",{href:t.url,className:l()("notification-message",{"notification-message-read":t.isRead,"notification-message-unread":!t.isRead}),dangerouslySetInnerHTML:{__html:t.message}})}function f(e){return e.notification.isRead?(0,n.Z)("div",{className:"notifications-list-item-read-status",title:pgettext("notification status","Read notification")},void 0,d||(d=(0,n.Z)("span",{className:"notification-read-icon"}))):(0,n.Z)("div",{className:"notifications-list-item-read-status",title:pgettext("notification status","Unread notification")},void 0,p||(p=(0,n.Z)("span",{className:"notification-unread-icon"})))}var Z=a(16069);function g(e){var t=e.notification;return(0,n.Z)("div",{className:"notifications-list-item-timestamp"},void 0,(0,n.Z)(Z.Z,{datetime:t.createdAt}))}function b(e){var t=e.notification;return(0,n.Z)(i.WI,{className:l()("notifications-list-item",{"notifications-list-item-read":t.isRead,"notifications-list-item-unread":!t.isRead})},t.id,(0,n.Z)("div",{className:"notifications-list-item-left-col"},void 0,(0,n.Z)("div",{className:"notifications-list-item-col-actor"},void 0,(0,n.Z)(m,{notification:t})),(0,n.Z)("div",{className:"notifications-list-item-col-read-icon"},void 0,(0,n.Z)(f,{notification:t}))),(0,n.Z)("div",{className:"notifications-list-item-right-col"},void 0,(0,n.Z)("div",{className:"notifications-list-item-col-message"},void 0,(0,n.Z)(v,{notification:t})),(0,n.Z)("div",{className:"notifications-list-item-col-timestamp"},void 0,(0,n.Z)(g,{notification:t}))))}function y(e){var t=e.filter,a=e.items;return(0,n.Z)(c,{className:a.length>0?"notifications-list-ready":"notifications-list-pending"},void 0,0===a.length&&(0,n.Z)(s,{filter:t}),a.map((function(e){return(0,n.Z)(b,{notification:e},e.id)})))}function _(e){var t,a=0===(t=e.error).status?gettext("Check your internet connection and try refreshing the site."):t.data&&t.data.detail?t.data.detail:void 0;return(0,n.Z)(c,{className:"notifications-list-pending"},void 0,(0,n.Z)(i.Zn,{icon:"notifications_off",message:pgettext("notifications list","Notifications could not be loaded."),detail:a}))}function N(){return(0,n.Z)(c,{className:"notifications-list-pending"},void 0,(0,n.Z)(i.WE,{message:pgettext("notifications list","Loading notifications...")}))}},64836:(e,t,a)=>{"use strict";a.d(t,{a:()=>b,i:()=>_});var n=a(22928),i=a(15671),s=a(43144),o=a(97326),r=a(79340),l=a(6215),c=a(61120),u=a(4942),d=a(94184),p=a.n(d),h=a(57588),m=a.n(h),v=a(37424),f=a(993);var Z="has-overlay",g=function(e){(0,r.Z)(h,e);var t,a,d=(t=h,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function h(e){var t;return(0,i.Z)(this,h),t=d.call(this,e),(0,u.Z)((0,o.Z)(t),"closeOnNavigation",(function(e){e.target.closest("a")&&t.props.dispatch((0,f.xv)())})),t.scrollOrigin=null,t}return(0,s.Z)(h,[{key:"componentDidUpdate",value:function(e){e.open!==this.props.open&&(this.props.open?(this.scrollOrigin=window.pageYOffset,document.body.classList.add(Z),this.props.onOpen&&this.props.onOpen()):(document.body.classList.remove(Z),window.scrollTo(0,this.scrollOrigin),this.scrollOrigin=null))}},{key:"render",value:function(){return(0,n.Z)("div",{className:p()("overlay",this.props.className,{"overlay-open":this.props.open}),onClick:this.closeOnNavigation},void 0,this.props.children)}}]),h}(m().Component);const b=(0,v.$j)()(g);var y;const _=(0,v.$j)()((function(e){var t=e.children,a=e.dispatch;return(0,n.Z)("div",{className:"overlay-header"},void 0,(0,n.Z)("div",{className:"overlay-header-caption"},void 0,t),(0,n.Z)("button",{className:"btn btn-overlay-close",title:pgettext("modal","Close"),type:"button",onClick:function(){return a((0,f.xv)())}},void 0,y||(y=(0,n.Z)("span",{className:"material-icon"},void 0,"close"))))}))},59131:(e,t,a)=>{"use strict";a.d(t,{Z:()=>i});var n=a(22928);a(57588);const i=function(e){var t=e.children;return(0,n.Z)("div",{className:"container page-container"},void 0,t)}},99755:(e,t,a)=>{"use strict";a.d(t,{mr:()=>r,gC:()=>l,sP:()=>c,eA:()=>u,Ql:()=>d,bM:()=>p,Iv:()=>h});var n,i=a(22928),s=a(94184),o=a.n(s);a(57588);const r=function(e){var t=e.children,a=e.className,s=e.styleName;return(0,i.Z)("div",{className:o()("page-header",a,s&&"page-header-"+s)},void 0,(0,i.Z)("div",{className:"page-header-bg-image"},void 0,(0,i.Z)("div",{className:"page-header-bg-overlay"},void 0,n||(n=(0,i.Z)("div",{className:"page-header-image"})),t)))},l=function(e){var t=e.children,a=e.className,n=e.styleName;return(0,i.Z)("div",{className:o()("page-header-banner",a,n&&"page-header-banner-"+n)},void 0,(0,i.Z)("div",{className:"page-header-banner-bg-image"},void 0,(0,i.Z)("div",{className:"page-header-banner-bg-overlay"},void 0,t)))},c=function(e){var t=e.children;return(0,i.Z)("div",{className:"container page-header-container"},void 0,t)},u=function(e){var t=e.children,a=e.className;return(0,i.Z)("div",{className:o()("page-header-details",a)},void 0,t)},d=function(e){var t=e.className,a=e.message;return(0,i.Z)("div",{className:o()("page-header-message",t),dangerouslySetInnerHTML:{__html:a}})},p=function(e){var t=e.children,a=e.className;return(0,i.Z)("div",{className:o()("page-header-message",a)},void 0,t)},h=function(e){var t=e.styleName,a=e.header,n=e.message;return(0,i.Z)(c,{},void 0,(0,i.Z)(r,{styleName:t},void 0,(0,i.Z)(l,{styleName:t},void 0,(0,i.Z)("h1",{},void 0,a)),n&&(0,i.Z)(u,{styleName:t},void 0,n)))}},40689:(e,t,a)=>{"use strict";a.d(t,{Z:()=>F});var n=a(22928),i=a(15671),s=a(43144),o=a(97326),r=a(79340),l=a(6215),c=a(61120),u=a(4942),d=a(94184),p=a.n(d),h=a(57588),m=a.n(h),v=a(78657),f=a(93825),Z=a(59801),g=a(53904),b=a(37848),y=a(87462),_=a(82211),N=a(43345),k=a(96359),x=a(59940);var w,C,R,E=["progress-bar-danger","progress-bar-warning","progress-bar-warning","progress-bar-primary","progress-bar-success"],S=[pgettext("password strength indicator","Entered password is very weak."),pgettext("password strength indicator","Entered password is weak."),pgettext("password strength indicator","Entered password is average."),pgettext("password strength indicator","Entered password is strong."),pgettext("password strength indicator","Entered password is very strong.")],O=function(e){(0,r.Z)(u,e);var t,a,o=(t=u,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function u(e){var t;return(0,i.Z)(this,u),(t=o.call(this,e))._score=0,t._password=null,t._inputs=[],t.state={loaded:!1},t}return(0,s.Z)(u,[{key:"componentDidMount",value:function(){var e=this;x.Z.load().then((function(){e.setState({loaded:!0})}))}},{key:"getScore",value:function(e,t){var a=this,n=!1;return e!==this._password&&(n=!0),t.length!==this._inputs.length?n=!0:t.map((function(e,t){e.trim()!==a._inputs[t]&&(n=!0)})),n&&(this._score=x.Z.scorePassword(e,t),this._password=e,this._inputs=t.map((function(e){return e.trim()}))),this._score}},{key:"render",value:function(){if(!this.state.loaded)return null;var e=this.getScore(this.props.password,this.props.inputs);return(0,n.Z)("div",{className:"help-block password-strength"},void 0,(0,n.Z)("div",{className:"progress"},void 0,(0,n.Z)("div",{className:"progress-bar "+E[e],style:{width:20+20*e+"%"},role:"progress-bar","aria-valuenow":e,"aria-valuemin":"0","aria-valuemax":"4"},void 0,(0,n.Z)("span",{className:"sr-only"},void 0,S[e]))),(0,n.Z)("p",{className:"text-small"},void 0,S[e]))}}]),u}(m().Component),T=a(26106),P=a(47235),L=a(99170),A=a(98274),I=a(93051),B=a(55210);function j(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function D(e){for(var t=1;t0?g.Z.error(e.__all__[0]):g.Z.error(gettext("Form contains errors."))):403===e.status&&e.ban?((0,I.Z)(e.ban),Z.Z.hide()):g.Z.apiError(e)}},{key:"render",value:function(){return(0,n.Z)("div",{className:"modal-dialog modal-register",role:"document"},void 0,(0,n.Z)("div",{className:"modal-content"},void 0,(0,n.Z)("div",{className:"modal-header"},void 0,(0,n.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,w||(w=(0,n.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,n.Z)("h4",{className:"modal-title"},void 0,pgettext("register modal title","Register"))),(0,n.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,n.Z)("input",{type:"type",style:{display:"none"}}),(0,n.Z)("input",{type:"password",style:{display:"none"}}),(0,n.Z)("div",{className:"modal-body"},void 0,(0,n.Z)(P.Z,{buttonClassName:"col-xs-12 col-sm-6",buttonLabel:pgettext("register modal field","Join with %(site)s"),formLabel:pgettext("register modal field","Or create forum account:")}),(0,n.Z)(k.Z,{label:pgettext("register modal field","Username"),for:"id_username",validation:this.state.errors.username},void 0,(0,n.Z)("input",{type:"text",id:"id_username",className:"form-control","aria-describedby":"id_username_status",disabled:this.state.isLoading,onChange:this.bindInput("username"),value:this.state.username})),(0,n.Z)(k.Z,{label:pgettext("register modal field","E-mail"),for:"id_email",validation:this.state.errors.email},void 0,(0,n.Z)("input",{type:"text",id:"id_email",className:"form-control","aria-describedby":"id_email_status",disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email})),(0,n.Z)(k.Z,{label:pgettext("register modal field","Password"),for:"id_password",validation:this.state.errors.password,extra:(0,n.Z)(O,{password:this.state.password,inputs:[this.state.username,this.state.email]})},void 0,(0,n.Z)("input",{type:"password",id:"id_password",className:"form-control","aria-describedby":"id_password_status",disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password})),f.ZP.component({form:this}),(0,n.Z)(T.Z,{errors:this.state.errors,privacyPolicy:this.state.privacyPolicy,termsOfService:this.state.termsOfService,onPrivacyPolicyChange:this.handlePrivacyPolicyChange,onTermsOfServiceChange:this.handleTermsOfServiceChange})),(0,n.Z)("div",{className:"modal-footer"},void 0,(0,n.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,pgettext("register modal btn","Cancel")),(0,n.Z)(_.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("register modal btn","Register account"))))))}}]),a}(N.Z),q=function(e){(0,r.Z)(a,e);var t=z(a);function a(){return(0,i.Z)(this,a),t.apply(this,arguments)}return(0,s.Z)(a,[{key:"getLead",value:function(){return"user"===this.props.activation?pgettext("account activation required","%(username)s, your account has been created but you need to activate it before you will be able to sign in."):"admin"===this.props.activation?pgettext("account activation required","%(username)s, your account has been created but the site administrator will have to activate it before you will be able to sign in."):void 0}},{key:"getSubscript",value:function(){return"user"===this.props.activation?pgettext("account activation required","We have sent an e-mail to %(email)s with link that you have to click to activate your account."):"admin"===this.props.activation?pgettext("account activation required","We will send an e-mail to %(email)s when this takes place."):void 0}},{key:"render",value:function(){return(0,n.Z)("div",{className:"modal-dialog modal-message modal-register",role:"document"},void 0,(0,n.Z)("div",{className:"modal-content"},void 0,(0,n.Z)("div",{className:"modal-header"},void 0,(0,n.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,C||(C=(0,n.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,n.Z)("h4",{className:"modal-title"},void 0,pgettext("register modal title","Registration complete"))),(0,n.Z)("div",{className:"modal-body"},void 0,R||(R=(0,n.Z)("div",{className:"message-icon"},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,n.Z)("div",{className:"message-body"},void 0,(0,n.Z)("p",{className:"lead"},void 0,interpolate(this.getLead(),{username:this.props.username},!0)),(0,n.Z)("p",{},void 0,interpolate(this.getSubscript(),{email:this.props.email},!0)),(0,n.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("register modal dismiss","Ok"))))))}}]),a}(m().Component),H=function(e){(0,r.Z)(a,e);var t=z(a);function a(e){var n;return(0,i.Z)(this,a),n=t.call(this,e),(0,u.Z)((0,o.Z)(n),"completeRegistration",(function(e){"active"===e.activation?(Z.Z.hide(),A.Z.signIn(e)):n.setState({complete:e})})),n.state={complete:!1},n}return(0,s.Z)(a,[{key:"render",value:function(){return this.state.complete?(0,n.Z)(q,{activation:this.state.complete.activation,email:this.state.complete.email,username:this.state.complete.username}):m().createElement(M,(0,y.Z)({callback:this.completeRegistration},this.props))}}]),a}(m().Component);const F=function(e){(0,r.Z)(h,e);var t,a,d=(t=h,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function h(e){var t;return(0,i.Z)(this,h),t=d.call(this,e),(0,u.Z)((0,o.Z)(t),"showRegisterForm",(function(){t.props.onClick&&t.props.onClick(),"closed"===misago.get("SETTINGS").account_activation?g.Z.info(pgettext("register form","Registration form is currently disabled by the site administrator.")):t.state.isLoaded?Z.Z.show((0,n.Z)(H,{criteria:t.state.criteria})):(t.setState({isLoading:!0}),Promise.all([f.ZP.load(),v.Z.get(misago.get("AUTH_CRITERIA_API"))]).then((function(e){t.setState({isLoading:!1,isLoaded:!0,criteria:e[1]}),Z.Z.show((0,n.Z)(H,{criteria:e[1]}))}),(function(){t.setState({isLoading:!1}),g.Z.error(pgettext("register form","Registration form is currently unavailable due to an error."))})))})),t.state={isLoading:!1,isLoaded:!1,criteria:null},t}return(0,s.Z)(h,[{key:"render",value:function(){return(0,n.Z)("button",{className:p()("btn btn-register",this.props.className,{"btn-block":this.props.block,"btn-loading":this.state.isLoading}),disabled:this.state.isLoading,onClick:this.showRegisterForm,type:"button"},void 0,pgettext("cta","Register"),this.state.isLoading?U||(U=(0,n.Z)(b.Z,{})):null)}}]),h}(m().Component)},26106:(e,t,a)=>{"use strict";a.d(t,{Z:()=>r});var n=a(22928),i=(a(57588),a(99170)),s=a(89627),o=function(e){var t=e.agreement,a=e.checked,i=e.errors,o=e.url,r=e.value,l=e.onChange;if(!o)return null;var c=interpolate('%(agreement)s',{agreement:(0,s.Z)(t),url:(0,s.Z)(o)},!0),u=interpolate(pgettext("register form agreement prompt","I have read and accept %(agreement)s."),{agreement:c},!0);return(0,n.Z)("div",{className:"checkbox legal-footnote"},void 0,(0,n.Z)("label",{},void 0,(0,n.Z)("input",{checked:a,type:"checkbox",value:r,onChange:l}),(0,n.Z)("span",{dangerouslySetInnerHTML:{__html:u}})),i&&i.map((function(e,t){return(0,n.Z)("div",{className:"help-block errors"},t,e)})))};const r=function(e){var t=e.errors,a=e.privacyPolicy,s=e.termsOfService,r=e.onPrivacyPolicyChange,l=e.onTermsOfServiceChange,c=i.Z.get("TERMS_OF_SERVICE_ID"),u=i.Z.get("TERMS_OF_SERVICE_URL"),d=i.Z.get("PRIVACY_POLICY_ID"),p=i.Z.get("PRIVACY_POLICY_URL");return c||d?(0,n.Z)("div",{},void 0,(0,n.Z)(o,{agreement:pgettext("register form agreement prompt","the terms of service"),checked:null!==s,errors:t.termsOfService,url:u,value:c,onChange:l}),(0,n.Z)(o,{agreement:pgettext("register form agreement prompt","the privacy policy"),checked:null!==a,errors:t.privacyPolicy,url:p,value:d,onChange:r})):null}},62989:(e,t,a)=>{"use strict";a.d(t,{E:()=>L,F:()=>B});var n=a(22928),i=a(57588),s=a.n(i),o=a(15671),r=a(43144),l=a(79340),c=a(6215),u=a(61120),d=a(60642),p=a(66398);function h(e){var t=e.children;return(0,n.Z)(p.NX,{className:"search-results-list"},void 0,t)}function m(){return(0,n.Z)(h,{},void 0,(0,n.Z)(p.j0,{message:pgettext("search cta","Enter search query (at least 3 characters).")}))}var v=a(16069);function f(e){var t=e.post;return(0,n.Z)(p.WI,{className:"search-result"},void 0,(0,n.Z)("a",{href:t.url.index},void 0,(0,n.Z)("div",{className:"search-result-card"},void 0,(0,n.Z)("div",{className:"search-result-name"},void 0,t.thread.title),(0,n.Z)("div",{className:"search-result-summary",dangerouslySetInnerHTML:{__html:t.content}}),(0,n.Z)("ul",{className:"search-result-details"},void 0,(0,n.Z)("li",{},void 0,(0,n.Z)("b",{},void 0,t.category.name)),(0,n.Z)("li",{},void 0,t.poster?t.poster.username:t.poster_name),(0,n.Z)("li",{},void 0,(0,n.Z)(v.Z,{datetime:t.posted_on}))))))}var Z,g,b,y=a(19605);function _(e){var t=e.user,a=t.title||t.rank.title;return(0,n.Z)(p.WI,{className:"search-result"},void 0,(0,n.Z)("a",{href:t.url},void 0,(0,n.Z)(y.ZP,{user:t,size:32}),(0,n.Z)("div",{className:"search-result-card"},void 0,(0,n.Z)("div",{className:"search-result-name"},void 0,t.username),(0,n.Z)("ul",{className:"search-result-details"},void 0,!!a&&(0,n.Z)("li",{},void 0,(0,n.Z)("b",{},void 0,a)),(0,n.Z)("li",{},void 0,t.rank.name),(0,n.Z)("li",{},void 0,(0,n.Z)(v.Z,{datetime:t.joined_on}))))))}function N(e){var t=e.query,a=e.results,i=a[0],s=a[1],o=i.results.count;return(0,n.Z)(h,{},void 0,s.results.results.map((function(e){return(0,n.Z)(_,{user:e},e.id)})),i.results.results.map((function(e){return(0,n.Z)(f,{post:e},e.id)})),o>0&&(0,n.Z)(p.WI,{},void 0,(0,n.Z)("a",{href:i.url+"?q="+encodeURIComponent(t),className:"btn btn-default btn-block"},void 0,npgettext("search results list","See all %(count)s result.","See all %(count)s results.",i.results.count).replace("%(count)s",i.results.count))))}function k(){return(0,n.Z)(h,{},void 0,(0,n.Z)(p.PB,{message:pgettext("search results","The search returned no results.")}))}function x(e){var t=e.error;return(0,n.Z)(h,{},void 0,(0,n.Z)(p.Zn,{message:pgettext("search results","The search could not be completed."),detail:w(t)}))}function w(e){return 0===e.status?gettext("Check your internet connection and try refreshing the site."):e.data&&e.data.detail?e.data.detail:void 0}function C(){return(0,n.Z)(h,{},void 0,(0,n.Z)(p.WE,{message:pgettext("search results","Searching...")}))}var R={},E=function(e){(0,l.Z)(s,e);var t,a,i=(t=s,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,u.Z)(t);if(a){var i=(0,u.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,c.Z)(this,e)});function s(e){var t;return(0,o.Z)(this,s),(t=i.call(this,e)).state={query:t.props.query.trim()},t.debounce=null,t}return(0,r.Z)(s,[{key:"componentDidUpdate",value:function(){var e=this,t=this.props.query.trim();this.state.query!=t&&(this.debounce&&window.clearTimeout(this.debounce),this.debounce=window.setTimeout((function(){e.setState({query:t})}),750))}},{key:"componentWillUnmount",value:function(){this.debounce&&window.clearTimeout(this.debounce)}},{key:"render",value:function(){var e,t=this;return(0,n.Z)(d.b,{url:(e=this.state.query,misago.get("SEARCH_API")+"?q="+encodeURIComponent(e)),cache:R,disabled:this.state.query.length<3},void 0,(function(e){var a=e.data,i=e.loading,s=e.error;return t.state.query.length<3?Z||(Z=(0,n.Z)(m,{})):i?g||(g=(0,n.Z)(C,{})):s?(0,n.Z)(x,{error:s}):function(e){if(null===e)return!0;var t=0;return e.forEach((function(e){t+=e.results.count})),0===t}(a)?b||(b=(0,n.Z)(k,{})):null!==a?(0,n.Z)(N,{query:t.state.query,results:a}):null}))}}]),s}(s().Component);function S(e){var t=e.query,a=e.setQuery;return(0,n.Z)("div",{className:"search-input"},void 0,(0,n.Z)("input",{className:"form-control form-control-search",type:"text",placeholder:pgettext("cta","Search"),value:t,onChange:function(e){return a(e.target.value)}}))}var O=a(97326),T=a(4942);var P=function(e){(0,l.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,u.Z)(t);if(a){var i=(0,u.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,c.Z)(this,e)});function i(e){var t;return(0,o.Z)(this,i),t=n.call(this,e),(0,T.Z)((0,O.Z)(t),"setQuery",(function(e){t.setState({query:e})})),t.state={query:""},t}return(0,r.Z)(i,[{key:"render",value:function(){return this.props.children({query:this.state.query,setQuery:this.setQuery})}}]),i}(s().Component);function L(){return(0,n.Z)(P,{},void 0,(function(e){var t=e.query,a=e.setQuery;return(0,n.Z)("div",{className:"search-dropdown-body"},void 0,(0,n.Z)(S,{query:t,setQuery:a}),(0,n.Z)(E,{query:t}))}))}var A=a(37424),I=a(64836);const B=(0,A.$j)((function(e){return{open:e.overlay.search}}))((function(e){var t=e.open;return(0,n.Z)(I.a,{open:t,onOpen:function(){window.setTimeout((function(){document.querySelector("#search-mount .form-control-search").focus()}),0)}},void 0,(0,n.Z)(I.i,{},void 0,pgettext("cta","Search")),(0,n.Z)(P,{},void 0,(function(e){var t=e.query,a=e.setQuery;return(0,n.Z)("div",{className:"search-overlay-body"},void 0,(0,n.Z)(S,{query:t,setQuery:a}),(0,n.Z)("div",{className:"search-results-container"},void 0,(0,n.Z)(E,{query:t})))})))}))},80261:(e,t,a)=>{"use strict";a.d(t,{Z:()=>c});var n,i=a(22928),s=a(94184),o=a.n(s),r=(a(57588),a(59801)),l=a(14467);const c=function(e){var t=e.block,a=e.className,s=e.onClick,c=misago.get("SETTINGS");return c.DELEGATE_AUTH?(0,i.Z)("a",{className:o()("btn btn-sign-in",a,{"btn-block":t}),href:c.LOGIN_URL,onClick:s},void 0,pgettext("cta","Sign in")):(0,i.Z)("button",{className:o()("btn btn-sign-in",a,{"btn-block":t}),type:"button",onClick:function(){s&&s(),r.Z.show(n||(n=(0,i.Z)(l.Z,{})))}},void 0,pgettext("cta","Sign in"))}},6333:(e,t,a)=>{"use strict";a.d(t,{bS:()=>v,Or:()=>g});var n,i,s,o=a(22928),r=a(94184),l=a.n(r),c=(a(57588),a(37424)),u=a(49021),d=a(40689),p=a(80261),h=(0,c.$j)((function(e){return{isAnonymous:!e.auth.user.id}}))((function(e){var t=e.isAnonymous,a=e.close,r=e.dropdown,c=e.overlay,h=misago.get("MISAGO_PATH"),m=misago.get("SETTINGS"),v=misago.get("main_menu"),f=misago.get("extraMenuItems"),Z=misago.get("extraFooterItems"),g=misago.get("categories_menu"),b=misago.get("usersLists"),y=m.enable_oauth2_client,_=[];v.forEach((function(e){_.push({title:e.label,url:e.url})})),_.push({title:pgettext("site nav","Search"),url:h+"search/"});var N=[],k=misago.get("TERMS_OF_SERVICE_TITLE"),x=misago.get("TERMS_OF_SERVICE_URL");k&&x&&N.push({title:k,url:x});var w=misago.get("PRIVACY_POLICY_TITLE"),C=misago.get("PRIVACY_POLICY_URL");return w&&C&&N.push({title:w,url:C}),(0,o.Z)("ul",{className:l()("site-nav-menu",{"dropdown-menu-list":r,"overlay-menu-list":c})},void 0,t&&(0,o.Z)(u.Aw,{className:"site-nav-sign-in-message"},void 0,pgettext("cta","You are not signed in")),t&&(0,o.Z)(u.KE,{className:"site-nav-sign-in-options"},void 0,(0,o.Z)(p.Z,{onClick:a}),!y&&(0,o.Z)(d.Z,{onClick:a})),(0,o.Z)(u.iC,{},void 0,m.forum_name),_.map((function(e){return(0,o.Z)(u.Xi,{},e.url,(0,o.Z)("a",{href:e.url},void 0,e.title))})),f.map((function(e,t){return(0,o.Z)(u.Xi,{className:e.className},t,(0,o.Z)("a",{href:e.url,target:e.targetBlank?"_blank":null,rel:e.rel},void 0,e.title))})),!!b.length&&(n||(n=(0,o.Z)(u.YV,{className:"site-nav-users-divider"}))),!!b.length&&(0,o.Z)(u.iC,{className:"site-nav-users"},void 0,pgettext("site nav section","Users")),b.map((function(e){return(0,o.Z)(u.Xi,{},e.url,(0,o.Z)("a",{href:e.url},void 0,e.name))})),i||(i=(0,o.Z)(u.YV,{className:"site-nav-categories-divider"})),(0,o.Z)(u.iC,{className:"site-nav-categories"},void 0,pgettext("site nav section","Categories")),g.map((function(e){return e.is_vanilla?(0,o.Z)(u.Xi,{className:"site-nav-category-header"},e.id,(0,o.Z)("a",{href:e.url},void 0,e.name)):(0,o.Z)(u.Xi,{className:l()("site-nav-category",{"site-nav-category-last":e.last})},e.id,(0,o.Z)("a",{href:e.url},void 0,(0,o.Z)("span",{},void 0,e.name),(0,o.Z)("span",{className:l()("threads-list-item-category threads-list-category-label",{"threads-list-category-label-color":!!e.color}),style:{"--label-color":e.color}},void 0,e.short_name||e.name)))})),(!!N.length||!!Z.length)&&(s||(s=(0,o.Z)(u.YV,{className:"site-nav-footer-divider"}))),(!!N.length||!!Z.length)&&(0,o.Z)(u.iC,{className:"site-nav-footer"},void 0,pgettext("site nav section","Footer")),Z.map((function(e,t){return(0,o.Z)(u.Xi,{className:e.className},t,(0,o.Z)("a",{href:e.url,target:e.targetBlank?"_blank":null,rel:e.rel},void 0,e.title))})),N.map((function(e){return(0,o.Z)(u.Xi,{},e.url,(0,o.Z)("a",{href:e.url},void 0,e.title))})))}));const m=h;function v(e){var t=e.close;return(0,o.Z)(m,{close:t,dropdown:!0})}var f=a(993),Z=a(64836);const g=(0,c.$j)((function(e){return{isOpen:e.overlay.siteNav}}))((function(e){var t=e.dispatch,a=e.isOpen;return(0,o.Z)(Z.a,{open:a},void 0,(0,o.Z)(Z.i,{},void 0,pgettext("site nav title","Menu")),(0,o.Z)(m,{close:function(){return t((0,f.xv)())},overlay:!0}))}))},47235:(e,t,a)=>{"use strict";a.d(t,{Z:()=>r});var n,i=a(22928),s=(a(57588),a(99170)),o=function(e){var t=e.className,a=e.text;return a?(0,i.Z)("h5",{className:t||""},void 0,a):null};const r=function(e){var t=e.buttonClassName,a=e.buttonLabel,r=e.formLabel,l=e.header,c=e.labelClassName,u=s.Z.get("SOCIAL_AUTH");return 0===u.length?null:(0,i.Z)("div",{className:"form-group form-social-auth"},void 0,(0,i.Z)(o,{className:c,text:l}),(0,i.Z)("div",{className:"row"},void 0,u.map((function(e){var n=e.pk,s=e.name,o=e.button_text,r=e.button_color,l=e.url,c="btn btn-block btn-default btn-social-"+n,u=r?{color:r}:null,d=o||interpolate(a,{site:s},!0);return(0,i.Z)("div",{className:t||"col-xs-12"},n,(0,i.Z)("a",{className:c,style:u,href:l},void 0,d))}))),n||(n=(0,i.Z)("hr",{})),(0,i.Z)(o,{className:c,text:r}))}},50366:(e,t,a)=>{"use strict";a.d(t,{Z:()=>d});var n,i,s,o,r,l,c,u=a(22928);a(57588);const d=function(e){var t=e.thread;return(0,u.Z)("ul",{className:"thread-flags"},void 0,2==t.weight&&(0,u.Z)("li",{className:"thread-flag-pinned-globally",title:pgettext("thread flag","Pinned globally")},void 0,n||(n=(0,u.Z)("span",{className:"material-icon"},void 0,"bookmark"))),1==t.weight&&(0,u.Z)("li",{className:"thread-flag-pinned-locally",title:pgettext("thread flag","Pinned in category")},void 0,i||(i=(0,u.Z)("span",{className:"material-icon"},void 0,"bookmark_outline"))),t.best_answer&&(0,u.Z)("li",{className:"thread-flag-answered",title:pgettext("thread flag","Answered")},void 0,s||(s=(0,u.Z)("span",{className:"material-icon"},void 0,"check_circle"))),t.has_poll&&(0,u.Z)("li",{className:"thread-flag-poll",title:pgettext("thread flag","Poll")},void 0,o||(o=(0,u.Z)("span",{className:"material-icon"},void 0,"poll"))),(t.is_unapproved||t.has_unapproved_posts)&&(0,u.Z)("li",{className:"thread-flag-unapproved",title:t.is_unapproved?pgettext("thread flag","Awaiting approval"):pgettext("thread flag","Has unapproved posts")},void 0,r||(r=(0,u.Z)("span",{className:"material-icon"},void 0,"visibility"))),t.is_closed&&(0,u.Z)("li",{className:"thread-flag-closed",title:pgettext("thread flag","Closed")},void 0,l||(l=(0,u.Z)("span",{className:"material-icon"},void 0,"lock"))),t.is_hidden&&(0,u.Z)("li",{className:"thread-flag-hidden",title:pgettext("thread flag","Hidden")},void 0,c||(c=(0,u.Z)("span",{className:"material-icon"},void 0,"visibility_off"))))}},16768:(e,t,a)=>{"use strict";a.d(t,{Z:()=>s});var n,i=a(22928);a(57588);const s=function(e){var t=e.thread;return(0,i.Z)("span",{className:"threads-replies",title:interpolate(npgettext("thread replies stat","%(replies)s reply","%(replies)s replies",t.replies),{replies:t.replies},!0)},void 0,n||(n=(0,i.Z)("span",{className:"material-icon"},void 0,"chat_bubble_outline")),t.replies>980?Math.round(t.replies/1e3)+"K":t.replies)}},16069:(e,t,a)=>{"use strict";a.d(t,{Z:()=>v});var n=a(22928),i=a(15671),s=a(43144),o=a(97326),r=a(79340),l=a(6215),c=a(61120),u=a(4942),d=a(57588),p=a.n(d),h=a(35983);function m(e){return{tick:e.tick+1}}const v=function(e){(0,r.Z)(p,e);var t,a,d=(t=p,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function p(e){var t;return(0,i.Z)(this,p),t=d.call(this,e),(0,u.Z)((0,o.Z)(t),"scheduleNextUpdate",(function(){var e=new Date,a=Math.ceil(Math.abs(Math.round((t.date-e)/1e3)));a<3600?t.timeout=window.setTimeout((function(){t.setState(m),t.scheduleNextUpdate()}),5e4):a<86400&&(t.timeout=window.setTimeout((function(){t.setState(m)}),24e5))})),t.state={tick:0},t.date=new Date(e.datetime),t.timeout=null,t}return(0,s.Z)(p,[{key:"componentDidMount",value:function(){this.scheduleNextUpdate()}},{key:"componentWillUnmount",value:function(){this.timeout&&window.clearTimeout(this.timeout)}},{key:"render",value:function(){var e=this.props.narrow?(0,h.formatNarrow)(this.date):(0,h.lY)(this.date);return(0,n.Z)("attr",{title:this.props.title?this.props.title.replace("%(timestamp)s",h.ry.format(this.date)):h.ry.format(this.date)},void 0,e)}}]),p}(p().Component)},92490:(e,t,a)=>{"use strict";a.d(t,{o8:()=>o,Eg:()=>r,Z2:()=>l,tw:()=>c});var n=a(22928),i=a(94184),s=a.n(i);a(57588);const o=function(e){var t=e.children,a=e.className;return(0,n.Z)("nav",{className:s()("toolbar",a)},void 0,t)},r=function(e){var t=e.children,a=e.className,i=e.shrink;return(0,n.Z)("div",{className:s()("toolbar-item",a,{"toolbar-item-shrink":i})},void 0,t)},l=function(e){var t=e.auto,a=e.children,i=e.className;return(0,n.Z)("div",{className:s()("toolbar-section",{"toolbar-section-auto":t},i)},void 0,a)},c=function(e){var t=e.className;return(0,n.Z)("div",{className:s()("toolbar-spacer",t)})}},28166:(e,t,a)=>{"use strict";a.d(t,{o4:()=>ie,Qm:()=>re});var n,i=a(42982),s=a(22928),o=a(15671),r=a(43144),l=a(97326),c=a(79340),u=a(6215),d=a(61120),p=a(4942),h=a(94184),m=a.n(h),v=a(57588),f=a.n(v),Z=a(37424),g=a(59801),b=a(19605),y=a(82211),_=a(37848),N=a(78657),k=a(53904);var x,w=function(e){(0,c.Z)(h,e);var t,a,i=(t=h,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function h(e){var t;return(0,o.Z)(this,h),t=i.call(this,e),(0,p.Z)((0,l.Z)(t),"setGravatar",(function(){t.callApi("gravatar")})),(0,p.Z)((0,l.Z)(t),"setGenerated",(function(){t.callApi("generated")})),t.state={isLoading:!1},t}return(0,r.Z)(h,[{key:"callApi",value:function(e){var t=this;if(this.state.isLoading)return!1;this.setState({isLoading:!0}),N.Z.post(this.props.user.api.avatar,{avatar:e}).then((function(e){t.setState({isLoading:!1}),k.Z.success(e.detail),t.props.onComplete(e)}),(function(e){400===e.status?(k.Z.error(e.detail),t.setState({isLoading:!1})):t.props.showError(e)}))}},{key:"getGravatarButton",value:function(){return this.props.options.gravatar?(0,s.Z)(y.Z,{onClick:this.setGravatar,disabled:this.state.isLoading,className:"btn-default btn-block btn-avatar-gravatar"},void 0,pgettext("avatar modal btn","Download my Gravatar")):null}},{key:"getCropButton",value:function(){return this.props.options.crop_src?(0,s.Z)(y.Z,{className:"btn-default btn-block btn-avatar-crop",disabled:this.state.isLoading,onClick:this.props.showCrop},void 0,pgettext("avatar modal btn","Re-crop uploaded image")):null}},{key:"getUploadButton",value:function(){return this.props.options.upload?(0,s.Z)(y.Z,{className:"btn-default btn-block btn-avatar-upload",disabled:this.state.isLoading,onClick:this.props.showUpload},void 0,pgettext("avatar modal btn","Upload new image")):null}},{key:"getGalleryButton",value:function(){return this.props.options.galleries?(0,s.Z)(y.Z,{className:"btn-default btn-block btn-avatar-gallery",disabled:this.state.isLoading,onClick:this.props.showGallery},void 0,pgettext("avatar modal btn","Pick avatar from gallery")):null}},{key:"getAvatarPreview",value:function(){var e={id:this.props.user.id,avatars:this.props.options.avatars};return this.state.isLoading?(0,s.Z)("div",{className:"avatar-preview preview-loading"},void 0,(0,s.Z)(b.ZP,{size:"200",user:e}),n||(n=(0,s.Z)(_.Z,{}))):(0,s.Z)("div",{className:"avatar-preview"},void 0,(0,s.Z)(b.ZP,{size:"200",user:e}))}},{key:"render",value:function(){return(0,s.Z)("div",{className:"modal-body modal-avatar-index"},void 0,(0,s.Z)("div",{className:"row"},void 0,(0,s.Z)("div",{className:"col-md-5"},void 0,this.getAvatarPreview()),(0,s.Z)("div",{className:"col-md-7"},void 0,this.getGravatarButton(),(0,s.Z)(y.Z,{onClick:this.setGenerated,disabled:this.state.isLoading,className:"btn-default btn-block btn-avatar-generate"},void 0,pgettext("avatar modal btn","Generate my individual avatar")),this.getCropButton(),this.getUploadButton(),this.getGalleryButton())))}}]),h}(f().Component),C=a(19755);var R,E=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(e){var t;return(0,o.Z)(this,i),t=n.call(this,e),(0,p.Z)((0,l.Z)(t),"cropAvatar",(function(){if(t.state.isLoading)return!1;t.setState({isLoading:!0});var e=t.props.upload?"crop_tmp":"crop_src",a=C(".crop-form"),n=a.cropit("exportZoom"),i=a.cropit("offset");N.Z.post(t.props.user.api.avatar,{avatar:e,crop:{offset:{x:i.x*n,y:i.y*n},zoom:a.cropit("zoom")*n}}).then((function(e){t.props.onComplete(e),k.Z.success(e.detail)}),(function(e){400===e.status?(k.Z.error(e.detail),t.setState({isLoading:!1})):t.props.showError(e)}))})),t.state={isLoading:!1,deviceRatio:1},t}return(0,r.Z)(i,[{key:"getAvatarSize",value:function(){return this.props.upload?this.props.options.crop_tmp.size:this.props.options.crop_src.size}},{key:"getImagePath",value:function(){return this.props.upload?this.props.dataUrl:this.props.options.crop_src.url}},{key:"componentDidMount",value:function(){for(var e=this,t=C(".crop-form"),a=this.getAvatarSize(),n=t.width();nn.height){var i=(n.width*a-e.getAvatarSize())/-2;t.cropit("offset",{x:i,y:0})}else if(n.widththis.props.options.upload.limit)return interpolate(pgettext("avatar upload modal","Selected file is too big. (%(filesize)s)"),{filesize:(0,S.Z)(e.size)},!0);var t=pgettext("avatar upload modal","Selected file type is not supported.");if(-1===this.props.options.upload.allowed_mime_types.indexOf(e.type))return t;var a=!1,n=e.name.toLowerCase();return this.props.options.upload.allowed_extensions.map((function(e){n.substr(-1*e.length)===e&&(a=!0)})),!a&&t}},{key:"getUploadRequirements",value:function(e){var t=e.allowed_extensions.map((function(e){return e.substr(1)}));return interpolate(pgettext("avatar upload modal","%(files)s files smaller than %(limit)s"),{files:t.join(", "),limit:(0,S.Z)(e.limit)},!0)}},{key:"getUploadButton",value:function(){return(0,s.Z)("div",{className:"modal-body modal-avatar-upload"},void 0,(0,s.Z)(y.Z,{className:"btn-pick-file",onClick:this.pickFile},void 0,R||(R=(0,s.Z)("div",{className:"material-icon"},void 0,"input")),pgettext("avatar upload modal field","Select file")),(0,s.Z)("p",{className:"text-muted"},void 0,this.getUploadRequirements(this.props.options.upload)))}},{key:"getUploadProgressLabel",value:function(){return interpolate(pgettext("avatar upload modal field","%(progress)s % complete"),{progress:this.state.progress},!0)}},{key:"getUploadProgress",value:function(){return(0,s.Z)("div",{className:"modal-body modal-avatar-upload"},void 0,(0,s.Z)("div",{className:"upload-progress"},void 0,(0,s.Z)("img",{src:this.state.preview}),(0,s.Z)("div",{className:"progress"},void 0,(0,s.Z)("div",{className:"progress-bar",role:"progressbar","aria-valuenow":"{this.state.progress}","aria-valuemin":"0","aria-valuemax":"100",style:{width:this.state.progress+"%"}},void 0,(0,s.Z)("span",{className:"sr-only"},void 0,this.getUploadProgressLabel())))))}},{key:"renderUpload",value:function(){return(0,s.Z)("div",{},void 0,(0,s.Z)("input",{type:"file",id:"avatar-hidden-upload",className:"hidden-file-upload",onChange:this.uploadFile}),this.state.image?this.getUploadProgress():this.getUploadButton(),(0,s.Z)("div",{className:"modal-footer"},void 0,(0,s.Z)("div",{className:"col-md-6 col-md-offset-3"},void 0,(0,s.Z)(y.Z,{onClick:this.props.showIndex,disabled:!!this.state.image,className:"btn-default btn-block"},void 0,pgettext("avatar upload modal btn","Cancel")))))}},{key:"renderCrop",value:function(){return(0,s.Z)(E,{options:this.state.options,user:this.props.user,upload:this.state.uploaded,dataUrl:this.state.preview,onComplete:this.props.onComplete,showError:this.props.showError,showIndex:this.props.showIndex})}},{key:"render",value:function(){return this.state.uploaded?this.renderCrop():this.renderUpload()}}]),i}(f().Component),P=a(87462),L=(a(99170),a(69130));function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=(0,d.Z)(e);if(t){var i=(0,d.Z)(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return(0,u.Z)(this,a)}}var I,B,j,D=function(e){(0,c.Z)(a,e);var t=A(a);function a(){var e;(0,o.Z)(this,a);for(var n=arguments.length,i=new Array(n),s=0;s2}:t.state={options:e.options,optionsMore:!1},t}return(0,r.Z)(i,[{key:"render",value:function(){var e=this.props,t=e.user,a=e.close,n=e.dropdown,i=e.overlay;if(!t)return null;var o=misago.get("ADMIN_URL");return(0,s.Z)("ul",{className:m()("user-nav-menu",{"dropdown-menu-list":n,"overlay-menu-list":i})},void 0,(0,s.Z)("li",{className:"dropdown-menu-item"},void 0,(0,s.Z)("a",{href:t.url,className:"user-nav-profile"},void 0,(0,s.Z)("strong",{},void 0,t.username),(0,s.Z)("small",{},void 0,pgettext("user nav","Go to your profile")))),$||($=(0,s.Z)(ee.YV,{})),(0,s.Z)(ee.Xi,{},void 0,(0,s.Z)("a",{href:misago.get("NOTIFICATIONS_URL")},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,t.unreadNotifications?"notifications_active":"notifications_none"),pgettext("user nav","Notifications"),!!t.unreadNotifications&&(0,s.Z)("span",{className:"badge"},void 0,t.unreadNotifications))),!!t.showPrivateThreads&&(0,s.Z)(ee.Xi,{},void 0,(0,s.Z)("a",{href:misago.get("PRIVATE_THREADS_URL")},void 0,W||(W=(0,s.Z)("span",{className:"material-icon"},void 0,"inbox")),pgettext("user nav","Private threads"),!!t.unreadPrivateThreads&&(0,s.Z)("span",{className:"badge"},void 0,t.unreadPrivateThreads))),!!o&&(0,s.Z)(ee.Xi,{},void 0,(0,s.Z)("a",{href:o,target:"_blank"},void 0,Q||(Q=(0,s.Z)("span",{className:"material-icon"},void 0,"security")),pgettext("user nav","Admin control panel"))),X||(X=(0,s.Z)(ee.YV,{})),(0,s.Z)(ee.iC,{className:"user-nav-options"},void 0,pgettext("user nav section","Account settings")),(0,s.Z)(ee.Xi,{},void 0,(0,s.Z)("button",{className:"btn-link",onClick:this.changeAvatar,type:"button"},void 0,K||(K=(0,s.Z)("span",{className:"material-icon"},void 0,"portrait")),pgettext("user nav","Change avatar"))),this.state.options.map((function(e){return(0,s.Z)(ee.Xi,{},e.icon,(0,s.Z)("a",{href:e.url},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,e.icon),e.name))})),(0,s.Z)(ee.Xi,{},void 0,(0,s.Z)("button",{className:m()("btn-link",{"d-none":!this.state.optionsMore}),onClick:this.revealOptions,type:"button"},void 0,J||(J=(0,s.Z)("span",{className:"material-icon"},void 0,"more_vertical")),pgettext("user nav","See more"))),!!n&&(0,s.Z)(ee.kE,{listItem:!0},void 0,(0,s.Z)("button",{className:"btn btn-default btn-block",onClick:function(){te(),a()},type:"button"},void 0,pgettext("user nav","Log out"))))}}]),i}(f().Component);const ne=(0,Z.$j)((function(e){var t=e.auth.user;return t.id?{user:{username:t.username,unreadNotifications:t.unreadNotifications,unreadPrivateThreads:t.unread_private_threads,showPrivateThreads:t.acl.can_use_private_threads,url:t.url},options:(0,i.Z)(misago.get("userOptions"))}:{user:null}}))(ae);function ie(e){var t=e.close;return(0,s.Z)(ne,{close:t,dropdown:!0})}var se=a(993),oe=a(64836);const re=(0,Z.$j)((function(e){return{isOpen:e.overlay.userNav}}))((function(e){var t=e.dispatch,a=e.isOpen;return(0,s.Z)(oe.a,{open:a},void 0,(0,s.Z)(oe.i,{},void 0,pgettext("user nav title","Your options")),(0,s.Z)(ne,{close:function(){return t((0,se.xv)())},overlay:!0}),(0,s.Z)(ee.kE,{},void 0,(0,s.Z)("button",{className:"btn btn-default btn-block",onClick:function(){te(),t((0,se.xv)())},type:"button"},void 0,pgettext("user nav","Log out"))))}))},19605:(e,t,a)=>{"use strict";a.d(t,{ZP:()=>s});var n=a(22928),i=(a(57588),a(99170));function s(e){var t=e.size||100,a=e.size2x||2*t;return(0,n.Z)("img",{alt:"",className:e.className||"user-avatar",src:o(e.user,t),srcSet:o(e.user,a),width:e.height||t,height:e.height||t})}function o(e,t){return e&&e.id?function(e,t){var a=e[0];return e.forEach((function(e){e.size>=t&&(a=e)})),a}(e.avatars,t).url:i.Z.get("BLANK_AVATAR_URL")}},82211:(e,t,a)=>{"use strict";a.d(t,{Z:()=>h});var n,i=a(22928),s=a(15671),o=a(43144),r=a(79340),l=a(6215),c=a(61120),u=a(57588),d=a.n(u),p=a(37848);var h=function(e){(0,r.Z)(d,e);var t,a,u=(t=d,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function d(){return(0,s.Z)(this,d),u.apply(this,arguments)}return(0,o.Z)(d,[{key:"render",value:function(){var e="btn "+this.props.className,t=this.props.disabled;return this.props.loading&&(e+=" btn-loading",t=!0),(0,i.Z)("button",{className:e,disabled:t,onClick:this.props.onClick,type:this.props.onClick?"button":"submit"},void 0,this.props.children,this.props.loading?n||(n=(0,i.Z)(p.Z,{})):null)}}]),d}(d().Component);h.defaultProps={className:"btn-default",type:"submit",loading:!1,disabled:!1,onClick:null}},57026:(e,t,a)=>{"use strict";a.d(t,{Z:()=>i});var n=a(22928);function i(e){return(0,n.Z)("select",{className:e.className||"form-control",disabled:e.disabled||!1,id:e.id||null,onChange:e.onChange,value:e.value},void 0,e.choices.map((function(e){return(0,n.Z)("option",{disabled:e.disabled||!1,value:e.value},e.value,"- - ".repeat(e.level)+e.label)})))}a(57588)},96359:(e,t,a)=>{"use strict";a.d(t,{Z:()=>u});var n=a(22928),i=a(15671),s=a(43144),o=a(79340),r=a(6215),l=a(61120),c=a(57588);var u=function(e){(0,o.Z)(u,e);var t,a,c=(t=u,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,l.Z)(t);if(a){var i=(0,l.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,i.Z)(this,u),c.apply(this,arguments)}return(0,s.Z)(u,[{key:"isValidated",value:function(){return void 0!==this.props.validation}},{key:"getClassName",value:function(){var e="form-group";return this.isValidated()&&(e+=" has-feedback",null===this.props.validation?e+=" has-success":e+=" has-error"),e}},{key:"getFeedback",value:function(){var e=this;return this.props.validation?(0,n.Z)("div",{className:"help-block errors"},void 0,this.props.validation.map((function(t,a){return(0,n.Z)("p",{},e.props.for+"FeedbackItem"+a,t)}))):null}},{key:"getFeedbackDescription",value:function(){return this.isValidated()?(0,n.Z)("span",{id:this.props.for+"_status",className:"sr-only"},void 0,this.props.validation?pgettext("field validation status","(error)"):pgettext("field validation status","(success)")):null}},{key:"getHelpText",value:function(){return this.props.helpText?(0,n.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}},{key:"render",value:function(){return(0,n.Z)("div",{className:this.getClassName()},void 0,(0,n.Z)("label",{className:"control-label "+(this.props.labelClass||""),htmlFor:this.props.for||""},void 0,this.props.label+":"),(0,n.Z)("div",{className:this.props.controlClass||""},void 0,this.props.children,this.getFeedbackDescription(),this.getFeedback(),this.getHelpText(),this.props.extra||null))}}]),u}(a.n(c)().Component)},43345:(e,t,a)=>{"use strict";a.d(t,{Z:()=>v});var n=a(15671),i=a(43144),s=a(97326),o=a(79340),r=a(6215),l=a(61120),c=a(4942),u=a(57588),d=a.n(u),p=a(55210),h=a(53904);var m=(0,p.C1)(),v=function(e){(0,o.Z)(d,e);var t,a,u=(t=d,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,l.Z)(t);if(a){var i=(0,l.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,r.Z)(this,e)});function d(){var e;(0,n.Z)(this,d);for(var t=arguments.length,a=new Array(t),i=0;i{"use strict";a.d(t,{Z:()=>u});var n=a(22928),i=a(15671),s=a(43144),o=a(79340),r=a(6215),l=a(61120),c=a(57588);var u=function(e){(0,o.Z)(u,e);var t,a,c=(t=u,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,l.Z)(t);if(a){var i=(0,l.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,i.Z)(this,u),c.apply(this,arguments)}return(0,s.Z)(u,[{key:"isActive",value:function(){return this.props.isControlled?this.props.isActive:!!this.props.path&&0===document.location.pathname.indexOf(this.props.path)}},{key:"getClassName",value:function(){return this.isActive()?(this.props.className||"")+" "+(this.props.activeClassName||"active"):this.props.className||""}},{key:"render",value:function(){return(0,n.Z)("li",{className:this.getClassName()},void 0,this.props.children)}}]),u}(a.n(c)().Component)},37848:(e,t,a)=>{"use strict";a.d(t,{Z:()=>s});var n,i=a(22928);function s(e){return(0,i.Z)("div",{className:e.className||"loader"},void 0,n||(n=(0,i.Z)("div",{className:"loader-spinning-wheel"})))}a(57588)},52753:(e,t,a)=>{"use strict";a.d(t,{ZP:()=>Z});var n,i=a(22928),s=a(15671),o=a(43144),r=a(97326),l=a(79340),c=a(6215),u=a(61120),d=a(4942),p=(a(57588),a(82211)),h=a(43345),m=a(96359),v=a(78657),f=a(59801);var Z=function(e){(0,l.Z)(m,e);var t,a,h=(t=m,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,u.Z)(t);if(a){var i=(0,u.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,c.Z)(this,e)});function m(e){var t;return(0,s.Z)(this,m),t=h.call(this,e),(0,d.Z)((0,r.Z)(t),"handleSuccess",(function(e){t.props.onSuccess(e),f.Z.hide()})),(0,d.Z)((0,r.Z)(t),"handleError",(function(e){t.props.onError(e)})),(0,d.Z)((0,r.Z)(t),"onBestAnswerChange",(function(e){t.changeValue("bestAnswer",e.target.value)})),(0,d.Z)((0,r.Z)(t),"onPollChange",(function(e){t.changeValue("poll",e.target.value)})),t.state={isLoading:!1,bestAnswer:"0",poll:"0"},t}return(0,o.Z)(m,[{key:"clean",value:function(){return!this.props.polls||"0"!==this.state.poll||window.confirm(pgettext("merge threads conflict form","Are you sure you want to delete all polls?"))}},{key:"send",value:function(){var e=Object.assign({},this.props.data,{best_answer:this.state.bestAnswer,poll:this.state.poll});return v.Z.post(this.props.api,e)}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,n||(n=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,pgettext("merge threads conflict modal title","Merge threads"))),(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(g,{choices:this.props.bestAnswers,onChange:this.onBestAnswerChange,value:this.state.bestAnswer}),(0,i.Z)(b,{choices:this.props.polls,onChange:this.onPollChange,value:this.state.poll})),(0,i.Z)("div",{className:"modal-footer"},void 0,(0,i.Z)("button",{className:"btn btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,pgettext("merge threads conflict btn","Cancel")),(0,i.Z)(p.Z,{className:"btn-primary",loading:this.state.isLoading},void 0,pgettext("merge threads conflict btn","Merge threads"))))))}}]),m}(h.Z);function g(e){var t=e.choices,a=e.onChange,n=e.value;return t?(0,i.Z)(m.Z,{label:pgettext("merge threads conflict best answer","Best answer"),helpText:pgettext("merge threads conflict best answer","Select the best answer for your newly merged thread. No posts will be deleted during the merge."),for:"id_best_answer"},void 0,(0,i.Z)("select",{className:"form-control",id:"id_best_answer",onChange:a,value:n},void 0,t.map((function(e){return(0,i.Z)("option",{value:e[0]},e[0],e[1])})))):null}function b(e){var t=e.choices,a=e.onChange,n=e.value;return t?(0,i.Z)(m.Z,{label:pgettext("merge threads conflict poll","Poll"),helpText:pgettext("merge threads conflict poll","Select the poll for your newly merged thread. Rejected polls will be permanently deleted and cannot be recovered."),for:"id_poll"},void 0,(0,i.Z)("select",{className:"form-control",id:"id_poll",onChange:a,value:n},void 0,t.map((function(e){return(0,i.Z)("option",{value:e[0]},e[0],e[1])})))):null}},69092:(e,t,a)=>{"use strict";a.d(t,{Z:()=>g});var n=a(15671),i=a(43144),s=a(79340),o=a(6215),r=a(61120),l=a(94184),c=a.n(l),u=a(57588),d=a.n(u),p=a(4942),h=a(19755),m=new RegExp("^.*(?:(?:youtu.be/|v/|vi/|u/w/|embed/)|(?:(?:watch)??v(?:i)?=|&v(?:i)?=))([^#&?]*).*");const v=new(function(){function e(){var t=this;(0,n.Z)(this,e),(0,p.Z)(this,"render",(function(e){e&&(t.highlightCode(e),t.embedYoutubePlayers(e))})),this._youtube={}}return(0,i.Z)(e,[{key:"highlightCode",value:function(e){a.e(417).then(a.bind(a,15739)).then((function(t){for(var a=t.default,n=e.querySelectorAll("pre>code"),i=0;ia"),a=0;a');h(e).replaceWith(n),n.wrap('
    ')}}]),e}());function f(e){var t=function(e){var t=e;return"https://"===e.substr(0,8)?t=t.substr(8):"http://"===e.substr(0,7)&&(t=t.substr(7)),"www."===t.substr(0,4)&&(t=t.substr(4)),t}(e),a=function(e){if(-1===e.indexOf("youtu"))return null;var t=e.match(m);return t?t[1]:null}(t);if(!a)return null;var n=0;if(t.indexOf("?")>0){var i=t.substr(t.indexOf("?")+1).split("&").filter((function(e){return"t="===e.substr(0,2)}))[0];if(i){var s=i.substr(2).split("m");"s"===s[0].substr(-1)?n+=parseInt(s[0].substr(0,s[0].length-1)):(n+=60*parseInt(s[0]),s[1]&&"s"===s[1].substr(-1)&&(n+=parseInt(s[1].substr(0,s[1].length-1))))}}return{start:n,video:a}}var Z=a(19755);var g=function(e){(0,s.Z)(u,e);var t,a,l=(t=u,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,r.Z)(t);if(a){var i=(0,r.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,o.Z)(this,e)});function u(){return(0,n.Z)(this,u),l.apply(this,arguments)}return(0,i.Z)(u,[{key:"componentDidMount",value:function(){v.render(this.documentNode),Z(this.documentNode).find(".spoiler-reveal").click(b)}},{key:"componentDidUpdate",value:function(e,t){v.render(this.documentNode),Z(this.documentNode).find(".spoiler-reveal").click(b)}},{key:"shouldComponentUpdate",value:function(e,t){return e.markup!==this.props.markup}},{key:"render",value:function(){var e=this;return d().createElement("article",{className:c()("misago-markup",this.props.className),dangerouslySetInnerHTML:{__html:this.props.markup},"data-author":this.props.author||void 0,ref:function(t){e.documentNode=t}})}}]),u}(d().Component);function b(e){var t=e.target;Z(t).parent().parent().addClass("revealed")}},3784:(e,t,a)=>{"use strict";a.d(t,{Z:()=>h});var n,i=a(22928),s=a(15671),o=a(43144),r=a(79340),l=a(6215),c=a(61120),u=a(57588),d=a.n(u),p=a(37848);var h=function(e){(0,r.Z)(d,e);var t,a,u=(t=d,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function d(){return(0,s.Z)(this,d),u.apply(this,arguments)}return(0,o.Z)(d,[{key:"render",value:function(){return n||(n=(0,i.Z)("div",{className:"modal-body modal-loader"},void 0,(0,i.Z)(p.Z,{})))}}]),d}(d().Component)},30337:(e,t,a)=>{"use strict";a.d(t,{Z:()=>c});var n=a(22928),i=a(15671),s=a(43144),o=a(79340),r=a(6215),l=a(61120);a(57588);var c=function(e){(0,o.Z)(u,e);var t,a,c=(t=u,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,l.Z)(t);if(a){var i=(0,l.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,i.Z)(this,u),c.apply(this,arguments)}return(0,s.Z)(u,[{key:"getHelpText",value:function(){return this.props.helpText?(0,n.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}},{key:"render",value:function(){return(0,n.Z)("div",{className:"modal-body"},void 0,(0,n.Z)("div",{className:"message-icon"},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,this.props.icon||"info_outline")),(0,n.Z)("div",{className:"message-body"},void 0,(0,n.Z)("p",{className:"lead"},void 0,this.props.message),this.getHelpText(),(0,n.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("modal message dismiss btn","Ok"))))}}]),u}(a(33556).Z)},33556:(e,t,a)=>{"use strict";a.d(t,{Z:()=>u});var n=a(22928),i=a(15671),s=a(43144),o=a(79340),r=a(6215),l=a(61120),c=a(57588);var u=function(e){(0,o.Z)(u,e);var t,a,c=(t=u,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,l.Z)(t);if(a){var i=(0,l.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,r.Z)(this,e)});function u(){return(0,i.Z)(this,u),c.apply(this,arguments)}return(0,s.Z)(u,[{key:"getHelpText",value:function(){return this.props.helpText?(0,n.Z)("p",{className:"help-block"},void 0,this.props.helpText):null}},{key:"render",value:function(){return(0,n.Z)("div",{className:"panel-body panel-message-body"},void 0,(0,n.Z)("div",{className:"message-icon"},void 0,(0,n.Z)("span",{className:"material-icon"},void 0,this.props.icon||"info_outline")),(0,n.Z)("div",{className:"message-body"},void 0,(0,n.Z)("p",{className:"lead"},void 0,this.props.message),this.getHelpText()))}}]),u}(a.n(c)().Component)},11005:(e,t,a)=>{"use strict";a.d(t,{Z:()=>x});var n=a(22928),i=a(57588),s=a.n(i),o=a(69092);function r(e){return e.post.content?s().createElement(l,e):s().createElement(c,e)}function l(e){return(0,n.Z)("div",{className:"post-body"},void 0,(0,n.Z)(o.Z,{markup:e.post.content}))}function c(e){return(0,n.Z)("div",{className:"post-body post-body-invalid"},void 0,(0,n.Z)("p",{className:"lead"},void 0,pgettext("post body invalid","This post's contents cannot be displayed.")),(0,n.Z)("p",{className:"text-muted"},void 0,pgettext("post body invalid","This error is caused by invalid post content manipulation.")))}function u(e){var t=e.post,a=t.category,i=t.thread,s=interpolate(pgettext("posts feed item header","posted %(posted_on)s"),{posted_on:t.posted_on.format("LL, LT")},!0);return(0,n.Z)("div",{className:"post-heading"},void 0,(0,n.Z)("a",{className:"btn btn-link item-title",href:i.url},void 0,i.title),(0,n.Z)("a",{className:"btn btn-link post-category",href:a.url.index},void 0,a.name),(0,n.Z)("a",{href:t.url.index,className:"btn btn-link posted-on",title:s},void 0,t.posted_on.fromNow()))}var d,p,h=a(19605);function m(e){var t=e.post;return(0,n.Z)("a",{className:"btn btn-default btn-icon pull-right",href:t.url.index},void 0,(0,n.Z)("span",{className:"btn-text-left hidden-xs"},void 0,pgettext("go to post link","See post")),d||(d=(0,n.Z)("span",{className:"material-icon"},void 0,"chevron_right")))}function v(e){var t=e.post;return(0,n.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,n.Z)(m,{post:t}),(0,n.Z)("div",{className:"media"},void 0,p||(p=(0,n.Z)("div",{className:"media-left"},void 0,(0,n.Z)("span",{},void 0,(0,n.Z)(h.ZP,{className:"poster-avatar",size:50})))),(0,n.Z)("div",{className:"media-body"},void 0,(0,n.Z)("div",{className:"media-heading"},void 0,(0,n.Z)("span",{className:"item-title"},void 0,t.poster_name)),(0,n.Z)("span",{className:"user-title user-title-anonymous"},void 0,pgettext("post removed poster username","Removed user")))))}function f(e){var t=e.rank,a=e.title||t.title||t.name,i="user-title";return t.css_class&&(i+=" user-title-"+t.css_class),t.is_tab?(0,n.Z)("a",{className:i,href:t.url},void 0,a):(0,n.Z)("span",{className:i},void 0,a)}function Z(e){var t=e.post,a=e.poster;return(0,n.Z)("div",{className:"post-side post-side-registered"},void 0,(0,n.Z)(m,{post:t}),(0,n.Z)("div",{className:"media"},void 0,(0,n.Z)("div",{className:"media-left"},void 0,(0,n.Z)("a",{href:a.url},void 0,(0,n.Z)(h.ZP,{className:"poster-avatar",size:50,user:a}))),(0,n.Z)("div",{className:"media-body"},void 0,(0,n.Z)("div",{className:"media-heading"},void 0,(0,n.Z)("a",{className:"item-title",href:a.url},void 0,a.username)),(0,n.Z)(f,{title:a.title,rank:a.rank}))))}function g(e){var t=e.post,a=e.poster;return a&&a.id?(0,n.Z)(Z,{post:t,poster:a}):(0,n.Z)(v,{post:t})}function b(e){var t=e.post,a=e.poster||t.poster,i="post";return a&&a.rank.css_class&&(i+=" post-"+a.rank.css_class),(0,n.Z)("li",{className:i,id:"post-"+t.id},void 0,(0,n.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,n.Z)("div",{className:"panel-body"},void 0,(0,n.Z)("div",{className:"panel-content"},void 0,(0,n.Z)(g,{post:t,poster:a}),(0,n.Z)(u,{post:t}),(0,n.Z)(r,{post:t})))))}var y,_,N=a(44039);function k(){return(0,n.Z)("ul",{className:"posts-list post-feed ui-preview"},void 0,(0,n.Z)("li",{className:"post"},void 0,(0,n.Z)("div",{className:"panel panel-default panel-post"},void 0,(0,n.Z)("div",{className:"panel-body"},void 0,(0,n.Z)("div",{className:"panel-content"},void 0,(0,n.Z)("div",{className:"post-side post-side-anonymous"},void 0,(0,n.Z)("div",{className:"media"},void 0,y||(y=(0,n.Z)("div",{className:"media-left"},void 0,(0,n.Z)("span",{},void 0,(0,n.Z)(h.ZP,{className:"poster-avatar",size:50})))),(0,n.Z)("div",{className:"media-body"},void 0,(0,n.Z)("div",{className:"media-heading"},void 0,(0,n.Z)("span",{className:"item-title"},void 0,(0,n.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," "))),(0,n.Z)("span",{className:"user-title user-title-anonymous"},void 0,(0,n.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," "))))),(0,n.Z)("div",{className:"post-heading"},void 0,(0,n.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")),(0,n.Z)("div",{className:"post-body"},void 0,(0,n.Z)("article",{className:"misago-markup"},void 0,(0,n.Z)("p",{},void 0,(0,n.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")," ",(0,n.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")," ",(0,n.Z)("span",{className:"ui-preview-text",style:{width:N.e(30,200)+"px"}},void 0," ")))))))))}function x(e){var t=e.isReady,a=e.posts,i=e.poster;return t?(0,n.Z)("ul",{className:"posts-list post-feed ui-ready"},void 0,a.map((function(e){return(0,n.Z)(b,{post:e,poster:i},e.id)}))):_||(_=(0,n.Z)(k,{}))}},9771:(e,t,a)=>{"use strict";a.d(t,{mv:()=>v,ZP:()=>la,MO:()=>A,Fi:()=>k});var n,i=a(57588),s=a.n(i),o=a(22928),r=a(43144),l=a(15671),c=a(97326),u=a(79340),d=a(6215),p=a(61120),h=a(4942),m=a(64646);var v=function(e){(0,u.Z)(v,e);var t,a,i=(t=v,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function v(e){var t;return(0,l.Z)(this,v),t=i.call(this,e),(0,h.Z)((0,c.Z)(t),"selected",(function(){if(t.element){var e=Z(t.element)||null,a=e?e.getBoundingClientRect():null;t.setState({range:e,rect:a})}})),(0,h.Z)((0,c.Z)(t),"reply",(function(){if(m.Z.isOpen()){var e=A();e&&!e.disabled&&(e.quote(k(t.state.range)),t.setState({range:null,rect:null}),f())}else{var a=k(t.state.range);m.Z.open(Object.assign({},t.props.posting,{default:a})),t.setState({range:null,rect:null}),window.setTimeout(f,1e3)}})),(0,h.Z)((0,c.Z)(t),"render",(function(){return(0,o.Z)("div",{},void 0,s().createElement("div",{ref:function(e){e&&(t.element=e)},onMouseUp:t.selected,onTouchEnd:t.selected},t.props.children),!!t.state.rect&&(0,o.Z)("div",{className:"quote-control",style:{position:"absolute",left:t.state.rect.left+window.scrollX,top:t.state.rect.bottom+window.scrollY}},void 0,n||(n=(0,o.Z)("div",{className:"quote-control-arrow"})),(0,o.Z)("div",{className:"quote-control-inner"},void 0,(0,o.Z)("button",{className:"btn quote-control-btn",type:"button",onClick:t.reply},void 0,pgettext("post reply","Quote")))))})),t.state={range:null,rect:null},t.element=null,t}return(0,r.Z)(v)}(s().Component);function f(){var e=document.querySelector("#posting-mount textarea");e.focus(),e.selectionStart=e.selectionEnd=e.value.length}var Z=function(e){if(void 0!==window.getSelection){var t=window.getSelection();if(t&&"Range"===t.type&&1===t.rangeCount){var a=t.getRangeAt(0);if(g(a,e)&&b(a)&&y(a.cloneContents()))return a}}},g=function(e,t){var a=e.commonAncestorContainer;if(a===t)return!0;for(var n=a.parentNode;n;){if(n===t)return!0;n=n.parentNode}return!1},b=function(e){var t=e.commonAncestorContainer;if("ARTICLE"===t.nodeName)return!0;if(t.dataset&&"1"===t.dataset.noquote)return!1;for(var a=t.parentNode;a;){if(a.dataset&&"1"===a.dataset.noquote)return!1;if("ARTICLE"===a.nodeName)return!0;a=a.parentNode}return!1},y=function e(t){for(var a=0;a0)return!0;if("IMG"===n.nodeName)return!0;if(e(n))return!0}return!1},_=a(42982),N=a(70885);const k=function(e){var t=x(e),a=T(e.cloneContents().childNodes,[]),n=t?'[quote="'.concat(t,'"]\n'):"[quote]\n",i="\n[/quote]\n\n",s=R(e);return s?(n+=s.syntax?"[code=".concat(s.syntax,"]\n"):"[code]\n",i="\n[/code]"+i):S(e)?(a=a.trim(),n+="`",i="`"+i):a=a.trim(),n+a+i};var x=function(e){var t=e.commonAncestorContainer;if(w(t))return C(t);for(var a=t.parentNode;a;){if(w(a))return C(a);a=a.parentNode}return""},w=function(e){return e.nodeType===Node.ELEMENT_NODE&&("ARTICLE"===e.nodeName||"BLOCKQUOTE"===e.nodeName&&e.dataset&&"quote"===e.dataset.block)},C=function(e){return e.dataset&&e.dataset.author||null},R=function(e){var t=e.commonAncestorContainer;if(E(t))return O(t);for(var a=t.parentNode;a;){if(E(a))return O(a);a=a.parentNode}return null},E=function(e){return"PRE"===e.nodeName},S=function(e){var t=e.commonAncestorContainer;if("CODE"===t.nodeName)return!0;for(var a=t.parentNode;a;){if(w(a))return!1;if("CODE"===a.nodeName)return!0;a=a.parentNode}return!1},O=function(e){return e.dataset?{syntax:e.dataset.syntax||null}:{syntax:null}},T=function(e,t){for(var a="",n=0;n0&&(0,o.Z)("li",{},void 0,(0,X.Z)(a.size))))),!!a.id&&(0,o.Z)("div",{className:"markup-editor-attachment-buttons"},void 0,(0,o.Z)("button",{className:"btn btn-markup-editor-attachment btn-icon",title:pgettext("markup editor","Insert into message"),type:"button",disabled:n,onClick:function(){var e=function(e){var t="[";return e.is_image?(t+="!["+e.filename+"]",t+="("+(e.url.thumb||e.url.index)+"?shva=1)"):t+=e.filename,t+"]("+e.url.index+"?shva=1)"}(a),t=se(i);ie(t,r,e)}},void 0,J||(J=(0,o.Z)("span",{className:"material-icon"},void 0,"flip_to_front"))),(0,o.Z)("button",{className:"btn btn-markup-editor-attachment btn-icon",title:pgettext("markup editor","Remove attachment"),type:"button",disabled:n,onClick:function(){s((function(e){var t=e.attachments;if(window.confirm(pgettext("markup editor","Remove this attachment?")))return{attachments:t.filter((function(e){return e.id!==a.id}))}}))}},void 0,ee||(ee=(0,o.Z)("span",{className:"material-icon"},void 0,"close")))),!a.id&&!!a.key&&(0,o.Z)("div",{className:"markup-editor-attachment-buttons"},void 0,a.error&&(0,o.Z)("button",{className:"btn btn-markup-editor-attachment btn-icon",title:pgettext("markup editor","See error"),type:"button",onClick:function(){Y.Z.error(interpolate(pgettext("markup editor","%(filename)s: %(error)s"),{filename:a.filename,error:a.error},!0))}},void 0,te||(te=(0,o.Z)("span",{className:"material-icon"},void 0,"warning"))),(0,o.Z)("button",{className:"btn btn-markup-editor-attachment btn-icon",title:pgettext("markup editor","Remove attachment"),type:"button",disabled:n,onClick:function(){s((function(e){return{attachments:e.attachments.filter((function(e){return e.key!==a.key}))}}))}},void 0,ae||(ae=(0,o.Z)("span",{className:"material-icon"},void 0,"close"))))))},ce=function(e){var t=e.attachments,a=e.disabled,n=e.element,i=e.setState,s=e.update;return(0,o.Z)("div",{className:"markup-editor-attachments"},void 0,(0,o.Z)("div",{className:"markup-editor-attachments-container"},void 0,t.map((function(e){return(0,o.Z)(le,{attachment:e,disabled:a,element:n,setState:i,update:s},e.key||e.id)}))))};var ue,de=a(82211);const pe=function(e){var t=e.canProtect,a=e.disabled,n=e.empty,i=e.preview,s=e.isProtected,r=e.submitText,l=e.showPreview,c=e.closePreview,u=e.enableProtection,d=e.disableProtection;return(0,o.Z)("div",{className:"markup-editor-footer"},void 0,!!t&&(0,o.Z)(de.Z,{className:"btn-default btn-icon hidden-sm hidden-md hidden-lg",title:s?pgettext("markup editor","Protected"):pgettext("markup editor","Protect"),type:"button",disabled:a,onClick:function(){s?d():u()}},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,s?"lock":"lock_open")),!!t&&(0,o.Z)("div",{},void 0,(0,o.Z)(de.Z,{className:"btn-default hidden-xs",type:"button",disabled:a,onClick:function(){s?d():u()}},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,s?"lock":"lock_open"),s?pgettext("markup editor","Protected"):pgettext("markup editor","Protect"))),ue||(ue=(0,o.Z)("div",{className:"markup-editor-spacer"})),i?(0,o.Z)(de.Z,{className:"btn-default btn-auto",type:"button",onClick:c},void 0,pgettext("markup editor","Edit")):(0,o.Z)(de.Z,{className:"btn-default btn-auto",disabled:a||n,type:"button",onClick:l},void 0,pgettext("markup editor","Preview")),(0,o.Z)(de.Z,{className:"btn-primary btn-auto",disabled:a||n},void 0,r||pgettext("markup editor","Post")))};var he,me=a(96359);var ve=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,l.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"handleSubmit",(function(e){e.preventDefault();var a=t.props,n=a.selection,i=a.update,s=t.state.syntax.trim(),o=t.state.text.trim();if(0===o.length)return t.setState({error:gettext("This field is required.")}),!1;var r=n.prefix.trim().length?"\n\n":"";return ie(Object.assign({},n,{text:o}),i,r+"```"+s+"\n"+o+"\n```\n\n"),Q.Z.hide(),!1})),t.state={error:null,syntax:"",text:e.selection.text},t}return(0,r.Z)(i,[{key:"render",value:function(){var e=this;return(0,o.Z)("div",{className:"modal-dialog modal-lg",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,he||(he=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("markup editor","Code"))),(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(me.Z,{for:"markup_code_syntax",label:pgettext("markup editor","Syntax highlighting")},void 0,(0,o.Z)("select",{id:"markup_code_syntax",className:"form-control",value:this.state.syntax,onChange:function(t){return e.setState({syntax:t.target.value})}},void 0,(0,o.Z)("option",{value:""},void 0,pgettext("markup editor","No syntax highlighting")),fe.map((function(e){var t=e.value,a=e.name;return(0,o.Z)("option",{value:t},t,a)})))),(0,o.Z)(me.Z,{for:"markup_code_text",label:pgettext("markup editor","Code to insert"),validation:this.state.error?[this.state.error]:void 0},void 0,(0,o.Z)("textarea",{id:"markup_code_text",className:"form-control",rows:"8",value:this.state.text,onChange:function(t){return e.setState({text:t.target.value})}}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("markup editor","Cancel")),(0,o.Z)("button",{className:"btn btn-primary"},void 0,pgettext("markup editor","Insert code"))))))}}]),i}(s().Component),fe=[{value:"bash",name:"Bash"},{value:"c",name:"C"},{value:"c#",name:"C#"},{value:"c++",name:"C++"},{value:"css",name:"CSS"},{value:"diff",name:"Diff"},{value:"go",name:"Go"},{value:"graphql",name:"GraphQL"},{value:"html,",name:"HTML"},{value:"xml",name:"XML"},{value:"json",name:"JSON"},{value:"java",name:"Java"},{value:"javascript",name:"JavaScript"},{value:"kotlin",name:"Kotlin"},{value:"less",name:"Less"},{value:"lua",name:"Lua"},{value:"makefile",name:"Makefile"},{value:"markdown",name:"Markdown"},{value:"objective-C",name:"Objective-C"},{value:"php",name:"PHP"},{value:"perl",name:"Perl"},{value:"plain",name:"Plain"},{value:"text",name:"text"},{value:"python",name:"Python"},{value:"repl",name:"REPL"},{value:"r",name:"R"},{value:"ruby",name:"Ruby"},{value:"rust",name:"Rust"},{value:"scss",name:"SCSS"},{value:"sql",name:"SQL"},{value:"shell",name:"Shell Session"},{value:"swift",name:"Swift"},{value:"toml",name:"TOML"},{value:"ini",name:"INI"},{value:"typescript",name:"TypeScript"},{value:"visualbasic",name:"Visual Basic .NET"},{value:"webassembly",name:"WebAssembly"},{value:"yaml",name:"YAML"}];const Ze=ve;var ge,be,ye,_e,Ne,ke,xe,we,Ce,Re,Ee,Se,Oe,Te,Pe,Le,Ae,Ie,Be,je,De,ze,Ue,Me,qe,He,Fe,Ye,Ve,Ge,$e,We,Qe,Xe,Ke,Je,et,tt,at,nt,it,st,ot,rt,lt;function ct(){return(0,o.Z)("div",{className:"modal-dialog modal-lg",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,ge||(ge=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("markup help","Formatting help"))),(0,o.Z)("div",{className:"modal-body formatting-help"},void 0,(0,o.Z)("h4",{},void 0,pgettext("markup help","Emphasis text")),(0,o.Z)(ut,{markup:pgettext("markup help","_This text will have emphasis_"),result:(0,o.Z)("p",{},void 0,(0,o.Z)("em",{},void 0,pgettext("markup help","This text will have emphasis")))}),be||(be=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Bold text")),(0,o.Z)(ut,{markup:pgettext("markup help","**This text will be bold**"),result:(0,o.Z)("p",{},void 0,(0,o.Z)("strong",{},void 0,pgettext("markup help","This text will be bold")))}),ye||(ye=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Removed text")),(0,o.Z)(ut,{markup:pgettext("markup help","~~This text will be removed~~"),result:(0,o.Z)("p",{},void 0,(0,o.Z)("del",{},void 0,pgettext("markup help","This text will be removed")))}),_e||(_e=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Bold text (BBCode)")),(0,o.Z)(ut,{markup:pgettext("markup help","[b]This text will be bold[/b]"),result:(0,o.Z)("p",{},void 0,(0,o.Z)("b",{},void 0,pgettext("markup help","This text will be bold")))}),Ne||(Ne=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Underlined text (BBCode)")),(0,o.Z)(ut,{markup:pgettext("markup help","[u]This text will be underlined[/u]"),result:(0,o.Z)("p",{},void 0,(0,o.Z)("u",{},void 0,pgettext("markup help","This text will be underlined")))}),ke||(ke=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Italics text (BBCode)")),(0,o.Z)(ut,{markup:pgettext("markup help","[i]This text will be in italics[/i]"),result:(0,o.Z)("p",{},void 0,(0,o.Z)("i",{},void 0,pgettext("markup help","This text will be in italics")))}),xe||(xe=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Link")),we||(we=(0,o.Z)(ut,{markup:"",result:(0,o.Z)("p",{},void 0,(0,o.Z)("a",{href:"#"},void 0,"example.com"))})),Ce||(Ce=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Link with text")),(0,o.Z)(ut,{markup:"["+pgettext("markup help","Link text")+"](http://example.com)",result:(0,o.Z)("p",{},void 0,(0,o.Z)("a",{href:"#"},void 0,pgettext("markup help","Link text")))}),Re||(Re=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Link (BBCode)")),Ee||(Ee=(0,o.Z)(ut,{markup:"[url]http://example.com[/url]",result:(0,o.Z)("p",{},void 0,(0,o.Z)("a",{href:"#"},void 0,"example.com"))})),Se||(Se=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Link with text (BBCode)")),(0,o.Z)(ut,{markup:"[url=http://example.com]"+pgettext("markup help","Link text")+"[/url]",result:(0,o.Z)("p",{},void 0,(0,o.Z)("a",{href:"#"},void 0,pgettext("markup help","Link text")))}),Oe||(Oe=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Image")),Te||(Te=(0,o.Z)(ut,{markup:"!(http://dummyimage.com/38/38)",result:(0,o.Z)("p",{},void 0,(0,o.Z)("img",{alt:"",src:"http://dummyimage.com/38/38"}))})),Pe||(Pe=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Image with alternate text")),(0,o.Z)(ut,{markup:"!["+pgettext("markup help","Image text")+"](http://dummyimage.com/38/38)",result:(0,o.Z)("p",{},void 0,(0,o.Z)("img",{alt:pgettext("markup help","Image text"),src:"http://dummyimage.com/38/38"}))}),Le||(Le=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Image (BBCode)")),Ae||(Ae=(0,o.Z)(ut,{markup:"[img]http://dummyimage.com/38/38[/img]",result:(0,o.Z)("p",{},void 0,(0,o.Z)("img",{alt:"",src:"http://dummyimage.com/38/38"}))})),Ie||(Ie=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Mention user by their name")),Be||(Be=(0,o.Z)(ut,{markup:"@username",result:(0,o.Z)("p",{},void 0,(0,o.Z)("a",{href:"#"},void 0,"@username"))})),je||(je=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Heading 1")),(0,o.Z)(ut,{markup:pgettext("markup help","# First level heading"),result:(0,o.Z)("h1",{},void 0,pgettext("markup help","First level heading"))}),De||(De=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Heading 2")),(0,o.Z)(ut,{markup:pgettext("markup help","## Second level heading"),result:(0,o.Z)("h2",{},void 0,pgettext("markup help","Second level heading"))}),ze||(ze=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Heading 3")),(0,o.Z)(ut,{markup:pgettext("markup help","### Third level heading"),result:(0,o.Z)("h3",{},void 0,pgettext("markup help","Third level heading"))}),Ue||(Ue=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Heading 4")),(0,o.Z)(ut,{markup:pgettext("markup help","#### Fourth level heading"),result:(0,o.Z)("h4",{},void 0,pgettext("markup help","Fourth level heading"))}),Me||(Me=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Heading 5")),(0,o.Z)(ut,{markup:pgettext("markup help","##### Fifth level heading"),result:(0,o.Z)("h5",{},void 0,pgettext("markup help","Fifth level heading"))}),qe||(qe=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Unordered list")),He||(He=(0,o.Z)(ut,{markup:"- Lorem ipsum\n- Dolor met\n- Vulputate lectus",result:(0,o.Z)("ul",{},void 0,(0,o.Z)("li",{},void 0,"Lorem ipsum"),(0,o.Z)("li",{},void 0,"Dolor met"),(0,o.Z)("li",{},void 0,"Vulputate lectus"))})),Fe||(Fe=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Ordered list")),Ye||(Ye=(0,o.Z)(ut,{markup:"1. Lorem ipsum\n2. Dolor met\n3. Vulputate lectus",result:(0,o.Z)("ol",{},void 0,(0,o.Z)("li",{},void 0,"Lorem ipsum"),(0,o.Z)("li",{},void 0,"Dolor met"),(0,o.Z)("li",{},void 0,"Vulputate lectus"))})),Ve||(Ve=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Quote text")),(0,o.Z)(ut,{markup:"> "+pgettext("markup help","Quoted text"),result:(0,o.Z)("blockquote",{},void 0,(0,o.Z)("p",{},void 0,pgettext("markup help","Quoted text")))}),Ge||(Ge=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Quote text (BBCode)")),(0,o.Z)(ut,{markup:"[quote]\n"+pgettext("markup help","Quoted text")+"\n[/quote]",result:(0,o.Z)("aside",{className:"quote-block"},void 0,(0,o.Z)("div",{className:"quote-heading"},void 0,gettext("Quoted message:")),(0,o.Z)("blockquote",{className:"quote-body"},void 0,(0,o.Z)("p",{},void 0,pgettext("markup help","Quoted text"))))}),$e||($e=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Quote text with author (BBCode)")),(0,o.Z)(ut,{markup:'[quote="'+pgettext("markup help","Quote author")+'"]\n'+pgettext("markup help","Quoted text")+"\n[/quote]",result:(0,o.Z)("aside",{className:"quote-block"},void 0,(0,o.Z)("div",{className:"quote-heading"},void 0,pgettext("markup help","Quote author has written:")),(0,o.Z)("blockquote",{className:"quote-body"},void 0,(0,o.Z)("p",{},void 0,pgettext("markup help","Quoted text"))))}),We||(We=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Spoiler")),(0,o.Z)(ut,{markup:"[spoiler]\n"+pgettext("markup help","Secret text")+"\n[/spoiler]",result:(0,o.Z)(pt,{},void 0,pgettext("markup help","Secret text"))}),Qe||(Qe=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Inline code")),(0,o.Z)(ut,{markup:pgettext("markup help","`Inline code`"),result:(0,o.Z)("p",{},void 0,(0,o.Z)("code",{},void 0,pgettext("markup help","Inline code")))}),Xe||(Xe=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Code block")),Ke||(Ke=(0,o.Z)(ut,{markup:'```\nalert("Hello world!");\n```',result:(0,o.Z)("pre",{},void 0,(0,o.Z)("code",{className:"hljs"},void 0,'alert("Hello world!");'))})),Je||(Je=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Code block with syntax highlighting")),et||(et=(0,o.Z)(ut,{markup:'```python\nprint("Hello world!");\n```',result:(0,o.Z)("pre",{},void 0,(0,o.Z)("code",{className:"hljs language-python"},void 0,(0,o.Z)("span",{className:"hljs-built_in"},void 0,"print"),'("Hello world!");'))})),tt||(tt=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Code block (BBCode)")),at||(at=(0,o.Z)(ut,{markup:'[code]\nalert("Hello world!");\n[/code]',result:(0,o.Z)("pre",{},void 0,(0,o.Z)("code",{className:"hljs"},void 0,'alert("Hello world!");'))})),nt||(nt=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Code block with syntax highlighting (BBCode)")),it||(it=(0,o.Z)(ut,{markup:'[code="python"]\nprint("Hello world!");\n[/code]',result:(0,o.Z)("pre",{},void 0,(0,o.Z)("code",{className:"hljs language-python"},void 0,(0,o.Z)("span",{className:"hljs-built_in"},void 0,"print"),'("Hello world!");'))})),st||(st=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Horizontal rule")),ot||(ot=(0,o.Z)(ut,{markup:"Lorem ipsum\n- - -\nDolor met",result:(0,o.Z)("div",{},void 0,(0,o.Z)("p",{},void 0,"Lorem ipsum"),(0,o.Z)("hr",{}),(0,o.Z)("p",{},void 0,"Dolor met"))})),rt||(rt=(0,o.Z)("hr",{})),(0,o.Z)("h4",{},void 0,pgettext("markup help","Horizontal rule (BBCode)")),lt||(lt=(0,o.Z)(ut,{markup:"Lorem ipsum\n[hr]\nDolor met",result:(0,o.Z)("div",{},void 0,(0,o.Z)("p",{},void 0,"Lorem ipsum"),(0,o.Z)("hr",{}),(0,o.Z)("p",{},void 0,"Dolor met"))}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("modal","Close")))))}function ut(e){var t=e.markup,a=e.result;return(0,o.Z)("div",{className:"formatting-help-item"},void 0,(0,o.Z)("div",{className:"formatting-help-item-markup"},void 0,(0,o.Z)("pre",{},void 0,(0,o.Z)("code",{},void 0,t))),(0,o.Z)("div",{className:"formatting-help-item-preview"},void 0,(0,o.Z)("article",{className:"misago-markup"},void 0,a)))}var dt,pt=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,l.Z)(this,i),(t=n.call(this,e)).state={reveal:!1},t}return(0,r.Z)(i,[{key:"render",value:function(){var e=this;return(0,o.Z)("aside",{className:this.state.reveal?"spoiler-block revealed":"spoiler-block"},void 0,(0,o.Z)("blockquote",{className:"spoiler-body"},void 0,(0,o.Z)("p",{},void 0,this.props.children)),!this.state.reveal&&(0,o.Z)("div",{className:"spoiler-overlay"},void 0,(0,o.Z)("button",{className:"spoiler-reveal",type:"button",onClick:function(){e.setState({reveal:!0})}},void 0,gettext("Reveal spoiler"))))}}]),i}(s().Component),ht=new RegExp("^(((ftps?)|(https?))://)","i");function mt(e){return ht.test(e.trim())}const vt=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;(0,l.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"handleSubmit",(function(e){e.preventDefault();var a=t.props,n=a.selection,i=a.update,s=t.state.text.trim(),o=t.state.url.trim();return 0===o.length?(t.setState({error:gettext("This field is required.")}),!1):(s.length>0?ie(n,i,"!["+s+"]("+o+")"):ie(n,i,"!("+o+")"),Q.Z.hide(),!1)}));var a=e.selection.text.trim(),s=mt(a);return t.state={error:null,text:s?"":a,url:s?a:""},t}return(0,r.Z)(i,[{key:"render",value:function(){var e=this;return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,dt||(dt=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("markup editor","Image"))),(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(me.Z,{for:"markup_image_text",label:pgettext("markup editor","Image description"),helpText:pgettext("markup editor","Optional but recommended . Will be displayed instead of image when it fails to load.")},void 0,(0,o.Z)("input",{id:"markup_image_text",className:"form-control",type:"text",value:this.state.text,onChange:function(t){return e.setState({text:t.target.value})}})),(0,o.Z)(me.Z,{for:"markup_image_url",label:pgettext("markup editor","Image URL"),validation:this.state.error?[this.state.error]:void 0},void 0,(0,o.Z)("input",{id:"markup_image_url",className:"form-control",type:"text",value:this.state.url,placeholder:"http://domain.com/image.png",onChange:function(t){return e.setState({url:t.target.value})}}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("markup editor","Cancel")),(0,o.Z)("button",{className:"btn btn-primary"},void 0,pgettext("markup editor","Insert image"))))))}}]),i}(s().Component);var ft;const Zt=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;(0,l.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"handleSubmit",(function(e){e.preventDefault();var a=t.props,n=a.selection,i=a.update,s=t.state.text.trim(),o=t.state.url.trim();return 0===o.length?(t.setState({error:gettext("This field is required.")}),!1):(s.length>0?ie(n,i,"["+s+"]("+o+")"):ie(n,i,"<"+o+">"),Q.Z.hide(),!1)}));var a=e.selection.text.trim(),s=mt(a);return t.state={error:null,text:s?"":a,url:s?a:""},t}return(0,r.Z)(i,[{key:"render",value:function(){var e=this;return(0,o.Z)("div",{className:"modal-dialog",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,ft||(ft=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("markup editor","Link"))),(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(me.Z,{for:"markup_link_url",label:pgettext("markup editor","Link text"),helpText:pgettext("markup editor","Optional. Will be displayed instead of link's address.")},void 0,(0,o.Z)("input",{id:"markup_link_text",className:"form-control",type:"text",value:this.state.text,onChange:function(t){return e.setState({text:t.target.value})}})),(0,o.Z)(me.Z,{for:"markup_link_url",label:pgettext("markup editor","Link address"),validation:this.state.error?[this.state.error]:void 0},void 0,(0,o.Z)("input",{id:"markup_link_url",className:"form-control",type:"text",value:this.state.url,onChange:function(t){return e.setState({url:t.target.value})}}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("markup editor","Cancel")),(0,o.Z)("button",{className:"btn btn-primary"},void 0,pgettext("markup editor","Insert link"))))))}}]),i}(s().Component);var gt;const bt=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,l.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"handleSubmit",(function(e){e.preventDefault();var a=t.props,n=a.selection,i=a.update,s=t.state.author.trim(),o=t.state.text.trim();if(0===o.length)return t.setState({error:gettext("This field is required.")}),!1;var r=n.prefix.trim().length?"\n\n":"";return ie(n,i,s?r+'[quote="'+s+'"]\n'+o+"\n[/quote]\n\n":r+"[quote]\n"+o+"\n[/quote]\n\n"),Q.Z.hide(),!1})),t.state={error:null,author:"",text:e.selection.text},t}return(0,r.Z)(i,[{key:"render",value:function(){var e=this;return(0,o.Z)("div",{className:"modal-dialog modal-lg",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,gt||(gt=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("markup editor","Quote"))),(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(me.Z,{for:"markup_quote_author",label:pgettext("markup editor","Quote's author or source"),helpText:pgettext("markup editor",'Optional. If it\'s username, put "@" before it ("@JohnDoe").')},void 0,(0,o.Z)("input",{id:"markup_quote_author",className:"form-control",type:"text",value:this.state.author,onChange:function(t){return e.setState({author:t.target.value})}})),(0,o.Z)(me.Z,{for:"markup_quote_text",label:pgettext("markup editor","Quoted text"),validation:this.state.error?[this.state.error]:void 0},void 0,(0,o.Z)("textarea",{id:"markup_quote_text",className:"form-control",rows:"8",value:this.state.text,onChange:function(t){return e.setState({text:t.target.value})}}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-default","data-dismiss":"modal",type:"button"},void 0,pgettext("markup editor","Cancel")),(0,o.Z)("button",{className:"btn btn-primary"},void 0,pgettext("markup editor","Insert quote"))))))}}]),i}(s().Component),yt=function(e){var t=e.disabled,a=e.icon,n=e.title,i=e.onClick;return(0,o.Z)("button",{className:"btn btn-markup-editor",title:n,type:"button",disabled:t,onClick:i},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,a))};var _t=a(54031);const Nt=function(e,t){var a=1024*$.Z.get("user").acl.max_attachment_size;if(e.size>a)Y.Z.error(interpolate(pgettext("markup editor","File %(filename)s is bigger than %(limit)s."),{filename:e.name,limit:(0,X.Z)(a)},!0));else{var n={id:null,key:(0,_t.ZP)(32),error:null,uploaded_on:null,progress:0,filename:e.name,filetype:null,is_image:!1,size:e.size,url:null,uploader_name:null};t((function(e){var t=e.attachments;return{attachments:[n].concat(t)}}));var i=function(){t((function(e){return{attachments:e.attachments.concat()}}))},s=new FormData;s.append("upload",e),F.Z.upload($.Z.get("ATTACHMENTS_API"),s,(function(e){n.progress=e,i()})).then((function(e){Object.assign(n,e,{uploaded_on:U()(e.uploaded_on)}),i()}),(function(e){400===e.status||413===e.status?(n.error=e.detail,Y.Z.error(e.detail),i()):Y.Z.apiError(e)}))}};var kt,xt;const wt=function(e){var t=e.disabled,a=e.element,n=e.update,i=e.updateAttachments,s=[{name:pgettext("markup editor","Strong"),icon:"format_bold",onClick:function(){ne(se(a),n,"**","**",pgettext("example markup","Strong text"))}},{name:pgettext("markup editor","Emphasis"),icon:"format_italic",onClick:function(){ne(se(a),n,"*","*",pgettext("example markup","Text with emphasis"))}},{name:pgettext("markup editor","Strikethrough"),icon:"format_strikethrough",onClick:function(){ne(se(a),n,"~~","~~",pgettext("example markup","Text with strikethrough"))}},{name:pgettext("markup editor","Horizontal ruler"),icon:"remove",onClick:function(){ie(se(a),n,"\n\n- - -\n\n")}},{name:pgettext("markup editor","Link"),icon:"insert_link",onClick:function(){var e=se(a);Q.Z.show((0,o.Z)(Zt,{selection:e,element:a,update:n}))}},{name:pgettext("markup editor","Image"),icon:"insert_photo",onClick:function(){var e=se(a);Q.Z.show((0,o.Z)(vt,{selection:e,element:a,update:n}))}},{name:pgettext("markup editor","Quote"),icon:"format_quote",onClick:function(){var e=se(a);Q.Z.show((0,o.Z)(bt,{selection:e,element:a,update:n}))}},{name:pgettext("markup editor","Spoiler"),icon:"visibility_off",onClick:function(){!function(e,t){var a=se(e),n=a.prefix.trim().length?"\n\n":"";ne(a,t,n+"[spoiler]\n","\n[/spoiler]\n\n",pgettext("markup editor","Spoiler text"))}(a,n)}},{name:pgettext("markup editor","Code"),icon:"code",onClick:function(){var e=se(a);Q.Z.show((0,o.Z)(Ze,{selection:e,element:a,update:n}))}}];return $.Z.get("user").acl.max_attachment_size&&s.push({name:pgettext("markup editor","Upload file"),icon:"file_upload",onClick:function(){return e=i,(t=document.createElement("input")).type="file",t.multiple="multiple",t.addEventListener("change",(function(){for(var a=0;a${username}',insertTpl:"@${username}",searchKey:"username",callbacks:{remoteFilter:function(e,t){Ct.getJSON($.Z.get("MENTION_API"),{q:e},t)}}}),Ct(t).on("inserted.atwho",(function(t,a,n,i){var s=i.query,o=n.target.innerText.trim(),r=t.target.value.substr(0,s.headPos),l=t.target.value.substr(s.endPos);t.target.value=r+o+l,e.onChange(t);var c=s.headPos+o.length;t.target.setSelectionRange(c,c),t.target.focus()}))}(t.props,e))},onChange:t.props.onChange,onDrop:t.onDrop,onFocus:function(){return t.setState({focused:!0})},onPaste:t.onPaste,onBlur:function(){return t.setState({focused:!1})}}),t.props.attachments.length>0&&(0,o.Z)(ce,{attachments:t.props.attachments,disabled:t.props.disabled||t.state.preview,element:t.state.element,setState:t.props.onAttachmentsChange,update:function(e){return t.props.onChange({target:{value:e}})}}),(0,o.Z)(pe,{preview:t.state.preview,canProtect:t.props.canProtect,isProtected:t.props.isProtected,disabled:t.props.disabled,empty:t.props.value.trim().length<$.Z.get("SETTINGS").post_length_min||t.state.loading,enableProtection:t.props.enableProtection,disableProtection:t.props.disableProtection,showPreview:t.showPreview,closePreview:t.closePreview,submitText:t.props.submitText}))})),t.state={element:null,focused:!1,loading:!1,preview:!1,parsed:null},t}return(0,r.Z)(i)}(s().Component);var Et=a(92490);var St="posting-active",Ot="posting-default",Tt="posting-minimized",Pt="posting-fullscreen";const Lt=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(){return(0,l.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"componentDidMount",value:function(){document.body.classList.add(St,Ot)}},{key:"componentWillUnmount",value:function(){document.body.classList.remove(St,Ot,Tt,Pt)}},{key:"componentWillReceiveProps",value:function(e){var t=e.fullscreen;e.minimized?(document.body.classList.remove(Ot,Pt),document.body.classList.add(Tt)):t?(document.body.classList.remove(Ot,Tt),document.body.classList.add(Pt)):(document.body.classList.remove(Pt,Tt),document.body.classList.add(Ot))}},{key:"render",value:function(){var e=this.props,t=e.children,a=e.fullscreen,n=e.minimized;return(0,o.Z)("div",{className:G()("posting-dialog",{"posting-dialog-minimized":n,"posting-dialog-fullscreen":a&&!n})},void 0,(0,o.Z)("div",{className:"posting-dialog-container"},void 0,t))}}]),i}(s().Component),At=function(e){var t=e.children;return(0,o.Z)("div",{className:"posting-dialog-body"},void 0,t)};var It;const Bt=function(e){var t=e.close,a=e.message;return(0,o.Z)("div",{className:"posting-dialog-error"},void 0,It||(It=(0,o.Z)("div",{className:"posting-dialog-error-icon"},void 0,(0,o.Z)("span",{className:"material-icon"},void 0,"error_outlined"))),(0,o.Z)("div",{className:"posting-dialog-error-detail"},void 0,(0,o.Z)("p",{},void 0,a),(0,o.Z)("button",{type:"button",className:"btn btn-default",onClick:t},void 0,pgettext("modal","Close"))))};var jt,Dt,zt,Ut,Mt;const qt=function(e){var t=e.children,a=e.close,n=e.fullscreen,i=e.minimize,s=e.minimized,r=e.fullscreenEnter,l=e.fullscreenExit,c=e.open;return(0,o.Z)("div",{className:"posting-dialog-header"},void 0,(0,o.Z)("div",{className:"posting-dialog-caption"},void 0,t),s?(0,o.Z)("button",{className:"btn btn-posting-dialog",title:pgettext("dialog","Open"),type:"button",onClick:c},void 0,jt||(jt=(0,o.Z)("span",{className:"material-icon"},void 0,"expand_less"))):(0,o.Z)("button",{className:"btn btn-posting-dialog",title:pgettext("dialog","Minimize"),type:"button",onClick:i},void 0,Dt||(Dt=(0,o.Z)("span",{className:"material-icon"},void 0,"expand_more"))),n?(0,o.Z)("button",{className:"btn btn-posting-dialog hidden-xs",title:pgettext("dialog","Exit the fullscreen mode"),type:"button",onClick:l},void 0,zt||(zt=(0,o.Z)("span",{className:"material-icon"},void 0,"fullscreen_exit"))):(0,o.Z)("button",{className:"btn btn-posting-dialog hidden-xs",title:pgettext("dialog","Enter the fullscreen mode"),type:"button",onClick:r},void 0,Ut||(Ut=(0,o.Z)("span",{className:"material-icon"},void 0,"fullscreen"))),(0,o.Z)("button",{className:"btn btn-posting-dialog",title:pgettext("dialog","Cancel"),type:"button",onClick:a},void 0,Mt||(Mt=(0,o.Z)("span",{className:"material-icon"},void 0,"close"))))};var Ht,Ft,Yt,Vt,Gt,$t,Wt,Qt,Xt;function Kt(e){var t=e.isClosed,a=e.isHidden,n=e.isPinned,i=e.disabled,s=e.options,r=e.close,l=e.open,c=e.hide,u=e.unhide,d=e.pinGlobally,p=e.pinLocally,h=e.unpin,m=function(e,t,a){var n=[];return 2===a&&n.push("bookmark"),1===a&&n.push("bookmark_outline"),e&&n.push("lock"),t&&n.push("visibility_off"),n}(t,a,n);return(0,o.Z)("div",{className:"dropdown"},void 0,(0,o.Z)("button",{className:"btn btn-default btn-outline btn-icon",title:pgettext("post thread","Options"),"aria-expanded":"true","aria-haspopup":"true","data-toggle":"dropdown",type:"button",disabled:i},void 0,m.length>0?(0,o.Z)("span",{className:"btn-icons-family"},void 0,m.map((function(e){return(0,o.Z)("span",{className:"material-icon"},e,e)}))):Ht||(Ht=(0,o.Z)("span",{className:"material-icon"},void 0,"more_horiz"))),(0,o.Z)("ul",{className:"dropdown-menu dropdown-menu-right stick-to-bottom"},void 0,2===s.pin&&2!==n&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:d,type:"button",disabled:i},void 0,Ft||(Ft=(0,o.Z)("span",{className:"material-icon"},void 0,"bookmark")),pgettext("post thread","Pinned globally"))),s.pin>=n&&1!==n&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:p,type:"button",disabled:i},void 0,Yt||(Yt=(0,o.Z)("span",{className:"material-icon"},void 0,"bookmark_outline")),pgettext("post thread","Pinned in category"))),s.pin>=n&&0!==n&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:h,type:"button",disabled:i},void 0,Vt||(Vt=(0,o.Z)("span",{className:"material-icon"},void 0,"radio_button_unchecked")),pgettext("post thread","Not pinned"))),s.close&&!!t&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:l,type:"button",disabled:i},void 0,Gt||(Gt=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),pgettext("post thread","Open"))),s.close&&!t&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:r,type:"button",disabled:i},void 0,$t||($t=(0,o.Z)("span",{className:"material-icon"},void 0,"lock")),pgettext("post thread","Closed"))),s.hide&&!!a&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:u,type:"button",disabled:i},void 0,Wt||(Wt=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility")),pgettext("post thread","Visible"))),s.hide&&!a&&(0,o.Z)("li",{},void 0,(0,o.Z)("button",{className:"btn btn-link",onClick:c,type:"button",disabled:i},void 0,Qt||(Qt=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),pgettext("post thread","Hidden")))))}var Jt=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,l.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"loadSuccess",(function(e){var a=null,n=null,i=e.map((function(e){return!1===e.post||a&&e.id!=t.state.category||(a=e.id,n=e.post),Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id})}));t.setState({isReady:!0,options:n,categories:i,category:a})})),(0,h.Z)((0,c.Z)(t),"loadError",(function(e){t.setState({error:e.detail})})),(0,h.Z)((0,c.Z)(t),"onCancel",(function(){if(0===t.state.post.length&&0===t.state.title.length&&0===t.state.attachments.length)return t.minimize(),m.Z.close();window.confirm(pgettext("post thread","Are you sure you want to discard thread?"))&&(t.minimize(),m.Z.close())})),(0,h.Z)((0,c.Z)(t),"onTitleChange",(function(e){t.changeValue("title",e.target.value)})),(0,h.Z)((0,c.Z)(t),"onCategoryChange",(function(e){var a=t.state.categories.find((function(t){return e.target.value==t.value})),n=t.state.pin;a.post.pin&&a.post.pin0}));return t.filter((function(e,a){return t.indexOf(e)==a}))}var aa=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;(0,l.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"onCancel",(function(){if(0===t.state.post.length&&0===t.state.title.length&&0===t.state.to.length&&0===t.state.attachments.length)return t.close();window.confirm(pgettext("post thread","Are you sure you want to discard private thread?"))&&t.close()})),(0,h.Z)((0,c.Z)(t),"onToChange",(function(e){t.changeValue("to",e.target.value)})),(0,h.Z)((0,c.Z)(t),"onTitleChange",(function(e){t.changeValue("title",e.target.value)})),(0,h.Z)((0,c.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,h.Z)((0,c.Z)(t),"onAttachmentsChange",(function(e){t.setState(e)})),(0,h.Z)((0,c.Z)(t),"close",(function(){t.minimize(),m.Z.close()})),(0,h.Z)((0,c.Z)(t),"minimize",(function(){t.setState({fullscreen:!1,minimized:!0})})),(0,h.Z)((0,c.Z)(t),"open",(function(){t.setState({minimized:!1}),t.state.fullscreen})),(0,h.Z)((0,c.Z)(t),"fullscreenEnter",(function(){t.setState({fullscreen:!0,minimized:!1})})),(0,h.Z)((0,c.Z)(t),"fullscreenExit",(function(){t.setState({fullscreen:!1,minimized:!1})}));var a=(e.to||[]).map((function(e){return e.username})).join(", ");return t.state={isLoading:!1,error:null,minimized:!1,fullscreen:!1,to:a,title:"",post:"",attachments:[],validators:{title:(0,H.jn)(),post:(0,H.Jh)()},errors:{}},t}return(0,r.Z)(i,[{key:"clean",value:function(){if(!ta(this.state.to).length)return Y.Z.error(pgettext("posting form","You have to enter at least one recipient.")),!1;if(!this.state.title.trim().length)return Y.Z.error(pgettext("posting form","You have to enter thread title.")),!1;if(!this.state.post.trim().length)return Y.Z.error(pgettext("posting form","You have to enter a message.")),!1;var e=this.validate();return e.title?(Y.Z.error(e.title[0]),!1):!e.post||(Y.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return F.Z.post(this.props.submit,{to:ta(this.state.to),title:this.state.title,post:this.state.post,attachments:M(this.state.attachments)})}},{key:"handleSuccess",value:function(e){this.setState({isLoading:!0}),this.close(),Y.Z.success(pgettext("post thread","Your thread has been posted.")),window.location=e.url}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.to||[],e.title||[],e.post||[],e.attachments||[]);Y.Z.error(t[0])}else Y.Z.apiError(e)}},{key:"render",value:function(){var e={minimized:this.state.minimized,minimize:this.minimize,open:this.open,fullscreen:this.state.fullscreen,fullscreenEnter:this.fullscreenEnter,fullscreenExit:this.fullscreenExit,close:this.onCancel};return s().createElement(na,e,(0,o.Z)("form",{className:"posting-dialog-form",onSubmit:this.handleSubmit},void 0,(0,o.Z)(Et.o8,{className:"posting-dialog-toolbar"},void 0,(0,o.Z)(Et.Z2,{className:"posting-dialog-thread-recipients",auto:!0},void 0,(0,o.Z)(Et.Eg,{auto:!0},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onToChange,placeholder:pgettext("post thread","Recipients, eg.: Danny, Lisa, Alice"),type:"text",value:this.state.to}))),(0,o.Z)(Et.Z2,{className:"posting-dialog-thread-title",auto:!0},void 0,(0,o.Z)(Et.Eg,{auto:!0},void 0,(0,o.Z)("input",{className:"form-control",disabled:this.state.isLoading,onChange:this.onTitleChange,placeholder:pgettext("post thread","Thread title"),type:"text",value:this.state.title})))),(0,o.Z)(Rt,{attachments:this.state.attachments,value:this.state.post,submitText:pgettext("post thread submit","Start thread"),disabled:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onChange:this.onPostChange})))}}]),i}(D.Z),na=function(e){var t=e.children,a=e.close,n=e.minimized,i=e.minimize,s=e.open,r=e.fullscreen,l=e.fullscreenEnter,c=e.fullscreenExit;return(0,o.Z)(Lt,{fullscreen:r,minimized:n},void 0,(0,o.Z)(qt,{fullscreen:r,fullscreenEnter:l,fullscreenExit:c,minimized:n,minimize:i,open:s,close:a},void 0,pgettext("post thread","Start private thread")),(0,o.Z)(At,{},void 0,t))};var ia=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,l.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"loadSuccess",(function(e){t.setState({isReady:!0,post:e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]":t.state.post}),t.quoteText=e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]":t.state.post})),(0,h.Z)((0,c.Z)(t),"loadError",(function(e){t.setState({error:e.detail})})),(0,h.Z)((0,c.Z)(t),"appendData",(function(e){var a=e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]\n\n":"";t.setState((function(e,t){return e.post.length>0?{post:e.post.trim()+"\n\n"+a}:{post:a}})),t.open()})),(0,h.Z)((0,c.Z)(t),"onCancel",(function(){if(t.state.post===t.quoteText&&0===t.state.attachments.length)return t.close();window.confirm(pgettext("post reply","Are you sure you want to discard your reply?"))&&t.close()})),(0,h.Z)((0,c.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,h.Z)((0,c.Z)(t),"onAttachmentsChange",(function(e){t.setState(e)})),(0,h.Z)((0,c.Z)(t),"onQuote",(function(e){t.setState((function(t){var a=t.post;return a.length>0?{post:a.trim()+"\n\n"+e}:{post:e}})),t.open()})),(0,h.Z)((0,c.Z)(t),"close",(function(){t.minimize(),m.Z.close()})),(0,h.Z)((0,c.Z)(t),"minimize",(function(){t.setState({fullscreen:!1,minimized:!0})})),(0,h.Z)((0,c.Z)(t),"open",(function(){t.setState({minimized:!1}),t.state.fullscreen})),(0,h.Z)((0,c.Z)(t),"fullscreenEnter",(function(){t.setState({fullscreen:!0,minimized:!1})})),(0,h.Z)((0,c.Z)(t),"fullscreenExit",(function(){t.setState({fullscreen:!1,minimized:!1})})),t.state={isReady:!1,isLoading:!1,error:null,minimized:!1,fullscreen:!1,post:t.props.default||"",attachments:[],validators:{post:(0,H.Jh)()},errors:{}},t.quoteText="",t}return(0,r.Z)(i,[{key:"componentDidMount",value:function(){F.Z.get(this.props.config,this.props.context||null).then(this.loadSuccess,this.loadError),I(!1,this.onQuote)}},{key:"componentWillUnmount",value:function(){B()}},{key:"componentWillReceiveProps",value:function(e){var t=this.props.context,a=e.context;t&&a&&!a.reply||F.Z.get(e.config,e.context||null).then(this.appendData,Y.Z.apiError)}},{key:"clean",value:function(){if(!this.state.post.trim().length)return Y.Z.error(pgettext("posting form","You have to enter a message.")),!1;var e=this.validate();return!e.post||(Y.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return I(!0,this.onQuote),F.Z.post(this.props.submit,{post:this.state.post,attachments:M(this.state.attachments)})}},{key:"handleSuccess",value:function(e){this.setState({isLoading:!0}),this.close(),I(!1,this.onQuote),Y.Z.success(pgettext("post reply","Your reply has been posted.")),window.location=e.url.index}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.post||[],e.attachments||[]);Y.Z.error(t[0])}else Y.Z.apiError(e);I(!1,this.onQuote)}},{key:"render",value:function(){var e={thread:this.props.thread,minimized:this.state.minimized,minimize:this.minimize,open:this.open,fullscreen:this.state.fullscreen,fullscreenEnter:this.fullscreenEnter,fullscreenExit:this.fullscreenExit,close:this.onCancel};return this.state.error?s().createElement(sa,e,(0,o.Z)(Bt,{message:this.state.error,close:this.close})):this.state.isReady?s().createElement(sa,e,(0,o.Z)("form",{className:"posting-dialog-form",method:"POST",onSubmit:this.handleSubmit},void 0,(0,o.Z)(Rt,{attachments:this.state.attachments,value:this.state.post,submitText:pgettext("post reply submit","Post reply"),disabled:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onChange:this.onPostChange}))):s().createElement(sa,e,(0,o.Z)("div",{className:"posting-loading ui-preview"},void 0,(0,o.Z)(Rt,{attachments:[],value:"",submitText:pgettext("post reply submit","Post reply"),disabled:!0,onAttachmentsChange:function(){},onChange:function(){}})))}}]),i}(D.Z),sa=function(e){var t=e.children,a=e.close,n=e.minimized,i=e.minimize,s=e.open,r=e.fullscreen,l=e.fullscreenEnter,c=e.fullscreenExit,u=e.thread;return(0,o.Z)(Lt,{fullscreen:r,minimized:n},void 0,(0,o.Z)(qt,{fullscreen:r,fullscreenEnter:l,fullscreenExit:c,minimized:n,minimize:i,open:s,close:a},void 0,interpolate(pgettext("post reply","Reply to: %(thread)s"),{thread:u.title},!0)),(0,o.Z)(At,{},void 0,t))};var oa=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,l.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"loadSuccess",(function(e){var a;t.originalPost=e.post,t.setState({isReady:!0,post:e.post,attachments:(a=e.attachments,a.map((function(e){return Object.assign({},e,{uploaded_on:U()(e.uploaded_on)})}))),protect:e.is_protected,canProtect:e.can_protect})})),(0,h.Z)((0,c.Z)(t),"loadError",(function(e){t.setState({error:e.detail})})),(0,h.Z)((0,c.Z)(t),"appendData",(function(e){var a=e.post?'[quote="@'+e.poster+'"]\n'+e.post+"\n[/quote]\n\n":"";t.setState((function(e,t){return e.post.length>0?{post:e.post.trim()+"\n\n"+a}:{post:a}})),t.open()})),(0,h.Z)((0,c.Z)(t),"onCancel",(function(){var e=t.state.originalPost===t.state.post,a=0===t.state.attachments.length;if(e&&a)return t.close();window.confirm(pgettext("edit reply","Are you sure you want to discard changes?"))&&t.close()})),(0,h.Z)((0,c.Z)(t),"onProtect",(function(){t.setState({protect:!0})})),(0,h.Z)((0,c.Z)(t),"onUnprotect",(function(){t.setState({protect:!1})})),(0,h.Z)((0,c.Z)(t),"onPostChange",(function(e){t.changeValue("post",e.target.value)})),(0,h.Z)((0,c.Z)(t),"onAttachmentsChange",(function(e){t.setState(e)})),(0,h.Z)((0,c.Z)(t),"onQuote",(function(e){t.setState((function(t){var a=t.post;return a.length>0?{post:a.trim()+"\n\n"+e}:{post:e}})),t.open()})),(0,h.Z)((0,c.Z)(t),"close",(function(){t.minimize(),m.Z.close()})),(0,h.Z)((0,c.Z)(t),"minimize",(function(){t.setState({fullscreen:!1,minimized:!0})})),(0,h.Z)((0,c.Z)(t),"open",(function(){t.setState({minimized:!1}),t.state.fullscreen})),(0,h.Z)((0,c.Z)(t),"fullscreenEnter",(function(){t.setState({fullscreen:!0,minimized:!1})})),(0,h.Z)((0,c.Z)(t),"fullscreenExit",(function(){t.setState({fullscreen:!1,minimized:!1})})),t.state={isReady:!1,isLoading:!1,error:!1,minimized:!1,fullscreen:!1,post:"",attachments:[],protect:!1,canProtect:!1,validators:{post:(0,H.Jh)()},errors:{}},t.originalPost="",t}return(0,r.Z)(i,[{key:"componentDidMount",value:function(){F.Z.get(this.props.config).then(this.loadSuccess,this.loadError),I(!1,this.onQuote)}},{key:"componentWillUnmount",value:function(){B()}},{key:"componentWillReceiveProps",value:function(e){var t=this.props.context,a=e.context;t&&a&&t.reply===a.reply||F.Z.get(e.config,e.context||null).then(this.appendData,Y.Z.apiError)}},{key:"clean",value:function(){if(!this.state.post.trim().length)return Y.Z.error(pgettext("posting form","You have to enter a message.")),!1;var e=this.validate();return!e.post||(Y.Z.error(e.post[0]),!1)}},{key:"send",value:function(){return I(!0,this.onQuote),F.Z.put(this.props.submit,{post:this.state.post,attachments:M(this.state.attachments),protect:this.state.protect})}},{key:"handleSuccess",value:function(e){this.setState({isLoading:!0}),this.close(),I(!1,this.onQuote),Y.Z.success(pgettext("edit reply","Reply has been edited.")),window.location=e.url.index}},{key:"handleError",value:function(e){if(400===e.status){var t=[].concat(e.non_field_errors||[],e.category||[],e.title||[],e.post||[],e.attachments||[]);Y.Z.error(t[0])}else Y.Z.apiError(e);I(!1,this.onQuote)}},{key:"render",value:function(){var e=this,t={post:this.props.post,minimized:this.state.minimized,minimize:this.minimize,open:this.open,fullscreen:this.state.fullscreen,fullscreenEnter:this.fullscreenEnter,fullscreenExit:this.fullscreenExit,close:this.onCancel};return this.state.error?s().createElement(ra,t,(0,o.Z)(Bt,{message:this.state.error,close:this.close})):this.state.isReady?s().createElement(ra,t,(0,o.Z)("form",{className:"posting-dialog-form",method:"POST",onSubmit:this.handleSubmit},void 0,(0,o.Z)(Rt,{attachments:this.state.attachments,canProtect:this.state.canProtect,isProtected:this.state.protect,enableProtection:function(){return e.setState({protect:!0})},disableProtection:function(){return e.setState({protect:!1})},value:this.state.post,submitText:pgettext("edit reply submit","Edit reply"),disabled:this.state.isLoading,onAttachmentsChange:this.onAttachmentsChange,onChange:this.onPostChange}))):s().createElement(ra,t,(0,o.Z)("div",{className:"posting-loading ui-preview"},void 0,(0,o.Z)(Rt,{attachments:[],value:"",submitText:pgettext("edit reply submit","Edit reply"),disabled:!0,onAttachmentsChange:function(){},onChange:function(){}})))}}]),i}(D.Z),ra=function(e){var t=e.children,a=e.close,n=e.minimized,i=e.minimize,s=e.open,r=e.fullscreen,l=e.fullscreenEnter,c=e.fullscreenExit,u=e.post;return(0,o.Z)(Lt,{fullscreen:r,minimized:n},void 0,(0,o.Z)(qt,{fullscreen:r,fullscreenEnter:l,fullscreenExit:c,minimized:n,minimize:i,open:s,close:a},void 0,interpolate(pgettext("edit reply","Edit reply by %(poster)s from %(date)s"),{poster:u.poster?u.poster.username:u.poster_name,date:u.posted_on.fromNow()},!0)),(0,o.Z)(At,{},void 0,t))};function la(e){switch(e.mode){case"START":return s().createElement(Jt,e);case"START_PRIVATE":return s().createElement(aa,e);case"REPLY":return s().createElement(ia,e);case"EDIT":return s().createElement(oa,e);default:return null}}},12891:(e,t,a)=>{"use strict";a.d(t,{Jh:()=>o,jn:()=>s});var n=a(55210),i=a(99170);function s(){return[(0,n.Ei)(i.Z.get("SETTINGS").thread_title_length_min,(function(e,t){var a=npgettext("thread title length validator","Thread title should be at least %(limit_value)s character long (it has %(show_value)s).","Thread title should be at least %(limit_value)s characters long (it has %(show_value)s).",e);return interpolate(a,{limit_value:e,show_value:t},!0)})),(0,n.BS)(i.Z.get("SETTINGS").thread_title_length_max,(function(e,t){var a=npgettext("thread title length validator","Thread title cannot be longer than %(limit_value)s character (it has %(show_value)s).","Thread title cannot be longer than %(limit_value)s characters (it has %(show_value)s).",e);return interpolate(a,{limit_value:e,show_value:t},!0)}))]}function o(){return i.Z.get("SETTINGS").post_length_max?[r(),(0,n.BS)(i.Z.get("SETTINGS").post_length_max||1e6,(function(e,t){var a=npgettext("post length validator","Posted message cannot be longer than %(limit_value)s character (it has %(show_value)s).","Posted message cannot be longer than %(limit_value)s characters (it has %(show_value)s).",e);return interpolate(a,{limit_value:e,show_value:t},!0)}))]:[r()]}function r(){return(0,n.Ei)(i.Z.get("SETTINGS").post_length_min,(function(e,t){var a=npgettext("post length validator","Posted message should be at least %(limit_value)s character long (it has %(show_value)s).","Posted message should be at least %(limit_value)s characters long (it has %(show_value)s).",e);return interpolate(a,{limit_value:e,show_value:t},!0)}))}},60471:(e,t,a)=>{"use strict";a.d(t,{Z:()=>p});var n=a(22928),i=a(15671),s=a(43144),o=a(97326),r=a(79340),l=a(6215),c=a(61120),u=a(4942),d=a(57588);var p=function(e){(0,r.Z)(p,e);var t,a,d=(t=p,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function p(){var e;(0,i.Z)(this,p);for(var t=arguments.length,a=new Array(t),n=0;n{"use strict";a.d(t,{Z:()=>b});var n,i=a(22928),s=a(15671),o=a(43144),r=a(79340),l=a(6215),c=a(61120),u=(a(57588),a(99170)),d=a(82211),p=a(43345),h=a(47235),m=a(78657),v=a(59801),f=a(53904),Z=a(93051),g=a(19755);var b=function(e){(0,r.Z)(b,e);var t,a,p=(t=b,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function b(e){var t;return(0,s.Z)(this,b),(t=p.call(this,e)).state={isLoading:!1,showActivation:!1,username:"",password:"",validators:{username:[],password:[]}},t}return(0,o.Z)(b,[{key:"clean",value:function(){return!!this.isValid()||(f.Z.error(pgettext("sign in modal","Fill out both fields.")),!1)}},{key:"send",value:function(){return m.Z.post(u.Z.get("AUTH_API"),{username:this.state.username,password:this.state.password})}},{key:"handleSuccess",value:function(){var e=g("#hidden-login-form");e.append(''),e.append(''),e.find('input[type="hidden"]').val(m.Z.getCsrfToken()),e.find('input[name="redirect_to"]').val(window.location.pathname),e.find('input[name="username"]').val(this.state.username),e.find('input[name="password"]').val(this.state.password),e.submit(),this.setState({isLoading:!0})}},{key:"handleError",value:function(e){400===e.status?"inactive_admin"===e.code?f.Z.info(e.detail):"inactive_user"===e.code?(f.Z.info(e.detail),this.setState({showActivation:!0})):"banned"===e.code?((0,Z.Z)(e.detail),v.Z.hide()):f.Z.error(e.detail):403===e.status&&e.ban?((0,Z.Z)(e.ban),v.Z.hide()):f.Z.apiError(e)}},{key:"getActivationButton",value:function(){return this.state.showActivation?(0,i.Z)("a",{className:"btn btn-success btn-block",href:u.Z.get("REQUEST_ACTIVATION_URL")},void 0,pgettext("sign in modal btn","Activate account")):null}},{key:"render",value:function(){return(0,i.Z)("div",{className:"modal-dialog modal-sm modal-sign-in",role:"document"},void 0,(0,i.Z)("div",{className:"modal-content"},void 0,(0,i.Z)("div",{className:"modal-header"},void 0,(0,i.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,n||(n=(0,i.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,i.Z)("h4",{className:"modal-title"},void 0,pgettext("sign in modal title","Sign in"))),(0,i.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,i.Z)("div",{className:"modal-body"},void 0,(0,i.Z)(h.Z,{buttonLabel:pgettext("sign in modal","Sign in with %(site)s"),formLabel:pgettext("sign in modal","Or use your forum account:"),labelClassName:"text-center"}),(0,i.Z)("div",{className:"form-group"},void 0,(0,i.Z)("div",{className:"control-input"},void 0,(0,i.Z)("input",{className:"form-control input-lg",disabled:this.state.isLoading,id:"id_username",onChange:this.bindInput("username"),placeholder:pgettext("sign in modal field","Username or e-mail"),type:"text",value:this.state.username}))),(0,i.Z)("div",{className:"form-group"},void 0,(0,i.Z)("div",{className:"control-input"},void 0,(0,i.Z)("input",{className:"form-control input-lg",disabled:this.state.isLoading,id:"id_password",onChange:this.bindInput("password"),placeholder:pgettext("sign in modal field","Password"),type:"password",value:this.state.password})))),(0,i.Z)("div",{className:"modal-footer"},void 0,this.getActivationButton(),(0,i.Z)(d.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,pgettext("sign in modal btn","Sign in")),(0,i.Z)("a",{className:"btn btn-default btn-block",href:u.Z.get("FORGOTTEN_PASSWORD_URL")},void 0,pgettext("sign in modal btn","Forgot password?"))))))}}]),b}(p.Z)},24678:(e,t,a)=>{"use strict";a.d(t,{Jj:()=>h,ZP:()=>p,pg:()=>m});var n=a(22928),i=a(15671),s=a(43144),o=a(79340),r=a(6215),l=a(61120),c=a(57588),u=a.n(c);function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=(0,l.Z)(e);if(t){var i=(0,l.Z)(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return(0,r.Z)(this,a)}}var p=function(e){(0,o.Z)(a,e);var t=d(a);function a(){return(0,i.Z)(this,a),t.apply(this,arguments)}return(0,s.Z)(a,[{key:"getClass",value:function(){return e=this.props.status,t="",e.is_banned?t="banned":e.is_hidden?t="offline":e.is_online_hidden?t="online":e.is_offline_hidden?t="offline":e.is_online?t="online":e.is_offline&&(t="offline"),"user-status user-"+t;var e,t}},{key:"render",value:function(){return(0,n.Z)("span",{className:this.getClass()},void 0,this.props.children)}}]),a}(u().Component),h=function(e){(0,o.Z)(a,e);var t=d(a);function a(){return(0,i.Z)(this,a),t.apply(this,arguments)}return(0,s.Z)(a,[{key:"getIcon",value:function(){return this.props.status.is_banned?"remove_circle_outline":this.props.status.is_hidden?"help_outline":this.props.status.is_online_hidden?"label":this.props.status.is_offline_hidden?"label_outline":this.props.status.is_online?"lens":this.props.status.is_offline?"panorama_fish_eye":void 0}},{key:"render",value:function(){return(0,n.Z)("span",{className:"material-icon status-icon"},void 0,this.getIcon())}}]),a}(u().Component),m=function(e){(0,o.Z)(a,e);var t=d(a);function a(){return(0,i.Z)(this,a),t.apply(this,arguments)}return(0,s.Z)(a,[{key:"getHelp",value:function(){return e=this.props.user,(t=this.props.status).is_banned?t.banned_until?interpolate(pgettext("user status","%(username)s is banned until %(ban_expires)s"),{username:e.username,ban_expires:t.banned_until.format("LL, LT")},!0):interpolate(pgettext("user status","%(username)s is banned"),{username:e.username},!0):t.is_hidden?interpolate(pgettext("user status","%(username)s is hiding presence"),{username:e.username},!0):t.is_online_hidden?interpolate(pgettext("user status","%(username)s is online (hidden)"),{username:e.username},!0):t.is_offline_hidden?interpolate(pgettext("user status","%(username)s was last seen %(last_click)s (hidden)"),{username:e.username,last_click:t.last_click.fromNow()},!0):t.is_online?interpolate(pgettext("user status","%(username)s is online"),{username:e.username},!0):t.is_offline?interpolate(pgettext("user status","%(username)s was last seen %(last_click)s"),{username:e.username,last_click:t.last_click.fromNow()},!0):void 0;var e,t}},{key:"getLabel",value:function(){return this.props.status.is_banned?pgettext("user status","Banned"):this.props.status.is_hidden?pgettext("user status","Hidden"):this.props.status.is_online_hidden?pgettext("user status","Online (hidden)"):this.props.status.is_offline_hidden?pgettext("user status","Offline (hidden)"):this.props.status.is_online?pgettext("user status","Online"):this.props.status.is_offline?pgettext("user status","Offline"):void 0}},{key:"render",value:function(){return(0,n.Z)("span",{className:this.props.className||"status-label",title:this.getHelp()},void 0,this.getLabel())}}]),a}(u().Component)},40429:(e,t,a)=>{"use strict";a.d(t,{Z:()=>O});var n,i=a(22928),s=a(57588),o=a.n(s),r=a(19605),l=a(24678);function c(e){var t=e.showStatus,a=e.user;return(0,i.Z)("ul",{className:"list-unstyled"},void 0,(0,i.Z)(u,{showStatus:t,user:a}),(0,i.Z)(d,{user:a}),n||(n=(0,i.Z)("li",{className:"user-stat-divider"})),(0,i.Z)(p,{user:a}),(0,i.Z)(h,{user:a}),(0,i.Z)(m,{user:a}))}function u(e){var t=e.showStatus,a=e.user;return t?(0,i.Z)("li",{className:"user-stat-status"},void 0,(0,i.Z)(l.ZP,{status:a.status},void 0,(0,i.Z)(l.pg,{status:a.status,user:a}))):null}function d(e){var t=e.user.joined_on,a=interpolate(pgettext("users list item","Joined on %(joined_on)s"),{joined_on:t.format("LL, LT")},!0),n=interpolate(pgettext("users list item","Joined %(joined_on)s"),{joined_on:t.fromNow()},!0);return(0,i.Z)("li",{className:"user-stat-join-date"},void 0,(0,i.Z)("abbr",{title:a},void 0,n))}function p(e){var t=e.user,a=v("user-stat-posts",t.posts),n=npgettext("users list item","%(posts)s post","%(posts)s posts",t.posts);return(0,i.Z)("li",{className:a},void 0,interpolate(n,{posts:t.posts},!0))}function h(e){var t=e.user,a=v("user-stat-threads",t.threads),n=npgettext("users list item","%(threads)s thread","%(threads)s threads",t.threads);return(0,i.Z)("li",{className:a},void 0,interpolate(n,{threads:t.threads},!0))}function m(e){var t=e.user,a=v("user-stat-followers",t.followers),n=npgettext("users list item","%(followers)s follower","%(followers)s followers",t.followers);return(0,i.Z)("li",{className:a},void 0,interpolate(n,{followers:t.followers},!0))}function v(e,t){return 0===t?e+" user-stat-empty":e}function f(e){var t=e.rank,a=e.title||t.title||t.name,n="user-title";return t.css_class&&(n+=" user-title-"+t.css_class),t.is_tab?(0,i.Z)("a",{className:n,href:t.url},void 0,a):(0,i.Z)("span",{className:n},void 0,a)}function Z(e){var t=e.showStatus,a=e.user,n=a.rank,s="panel user-card";return n.css_class&&(s+=" user-card-"+n.css_class),(0,i.Z)("div",{className:s},void 0,(0,i.Z)("div",{className:"panel-body"},void 0,(0,i.Z)("div",{className:"row"},void 0,(0,i.Z)("div",{className:"col-xs-3 user-card-left"},void 0,(0,i.Z)("div",{className:"user-card-small-avatar"},void 0,(0,i.Z)("a",{href:a.url},void 0,(0,i.Z)(r.ZP,{size:"50",size2x:"80",user:a})))),(0,i.Z)("div",{className:"col-xs-9 col-sm-12 user-card-body"},void 0,(0,i.Z)("div",{className:"user-card-avatar"},void 0,(0,i.Z)("a",{href:a.url},void 0,(0,i.Z)(r.ZP,{size:"150",size2x:"200",user:a}))),(0,i.Z)("div",{className:"user-card-username"},void 0,(0,i.Z)("a",{href:a.url},void 0,a.username)),(0,i.Z)("div",{className:"user-card-title"},void 0,(0,i.Z)(f,{rank:n,title:a.title})),(0,i.Z)("div",{className:"user-card-stats"},void 0,(0,i.Z)(c,{showStatus:t,user:a}))))))}var g,b,y,_=a(15671),N=a(43144),k=a(79340),x=a(6215),w=a(61120),C=a(44039);var R,E=function(e){(0,k.Z)(s,e);var t,a,n=(t=s,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,w.Z)(t);if(a){var i=(0,w.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,x.Z)(this,e)});function s(){return(0,_.Z)(this,s),n.apply(this,arguments)}return(0,N.Z)(s,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){return(0,i.Z)("div",{className:"panel user-card user-card-preview"},void 0,(0,i.Z)("div",{className:"panel-body"},void 0,(0,i.Z)("div",{className:"row"},void 0,g||(g=(0,i.Z)("div",{className:"col-xs-3 user-card-left"},void 0,(0,i.Z)("div",{className:"user-card-small-avatar"},void 0,(0,i.Z)("span",{},void 0,(0,i.Z)(r.ZP,{size:"50",size2x:"80"}))))),(0,i.Z)("div",{className:"col-xs-9 col-sm-12 user-card-body"},void 0,b||(b=(0,i.Z)("div",{className:"user-card-avatar"},void 0,(0,i.Z)("span",{},void 0,(0,i.Z)(r.ZP,{size:"150",size2x:"200"})))),(0,i.Z)("div",{className:"user-card-username"},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:C.e(60,150)+"px"}},void 0," ")),(0,i.Z)("div",{className:"user-card-title"},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:C.e(60,150)+"px"}},void 0," ")),(0,i.Z)("div",{className:"user-card-stats"},void 0,(0,i.Z)("ul",{className:"list-unstyled"},void 0,(0,i.Z)("li",{},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:C.e(30,70)+"px"}},void 0," ")),(0,i.Z)("li",{},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:C.e(30,70)+"px"}},void 0," ")),y||(y=(0,i.Z)("li",{className:"user-stat-divider"})),(0,i.Z)("li",{},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:C.e(30,70)+"px"}},void 0," ")),(0,i.Z)("li",{},void 0,(0,i.Z)("span",{className:"ui-preview-text",style:{width:C.e(30,70)+"px"}},void 0," "))))))))}}]),s}(o().Component);function S(e){var t=e.colClassName,a=e.cols,n=Array.apply(null,{length:a}).map(Number.call,Number);return(0,i.Z)("div",{className:"users-cards-list ui-preview"},void 0,(0,i.Z)("div",{className:"row"},void 0,n.map((function(e){var a=t;return 0!==e&&(a+=" hidden-xs"),3===e&&(a+=" hidden-sm"),(0,i.Z)("div",{className:a},e,R||(R=(0,i.Z)(E,{})))}))))}function O(e){var t=e.cols,a=e.isReady,n=e.showStatus,s=e.users,o="col-xs-12 col-sm-4";return 4===t&&(o+=" col-md-3"),a?(0,i.Z)("div",{className:"users-cards-list ui-ready"},void 0,(0,i.Z)("div",{className:"row"},void 0,s.map((function(e){return(0,i.Z)("div",{className:o},e.id,(0,i.Z)(Z,{showStatus:n,user:e}))})))):(0,i.Z)(S,{colClassName:o,cols:t})}},82125:(e,t,a)=>{"use strict";a.d(t,{Z:()=>d});var n=a(15671),i=a(43144),s=a(97326),o=a(79340),r=a(6215),l=a(61120),c=a(4942),u=a(57588);var d=function(e){(0,o.Z)(d,e);var t,a,u=(t=d,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,l.Z)(t);if(a){var i=(0,l.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,r.Z)(this,e)});function d(e){var t;return(0,n.Z)(this,d),t=u.call(this,e),(0,c.Z)((0,s.Z)(t),"toggleNav",(function(){t.setState({dropdown:!t.state.dropdown})})),(0,c.Z)((0,s.Z)(t),"hideNav",(function(){t.setState({dropdown:!1})})),t.state={dropdown:!1},t}return(0,i.Z)(d,[{key:"getCompactNavClassName",value:function(){return this.state.dropdown?"compact-nav open":"compact-nav"}}]),d}(a.n(u)().Component)},7227:(e,t,a)=>{"use strict";a.d(t,{Z:()=>p});var n=a(22928),i=a(15671),s=a(43144),o=a(97326),r=a(79340),l=a(6215),c=a(61120),u=a(4942),d=a(57588);var p=function(e){(0,r.Z)(p,e);var t,a,d=(t=p,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,c.Z)(t);if(a){var i=(0,c.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,l.Z)(this,e)});function p(){var e;(0,i.Z)(this,p);for(var t=arguments.length,a=new Array(t),n=0;n{"use strict";a.d(t,{LN:()=>N,lY:()=>k,ry:()=>f});var n=window.misago_locale||"en-us",i=pgettext("time ago","moment ago"),s=pgettext("time ago","now"),o=pgettext("day at time","%(day)s at %(time)s"),r=pgettext("day at time","at %(time)s"),l=pgettext("day at time","Tomorrow at %(time)s"),c=pgettext("day at time","Yesterday at %(time)s"),u=pgettext("short minutes","%(time)sm"),d=pgettext("short hours","%(time)sh"),p=pgettext("short days","%(time)sd"),h=pgettext("short month","%(day)s %(month)s"),m=pgettext("short month","%(month)s %(year)s"),v=new Intl.RelativeTimeFormat(n,{numeric:"always",style:"long"}),f=new Intl.DateTimeFormat(n,{dateStyle:"full",timeStyle:"medium"}),Z=new Intl.DateTimeFormat(n,{month:"long",day:"numeric"}),g=new Intl.DateTimeFormat(n,{year:"numeric",month:"long",day:"numeric"}),b=new Intl.DateTimeFormat(n,{year:"2-digit",month:"short",day:"numeric"}),y=new Intl.DateTimeFormat(n,{weekday:"long"}),_=new Intl.DateTimeFormat(n,{timeStyle:"short"});function N(e){var t=new Date,a=Math.abs(Math.round((e-t)/1e3));if(a<60)return s;if(a<3300){var n=Math.ceil(a/60);return u.replace("%(time)s",n)}if(a<86400){var i=Math.ceil(a/3600);return d.replace("%(time)s",i)}if(a<604800){var o=Math.ceil(a/86400);return p.replace("%(time)s",o)}var r={};return b.formatToParts(e).forEach((function(e){var t=e.type,a=e.value;r[t]=a})),e.getFullYear()===t.getFullYear()?h.replace("%(day)s",r.day).replace("%(month)s",r.month):m.replace("%(year)s",r.year).replace("%(month)s",r.month)}function k(e){var t=new Date,a=Math.round((e-t)/1e3),n=Math.abs(a),s=a<1?-1:1;if(n<90)return i;if(n<2820){var u=Math.ceil(n/60)*s;return v.format(u,"minute")}if(n<10800){var d=Math.ceil(n/3600)*s;return v.format(d,"hour")}return x(t,e)?a>0?r.replace("%(time)s",_.format(e)):_.format(e):function(e){var t=new Date;return t.setDate(t.getDate()-1),x(t,e)}(e)?c.replace("%(time)s",_.format(e)):function(e){var t=new Date;return t.setDate(t.getDate()+1),x(t,e)}(e)?l.replace("%(time)s",_.format(e)):a<0&&n<518400?function(e,t){return o.replace("%(day)s",e).replace("%(time)s",_.format(t))}(y.format(e),e):t.getFullYear()==e.getFullYear()?Z.format(e):g.format(e)}function x(e,t){return e.getFullYear()==t.getFullYear()&&e.getMonth()==t.getMonth()&&e.getDate()==t.getDate()}},99170:(e,t,a)=>{"use strict";a.d(t,{Z:()=>B});var n=a(15671),i=a(43144),s=(a(58294),a(95377),a(68852),a(39737),a(14316),a(43204),a(7023),a(94028)),o=a.n(s);const r=function(){function e(t){(0,n.Z)(this,e),this.isOrdered=!1,this._items=t||[]}return(0,i.Z)(e,[{key:"add",value:function(e,t,a){this._items.push({key:e,item:t,after:a&&a.after||null,before:a&&a.before||null})}},{key:"get",value:function(e,t){for(var a=0;a0&&t.length!==n.length;)s-=1,e.forEach(i);return a}}]),e}();var l=a(4942);function c(e){var t=e.closest("[hx-silent]");return!t||"true"!==t.getAttribute("hx-silent")}const u=(0,i.Z)((function e(){var t=this;(0,n.Z)(this,e),(0,l.Z)(this,"show",(function(){t.requests+=1,t.update()})),(0,l.Z)(this,"hide",(function(){t.requests&&(t.requests-=1,t.update())})),(0,l.Z)(this,"update",(function(){t.timeout&&window.clearTimeout(t.timeout),t.requests?(t.element.classList.add("busy"),t.element.classList.remove("complete")):(t.element.classList.remove("busy"),t.element.classList.add("complete"),t.timeout=setTimeout((function(){t.element.classList.remove("complete")}),1500))})),this.element=document.getElementById("misago-ajax-loader"),this.requests=0,this.timeout=null}));var d=a(19755);const p=(0,i.Z)((function e(t){var a=this;(0,n.Z)(this,e),(0,l.Z)(this,"registerActions",(function(){a.actions.forEach((function(e){"remove-selection"===e.getAttribute("moderation-action")?e.addEventListener("click",a.onRemoveSelection):e.addEventListener("click",a.onAction)}))})),(0,l.Z)(this,"onAction",(function(e){var t=document.querySelector(a.form),n={};new FormData(t).forEach((function(e,t){void 0===n[t]&&(n[t]=[]),n[t].push(e)}));var i=e.target;n.moderation=i.getAttribute("moderation-action"),"true"===i.getAttribute("moderation-multistage")?o().ajax("POST",document.location.href,{target:a.modal,swap:"innerHTML",values:n}).then((function(){d(a.modal).modal("show")})):o().ajax("POST",document.location.href,{target:"#misago-htmx-root",swap:"outerHTML",values:n})})),(0,l.Z)(this,"onRemoveSelection",(function(e){document.querySelectorAll(a.selection).forEach((function(e){e.checked=!1})),a.update()})),(0,l.Z)(this,"registerEvents",(function(){document.body.addEventListener("click",(function(e){var t=e.target;"INPUT"===t.tagName&&"checkbox"===t.type&&a.update()})),o().onLoad((function(){return a.update()}))})),(0,l.Z)(this,"update",(function(){var e=document.querySelectorAll(a.selection).length;a.control.innerText=a.text.replace("%(number)s",e),a.control.disabled=!e,a.menu&&(e?a.menu.classList.add("visible"):a.menu.classList.remove("visible"))})),this.menu=t.menu?document.querySelector(t.menu):null,this.form=t.form,this.modal=t.modal,this.actions=document.querySelectorAll(t.actions),this.selection=t.selection,this.control=document.querySelector(t.button.selector),this.text=t.button.text,this.update(),this.registerEvents(),this.registerActions()}));var h=a(15861),m=a(64687),v=a.n(m),f={};function Z(e){if(!e.getAttribute("misago-validate-active")){var t=e.getAttribute("misago-validate"),a=e.getAttribute("misago-validate-user"),n="false"!=e.getAttribute("misago-validate-strip"),i=e.querySelector("input"),s=i.closest("form").querySelector("input[type=hidden]");if(t&&i){f[t]||(f[t]={}),e.setAttribute("misago-validate-active","true");var o=null;i.addEventListener("keyup",(function(r){var l=r.target.value;n&&(l=l.trim()),0!==l.trim().length?f[t][l]?g(e,i,f[t][l]):(o&&window.clearTimeout(o),o=window.setTimeout((0,h.Z)(v().mark((function n(){var o,r;return v().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,y(t,s,l,a);case 2:o=n.sent,r=o.errors,f[t][l]=r,g(e,i,r);case 6:case"end":return n.stop()}}),n)}))),1e3)):function(e){e.classList.remove("has-error"),e.classList.remove("has-success"),b(e)}(e)}))}}}function g(e,t,a){a.length?function(e,t,a){e.classList.remove("has-success"),e.classList.add("has-error"),b(e),a.forEach((function(e){var a=document.createElement("p");a.className="help-block",a.setAttribute("misago-dynamic-message","true"),a.innerText=e,t.after(a)}))}(e,t,a):function(e){e.classList.remove("has-error"),e.classList.add("has-success"),b(e)}(e)}function b(e){e.querySelectorAll("[misago-dynamic-message]").forEach((function(e){return e.remove()}))}function y(e,t,a,n){return _.apply(this,arguments)}function _(){return(_=(0,h.Z)(v().mark((function e(t,a,n,i){var s,o;return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(s=new FormData).set(a.name,a.value),s.set("value",n),i&&s.set("user",i),e.next=6,fetch(t,{method:"POST",mode:"cors",credentials:"same-origin",body:s});case 6:return o=e.sent,e.next=9,o.json();case 9:return e.abrupt("return",e.sent);case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}o().onLoad((function(e){(e||document).querySelectorAll("[misago-validate]").forEach(Z)}));var N=document.getElementById("misago-snackbars"),k=null;function x(){N.replaceChildren()}function w(){k&&window.clearTimeout(k),N.querySelectorAll(".snackbar").forEach((function(e){e.classList.add("in")})),k=window.setTimeout((function(){N.querySelectorAll(".snackbar").forEach((function(e){e.classList.add("out"),k=window.setTimeout(x,1e3)}))}),6e3)}function C(e,t){x(),k&&window.clearTimeout(k);var a=document.createElement("div");a.classList.add("snackbar"),a.classList.add("snackbar-"+e),a.innerText=t,a.role="alert",N.appendChild(a),k=window.setTimeout(w,100)}function R(e){C("danger",e)}function E(e){var t,a,n=e.detail;return!("true"===(t=n.target,a=t.closest("[hx-silent]"),a?a.getAttribute("hx-silent"):null)&&"get"===n.requestConfig.verb)}o().onLoad(w),document.addEventListener("htmx:responseError",(function(e){E(e)&&R(function(e){if("application/json"===e.getResponseHeader("content-type")){var t=JSON.parse(e.response);if(t.error)return t.error}return 404===e.status?pgettext("htmx response error","Not found"):403===e.status?pgettext("htmx response error","Permission denied"):pgettext("htmx response error","Unexpected error")}(e.detail.xhr))})),document.addEventListener("htmx:sendError",(function(e){E(e)&&R(pgettext("htmx response error","Site could not be reached"))})),document.addEventListener("htmx:timeout",(function(e){E(e)&&R(pgettext("htmx response error","Site took too long to reply"))}));var S=a(35983),O={};function T(e){var t=e.getAttribute("misago-timestamp");O[t]||(O[t]=new Date(t)),e.hasAttribute("title")||e.setAttribute("title",S.ry.format(O[t]));var a=e.getAttribute("misago-timestamp-format");e.textContent="short"==a?(0,S.LN)(O[t]):(0,S.lY)(O[t])}function P(e){(e||document).querySelectorAll("[misago-timestamp]").forEach(T)}document.querySelectorAll("[misago-timestamp]").forEach(T),P(),window.setInterval(P,55e3),o().onLoad(P);var L=a(19755),A=new u,I=new(function(){function e(){(0,n.Z)(this,e),this._initializers=[],this._context={},this.loader=A}return(0,i.Z)(e,[{key:"addInitializer",value:function(e){this._initializers.push({key:e.name,item:e.initializer,after:e.after,before:e.before})}},{key:"init",value:function(e){var t=this;this._context=e,new r(this._initializers).orderedValues().forEach((function(e){e(t)}))}},{key:"has",value:function(e){return!!this._context[e]}},{key:"get",value:function(e,t){return this.has(e)?this._context[e]:t||void 0}},{key:"pop",value:function(e){if(this.has(e)){var t=this._context[e];return this._context[e]=null,t}}},{key:"snackbar",value:function(e,t){C(e,t)}},{key:"snackbarInfo",value:function(e){!function(e){C("info",e)}(e)}},{key:"snackbarSuccess",value:function(e){!function(e){C("success",e)}(e)}},{key:"snackbarWarning",value:function(e){!function(e){C("warning",e)}(e)}},{key:"snackbarError",value:function(e){R(e)}},{key:"bulkModeration",value:function(e){return new p(e)}}]),e}());window.misago=I;const B=I;document.addEventListener("htmx:beforeRequest",(function(e){c(e.target)&&A.show()})),document.addEventListener("htmx:afterRequest",(function(e){c(e.target)&&A.hide()})),document.addEventListener("misago:afterModeration",(function(){L("#threads-moderation-modal").modal("hide")}))},58339:(e,t,a)=>{"use strict";var n=a(99170),i=a(78657);n.Z.addInitializer({name:"ajax",initializer:function(){i.Z.init(n.Z.get("CSRF_COOKIE_NAME"))}})},64109:(e,t,a)=>{"use strict";var n=a(99170),i=a(35486),s=a(78657),o=a(53904),r=a(90287);n.Z.addInitializer({name:"auth-sync",initializer:function(e){e.get("isAuthenticated")&&window.setInterval((function(){s.Z.get(e.get("AUTH_API")).then((function(e){r.Z.dispatch((0,i.r$)(e))}),(function(e){o.Z.apiError(e)}))}),45e3)},after:"auth"})},46226:(e,t,a)=>{"use strict";var n=a(99170),i=a(98274),s=a(59801),o=a(90287),r=a(62833);n.Z.addInitializer({name:"auth",initializer:function(){i.Z.init(o.Z,r.Z,s.Z)},after:"store"})},93240:(e,t,a)=>{"use strict";var n=a(99170),i=a(78657),s=a(93825),o=a(96142),r=a(53904);n.Z.addInitializer({name:"captcha",initializer:function(e){s.ZP.init(e,i.Z,o.Z,r.Z)}})},75147:(e,t,a)=>{"use strict";var n=a(22928),i=a(57588),s=a.n(i),o=a(99170),r=a(15671),l=a(43144),c=a(97326),u=a(79340),d=a(6215),p=a(61120),h=a(4942),m=a(78657);var v=function(e){(0,u.Z)(s,e);var t,a,i=(t=s,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=i.call(this,e),(0,h.Z)((0,c.Z)(t),"handleDecline",(function(){t.state.submiting||window.confirm(pgettext("accept agreement prompt","Declining will result in immediate deactivation and deletion of your account. This action is not reversible."))&&(t.setState({submiting:!0}),m.Z.post(t.props.api,{accept:!1}).then((function(){window.location.reload(!0)})))})),(0,h.Z)((0,c.Z)(t),"handleAccept",(function(){t.state.submiting||(t.setState({submiting:!0}),m.Z.post(t.props.api,{accept:!0}).then((function(){window.location.reload(!0)})))})),t.state={submiting:!1},t}return(0,l.Z)(s,[{key:"render",value:function(){return(0,n.Z)("div",{},void 0,(0,n.Z)("button",{className:"btn btn-default",disabled:this.state.submiting,type:"buton",onClick:this.handleDecline},void 0,pgettext("accept agreement choice","Decline")),(0,n.Z)("button",{className:"btn btn-primary",disabled:this.state.submiting,type:"buton",onClick:this.handleAccept},void 0,pgettext("accept agreement choice","Accept and continue")))}}]),s}(s().Component),f=a(4869);o.Z.addInitializer({name:"component:accept-agreement",initializer:function(e){document.getElementById("required-agreement-mount")&&(0,f.Z)((0,n.Z)(v,{api:e.get("REQUIRED_AGREEMENT_API")}),"required-agreement-mount",!1)},after:"store"})},4894:(e,t,a)=>{"use strict";var n=a(37424),i=a(99170),s=a(22928),o=a(15671),r=a(43144),l=a(79340),c=a(6215),u=a(61120),d=a(57588);var p=function(e){(0,l.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,u.Z)(t);if(a){var i=(0,u.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,c.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"refresh",value:function(){window.location.reload()}},{key:"getMessage",value:function(){return this.props.signedIn?interpolate(pgettext("auth message","You have signed in as %(username)s. Please refresh the page before continuing."),{username:this.props.signedIn.username},!0):this.props.signedOut?interpolate(pgettext("auth message","%(username)s, you have been signed out. Please refresh the page before continuing."),{username:this.props.user.username},!0):void 0}},{key:"render",value:function(){var e="auth-message";return(this.props.signedIn||this.props.signedOut)&&(e+=" show"),(0,s.Z)("div",{className:e},void 0,(0,s.Z)("div",{className:"container"},void 0,(0,s.Z)("p",{className:"lead"},void 0,this.getMessage()),(0,s.Z)("p",{},void 0,(0,s.Z)("button",{className:"btn btn-default",type:"button",onClick:this.refresh},void 0,pgettext("auth message","Reload page")),(0,s.Z)("span",{className:"hidden-xs hidden-sm"},void 0," "+pgettext("auth message","or press F5 key.")))))}}]),i}(a.n(d)().Component);function h(e){return{user:e.auth.user,signedIn:e.auth.signedIn,signedOut:e.auth.signedOut}}var m=a(4869);i.Z.addInitializer({name:"component:auth-message",initializer:function(){(0,m.Z)((0,n.$j)(h)(p),"auth-message-mount")},after:"store"})},29223:(e,t,a)=>{"use strict";var n=a(99170),i=a(93051);n.Z.addInitializer({name:"component:banmed-page",initializer:function(e){e.has("BAN_MESSAGE")&&(0,i.Z)(e.get("BAN_MESSAGE"),!1)},after:"store"})},73806:(e,t,a)=>{"use strict";var n,i=a(22928),s=a(57588),o=a.n(s),r=a(73935),l=a.n(r),c=a(37424),u=a(993),d=a(40689),p=a(80261),h=a(15671),m=a(43144),v=a(79340),f=a(6215),Z=a(61120),g=a(59801),b=a(14467);const y=function(e){(0,v.Z)(o,e);var t,a,s=(t=o,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,Z.Z)(t);if(a){var i=(0,Z.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,f.Z)(this,e)});function o(){return(0,h.Z)(this,o),s.apply(this,arguments)}return(0,m.Z)(o,[{key:"componentDidMount",value:function(){"?modal=login"===window.document.location.search&&window.setTimeout((function(){return g.Z.show(n||(n=(0,i.Z)(b.Z,{})))}),300)}},{key:"render",value:function(){return null}}]),o}(o().Component);function _(e){var t=e.logo,a=e.logoXs,n=e.text,s=e.url;return t?(0,i.Z)("div",{className:"navbar-branding"},void 0,(0,i.Z)("a",{href:s,className:"navbar-branding-logo"},void 0,(0,i.Z)("img",{src:t,alt:n}))):(0,i.Z)("div",{className:"navbar-branding"},void 0,!!a&&(0,i.Z)("a",{href:s,className:"navbar-branding-logo-xs"},void 0,(0,i.Z)("img",{src:a,alt:n})),!!n&&(0,i.Z)("a",{href:s,className:"navbar-branding-text"},void 0,n))}function N(e){var t=e.items;return(0,i.Z)("ul",{className:"navbar-extra-menu",role:"nav"},void 0,t.map((function(e,t){return(0,i.Z)("li",{className:e.className},t,(0,i.Z)("a",{href:e.url,target:e.targetBlank?"_blank":null,rel:e.rel},void 0,e.title))})))}var k,x=a(49021),w=a(97326),C=a(4942),R=a(63026),E=a(66462),S=a(94184),O=a.n(S);function T(e){var t=e.children,a=e.showAll,n=e.showUnread,s=e.unread;return(0,i.Z)("div",{className:"notifications-dropdown-body"},void 0,(0,i.Z)(x.Aw,{},void 0,pgettext("notifications title","Notifications")),(0,i.Z)(x.KE,{},void 0,(0,i.Z)(P,{active:!s,onClick:a},void 0,pgettext("notifications dropdown","All")),(0,i.Z)(P,{active:s,onClick:n},void 0,pgettext("notifications dropdown","Unread"))),t,(0,i.Z)(x.kE,{},void 0,(0,i.Z)("a",{className:"btn btn-default btn-block",href:misago.get("NOTIFICATIONS_URL")},void 0,pgettext("notifications","See all notifications"))))}function P(e){var t=e.active,a=e.children,n=e.onClick;return(0,i.Z)("button",{className:O()("btn",{"btn-primary":t,"btn-default":!t}),type:"button",onClick:n},void 0,a)}const L=function(e){(0,v.Z)(s,e);var t,a,n=(t=s,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,Z.Z)(t);if(a){var i=(0,Z.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,f.Z)(this,e)});function s(e){var t;return(0,h.Z)(this,s),t=n.call(this,e),(0,C.Z)((0,w.Z)(t),"render",(function(){return(0,i.Z)(T,{unread:t.state.unread,showAll:function(){return t.setState({unread:!1})},showUnread:function(){return t.setState({unread:!0})}},void 0,(0,i.Z)(R.Z,{filter:t.state.unread?"unread":"all",disabled:!t.props.active},void 0,(function(e){var a=e.data,n=e.loading,s=e.error;return n?k||(k=(0,i.Z)(E.Pu,{})):s?(0,i.Z)(E.lb,{error:s}):(0,i.Z)(E.uE,{filter:t.state.unread?"unread":"all",items:a?a.results:[]})})))})),t.state={unread:!1,url:""},t}return(0,m.Z)(s,[{key:"getApiUrl",value:function(){return misago.get("NOTIFICATIONS_API")+"?limit=20"+(this.state.unread?"&filter=unread":"")}}]),s}(o().Component);function A(e){var t=e.id,a=e.className,n=e.badge,s=e.url,o=e.active,r=e.onClick,l=n?pgettext("navbar","You have unread notifications!"):pgettext("navbar","Open notifications");return(0,i.Z)("a",{id:t,className:O()("btn btn-navbar-icon",a,{active:o}),href:s,title:l,onClick:r},void 0,!!n&&(0,i.Z)("span",{className:"navbar-item-badge"},void 0,n),(0,i.Z)("span",{className:"material-icon"},void 0,n?"notifications_active":"notifications_none"))}function I(e){var t=e.id,a=e.className,n=e.badge,s=e.url;return(0,i.Z)(x.Lt,{id:t,toggle:function(e){var t=e.isOpen,o=e.toggle;return(0,i.Z)(A,{className:a,active:t,badge:n,url:s,onClick:function(e){e.preventDefault(),o()}})},menuClassName:"notifications-dropdown",menuAlignRight:!0},void 0,(function(e){var t=e.isOpen;return(0,i.Z)(L,{active:t})}))}var B;function j(e){var t=e.id,a=e.className,n=e.badge,s=e.url,o=e.active,r=e.onClick,l=n?pgettext("navbar","You have unread private threads!"):pgettext("navbar","Open private threads");return(0,i.Z)("a",{id:t,className:O()("btn btn-navbar-icon",a,{active:o}),href:s,title:l,onClick:r},void 0,!!n&&(0,i.Z)("span",{className:"navbar-item-badge"},void 0,n),B||(B=(0,i.Z)("span",{className:"material-icon"},void 0,"inbox")))}var D,z,U,M=a(62989);function q(e){var t=e.id,a=e.className,n=e.url,s=e.active,o=e.onClick;return(0,i.Z)("a",{id:t,className:O()("btn btn-navbar-icon",a,{active:s}),href:n,title:pgettext("navbar","Open search"),onClick:o},void 0,D||(D=(0,i.Z)("span",{className:"material-icon"},void 0,"search")))}function H(e){var t=e.id,a=e.className,n=e.url;return(0,i.Z)(x.Lt,{id:t,toggle:function(e){var t=e.isOpen,s=e.toggle;return(0,i.Z)(q,{className:a,active:t,url:n,onClick:function(e){e.preventDefault(),s(),window.setTimeout((function(){document.querySelector(".search-dropdown .form-control-search").focus()}),0)}})},menuClassName:"search-dropdown",menuAlignRight:!0},void 0,(function(){return z||(z=(0,i.Z)(M.E,{}))}))}function F(e){var t=e.id,a=e.className,n=e.active,s=e.onClick;return(0,i.Z)("button",{id:t,className:O()("btn btn-navbar-icon",a,{active:n}),title:pgettext("navbar","Open menu"),type:"button",onClick:s},void 0,U||(U=(0,i.Z)("span",{className:"material-icon"},void 0,"menu")))}var Y=a(6333);function V(e){var t=e.id,a=e.className;return(0,i.Z)(x.Lt,{id:t,toggle:function(e){var t=e.isOpen,n=e.toggle;return(0,i.Z)(F,{className:a,active:t,onClick:n})},menuClassName:"site-nav-dropdown",menuAlignRight:!0},void 0,(function(e){e.isOpen;var t=e.close;return(0,i.Z)(Y.bS,{close:t})}))}var G=a(19605);function $(e){var t=e.id,a=e.className,n=e.user,s=e.active,o=e.onClick;return(0,i.Z)("a",{id:t,className:O()("btn-navbar-image",a,{active:s}),href:n.url,title:pgettext("navbar","Open your options"),onClick:o},void 0,(0,i.Z)(G.ZP,{user:n,size:34}))}var W,Q,X,K,J=a(28166);function ee(e){var t=e.id,a=e.className,n=e.user;return(0,i.Z)(x.Lt,{id:t,toggle:function(e){var t=e.isOpen,s=e.toggle;return(0,i.Z)($,{className:a,active:t,user:n,onClick:function(e){e.preventDefault(),s()}})},menuClassName:"user-nav-dropdown",menuAlignRight:!0},void 0,(function(e){e.isOpen;var t=e.close;return(0,i.Z)(J.o4,{close:t})}))}const te=(0,c.$j)((function(e){var t=misago.get("SETTINGS"),a=e.auth.user;return{branding:{logo:t.logo,logoXs:t.logo_small,text:t.logo_text,url:misago.get("MISAGO_PATH")},extraMenuItems:misago.get("extraMenuItems"),user:a.id?{id:a.id,username:a.username,email:a.email,avatars:a.avatars,unreadNotifications:a.unreadNotifications,unreadPrivateThreads:a.unread_private_threads,url:a.url}:null,searchUrl:misago.get("SEARCH_URL"),notificationsUrl:misago.get("NOTIFICATIONS_URL"),privateThreadsUrl:misago.get("PRIVATE_THREADS_URL"),authDelegated:t.enable_oauth2_client,showSearch:!!a.acl.can_search,showPrivateThreads:!!a&&!!a.acl.can_use_private_threads}}))((function(e){var t=e.dispatch,a=e.branding,n=e.extraMenuItems,s=e.authDelegated,r=e.user,l=e.searchUrl,c=e.notificationsUrl,h=e.privateThreadsUrl,m=e.showSearch,v=e.showPrivateThreads;return(0,i.Z)("div",{className:"container navbar-container"},void 0,o().createElement(_,a),(0,i.Z)("div",{className:"navbar-right"},void 0,n.length>0&&(0,i.Z)(N,{items:n}),!!m&&(0,i.Z)(H,{id:"navbar-search-dropdown",url:l}),!!m&&(0,i.Z)(q,{id:"navbar-search-overlay",url:l,onClick:function(e){t(u.UL()),e.preventDefault()}}),W||(W=(0,i.Z)(V,{id:"navbar-site-nav-dropdown"})),(0,i.Z)(F,{id:"navbar-site-nav-overlay",onClick:function(){t(u.AU())}}),!!v&&(0,i.Z)(j,{id:"navbar-private-threads",badge:r.unreadPrivateThreads,url:h}),!!r&&(0,i.Z)(I,{id:"navbar-notifications-dropdown",badge:r.unreadNotifications,url:c}),!!r&&(0,i.Z)(A,{id:"navbar-notifications-overlay",badge:r.unreadNotifications,url:c,onClick:function(e){t(u.hN()),e.preventDefault()}}),!!r&&(0,i.Z)(ee,{id:"navbar-user-nav-dropdown",user:r}),!!r&&(0,i.Z)($,{id:"navbar-user-nav-overlay",user:r,onClick:function(e){t(u.T5()),e.preventDefault()}}),!r&&(Q||(Q=(0,i.Z)(p.Z,{className:"btn-navbar-sign-in"}))),!r&&!s&&(X||(X=(0,i.Z)(d.Z,{className:"btn-navbar-register"}))),!r&&!s&&(K||(K=(0,i.Z)(y,{})))))}));var ae,ne=a(90287);misago.addInitializer({name:"component:navbar",initializer:function(e){var t=document.getElementById("misago-navbar");l().render((0,i.Z)(c.zt,{store:ne.Z.getStore()},void 0,ae||(ae=(0,i.Z)(te,{}))),t)},after:"store"})},27015:(e,t,a)=>{"use strict";var n,i=a(22928),s=a(57588),o=a.n(s),r=a(73935),l=a.n(r),c=a(37424),u=a(15671),d=a(43144),p=a(97326),h=a(79340),m=a(6215),v=a(61120),f=a(4942),Z=a(63026),g=a(66462),b=a(94184),y=a.n(b),_=a(49021),N=a(64836);function k(e){var t=e.children,a=e.open,n=e.showAll,s=e.showUnread,o=e.unread;return(0,i.Z)(N.a,{open:a},void 0,(0,i.Z)(N.i,{},void 0,pgettext("notifications title","Notifications")),(0,i.Z)(_.KE,{},void 0,(0,i.Z)(x,{active:!o,onClick:n},void 0,pgettext("notifications dropdown","All")),(0,i.Z)(x,{active:o,onClick:s},void 0,pgettext("notifications dropdown","Unread"))),t,(0,i.Z)(_.kE,{},void 0,(0,i.Z)("a",{className:"btn btn-default btn-block",href:misago.get("NOTIFICATIONS_URL")},void 0,pgettext("notifications","See all notifications"))))}function x(e){var t=e.active,a=e.children,n=e.onClick;return(0,i.Z)("button",{className:y()("btn",{"btn-primary":t,"btn-default":!t}),type:"button",onClick:n},void 0,a)}var w=function(e){(0,h.Z)(o,e);var t,a,s=(t=o,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,v.Z)(t);if(a){var i=(0,v.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,m.Z)(this,e)});function o(e){var t;return(0,u.Z)(this,o),t=s.call(this,e),(0,f.Z)((0,p.Z)(t),"render",(function(){return(0,i.Z)(k,{open:t.props.open,unread:t.state.unread,showAll:function(){return t.setState({unread:!1})},showUnread:function(){return t.setState({unread:!0})}},void 0,(0,i.Z)(Z.Z,{filter:t.state.unread?"unread":"all",disabled:!t.props.open},void 0,(function(e){var a=e.data,s=e.loading,o=e.error;return s?n||(n=(0,i.Z)(g.Pu,{})):o?(0,i.Z)(g.lb,{error:o}):(0,i.Z)(g.uE,{filter:t.state.unread?"unread":"all",items:a?a.results:[]})})))})),t.body=document.body,t.state={unread:!1,url:""},t}return(0,d.Z)(o,[{key:"getApiUrl",value:function(){return misago.get("NOTIFICATIONS_API")+"?limit=20"+(this.state.unread?"&filter=unread":"")}},{key:"componentDidUpdate",value:function(e,t){e.open!==this.props.open&&(this.props.open?this.body.classList.add("notifications-fullscreen"):this.body.classList.remove("notifications-fullscreen"))}}]),o}(o().Component);const C=(0,c.$j)((function(e){return{open:e.overlay.notifications}}))(w);var R,E=a(90287);misago.addInitializer({name:"component:notifications-overlay",initializer:function(e){if(e.get("isAuthenticated")){var t=document.getElementById("notifications-mount");l().render((0,i.Z)(c.zt,{store:E.Z.getStore()},void 0,R||(R=(0,i.Z)(C,{}))),t)}},after:"store"})},88097:(e,t,a)=>{"use strict";var n=a(22928),i=a(57588),s=a.n(i),o=a(73935),r=a.n(o),l=a(37424),c=a(69987),u=a(99755);function d(){return(0,n.Z)(u.Iv,{header:pgettext("notifications title","Notifications"),styleName:"notifications"})}var p=a(87462),h=a(15861),m=a(64687),v=a.n(m),f=a(35486),Z=a(53904),g=a(60642),b=a(63026);const y=function(e){var t=e.title,a=e.subtitle,n=[];return a&&n.push(a),t&&n.push(t),n.push(misago.get("SETTINGS").forum_name),document.title=n.join(" | "),null};var _=a(59131),N=a(66462);function k(e){var t=e.children;return(0,n.Z)("ul",{className:"nav nav-pills"},void 0,t)}var x=a(94184),w=a.n(x);function C(e){var t=e.active,a=e.link,i=e.icon,s=e.children;return(0,n.Z)("li",{className:w()({active:t})},void 0,(0,n.Z)(c.rU,{to:a,activeClassName:""},void 0,!!i&&(0,n.Z)("span",{className:"material-icon"},void 0,i),s))}var R=a(92490);function E(e){var t=e.filter,a=misago.get("NOTIFICATIONS_URL");return(0,n.Z)(R.o8,{},void 0,(0,n.Z)(R.Z2,{auto:!0},void 0,(0,n.Z)(R.Eg,{},void 0,(0,n.Z)(k,{},void 0,(0,n.Z)(C,{active:"all"===t,link:a},void 0,pgettext("notifications nav","All")),(0,n.Z)(C,{active:"unread"===t,link:a+"unread/"},void 0,pgettext("notifications nav","Unread")),(0,n.Z)(C,{active:"read"===t,link:a+"read/"},void 0,pgettext("notifications nav","Read"))))))}var S,O,T,P=a(82211);function L(e){var t=e.baseUrl,a=e.data,i=e.disabled;return(0,n.Z)("div",{className:"misago-pagination"},void 0,(0,n.Z)(A,{url:t,disabled:i||!a||!a.hasPrevious},void 0,pgettext("notifications pagination","Latest")),(0,n.Z)(A,{url:t+"?before="+(a?a.firstCursor:""),disabled:i||!a||!a.hasPrevious},void 0,pgettext("notifications pagination","Newer")),(0,n.Z)(A,{url:t+"?after="+(a?a.lastCursor:""),disabled:i||!a||!a.hasNext},void 0,pgettext("notifications pagination","Older")))}function A(e){var t=e.disabled,a=e.children,i=e.url;return t?(0,n.Z)("button",{className:"btn btn-default",type:"disabled",disabled:!0},void 0,a):(0,n.Z)(c.rU,{to:i,className:"btn btn-default",activeClassName:""},void 0,a)}function I(e){var t=e.baseUrl,a=e.data,i=e.disabled,s=e.bottom,o=e.markAllAsRead;return(0,n.Z)(R.o8,{},void 0,(0,n.Z)(R.Z2,{},void 0,(0,n.Z)(R.Eg,{},void 0,(0,n.Z)(L,{baseUrl:t,data:a,disabled:i}))),S||(S=(0,n.Z)(R.tw,{})),(0,n.Z)(R.Z2,{className:w()({"hidden-xs":!s})},void 0,(0,n.Z)(R.Eg,{},void 0,(0,n.Z)(P.Z,{className:"btn-default btn-block",type:"button",disabled:i||!a||!a.unreadNotifications,onClick:o},void 0,O||(O=(0,n.Z)("span",{className:"material-icon"},void 0,"done_all")),pgettext("notifications","Mark all as read")))))}function B(e){return"unread"===e?pgettext("notifications title","Unread notifications"):"read"===e?pgettext("notifications title","Read notifications"):null}const j=(0,l.$j)()((function(e){var t=e.dispatch,a=e.location,i=e.route,o=a.query,r=i.props.filter,l=function(e){var t=misago.get("NOTIFICATIONS_URL");return"all"!==e&&(t+=e+"/"),t}(r);return(0,n.Z)(_.Z,{},void 0,(0,n.Z)(y,{title:pgettext("notifications title","Notifications"),subtitle:B(r)}),(0,n.Z)(E,{filter:r}),(0,n.Z)(b.Z,{filter:r,query:o},void 0,(function(e){var a,i=e.data,c=e.loading,u=e.error,d=e.refetch;return(0,n.Z)(g.D,{url:misago.get("NOTIFICATIONS_API")+"read-all/"},void 0,(function(e,m){var g,b=m.loading,y={baseUrl:l,data:i,disabled:c||b||!i||0===i.results.length,markAllAsRead:(g=(0,h.Z)(v().mark((function a(){return v().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:window.confirm(pgettext("notifications","Mark all notifications as read?"))&&e({onSuccess:function(){var e=(0,h.Z)(v().mark((function e(){return v().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:d(),t((0,f.yH)({unreadNotifications:null})),Z.Z.success(pgettext("notifications","All notifications have been marked as read."));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),onError:Z.Z.apiError});case 2:case"end":return a.stop()}}),a)}))),function(){return g.apply(this,arguments)})};return c||b?(0,n.Z)("div",{},void 0,s().createElement(I,y),T||(T=(0,n.Z)(N.Pu,{})),s().createElement(I,(0,p.Z)({},y,{bottom:!0}))):u?(0,n.Z)("div",{},void 0,s().createElement(I,y),a||(a=(0,n.Z)(N.lb,{error:u})),s().createElement(I,(0,p.Z)({},y,{bottom:!0}))):i?(!i.hasPrevious&&o&&window.history.replaceState({},"",l),(0,n.Z)("div",{},void 0,s().createElement(I,y),(0,n.Z)(N.uE,{filter:r,items:i.results,hasNext:i.hasNext,hasPrevious:i.hasPrevious}),s().createElement(I,(0,p.Z)({},y,{bottom:!0})))):null}))})))}));var D;a(4517);const z=function(){var e=misago.get("NOTIFICATIONS_URL");return(0,n.Z)("div",{className:"page page-notifications"},void 0,D||(D=(0,n.Z)(d,{})),(0,n.Z)(c.F0,{history:c.mW,routes:[{path:e,component:j,props:{filter:"all"}},{path:e+"unread/",component:j,props:{filter:"unread"}},{path:e+"read/",component:j,props:{filter:"read"}}]}))};var U,M=a(90287);misago.addInitializer({name:"component:notifications",initializer:function(e){var t=misago.get("NOTIFICATIONS_URL");if(document.location.pathname.startsWith(t)&&!document.location.pathname.startsWith(t+"disable-email/")&&e.get("isAuthenticated")){var a=document.getElementById("page-mount");r().render((0,n.Z)(l.zt,{store:M.Z.getStore()},void 0,U||(U=(0,n.Z)(z,{}))),a)}},after:"store"})},46016:(e,t,a)=>{"use strict";var n,i=a(37424),s=a(22928),o=a(15671),r=a(43144),l=a(97326),c=a(79340),u=a(6215),d=a(61120),p=a(4942),h=a(57588),m=a.n(h),v=a(30381),f=a.n(v),Z=a(37848);var g,b=function(e){(0,c.Z)(l,e);var t,a,i=(t=l,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function l(){return(0,o.Z)(this,l),i.apply(this,arguments)}return(0,r.Z)(l,[{key:"render",value:function(){return n||(n=(0,s.Z)("div",{className:"panel-body panel-body-loading"},void 0,(0,s.Z)(Z.Z,{className:"loader loader-spaced"})))}}]),l}(m().Component),y=a(33556),_=a(99170),N=a(55547),k=a(53328);var x,w=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(e){var t;return(0,o.Z)(this,i),t=n.call(this,e),(0,p.Z)((0,l.Z)(t),"update",(function(e){e.expires_on&&(e.expires_on=f()(e.expires_on)),t.setState({isLoaded:!0,error:null,ban:e})})),(0,p.Z)((0,l.Z)(t),"error",(function(e){t.setState({isLoaded:!0,error:e.detail,ban:null})})),_.Z.has("PROFILE_BAN")?t.initWithPreloadedData(_.Z.pop("PROFILE_BAN")):t.initWithoutPreloadedData(),t.startPolling(e.profile.api.ban),t}return(0,r.Z)(i,[{key:"initWithPreloadedData",value:function(e){e.expires_on&&(e.expires_on=f()(e.expires_on)),this.state={isLoaded:!0,ban:e}}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1}}},{key:"startPolling",value:function(e){N.Z.start({poll:"ban-details",url:e,frequency:9e4,update:this.update,error:this.error})}},{key:"componentDidMount",value:function(){k.Z.set({title:pgettext("profile ban details title","Ban details"),parent:this.props.profile.username})}},{key:"componentWillUnmount",value:function(){N.Z.stop("ban-details")}},{key:"getUserMessage",value:function(){return this.state.ban.user_message?(0,s.Z)("div",{className:"panel-body ban-message ban-user-message"},void 0,(0,s.Z)("h4",{},void 0,pgettext("profile ban details","User-shown ban message")),(0,s.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.state.ban.user_message.html}})):null}},{key:"getStaffMessage",value:function(){return this.state.ban.staff_message?(0,s.Z)("div",{className:"panel-body ban-message ban-staff-message"},void 0,(0,s.Z)("h4",{},void 0,pgettext("profile ban details","Team-shown ban message")),(0,s.Z)("div",{className:"lead",dangerouslySetInnerHTML:{__html:this.state.ban.staff_message.html}})):null}},{key:"getExpirationMessage",value:function(){if(this.state.ban.expires_on){if(this.state.ban.expires_on.isAfter(f()())){var e=interpolate(pgettext("profile ban details","This ban expires on %(expires_on)s."),{expires_on:this.state.ban.expires_on.format("LL, LT")},!0),t=interpolate(pgettext("profile ban details","This ban expires %(expires_on)s."),{expires_on:this.state.ban.expires_on.fromNow()},!0);return(0,s.Z)("abbr",{title:e},void 0,t)}return pgettext("profile ban details","This ban has expired.")}return interpolate(pgettext("profile ban details","%(username)s's ban is permanent."),{username:this.props.profile.username},!0)}},{key:"getPanelBody",value:function(){return this.state.ban?Object.keys(this.state.ban).length?(0,s.Z)("div",{},void 0,this.getUserMessage(),this.getStaffMessage(),(0,s.Z)("div",{className:"panel-body ban-expires"},void 0,(0,s.Z)("h4",{},void 0,pgettext("profile ban details","Ban expiration")),(0,s.Z)("p",{className:"lead"},void 0,this.getExpirationMessage()))):(0,s.Z)("div",{},void 0,(0,s.Z)(y.Z,{message:pgettext("profile ban details","No ban is active at the moment.")})):this.state.error?(0,s.Z)("div",{},void 0,(0,s.Z)(y.Z,{icon:"error_outline",message:this.state.error})):g||(g=(0,s.Z)("div",{},void 0,(0,s.Z)(b,{})))}},{key:"render",value:function(){return(0,s.Z)("div",{className:"profile-ban-details"},void 0,(0,s.Z)("div",{className:"panel panel-default"},void 0,(0,s.Z)("div",{className:"panel-heading"},void 0,(0,s.Z)("h3",{className:"panel-title"},void 0,pgettext("profile ban details title","Ban details"))),this.getPanelBody()))}}]),i}(m().Component);function C(e){return e.display?(0,s.Z)(y.Z,{helpText:pgettext("user profile details","No profile details are editable at this time."),message:pgettext("user profile details","This option is currently unavailable.")}):null}function R(e){return e.display?x||(x=(0,s.Z)("div",{className:"panel-body"},void 0,(0,s.Z)(Z.Z,{}))):null}var E=a(60471);var S=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){var e;(0,o.Z)(this,i);for(var t=arguments.length,a=new Array(t),s=0;s0&&void 0!==arguments[0]?arguments[0]:0;A.Z.get(this.props.api,{start:t||0}).then((function(a){0===t?ae.Z.dispatch(te.zD(a)):ae.Z.dispatch(te.R3(a)),e.setState({isLoading:!1})}),(function(t){e.setState({isLoading:!1}),I.Z.apiError(t)}))}},{key:"componentDidMount",value:function(){k.Z.set({title:this.props.title,parent:this.props.profile.username}),this.loadItems()}},{key:"render",value:function(){return(0,s.Z)("div",{className:"profile-feed"},void 0,(0,s.Z)($.o8,{},void 0,(0,s.Z)($.Z2,{auto:!0},void 0,(0,s.Z)($.Eg,{auto:!0},void 0,(0,s.Z)("h3",{},void 0,this.props.header)))),m().createElement(se,(0,J.Z)({isLoading:this.state.isLoading,loadMore:this.loadMore},this.props)))}}]),i}(m().Component);function se(e){return e.posts.isLoaded&&!e.posts.results.length?(0,s.Z)("p",{className:"lead"},void 0,e.emptyMessage):(0,s.Z)("div",{},void 0,(0,s.Z)(ee.Z,{isReady:e.posts.isLoaded,posts:e.posts.results,poster:e.profile}),(0,s.Z)(oe,{isLoading:e.isLoading,loadMore:e.loadMore,next:e.posts.next}))}function oe(e){return e.next?(0,s.Z)("div",{className:"pager-more"},void 0,(0,s.Z)(P.Z,{className:"btn btn-default btn-outline",loading:e.isLoading,onClick:e.loadMore},void 0,pgettext("profile load more btn","Show older activity"))):null}var re=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"getClassName",value:function(){return this.props.className?"form-search "+this.props.className:"form-search"}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getClassName()},void 0,(0,s.Z)("input",{type:"text",className:"form-control",value:this.props.value,onChange:this.props.onChange,placeholder:this.props.placeholder||pgettext("quick search placeholder","Search...")}),ne||(ne=(0,s.Z)("span",{className:"material-icon"},void 0,"search")))}}]),i}(m().Component),le=a(40429),ce=a(6935);var ue=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(e){var t;return(0,o.Z)(this,i),t=n.call(this,e),(0,p.Z)((0,l.Z)(t),"loadMore",(function(){t.setState({isBusy:!0}),t.loadUsers(t.state.page+1,t.state.search)})),(0,p.Z)((0,l.Z)(t),"search",(function(e){t.setState({isLoaded:!1,isBusy:!0,search:e.target.value,count:0,more:0,page:1,pages:1}),t.loadUsers(1,e.target.value)})),t.setSpecialProps(),_.Z.has(t.PRELOADED_DATA_KEY)?t.initWithPreloadedData(_.Z.pop(t.PRELOADED_DATA_KEY)):t.initWithoutPreloadedData(),t}return(0,r.Z)(i,[{key:"setSpecialProps",value:function(){this.PRELOADED_DATA_KEY="PROFILE_FOLLOWERS",this.TITLE=pgettext("profile followers title","Followers"),this.API_FILTER="followers"}},{key:"initWithPreloadedData",value:function(e){this.state={isLoaded:!0,isBusy:!1,search:"",count:e.count,more:e.more,page:e.page,pages:e.pages},ae.Z.dispatch((0,ce.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1,isBusy:!1,search:"",count:0,more:0,page:1,pages:1},this.loadUsers()}},{key:"loadUsers",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.props.profile.api[this.API_FILTER];A.Z.get(n,{search:a,page:t||1},"user-"+this.API_FILTER).then((function(a){1===t?ae.Z.dispatch((0,ce.ZB)(a.results)):ae.Z.dispatch((0,ce.R3)(a.results)),e.setState({isLoaded:!0,isBusy:!1,count:a.count,more:a.more,page:a.page,pages:a.pages})}),(function(e){I.Z.apiError(e)}))}},{key:"componentDidMount",value:function(){k.Z.set({title:this.TITLE,parent:this.props.profile.username})}},{key:"getLabel",value:function(){if(this.state.isLoaded){if(this.state.search){var e=npgettext("profile followers","Found %(users)s user.","Found %(users)s users.",this.state.count);return interpolate(e,{users:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){var t=npgettext("profile followers","You have %(users)s follower.","You have %(users)s followers.",this.state.count);return interpolate(t,{users:this.state.count},!0)}var a=npgettext("profile followers","%(username)s has %(users)s follower.","%(username)s has %(users)s followers.",this.state.count);return interpolate(a,{username:this.props.profile.username,users:this.state.count},!0)}return pgettext("Loading...")}},{key:"getEmptyMessage",value:function(){return this.state.search?pgettext("profile followers","Search returned no users matching specified criteria."):this.props.user.id===this.props.profile.id?pgettext("profile followers","You have no followers."):interpolate(pgettext("profile followers","%(username)s has no followers."),{username:this.props.profile.username},!0)}},{key:"getMoreButton",value:function(){return this.state.more?(0,s.Z)("div",{className:"pager-more"},void 0,(0,s.Z)(P.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy,onClick:this.loadMore},void 0,interpolate(pgettext("profile followers","Show more (%(more)s)"),{more:this.state.more},!0))):null}},{key:"getListBody",value:function(){return this.state.isLoaded&&0===this.state.count?(0,s.Z)("p",{className:"lead"},void 0,this.getEmptyMessage()):(0,s.Z)("div",{},void 0,(0,s.Z)(le.Z,{cols:3,isReady:this.state.isLoaded,users:this.props.users}),this.getMoreButton())}},{key:"getClassName",value:function(){return"profile-"+this.API_FILTER}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getClassName()},void 0,(0,s.Z)($.o8,{},void 0,(0,s.Z)($.Z2,{auto:!0},void 0,(0,s.Z)($.Eg,{auto:!0},void 0,(0,s.Z)("h3",{},void 0,this.getLabel()))),(0,s.Z)($.Z2,{},void 0,(0,s.Z)($.Eg,{},void 0,(0,s.Z)(re,{value:this.state.search,onChange:this.search,placeholder:pgettext("profile followers search","Search users...")})))),this.getListBody())}}]),i}(m().Component);var de=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"setSpecialProps",value:function(){this.PRELOADED_DATA_KEY="PROFILE_FOLLOWS",this.TITLE=pgettext("profile follows title","Follows"),this.API_FILTER="follows"}},{key:"getLabel",value:function(){if(this.state.isLoaded){if(this.state.search){var e=npgettext("profile follows","Found %(users)s user.","Found %(users)s users.",this.state.count);return interpolate(e,{users:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){var t=npgettext("profile follows","You are following %(users)s user.","You are following %(users)s users.",this.state.count);return interpolate(t,{users:this.state.count},!0)}var a=npgettext("profile follows","%(username)s is following %(users)s user.","%(username)s is following %(users)s users.",this.state.count);return interpolate(a,{username:this.props.profile.username,users:this.state.count},!0)}return pgettext("profile follows","Loading...")}},{key:"getEmptyMessage",value:function(){return this.state.search?pgettext("profile follows","Search returned no users matching specified criteria."):this.props.user.id===this.props.profile.id?pgettext("profile follows","You are not following any users."):interpolate(pgettext("profile follows","%(username)s is not following any users."),{username:this.props.profile.username},!0)}}]),i}(ue);var pe,he,me=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"getEmptyMessage",value:function(){return this.props.emptyMessage?this.props.emptyMessage:pgettext("username history empty","Your account has no history of name changes.")}},{key:"render",value:function(){return(0,s.Z)("div",{className:"username-history ui-ready"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,(0,s.Z)("li",{className:"list-group-item empty-message"},void 0,this.getEmptyMessage())))}}]),i}(m().Component),ve=a(19605);var fe=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"renderUserAvatar",value:function(){return this.props.change.changed_by?(0,s.Z)("a",{href:this.props.change.changed_by.url,className:"user-avatar-wrapper"},void 0,(0,s.Z)(ve.ZP,{user:this.props.change.changed_by,size:"100"})):pe||(pe=(0,s.Z)("span",{className:"user-avatar-wrapper"},void 0,(0,s.Z)(ve.ZP,{size:"100"})))}},{key:"renderUsername",value:function(){return this.props.change.changed_by?(0,s.Z)("a",{href:this.props.change.changed_by.url,className:"item-title"},void 0,this.props.change.changed_by.username):(0,s.Z)("span",{className:"item-title"},void 0,this.props.change.changed_by_username)}},{key:"render",value:function(){return(0,s.Z)("li",{className:"list-group-item"},this.props.change.id,(0,s.Z)("div",{className:"change-avatar"},void 0,this.renderUserAvatar()),(0,s.Z)("div",{className:"change-author"},void 0,this.renderUsername()),(0,s.Z)("div",{className:"change"},void 0,(0,s.Z)("span",{className:"old-username"},void 0,this.props.change.old_username),he||(he=(0,s.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),(0,s.Z)("span",{className:"new-username"},void 0,this.props.change.new_username)),(0,s.Z)("div",{className:"change-date"},void 0,(0,s.Z)("abbr",{title:this.props.change.changed_on.format("LLL")},void 0,this.props.change.changed_on.fromNow())))}}]),i}(m().Component);var Ze,ge,be=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"render",value:function(){return(0,s.Z)("div",{className:"username-history ui-ready"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,this.props.changes.map((function(e){return(0,s.Z)(fe,{change:e},e.id)}))))}}]),i}(m().Component),ye=a(44039);var _e=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"getClassName",value:function(){return this.props.hiddenOnMobile?"list-group-item hidden-xs hidden-sm":"list-group-item"}},{key:"render",value:function(){return(0,s.Z)("li",{className:this.getClassName()},void 0,Ze||(Ze=(0,s.Z)("div",{className:"change-avatar"},void 0,(0,s.Z)("span",{className:"user-avatar"},void 0,(0,s.Z)(ve.ZP,{size:"100"})))),(0,s.Z)("div",{className:"change-author"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:ye.e(30,100)+"px"}},void 0," ")),(0,s.Z)("div",{className:"change"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:ye.e(30,70)+"px"}},void 0," "),ge||(ge=(0,s.Z)("span",{className:"material-icon"},void 0,"arrow_forward")),(0,s.Z)("span",{className:"ui-preview-text",style:{width:ye.e(30,70)+"px"}},void 0," ")),(0,s.Z)("div",{className:"change-date"},void 0,(0,s.Z)("span",{className:"ui-preview-text",style:{width:ye.e(80,140)+"px"}},void 0," ")))}}]),i}(m().Component);var Ne,ke=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){return(0,s.Z)("div",{className:"username-history ui-preview"},void 0,(0,s.Z)("ul",{className:"list-group"},void 0,[0,1,2].map((function(e){return(0,s.Z)(_e,{hiddenOnMobile:e>0},e)}))))}}]),i}(m().Component);var xe=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"render",value:function(){return this.props.isLoaded?this.props.changes.length?(0,s.Z)(be,{changes:this.props.changes}):(0,s.Z)(me,{emptyMessage:this.props.emptyMessage}):Ne||(Ne=(0,s.Z)(ke,{}))}}]),i}(m().Component),we=a(48927);var Ce=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(e){var t;return(0,o.Z)(this,i),t=n.call(this,e),(0,p.Z)((0,l.Z)(t),"loadMore",(function(){t.setState({isBusy:!0}),t.loadChanges(t.state.page+1,t.state.search)})),(0,p.Z)((0,l.Z)(t),"search",(function(e){t.setState({isLoaded:!1,isBusy:!0,search:e.target.value,count:0,more:0,page:1,pages:1}),t.loadChanges(1,e.target.value)})),_.Z.has("PROFILE_NAME_HISTORY")?t.initWithPreloadedData(_.Z.pop("PROFILE_NAME_HISTORY")):t.initWithoutPreloadedData(),t}return(0,r.Z)(i,[{key:"initWithPreloadedData",value:function(e){this.state={isLoaded:!0,isBusy:!1,search:"",count:e.count,more:e.more,page:e.page,pages:e.pages},ae.Z.dispatch((0,we.ZB)(e.results))}},{key:"initWithoutPreloadedData",value:function(){this.state={isLoaded:!1,isBusy:!1,search:"",count:0,more:0,page:1,pages:1},this.loadChanges()}},{key:"loadChanges",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;A.Z.get(_.Z.get("USERNAME_CHANGES_API"),{user:this.props.profile.id,search:a,page:t||1},"search-username-history").then((function(a){1===t?ae.Z.dispatch((0,we.ZB)(a.results)):ae.Z.dispatch((0,we.R3)(a.results)),e.setState({isLoaded:!0,isBusy:!1,count:a.count,more:a.more,page:a.page,pages:a.pages})}),(function(e){I.Z.apiError(e)}))}},{key:"componentDidMount",value:function(){k.Z.set({title:pgettext("profile username history title","Username history"),parent:this.props.profile.username})}},{key:"getLabel",value:function(){if(this.state.isLoaded){if(this.state.search){var e=npgettext("profile username history","Found %(changes)s username change.","Found %(changes)s username changes.",this.state.count);return interpolate(e,{changes:this.state.count},!0)}if(this.props.profile.id===this.props.user.id){var t=npgettext("profile username history","Your username was changed %(changes)s time.","Your username was changed %(changes)s times.",this.state.count);return interpolate(t,{changes:this.state.count},!0)}var a=npgettext("profile username history","%(username)s's username was changed %(changes)s time.","%(username)s's username was changed %(changes)s times.",this.state.count);return interpolate(a,{username:this.props.profile.username,changes:this.state.count},!0)}return pgettext("profile username history","Loading...")}},{key:"getEmptyMessage",value:function(){return this.state.search?pgettext("profile username history","Search returned no username changes matching specified criteria."):this.props.user.id===this.props.profile.id?pgettext("username history empty","Your account has no history of name changes."):interpolate(pgettext("profile username history","%(username)s's username was never changed."),{username:this.props.profile.username},!0)}},{key:"getMoreButton",value:function(){return this.state.more?(0,s.Z)("div",{className:"pager-more"},void 0,(0,s.Z)(P.Z,{className:"btn btn-default btn-outline",loading:this.state.isBusy,onClick:this.loadMore},void 0,interpolate(pgettext("profile username history","Show older (%(more)s)"),{more:this.state.more},!0))):null}},{key:"render",value:function(){return(0,s.Z)("div",{className:"profile-username-history"},void 0,(0,s.Z)($.o8,{},void 0,(0,s.Z)($.Z2,{auto:!0},void 0,(0,s.Z)($.Eg,{auto:!0},void 0,(0,s.Z)("h3",{},void 0,this.getLabel()))),(0,s.Z)($.Z2,{},void 0,(0,s.Z)($.Eg,{},void 0,(0,s.Z)(re,{value:this.state.search,onChange:this.search,placeholder:pgettext("profile username history search input","Search history...")})))),(0,s.Z)(xe,{isLoaded:this.state.isLoaded,emptyMessage:this.getEmptyMessage(),changes:this.props["username-history"]}),this.getMoreButton())}}]),i}(m().Component),Re=a(82125),Ee=a(27519),Se=a(59131),Oe=a(98936),Te=a(99755);var Pe,Le=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(e){var t;return(0,o.Z)(this,i),t=n.call(this,e),(0,p.Z)((0,l.Z)(t),"action",(function(){t.setState({isLoading:!0}),t.props.profile.is_followed?ae.Z.dispatch((0,Ee.r$)({is_followed:!1,followers:t.props.profile.followers-1})):ae.Z.dispatch((0,Ee.r$)({is_followed:!0,followers:t.props.profile.followers+1})),A.Z.post(t.props.profile.api.follow).then((function(e){t.setState({isLoading:!1}),ae.Z.dispatch((0,Ee.r$)(e))}),(function(e){t.setState({isLoading:!1}),I.Z.apiError(e)}))})),t.state={isLoading:!1},t}return(0,r.Z)(i,[{key:"getClassName",value:function(){return this.props.profile.is_followed?this.props.className+" btn-default btn-following":this.props.className+" btn-default btn-follow"}},{key:"getIcon",value:function(){return this.props.profile.is_followed?"favorite":"favorite_border"}},{key:"getLabel",value:function(){return this.props.profile.is_followed?pgettext("user profile follow btn","Following"):pgettext("user profile follow btn","Follow")}},{key:"render",value:function(){return(0,s.Z)(P.Z,{className:this.getClassName(),disabled:this.state.isLoading,onClick:this.action},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,this.getIcon()),this.getLabel())}}]),i}(m().Component),Ae=a(64646);var Ie,Be,je=function(e){(0,c.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function i(){var e;(0,o.Z)(this,i);for(var t=arguments.length,a=new Array(t),s=0;s1?(t.setState({countdown:t.state.countdown-1}),t.countdown()):t.state.confirm||t.setState({confirm:!0})}),1e3)})),t.state={isLoaded:!1,isLoading:!1,isDeleted:!1,error:null,countdown:5,confirm:!1,with_content:!1},t}return(0,r.Z)(i,[{key:"componentDidMount",value:function(){var e=this;A.Z.get(this.props.profile.api.delete).then((function(){e.setState({isLoaded:!0}),e.countdown()}),(function(t){e.setState({isLoaded:!0,error:t.detail})}))}},{key:"send",value:function(){return A.Z.post(this.props.profile.api.delete,{with_content:this.state.with_content})}},{key:"handleSuccess",value:function(){N.Z.stop("user-profile"),this.state.with_content?this.setState({isDeleted:interpolate(pgettext("profile delete","%(username)s's account, threads, posts and other content has been deleted."),{username:this.props.profile.username},!0)}):this.setState({isDeleted:interpolate(pgettext("profile delete","%(username)s's account has been deleted and other content has been hidden."),{username:this.props.profile.username},!0)})}},{key:"getButtonLabel",value:function(){return this.state.confirm?interpolate(pgettext("profile delete btn","Delete %(username)s"),{username:this.props.profile.username},!0):interpolate(pgettext("profile delete btn","Please wait... (%(countdown)ss)"),{countdown:this.state.countdown},!0)}},{key:"getForm",value:function(){return(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)("div",{className:"modal-body"},void 0,(0,s.Z)(O.Z,{label:pgettext("profile delete","User content"),for:"id_with_content"},void 0,(0,s.Z)(ze.Z,{id:"id_with_content",disabled:this.state.isLoading,labelOn:pgettext("profile delete content","Delete together with user's account"),labelOff:pgettext("profile delete content","Hide after deleting user's account"),onChange:this.bindInput("with_content"),value:this.state.with_content}))),(0,s.Z)("div",{className:"modal-footer"},void 0,(0,s.Z)("button",{type:"button",className:"btn btn-default","data-dismiss":"modal"},void 0,pgettext("profile delete btn","Cancel")),(0,s.Z)(P.Z,{className:"btn-danger",loading:this.state.isLoading,disabled:!this.state.confirm},void 0,this.getButtonLabel())))}},{key:"getDeletedBody",value:function(){return(0,s.Z)("div",{className:"modal-body"},void 0,Ye||(Ye=(0,s.Z)("div",{className:"message-icon"},void 0,(0,s.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,s.Z)("div",{className:"message-body"},void 0,(0,s.Z)("p",{className:"lead"},void 0,this.state.isDeleted),(0,s.Z)("p",{},void 0,(0,s.Z)("a",{href:_.Z.get("USERS_LIST_URL")},void 0,pgettext("profile delete link","Return to users list")))))}},{key:"getModalBody",value:function(){return this.state.error?(0,s.Z)(Ue.Z,{icon:"remove_circle_outline",message:this.state.error}):this.state.isLoaded?this.state.isDeleted?this.getDeletedBody():this.getForm():Ve||(Ve=(0,s.Z)(De.Z,{}))}},{key:"getClassName",value:function(){return this.state.error||this.state.isDeleted?"modal-dialog modal-message modal-delete-account":"modal-dialog modal-delete-account"}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getClassName(),role:"document"},void 0,(0,s.Z)("div",{className:"modal-content"},void 0,(0,s.Z)("div",{className:"modal-header"},void 0,(0,s.Z)("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":pgettext("modal","Close")},void 0,Ge||(Ge=(0,s.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,s.Z)("h4",{className:"modal-title"},void 0,pgettext("profile delete title","Delete user account"))),this.getModalBody()))}}]),i}(L.Z),Je=a(59801);var et=function(e){return{tick:e.tick,user:e.auth,profile:e.profile}},tt=function(e){(0,c.Z)(h,e);var t,a,n=(t=h,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,d.Z)(t);if(a){var i=(0,d.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,u.Z)(this,e)});function h(){var e;(0,o.Z)(this,h);for(var t=arguments.length,a=new Array(t),s=0;s{"use strict";var n,i=a(99170),s=a(97326),o=a(4942),r=a(22928),l=a(15671),c=a(43144),u=a(79340),d=a(6215),p=a(61120),h=a(57588),m=a.n(h),v=a(82211),f=a(43345),Z=a(78657),g=a(53904),b=a(55210),y=a(93051);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=(0,p.Z)(e);if(t){var i=(0,p.Z)(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return(0,d.Z)(this,a)}}var N=function(e){(0,u.Z)(a,e);var t=_(a);function a(e){var n;return(0,l.Z)(this,a),(n=t.call(this,e)).state={isLoading:!1,email:"",validators:{email:[b.Do()]}},n}return(0,c.Z)(a,[{key:"clean",value:function(){return!!this.isValid()||(g.Z.error(pgettext("request activation link form","Enter a valid e-mail address.")),!1)}},{key:"send",value:function(){return Z.Z.post(i.Z.get("SEND_ACTIVATION_API"),{email:this.state.email})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){["already_active","inactive_admin"].indexOf(e.code)>-1?g.Z.info(e.detail):403===e.status&&e.ban?(0,y.Z)(e.ban):g.Z.apiError(e)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"well well-form well-form-request-activation-link"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"form-group"},void 0,(0,r.Z)("div",{className:"control-input"},void 0,(0,r.Z)("input",{type:"text",className:"form-control",placeholder:pgettext("request activation link form field","Your e-mail address"),disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email}))),(0,r.Z)(v.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,pgettext("request activation link form btn","Send link"))))}}]),a}(f.Z),k=function(e){(0,u.Z)(a,e);var t=_(a);function a(){return(0,l.Z)(this,a),t.apply(this,arguments)}return(0,c.Z)(a,[{key:"getMessage",value:function(){return interpolate(pgettext("request activation link form","Activation link was sent to %(email)s"),{email:this.props.user.email},!0)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"well well-form well-form-request-activation-link well-done"},void 0,(0,r.Z)("div",{className:"done-message"},void 0,n||(n=(0,r.Z)("div",{className:"message-icon"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,"check"))),(0,r.Z)("div",{className:"message-body"},void 0,(0,r.Z)("p",{},void 0,this.getMessage())),(0,r.Z)("button",{className:"btn btn-primary btn-block",type:"button",onClick:this.props.callback},void 0,pgettext("request activation link form btn","Request another link"))))}}]),a}(m().Component),x=function(e){(0,u.Z)(a,e);var t=_(a);function a(e){var n;return(0,l.Z)(this,a),n=t.call(this,e),(0,o.Z)((0,s.Z)(n),"complete",(function(e){n.setState({complete:e})})),(0,o.Z)((0,s.Z)(n),"reset",(function(){n.setState({complete:!1})})),n.state={complete:!1},n}return(0,c.Z)(a,[{key:"render",value:function(){return this.state.complete?(0,r.Z)(k,{user:this.state.complete,callback:this.reset}):(0,r.Z)(N,{callback:this.complete})}}]),a}(m().Component),w=a(4869);i.Z.addInitializer({name:"component:request-activation-link",initializer:function(){document.getElementById("request-activation-link-mount")&&(0,w.Z)(x,"request-activation-link-mount",!1)},after:"store"})},11768:(e,t,a)=>{"use strict";var n,i,s=a(99170),o=a(97326),r=a(4942),l=a(22928),c=a(15671),u=a(43144),d=a(79340),p=a(6215),h=a(61120),m=a(57588),v=a.n(m),f=a(73935),Z=a.n(f),g=a(82211),b=a(43345),y=a(78657),_=a(53904),N=a(55210),k=a(93051);function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=(0,h.Z)(e);if(t){var i=(0,h.Z)(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return(0,p.Z)(this,a)}}var w=function(e){(0,d.Z)(a,e);var t=x(a);function a(e){var n;return(0,c.Z)(this,a),(n=t.call(this,e)).state={isLoading:!1,email:"",validators:{email:[N.Do()]}},n}return(0,u.Z)(a,[{key:"clean",value:function(){return!!this.isValid()||(_.Z.error(pgettext("request password reset form","Enter a valid e-mail address.")),!1)}},{key:"send",value:function(){return y.Z.post(s.Z.get("SEND_PASSWORD_RESET_API"),{email:this.state.email})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){["inactive_user","inactive_admin"].indexOf(e.code)>-1?this.props.showInactivePage(e):403===e.status&&e.ban?(0,k.Z)(e.ban):_.Z.apiError(e)}},{key:"render",value:function(){return(0,l.Z)("div",{className:"well well-form well-form-request-password-reset"},void 0,(0,l.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,l.Z)("div",{className:"form-group"},void 0,(0,l.Z)("div",{className:"control-input"},void 0,(0,l.Z)("input",{type:"text",className:"form-control",placeholder:pgettext("request password reset form field","Your e-mail address"),disabled:this.state.isLoading,onChange:this.bindInput("email"),value:this.state.email}))),(0,l.Z)(g.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,pgettext("request password reset form btn","Send link"))))}}]),a}(b.Z),C=function(e){(0,d.Z)(a,e);var t=x(a);function a(){return(0,c.Z)(this,a),t.apply(this,arguments)}return(0,u.Z)(a,[{key:"getMessage",value:function(){return interpolate(pgettext("request password reset form","Reset password link was sent to %(email)s"),{email:this.props.user.email},!0)}},{key:"render",value:function(){return(0,l.Z)("div",{className:"well well-form well-form-request-password-reset well-done"},void 0,(0,l.Z)("div",{className:"done-message"},void 0,n||(n=(0,l.Z)("div",{className:"message-icon"},void 0,(0,l.Z)("span",{className:"material-icon"},void 0,"check"))),(0,l.Z)("div",{className:"message-body"},void 0,(0,l.Z)("p",{},void 0,this.getMessage())),(0,l.Z)("button",{type:"button",className:"btn btn-primary btn-block",onClick:this.props.callback},void 0,pgettext("request password reset form btn","Request another link"))))}}]),a}(v().Component),R=function(e){(0,d.Z)(a,e);var t=x(a);function a(){return(0,c.Z)(this,a),t.apply(this,arguments)}return(0,u.Z)(a,[{key:"getActivateButton",value:function(){return"inactive_user"===this.props.activation?(0,l.Z)("p",{},void 0,(0,l.Z)("a",{href:s.Z.get("REQUEST_ACTIVATION_URL")},void 0,pgettext("request password reset form error","Activate your account."))):null}},{key:"render",value:function(){return(0,l.Z)("div",{className:"page page-message page-message-info page-forgotten-password-inactive"},void 0,(0,l.Z)("div",{className:"container"},void 0,(0,l.Z)("div",{className:"message-panel"},void 0,i||(i=(0,l.Z)("div",{className:"message-icon"},void 0,(0,l.Z)("span",{className:"material-icon"},void 0,"info_outline"))),(0,l.Z)("div",{className:"message-body"},void 0,(0,l.Z)("p",{className:"lead"},void 0,pgettext("request password reset form error","Your account is inactive.")),(0,l.Z)("p",{},void 0,this.props.message),this.getActivateButton()))))}}]),a}(v().Component),E=function(e){(0,d.Z)(a,e);var t=x(a);function a(e){var n;return(0,c.Z)(this,a),n=t.call(this,e),(0,r.Z)((0,o.Z)(n),"complete",(function(e){n.setState({complete:e})})),(0,r.Z)((0,o.Z)(n),"reset",(function(){n.setState({complete:!1})})),n.state={complete:!1},n}return(0,u.Z)(a,[{key:"showInactivePage",value:function(e){Z().render((0,l.Z)(R,{activation:e.code,message:e.detail}),document.getElementById("page-mount"))}},{key:"render",value:function(){return this.state.complete?(0,l.Z)(C,{callback:this.reset,user:this.state.complete}):(0,l.Z)(w,{callback:this.complete,showInactivePage:this.showInactivePage})}}]),a}(v().Component),S=a(4869);s.Z.addInitializer({name:"component:request-password-reset",initializer:function(){document.getElementById("request-password-reset-mount")&&(0,S.Z)(E,"request-password-reset-mount",!1)},after:"store"})},61323:(e,t,a)=>{"use strict";var n,i=a(99170),s=a(97326),o=a(4942),r=a(22928),l=a(15671),c=a(43144),u=a(79340),d=a(6215),p=a(61120),h=a(57588),m=a.n(h),v=a(73935),f=a.n(v),Z=a(82211),g=a(43345),b=a(14467),y=a(78657),_=a(98274),N=a(59801),k=a(53904),x=a(93051),w=a(19755);function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=(0,p.Z)(e);if(t){var i=(0,p.Z)(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return(0,d.Z)(this,a)}}var R=function(e){(0,u.Z)(a,e);var t=C(a);function a(e){var n;return(0,l.Z)(this,a),(n=t.call(this,e)).state={isLoading:!1,password:""},n}return(0,c.Z)(a,[{key:"clean",value:function(){return!!this.state.password.trim().length||(k.Z.error(pgettext("password reset form","Enter new password.")),!1)}},{key:"send",value:function(){return y.Z.post(i.Z.get("CHANGE_PASSWORD_API"),{password:this.state.password})}},{key:"handleSuccess",value:function(e){this.props.callback(e)}},{key:"handleError",value:function(e){403===e.status&&e.ban?(0,x.Z)(e.ban):k.Z.apiError(e)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"well well-form well-form-reset-password"},void 0,(0,r.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,r.Z)("div",{className:"form-group"},void 0,(0,r.Z)("div",{className:"control-input"},void 0,(0,r.Z)("input",{type:"password",className:"form-control",placeholder:pgettext("password reset form field","Enter new password"),disabled:this.state.isLoading,onChange:this.bindInput("password"),value:this.state.password}))),(0,r.Z)(Z.Z,{className:"btn-primary btn-block",loading:this.state.isLoading},void 0,pgettext("password reset form btn","Change password"))))}}]),a}(g.Z),E=function(e){(0,u.Z)(a,e);var t=C(a);function a(){return(0,l.Z)(this,a),t.apply(this,arguments)}return(0,c.Z)(a,[{key:"getMessage",value:function(){return interpolate(pgettext("password reset form","%(username)s, your password has been changed."),{username:this.props.user.username},!0)}},{key:"showSignIn",value:function(){N.Z.show(b.Z)}},{key:"render",value:function(){return(0,r.Z)("div",{className:"page page-message page-message-success page-forgotten-password-changed"},void 0,(0,r.Z)("div",{className:"container"},void 0,(0,r.Z)("div",{className:"message-panel"},void 0,n||(n=(0,r.Z)("div",{className:"message-icon"},void 0,(0,r.Z)("span",{className:"material-icon"},void 0,"check"))),(0,r.Z)("div",{className:"message-body"},void 0,(0,r.Z)("p",{className:"lead"},void 0,this.getMessage()),(0,r.Z)("p",{},void 0,pgettext("password reset form","Sign in using new password to continue.")),(0,r.Z)("p",{},void 0,(0,r.Z)("button",{type:"button",className:"btn btn-primary",onClick:this.showSignIn},void 0,pgettext("password reset form btn","Sign in")))))))}}]),a}(m().Component),S=function(e){(0,u.Z)(a,e);var t=C(a);function a(){var e;(0,l.Z)(this,a);for(var n=arguments.length,i=new Array(n),c=0;c{"use strict";var n,i=a(22928),s=(a(57588),a(73935)),o=a.n(s),r=a(37424),l=a(62989),c=a(90287);misago.addInitializer({name:"component:search-overlay",initializer:function(e){var t=document.getElementById("search-mount");o().render((0,i.Z)(r.zt,{store:c.Z.getStore()},void 0,n||(n=(0,i.Z)(l.F,{}))),t)},after:"store"})},40949:(e,t,a)=>{"use strict";var n,i=a(37424),s=a(22928),o=a(87462),r=a(57588),l=a.n(r),c=a(59131),u=a(15671),d=a(43144),p=a(97326),h=a(79340),m=a(6215),v=a(61120),f=a(4942),Z=a(99170),g=a(43345),b=a(21981),y=a(16427),_=a(6935),N=a(78657),k=a(53904),x=a(90287),w=a(98936),C=a(99755);var R=function(e){(0,h.Z)(o,e);var t,a,i=(t=o,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,v.Z)(t);if(a){var i=(0,v.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,m.Z)(this,e)});function o(e){var t;return(0,u.Z)(this,o),t=i.call(this,e),(0,f.Z)((0,p.Z)(t),"onQueryChange",(function(e){t.changeValue("query",e.target.value)})),t.state={isLoading:!1,query:e.search.query},t}return(0,d.Z)(o,[{key:"componentDidMount",value:function(){this.state.query.length&&this.handleSubmit()}},{key:"clean",value:function(){return!!this.state.query.trim().length||(k.Z.error(pgettext("search form","You have to enter search query.")),!1)}},{key:"send",value:function(){x.Z.dispatch((0,y.Vx)({isLoading:!0}));var e=this.state.query.trim(),t=window.location.href,a=t.indexOf("?q=");return a>0&&(t=t.substring(0,a+3)),window.history.pushState({},"",t+encodeURIComponent(e)),N.Z.get(Z.Z.get("SEARCH_API"),{q:e})}},{key:"handleSuccess",value:function(e){x.Z.dispatch((0,y.Vx)({query:this.state.query.trim(),isLoading:!1,providers:e})),e.forEach((function(e){"users"===e.id?x.Z.dispatch((0,_.ZB)(e.results.results)):"threads"===e.id&&x.Z.dispatch((0,b.zD)(e.results))}))}},{key:"handleError",value:function(e){k.Z.apiError(e),x.Z.dispatch((0,y.Vx)({isLoading:!1}))}},{key:"render",value:function(){return(0,s.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,s.Z)(C.sP,{},void 0,(0,s.Z)(C.mr,{styleName:"site-search"},void 0,(0,s.Z)(C.gC,{styleName:"site-search"},void 0,(0,s.Z)("h1",{},void 0,pgettext("search form title","Search"))),(0,s.Z)(C.eA,{className:"page-header-search-form"},void 0,(0,s.Z)(w.gq,{},void 0,(0,s.Z)(w.kw,{auto:!0},void 0,(0,s.Z)(w.Z6,{},void 0,(0,s.Z)("input",{className:"form-control",disabled:this.state.isLoading,type:"text",value:this.state.query,placeholder:pgettext("search form input","Search"),onChange:this.onQueryChange})),(0,s.Z)(w.Z6,{shrink:!0},void 0,(0,s.Z)("button",{className:"btn btn-secondary btn-icon btn-outline",title:pgettext("search form btn","Search"),disabled:this.state.isLoading},void 0,n||(n=(0,s.Z)("span",{className:"material-icon"},void 0,"search"))))))))))}}]),o}(g.Z),E=a(69987);function S(e){return(0,s.Z)("div",{className:"list-group nav-side"},void 0,e.providers.map((function(e){return(0,s.Z)(E.rU,{activeClassName:"active",className:"list-group-item",to:e.url},e.id,(0,s.Z)("span",{className:"material-icon"},void 0,e.icon),e.name,(0,s.Z)(O,{results:e.results}))})))}function O(e){if(!e.results)return null;var t=e.results.count;return t>1e6?t=Math.ceil(t/1e6)+"KK":t>1e3&&(t=Math.ceil(t/1e3)+"K"),(0,s.Z)("span",{className:"badge"},void 0,t)}function T(e){return(0,s.Z)("div",{className:"page page-search"},void 0,(0,s.Z)(R,{provider:e.provider,search:e.search}),(0,s.Z)(c.Z,{},void 0,(0,s.Z)("div",{className:"row"},void 0,(0,s.Z)("div",{className:"col-md-3"},void 0,(0,s.Z)(S,{providers:e.search.providers})),(0,s.Z)("div",{className:"col-md-9"},void 0,e.children,(0,s.Z)(P,{provider:e.provider,search:e.search})))))}function P(e){var t=null;if(e.search.providers.forEach((function(a){a.id===e.provider.id&&(t=a.time)})),null===t)return null;var a=pgettext("search time","Search took %(time)s s");return(0,s.Z)("footer",{className:"search-footer"},void 0,(0,s.Z)("p",{},void 0,interpolate(a,{time:t},!0)))}var L=a(11005),A=a(82211);function I(e){return(0,s.Z)("div",{},void 0,(0,s.Z)(L.Z,{isReady:!0,posts:e.results}),l().createElement(B,e))}a(69092);var B=function(e){(0,h.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,v.Z)(t);if(a){var i=(0,v.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,m.Z)(this,e)});function i(){var e;(0,u.Z)(this,i);for(var t=arguments.length,a=new Array(t),s=0;s{"use strict";var n,i=a(22928),s=(a(57588),a(73935)),o=a.n(s),r=a(37424),l=a(6333),c=a(90287);misago.addInitializer({name:"component:site-nav-overlay",initializer:function(e){var t=document.getElementById("site-nav-mount");o().render((0,i.Z)(r.zt,{store:c.Z.getStore()},void 0,n||(n=(0,i.Z)(l.Or,{}))),t)},after:"store"})},61814:(e,t,a)=>{"use strict";var n=a(37424),i=a(99170),s=a(22928),o=a(15671),r=a(43144),l=a(79340),c=a(6215),u=a(61120),d=a(57588);var p={info:"alert-info",success:"alert-success",warning:"alert-warning",error:"alert-danger"},h=function(e){(0,l.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,u.Z)(t);if(a){var i=(0,u.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,c.Z)(this,e)});function i(){return(0,o.Z)(this,i),n.apply(this,arguments)}return(0,r.Z)(i,[{key:"getSnackbarClass",value:function(){var e="alerts-snackbar";return this.props.isVisible?e+=" in":e+=" out",e}},{key:"render",value:function(){return(0,s.Z)("div",{className:this.getSnackbarClass()},void 0,(0,s.Z)("p",{className:"alert "+p[this.props.type]},void 0,this.props.message))}}]),i}(a.n(d)().Component);function m(e){return e.snackbar}var v=a(4869);i.Z.addInitializer({name:"component:snackbar",initializer:function(){(0,v.Z)((0,n.$j)(m)(h),"snackbar-mount")},after:"snackbar"})},95920:(e,t,a)=>{"use strict";var n=a(57588),i=a.n(n),s=a(22928),o=a(15671),r=a(43144),l=a(97326),c=a(79340),u=a(6215),d=a(61120),p=a(4942),h=a(99170),m=a(26106),v=a(82211),f=a(43345),Z=a(96359),g=a(78657),b=a(53904),y=a(55210),_=a(59131),N=a(99755);const k=function(e){var t=e.backendName,a=pgettext("social auth title","Sign in with %(backend)s"),n=interpolate(a,{backend:t},!0);return(0,s.Z)(N.sP,{},void 0,(0,s.Z)(N.mr,{styleName:"social-auth"},void 0,(0,s.Z)(N.gC,{styleName:"social-auth"},void 0,(0,s.Z)("h1",{},void 0,n))))};function x(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function w(e){for(var t=1;t{"use strict";var n,i,s=a(37424),o=a(22928),r=a(15671),l=a(43144),c=a(97326),u=a(79340),d=a(6215),p=a(61120),h=a(4942),m=a(57588),v=a.n(m),f=a(87462),Z=a(43345),g=a(96359),b=a(8154),y=a(7738),_=a(78657),N=a(59801),k=a(53904),x=a(90287);var w,C=function(e){(0,u.Z)(s,e);var t,a,i=(t=s,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function s(e){var t;return(0,r.Z)(this,s),t=i.call(this,e),(0,h.Z)((0,c.Z)(t),"onUsernameChange",(function(e){t.changeValue("username",e.target.value)})),t.state={isLoading:!1,username:""},t}return(0,l.Z)(s,[{key:"clean",value:function(){return!!this.state.username.trim().length||(k.Z.error(pgettext("add private thread participant","You have to enter user name.")),!1)}},{key:"send",value:function(){return _.Z.patch(this.props.thread.api.index,[{op:"add",path:"participants",value:this.state.username},{op:"add",path:"acl",value:1}])}},{key:"handleSuccess",value:function(e){x.Z.dispatch((0,y.y8)(e)),x.Z.dispatch(b.gx(e.participants)),k.Z.success(pgettext("add private thread participant","New participant has been added to thread.")),N.Z.hide()}},{key:"render",value:function(){return(0,o.Z)("div",{className:"modal-dialog modal-sm",role:"document"},void 0,(0,o.Z)("form",{onSubmit:this.handleSubmit},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,n||(n=(0,o.Z)(R,{})),(0,o.Z)("div",{className:"modal-body"},void 0,(0,o.Z)(g.Z,{for:"id_username",label:pgettext("add private thread participant field","User to add")},void 0,(0,o.Z)("input",{id:"id_username",className:"form-control",disabled:this.state.isLoading,onChange:this.onUsernameChange,type:"text",value:this.state.username}))),(0,o.Z)("div",{className:"modal-footer"},void 0,(0,o.Z)("button",{className:"btn btn-block btn-primary",disabled:this.state.isLoading},void 0,pgettext("add private thread participant btn","Add participant")),(0,o.Z)("button",{className:"btn btn-block btn-default","data-dismiss":"modal",disabled:this.state.isLoading,type:"button"},void 0,pgettext("add private thread participant btn","Cancel"))))))}}]),s}(Z.Z);function R(e){return(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,i||(i=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("add private thread participant modal title","Add participant")))}var E=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(){var e;(0,r.Z)(this,i);for(var t=arguments.length,a=new Array(t),s=0;s%(relative)s';function be(e){return(0,o.Z)("ul",{className:"list-unstyled list-inline poll-details"},void 0,(0,o.Z)(we,{votes:e.poll.votes}),(0,o.Z)(ke,{poll:e.poll}),(0,o.Z)(Ce,{poll:e.poll}),(0,o.Z)(ye,{poll:e.poll}))}function ye(e){var t=interpolate((0,Ze.Z)(pgettext("thread poll","Started by %(poster)s %(posted_on)s.")),{poster:_e(e.poll),posted_on:Ne(e.poll)},!0);return(0,o.Z)("li",{className:"poll-info-creation",dangerouslySetInnerHTML:{__html:t}})}function _e(e){return e.url.poster?interpolate('%(user)s',{url:(0,Ze.Z)(e.url.poster),user:(0,Ze.Z)(e.poster_name)},!0):interpolate('%(user)s',{user:(0,Ze.Z)(e.poster_name)},!0)}function Ne(e){return interpolate(ge,{absolute:(0,Ze.Z)(e.posted_on.format("LLL")),relative:(0,Ze.Z)(e.posted_on.fromNow())},!0)}function ke(e){if(!e.poll.length)return null;var t=interpolate((0,Ze.Z)(pgettext("thread poll","Voting ends %(ends_on)s.")),{ends_on:xe(e.poll)},!0);return(0,o.Z)("li",{className:"poll-info-ends-on",dangerouslySetInnerHTML:{__html:t}})}function xe(e){return interpolate(ge,{absolute:(0,Ze.Z)(e.endsOn.format("LLL")),relative:(0,Ze.Z)(e.endsOn.fromNow())},!0)}function we(e){var t=npgettext("thread poll","%(votes)s vote.","%(votes)s votes.",e.votes),a=interpolate(t,{votes:e.votes},!0);return(0,o.Z)("li",{className:"poll-info-votes"},void 0,a)}function Ce(e){return e.poll.is_public?(0,o.Z)("li",{className:"poll-info-public"},void 0,pgettext("thread poll","Voting is public.")):null}function Re(e){return(0,o.Z)("div",{className:"panel panel-default panel-poll"},void 0,(0,o.Z)("div",{className:"panel-body"},void 0,(0,o.Z)("h2",{},void 0,e.poll.question),(0,o.Z)(be,{poll:e.poll}),(0,o.Z)(F,{poll:e.poll}),(0,o.Z)(de,{isPollOver:e.isPollOver,poll:e.poll,edit:e.edit,showVoting:e.showVoting,thread:e.thread})))}function Ee(e){return(0,o.Z)("ul",{className:"list-unstyled list-inline poll-help"},void 0,(0,o.Z)(Se,{choicesLeft:e.choicesLeft}),(0,o.Z)(Oe,{poll:e.poll}))}function Se(e){var t=e.choicesLeft;if(0===t)return(0,o.Z)("li",{className:"poll-help-choices-left"},void 0,pgettext("thread poll","You can't select any more choices."));var a=npgettext("thread poll","You can select %(choices)s more choice.","You can select %(choices)s more choices.",t),n=interpolate(a,{choices:t},!0);return(0,o.Z)("li",{className:"poll-help-choices-left"},void 0,n)}function Oe(e){return e.poll.allow_revotes?(0,o.Z)("li",{className:"poll-help-allow-revotes"},void 0,pgettext("thread poll","You can change your vote later.")):(0,o.Z)("li",{className:"poll-help-no-revotes"},void 0,pgettext("thread poll","Votes are final."))}function Te(e){return(0,o.Z)("ul",{className:"list-unstyled poll-select-choices"},void 0,e.choices.map((function(t){return(0,o.Z)(Pe,{choice:t,toggleChoice:e.toggleChoice},t.hash)})))}var Pe=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(){var e;(0,r.Z)(this,i);for(var t=arguments.length,a=new Array(t),s=0;s2,choice:t,disabled:e.props.disabled,onChange:e.onChange,onDelete:e.onDelete},t.hash)}))),(0,o.Z)("button",{className:"btn btn-default btn-sm",disabled:this.props.disabled,onClick:this.onAdd,type:"button"},void 0,pgettext("thread poll","Add choice")))}}]),a}(v().Component),Me=function(e){(0,u.Z)(a,e);var t=ze(a);function a(){var e;(0,r.Z)(this,a);for(var n=arguments.length,i=new Array(n),s=0;s%(relative)s',{absolute:(0,Ze.Z)(e.post.hidden_on.format("LLL")),relative:(0,Ze.Z)(e.post.hidden_on.fromNow())},!0),n=interpolate((0,Ze.Z)(pgettext("event info","Hidden by %(event_by)s %(event_on)s.")),{event_by:t,event_on:a},!0);return(0,o.Z)("li",{className:"event-hidden-message",dangerouslySetInnerHTML:{__html:n}})}return null}function nt(e){var t;t=e.post.poster?interpolate(et,{url:(0,Ze.Z)(e.post.poster.url),user:(0,Ze.Z)(e.post.poster_name)},!0):interpolate(Je,{user:(0,Ze.Z)(e.post.poster_name)},!0);var a=interpolate('%(relative)s',{url:(0,Ze.Z)(e.post.url.index),absolute:(0,Ze.Z)(e.post.posted_on.format("LLL")),relative:(0,Ze.Z)(e.post.posted_on.fromNow())},!0),n=interpolate((0,Ze.Z)(pgettext("event info","By %(event_by)s %(event_on)s.")),{event_by:t,event_on:a},!0);return(0,o.Z)("li",{className:"event-posters",dangerouslySetInnerHTML:{__html:n}})}var it={pinned_globally:pgettext("event message","Thread has been pinned globally."),pinned_locally:pgettext("event message","Thread has been pinned in category."),unpinned:pgettext("event message","Thread has been unpinned."),approved:pgettext("event message","Thread has been approved."),opened:pgettext("event message","Thread has been opened."),closed:pgettext("event message","Thread has been closed."),unhid:pgettext("event message","Thread has been revealed."),hid:pgettext("event message","Thread has been made hidden."),tookover:pgettext("event message","Took thread over."),owner_left:pgettext("event message","Owner has left thread. This thread is now closed."),participant_left:pgettext("event message","Participant has left thread.")},st='%(name)s',ot='%(name)s';function rt(e){return it[e.post.event_type]?(0,o.Z)("p",{className:"event-message"},void 0,it[e.post.event_type]):"changed_title"===e.post.event_type?v().createElement(lt,e):"moved"===e.post.event_type?v().createElement(ct,e):"merged"===e.post.event_type?v().createElement(ut,e):"changed_owner"===e.post.event_type?v().createElement(dt,e):"added_participant"===e.post.event_type?v().createElement(pt,e):"removed_participant"===e.post.event_type?v().createElement(ht,e):null}function lt(e){var t=(0,Ze.Z)(pgettext("event message","Thread title has been changed from %(old_title)s.")),a=interpolate(ot,{name:(0,Ze.Z)(e.post.event_context.old_title)},!0),n=interpolate(t,{old_title:a},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:n}})}function ct(e){var t=(0,Ze.Z)(pgettext("event message","Thread has been moved from %(from_category)s.")),a=interpolate(st,{url:(0,Ze.Z)(e.post.event_context.from_category.url),name:(0,Ze.Z)(e.post.event_context.from_category.name)},!0),n=interpolate(t,{from_category:a},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:n}})}function ut(e){var t=(0,Ze.Z)(pgettext("event message","The %(merged_thread)s thread has been merged into this thread.")),a=interpolate(ot,{name:(0,Ze.Z)(e.post.event_context.merged_thread)},!0),n=interpolate(t,{merged_thread:a},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:n}})}function dt(e){var t=(0,Ze.Z)(pgettext("event message","Changed thread owner to %(user)s.")),a=interpolate(st,{url:(0,Ze.Z)(e.post.event_context.user.url),name:(0,Ze.Z)(e.post.event_context.user.username)},!0),n=interpolate(t,{user:a},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:n}})}function pt(e){var t=(0,Ze.Z)(pgettext("event message","Added %(user)s to thread.")),a=interpolate(st,{url:(0,Ze.Z)(e.post.event_context.user.url),name:(0,Ze.Z)(e.post.event_context.user.username)},!0),n=interpolate(t,{user:a},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:n}})}function ht(e){var t=(0,Ze.Z)(pgettext("event message","Removed %(user)s from thread.")),a=interpolate(st,{url:(0,Ze.Z)(e.post.event_context.user.url),name:(0,Ze.Z)(e.post.event_context.user.username)},!0),n=interpolate(t,{user:a},!0);return(0,o.Z)("p",{className:"event-message",dangerouslySetInnerHTML:{__html:n}})}function mt(e){return e.post.is_read?null:(0,o.Z)("div",{className:"event-label"},void 0,(0,o.Z)("span",{className:"label label-unread"},void 0,pgettext("event unread label","New event")))}var vt=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,r.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"initialize",(function(e){t.initialized=!0,t.observer=new IntersectionObserver((function(e){return e.forEach(t.callback)})),t.observer.observe(e)})),(0,h.Z)((0,c.Z)(t),"callback",(function(e){!e.isIntersecting||t.props.post.is_read||t.primed||(window.setTimeout((function(){_.Z.post(t.props.post.api.read)}),0),t.primed=!0,t.destroy())})),t.initialized=!1,t.primed=!1,t.observer=null,t}return(0,l.Z)(i,[{key:"destroy",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null)}},{key:"componentWillUnmount",value:function(){this.destroy()}},{key:"render",value:function(){var e=this,t=!this.initialized&&!this.primed&&!this.props.post.is_read;return v().createElement("div",{className:this.props.className,ref:function(a){a&&t&&e.initialize(a)}},this.props.children)}}]),i}(v().Component);function ft(e){var t="event";return e.post.isDeleted?t="hide":e.post.is_hidden&&(t="event post-hidden"),(0,o.Z)("li",{id:"post-"+e.post.id,className:t},void 0,(0,o.Z)(mt,{post:e.post}),(0,o.Z)("div",{className:"event-body"},void 0,(0,o.Z)("div",{className:"event-icon"},void 0,v().createElement(Ve,e)),(0,o.Z)(vt,{className:"event-content",post:e.post},void 0,v().createElement(rt,e),v().createElement(tt,e))))}var Zt=a(69130),gt=a(48772);function bt(e){return(0,o.Z)("div",{className:"col-xs-12 col-md-6"},void 0,v().createElement(yt,e),(0,o.Z)("div",{className:"post-attachment"},void 0,(0,o.Z)("a",{href:e.attachment.url.index,className:"attachment-name item-title",target:"_blank"},void 0,e.attachment.filename),v().createElement(kt,e)))}function yt(e){return e.attachment.is_image?(0,o.Z)("div",{className:"post-attachment-preview"},void 0,v().createElement(Nt,e)):(0,o.Z)("div",{className:"post-attachment-preview"},void 0,v().createElement(_t,e))}function _t(e){return(0,o.Z)("a",{href:e.attachment.url.index,className:"material-icon"},void 0,"insert_drive_file")}function Nt(e){var t=e.attachment.url.thumb||e.attachment.url.index;return(0,o.Z)("a",{className:"post-thumbnail",href:e.attachment.url.index,target:"_blank",style:{backgroundImage:'url("'+(0,Ze.Z)(t)+'")'}})}function kt(e){var t;t=e.attachment.url.uploader?interpolate('%(user)s',{url:(0,Ze.Z)(e.attachment.url.uploader),user:(0,Ze.Z)(e.attachment.uploader_name)},!0):interpolate('%(user)s',{user:(0,Ze.Z)(e.attachment.uploader_name)},!0);var a=interpolate('%(relative)s',{absolute:(0,Ze.Z)(e.attachment.uploaded_on.format("LLL")),relative:(0,Ze.Z)(e.attachment.uploaded_on.fromNow())},!0),n=interpolate((0,Ze.Z)(pgettext("post attachment","%(filetype)s, %(size)s, uploaded by %(uploader)s %(uploaded_on)s.")),{filetype:e.attachment.filetype,size:(0,gt.Z)(e.attachment.size),uploader:t,uploaded_on:a},!0);return(0,o.Z)("p",{className:"post-attachment-description",dangerouslySetInnerHTML:{__html:n}})}function xt(e){return function(e){return(!e.is_hidden||e.acl.can_see_hidden)&&e.attachments}(e.post)?(0,o.Z)("div",{className:"post-attachments"},void 0,(0,Zt.Z)(e.post.attachments,2).map((function(e){var t=e.map((function(e){return e?e.id:0})).join("_");return(0,o.Z)(wt,{row:e},t)}))):null}function wt(e){return(0,o.Z)("div",{className:"row"},void 0,e.row.map((function(e){return(0,o.Z)(bt,{attachment:e},e?e.id:0)})))}var Ct,Rt,Et,St,Ot,Tt,Pt,Lt=a(69092);function At(e){return e.post.is_hidden&&!e.post.acl.can_see_hidden?v().createElement(Bt,e):e.post.content?v().createElement(It,e):v().createElement(jt,e)}function It(e){var t=e.post,a="@"+(t.poster?t.poster.username:t.poster_name);return(0,o.Z)(vt,{className:"post-body",post:t},void 0,(0,o.Z)(Lt.Z,{author:a,markup:t.content}))}function Bt(e){var t;t=e.post.hidden_by?interpolate('%(user)s',{url:(0,Ze.Z)(e.post.url.hidden_by),user:(0,Ze.Z)(e.post.hidden_by_name)},!0):interpolate('%(user)s',{user:(0,Ze.Z)(e.post.hidden_by_name)},!0);var a=interpolate('%(relative)s',{absolute:(0,Ze.Z)(e.post.hidden_on.format("LLL")),relative:(0,Ze.Z)(e.post.hidden_on.fromNow())},!0),n=interpolate((0,Ze.Z)(pgettext("post body hidden","Hidden by %(hidden_by)s %(hidden_on)s.")),{hidden_by:t,hidden_on:a},!0);return(0,o.Z)(vt,{className:"post-body post-body-hidden",post:e.post},void 0,(0,o.Z)("p",{className:"lead"},void 0,pgettext("post body hidden","This post is hidden. You cannot see its contents.")),(0,o.Z)("p",{className:"text-muted",dangerouslySetInnerHTML:{__html:n}}))}function jt(e){return(0,o.Z)(vt,{className:"post-body post-body-invalid",post:e.post},void 0,(0,o.Z)("p",{className:"lead"},void 0,pgettext("post body invalid","This post's contents cannot be displayed.")),(0,o.Z)("p",{className:"text-muted"},void 0,pgettext("post body invalid","This error is caused by invalid post content manipulation.")))}function Dt(e){var t=e.post,a=e.thread,n=e.user;if(!qt(t)||t.id!==a.best_answer)return null;var i;return i=n.id&&a.best_answer_marked_by===n.id?interpolate(pgettext("post best answer flag","Marked as best answer by you %(marked_on)s."),{marked_on:a.best_answer_marked_on.fromNow()},!0):interpolate(pgettext("post best answer flag","Marked as best answer by %(marked_by)s %(marked_on)s."),{marked_by:a.best_answer_marked_by_name,marked_on:a.best_answer_marked_on.fromNow()},!0),(0,o.Z)("div",{className:"post-status-message post-status-best-answer"},void 0,Ct||(Ct=(0,o.Z)("span",{className:"material-icon"},void 0,"check_box")),(0,o.Z)("p",{},void 0,i))}function zt(e){return qt(e.post)&&e.post.is_hidden?(0,o.Z)("div",{className:"post-status-message post-status-hidden"},void 0,Rt||(Rt=(0,o.Z)("span",{className:"material-icon"},void 0,"visibility_off")),(0,o.Z)("p",{},void 0,pgettext("post hidden flag","This post is hidden. Only users with permission may see its contents."))):null}function Ut(e){return qt(e.post)&&e.post.is_unapproved?(0,o.Z)("div",{className:"post-status-message post-status-unapproved"},void 0,Et||(Et=(0,o.Z)("span",{className:"material-icon"},void 0,"remove_circle_outline")),(0,o.Z)("p",{},void 0,pgettext("post unapproved flag","This post is unapproved. Only users with permission to approve posts and its author may see its contents."))):null}function Mt(e){return qt(e.post)&&e.post.is_protected?(0,o.Z)("div",{className:"post-status-message post-status-protected visible-xs-block"},void 0,St||(St=(0,o.Z)("span",{className:"material-icon"},void 0,"lock_outline")),(0,o.Z)("p",{},void 0,pgettext("post protected flag","This post is protected. Only moderators may change it."))):null}function qt(e){return!e.is_hidden||e.acl.can_see_hidden}function Ht(e){x.Z.dispatch(Ge.r$(e.post,{is_unapproved:!1})),Qt(e,[{op:"replace",path:"is-unapproved",value:!1}],{is_unapproved:e.post.is_unapproved})}function Ft(e){x.Z.dispatch(Ge.r$(e.post,{is_protected:!0})),Qt(e,[{op:"replace",path:"is-protected",value:!0}],{is_protected:e.post.is_protected})}function Yt(e){x.Z.dispatch(Ge.r$(e.post,{is_protected:!1})),Qt(e,[{op:"replace",path:"is-protected",value:!1}],{is_protected:e.post.is_protected})}function Vt(e){x.Z.dispatch(Ge.r$(e.post,{is_hidden:!0,hidden_on:H()(),hidden_by_name:e.user.username,url:Object.assign(e.post.url,{hidden_by:e.user.url})})),Qt(e,[{op:"replace",path:"is-hidden",value:!0}],{is_hidden:e.post.is_hidden,hidden_on:e.post.hidden_on,hidden_by_name:e.post.hidden_by_name,url:e.post.url})}function Gt(e){x.Z.dispatch(Ge.r$(e.post,{is_hidden:!1})),Qt(e,[{op:"replace",path:"is-hidden",value:!1}],{is_hidden:e.post.is_hidden})}function $t(e){var t=e.post.last_likes||[],a=[e.user].concat(t),n=a.length>3?a.slice(0,-1):a;x.Z.dispatch(Ge.r$(e.post,{is_liked:!0,likes:e.post.likes+1,last_likes:n})),Qt(e,[{op:"replace",path:"is-liked",value:!0}],{is_liked:e.post.is_liked,likes:e.post.likes,last_likes:e.post.last_likes})}function Wt(e){x.Z.dispatch(Ge.r$(e.post,{is_liked:!1,likes:e.post.likes-1,last_likes:e.post.last_likes.filter((function(t){return!t.id||t.id!==e.user.id}))}));var t={is_liked:e.post.is_liked,likes:e.post.likes,last_likes:e.post.last_likes};Qt(e,[{op:"replace",path:"is-liked",value:!1}],t)}function Qt(e,t,a){_.Z.patch(e.post.api.index,t).then((function(t){x.Z.dispatch(Ge.r$(e.post,t))}),(function(t){400===t.status?k.Z.error(t.detail[0]):k.Z.apiError(t),x.Z.dispatch(Ge.r$(e.post,a))}))}function Xt(e){window.confirm(pgettext("post delete","Are you sure you want to delete this post? This action is not reversible!"))&&(x.Z.dispatch(Ge.r$(e.post,{isDeleted:!0})),_.Z.delete(e.post.api.index).then((function(){k.Z.success(pgettext("post delete","Post has been deleted."))}),(function(t){400===t.status?k.Z.error(t.detail):k.Z.apiError(t),x.Z.dispatch(Ge.r$(e.post,{isDeleted:!1}))})))}function Kt(e){var t=e.post,a=e.user;x.Z.dispatch(y.Vx({best_answer:t.id,best_answer_is_protected:t.is_protected,best_answer_marked_on:H()(),best_answer_marked_by:a.id,best_answer_marked_by_name:a.username,best_answer_marked_by_slug:a.slug})),ea(e,[{op:"replace",path:"best-answer",value:t.id},{op:"add",path:"acl",value:!0}],{best_answer:e.thread.best_answer,best_answer_is_protected:e.thread.best_answer_is_protected,best_answer_marked_on:e.thread.best_answer_marked_on,best_answer_marked_by:e.thread.best_answer_marked_by,best_answer_marked_by_name:e.thread.best_answer_marked_by_name,best_answer_marked_by_slug:e.thread.best_answer_marked_by_slug})}function Jt(e){var t=e.post;x.Z.dispatch(y.Vx({best_answer:null,best_answer_is_protected:!1,best_answer_marked_on:null,best_answer_marked_by:null,best_answer_marked_by_name:null,best_answer_marked_by_slug:null})),ea(e,[{op:"remove",path:"best-answer",value:t.id},{op:"add",path:"acl",value:!0}],{best_answer:e.thread.best_answer,best_answer_is_protected:e.thread.best_answer_is_protected,best_answer_marked_on:e.thread.best_answer_marked_on,best_answer_marked_by:e.thread.best_answer_marked_by,best_answer_marked_by_name:e.thread.best_answer_marked_by_name,best_answer_marked_by_slug:e.thread.best_answer_marked_by_slug})}function ea(e,t,a){_.Z.patch(e.thread.api.index,t).then((function(e){e.best_answer_marked_on&&(e.best_answer_marked_on=H()(e.best_answer_marked_on)),x.Z.dispatch(y.Vx(e))}),(function(e){400===e.status?k.Z.error(e.detail[0]):k.Z.apiError(e),x.Z.dispatch(y.Vx(a))}))}var ta,aa,na,ia,sa=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,r.Z)(this,i),(t=n.call(this,e)).state={isReady:!1,error:null,likes:[]},t}return(0,l.Z)(i,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(this.props.post.api.likes).then((function(t){e.setState({isReady:!0,likes:t.map(oa)})}),(function(t){e.setState({isReady:!0,error:t.detail})}))}},{key:"render",value:function(){return this.state.error?(0,o.Z)(ra,{className:"modal-message"},void 0,(0,o.Z)(K.Z,{message:this.state.error})):this.state.isReady?this.state.likes.length?(0,o.Z)(ra,{className:"modal-sm",likes:this.state.likes},void 0,(0,o.Z)(la,{likes:this.state.likes})):(0,o.Z)(ra,{className:"modal-message"},void 0,(0,o.Z)(K.Z,{message:pgettext("post likes modal","No users have liked this post.")})):Ot||(Ot=(0,o.Z)(ra,{className:"modal-sm"},void 0,(0,o.Z)(J.Z,{})))}}]),i}(v().Component);function oa(e){return Object.assign({},e,{liked_on:H()(e.liked_on)})}function ra(e){var t=e.className,a=e.children,n=e.likes,i=pgettext("post likes modal title","Post Likes");if(n){var s=n.length,r=npgettext("post likes modal","%(likes)s like","%(likes)s likes",s);i=interpolate(r,{likes:s},!0)}return(0,o.Z)("div",{className:"modal-dialog "+(t||""),role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,Tt||(Tt=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,i)),a))}function la(e){return(0,o.Z)("div",{className:"modal-body modal-post-likers"},void 0,(0,o.Z)("ul",{className:"media-list"},void 0,e.likes.map((function(e){return v().createElement(ca,(0,f.Z)({key:e.id},e))}))))}function ca(e){if(e.url){var t={id:e.liker_id,avatars:e.avatars};return(0,o.Z)("li",{className:"media"},void 0,(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("a",{className:"user-avatar",href:e.url},void 0,(0,o.Z)(I.ZP,{size:"50",user:t}))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("a",{className:"item-title",href:e.url},void 0,e.username)," ",(0,o.Z)(ua,{likedOn:e.liked_on})))}return(0,o.Z)("li",{className:"media"},void 0,Pt||(Pt=(0,o.Z)("div",{className:"media-left"},void 0,(0,o.Z)("span",{className:"user-avatar"},void 0,(0,o.Z)(I.ZP,{size:"50"})))),(0,o.Z)("div",{className:"media-body"},void 0,(0,o.Z)("strong",{},void 0,e.username)," ",(0,o.Z)(ua,{likedOn:e.liked_on})))}function ua(e){return(0,o.Z)("span",{className:"text-muted",title:e.likedOn.format("LLL")},void 0,e.likedOn.fromNow())}function da(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=(0,p.Z)(e);if(t){var i=(0,p.Z)(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return(0,d.Z)(this,a)}}function pa(e){return function(e){return(!e.is_hidden||e.acl.can_see_hidden)&&(e.acl.can_reply||e.acl.can_edit||e.acl.can_see_likes&&(e.last_likes||[]).length||e.acl.can_like)}(e.post)?(0,o.Z)("div",{className:"post-footer"},void 0,v().createElement(ha,e),v().createElement(ma,e),v().createElement(va,e),v().createElement(fa,(0,f.Z)({lastLikes:e.post.last_likes,likes:e.post.likes},e)),v().createElement(Za,(0,f.Z)({likes:e.post.likes},e)),v().createElement(_a,e),v().createElement(Na,e),v().createElement(ka,e)):null}var ha=function(e){(0,u.Z)(a,e);var t=da(a);function a(){var e;(0,r.Z)(this,a);for(var n=arguments.length,i=new Array(n),s=0;s0;return this.props.post.acl.can_see_likes&&e?2===this.props.post.acl.can_see_likes?(0,o.Z)("button",{className:"btn btn-link btn-sm pull-left hidden-xs",onClick:this.onClick,type:"button"},void 0,ga(this.props.likes,this.props.lastLikes)):(0,o.Z)("p",{className:"pull-left hidden-xs"},void 0,ga(this.props.likes,this.props.lastLikes)):null}}]),a}(v().Component),Za=function(e){(0,u.Z)(a,e);var t=da(a);function a(){return(0,r.Z)(this,a),t.apply(this,arguments)}return(0,l.Z)(a,[{key:"render",value:function(){var e=(this.props.post.last_likes||[]).length>0;return this.props.post.acl.can_see_likes&&e?2===this.props.post.acl.can_see_likes?(0,o.Z)("button",{className:"btn btn-link btn-sm likes-compact pull-left visible-xs-block",onClick:this.onClick,type:"button"},void 0,na||(na=(0,o.Z)("span",{className:"material-icon"},void 0,"favorite")),this.props.likes):(0,o.Z)("p",{className:"likes-compact pull-left visible-xs-block"},void 0,ia||(ia=(0,o.Z)("span",{className:"material-icon"},void 0,"favorite")),this.props.likes):null}}]),a}(fa);function ga(e,t){var a=t.slice(0,3).map((function(e){return e.username}));if(1==a.length)return interpolate(pgettext("post likes","%(user)s likes this."),{user:a[0]},!0);var n=e-a.length,i=a.slice(0,-1).join(", "),s=a.slice(-1)[0],o=interpolate(pgettext("post likes","%(users)s and %(last_user)s"),{users:i,last_user:s},!0);if(0===n)return interpolate(pgettext("post likes","%(users)s like this."),{users:o},!0);var r=npgettext("post likes","%(users)s and %(likes)s other user like this.","%(users)s and %(likes)s other users like this.",n);return interpolate(r,{users:a.join(", "),likes:n},!0)}var ba,ya,_a=function(e){(0,u.Z)(a,e);var t=da(a);function a(){var e;(0,r.Z)(this,a);for(var n=arguments.length,i=new Array(n),s=0;s%(user)s',{url:(0,Ze.Z)(e.edit.url.editor),user:(0,Ze.Z)(e.edit.editor_name)},!0):interpolate('%(user)s',{user:(0,Ze.Z)(e.edit.editor_name)},!0);var a=interpolate('%(relative)s',{absolute:(0,Ze.Z)(e.edit.edited_on.format("LLL")),relative:(0,Ze.Z)(e.edit.edited_on.fromNow())},!0),n=interpolate((0,Ze.Z)(pgettext("post history modal","By %(edited_by)s %(edited_on)s.")),{edited_by:t,edited_on:a},!0);return(0,o.Z)("p",{dangerouslySetInnerHTML:{__html:n}})}function Ua(e){return Object.assign({},e,{edited_on:H()(e.edited_on)})}var Ma=function(e){(0,u.Z)(i,e);var t,a,n=(t=i,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=(0,p.Z)(t);if(a){var i=(0,p.Z)(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return(0,d.Z)(this,e)});function i(e){var t;return(0,r.Z)(this,i),t=n.call(this,e),(0,h.Z)((0,c.Z)(t),"goToEdit",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t.setState({isBusy:!0});var a=t.props.post.api.edits;null!==e&&(a+="?edit="+e),_.Z.get(a).then((function(e){t.setState({isReady:!0,isBusy:!1,edit:Ua(e)})}),(function(e){t.setState({isReady:!0,isBusy:!1,error:e.detail})}))})),(0,h.Z)((0,c.Z)(t),"revertEdit",(function(e){if(!t.state.isBusy&&window.confirm(pgettext("post revert","Are you sure you with to revert this post to the state from before this edit?"))){t.setState({isBusy:!0});var a=t.props.post.api.edits+"?edit="+e;_.Z.post(a).then((function(e){var t=Ge.ZB(e);x.Z.dispatch(Ge.r$(e,t)),k.Z.success(pgettext("post revert","Post has been reverted to previous state.")),N.Z.hide()}),(function(e){k.Z.apiError(e),t.setState({isBusy:!1})}))}})),t.state={isReady:!1,isBusy:!0,canRevert:e.post.acl.can_edit,error:null,edit:null},t}return(0,l.Z)(i,[{key:"componentDidMount",value:function(){this.goToEdit()}},{key:"render",value:function(){return this.state.error?(0,o.Z)(qa,{className:"modal-dialog modal-message"},void 0,(0,o.Z)(K.Z,{message:this.state.error})):this.state.isReady?(0,o.Z)(qa,{},void 0,(0,o.Z)(Aa,{canRevert:this.state.canRevert,disabled:this.state.isBusy,edit:this.state.edit,goToEdit:this.goToEdit,revertEdit:this.revertEdit}),(0,o.Z)(Ca,{diff:this.state.edit.diff}),(0,o.Z)(Ta,{canRevert:this.state.canRevert,disabled:this.state.isBusy,edit:this.state.edit,revertEdit:this.revertEdit})):Pa||(Pa=(0,o.Z)(qa,{},void 0,(0,o.Z)(J.Z,{})))}}]),i}(v().Component);function qa(e){return(0,o.Z)("div",{className:e.className||"modal-dialog",role:"document"},void 0,(0,o.Z)("div",{className:"modal-content"},void 0,(0,o.Z)("div",{className:"modal-header"},void 0,(0,o.Z)("button",{"aria-label":pgettext("modal","Close"),className:"close","data-dismiss":"modal",type:"button"},void 0,La||(La=(0,o.Z)("span",{"aria-hidden":"true"},void 0,"×"))),(0,o.Z)("h4",{className:"modal-title"},void 0,pgettext("post history modal title","Post edits history"))),e.children))}var Ha,Fa,Ya,Va,Ga,$a,Wa=a(57026),Qa=a(60471),Xa=a(55210);function Ka(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=(0,p.Z)(e);if(t){var i=(0,p.Z)(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return(0,d.Z)(this,a)}}function Ja(e){return v().createElement(mn,(0,f.Z)({},e,{Form:vn}))}var en,tn,an,nn,sn,on,rn,ln,cn,un,dn,pn,hn,mn=function(e){(0,u.Z)(a,e);var t=Ka(a);function a(e){var n;return(0,r.Z)(this,a),(n=t.call(this,e)).state={isLoaded:!1,isError:!1,categories:[]},n}return(0,l.Z)(a,[{key:"componentDidMount",value:function(){var e=this;_.Z.get(misago.get("THREAD_EDITOR_API")).then((function(t){var a=t.map((function(e){return Object.assign(e,{disabled:!1===e.post,label:e.name,value:e.id,post:e.post})}));e.setState({isLoaded:!0,categories:a})}),(function(t){e.setState({isError:t.detail})}))}},{key:"render",value:function(){return this.state.isError?(0,o.Z)(Zn,{message:this.state.isError}):this.state.isLoaded?v().createElement(vn,(0,f.Z)({},this.props,{categories:this.state.categories})):Ha||(Ha=(0,o.Z)(fn,{}))}}]),a}(v().Component),vn=function(e){(0,u.Z)(a,e);var t=Ka(a);function a(e){var n;return(0,r.Z)(this,a),n=t.call(this,e),(0,h.Z)((0,c.Z)(n),"onCategoryChange",(function(e){var t=e.target.value,a={category:t};n.acl[t].can_pin_threads
    \n \n )\n }\n}\n\nfunction ariaProps(isOpen) {\n return {\n \"aria-haspopup\": \"true\",\n \"aria-expanded\": isOpen ? \"true\" : \"false\",\n }\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function DropdownDivider({ className }) {\n return
  • \n}\n","import React from \"react\"\n\nexport default function DropdownFooter({ children, listItem }) {\n if (listItem) {\n return
  • {children}
  • \n }\n\n return
    {children}
    \n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function DropdownHeader({ className, children }) {\n return (\n
    {children}
    \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function DropdownMenuItem({ className, children }) {\n return (\n
  • {children}
  • \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function DropdownPills({ className, children }) {\n return (\n
    {children}
    \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function DropdownSubheader({ className, children }) {\n return (\n
  • {children}
  • \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst FlexRow = ({ children, className }) => (\n
    {children}
    \n)\n\nexport default FlexRow\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst FlexRowCol = ({ children, className, shrink }) => (\n \n {children}\n \n)\n\nexport default FlexRowCol\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst FlexRowSection = ({ auto, children, className }) => (\n \n {children}\n \n)\n\nexport default FlexRowSection\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function ListGroup({ className, children }) {\n return
      {children}
    \n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function ListGroupItem({ className, children }) {\n return (\n
  • {children}
  • \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport ListGroupItem from \"./ListGroupItem\"\n\nexport default function ListGroupEmpty({ className, icon, message }) {\n return (\n \n {!!icon && (\n
    \n {icon}\n
    \n )}\n

    {message}

    \n
    \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport ListGroupItem from \"./ListGroupItem\"\n\nexport default function ListGroupError({ className, icon, message, detail }) {\n return (\n \n {!!icon && (\n
    \n {icon}\n
    \n )}\n

    {message}

    \n {!!detail &&

    {detail}

    }\n
    \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport ListGroupItem from \"./ListGroupItem\"\n\nexport default function ListGroupLoading({ className, message }) {\n return (\n \n

    {message}

    \n
    \n
    \n
    \n
    \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport ListGroupItem from \"./ListGroupItem\"\n\nexport default function ListGroupMessage({ className, icon, message, detail }) {\n return (\n \n {!!icon && (\n
    \n {icon}\n
    \n )}\n

    {message}

    \n {!!detail &&

    {detail}

    }\n
    \n )\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { updateAuthenticatedUser } from \"../../reducers/auth\"\nimport { ApiFetch } from \"../Api\"\n\nfunction NotificationsFetch({\n children,\n filter,\n query,\n dispatch,\n unreadNotifications,\n disabled,\n}) {\n return (\n {\n if (data.unreadNotifications != unreadNotifications) {\n dispatch(\n updateAuthenticatedUser({\n unreadNotifications: data.unreadNotifications,\n })\n )\n }\n }}\n >\n {({ data, loading, error, refetch }) => {\n return children({ data, loading, error, refetch })\n }}\n \n )\n}\n\nfunction getApiUrl(filter, query) {\n let api = misago.get(\"NOTIFICATIONS_API\") + \"?limit=30\"\n api += \"&filter=\" + filter\n\n if (query) {\n if (query.after) {\n api += \"&after=\" + query.after\n }\n if (query.before) {\n api += \"&before=\" + query.before\n }\n }\n\n return api\n}\n\nfunction selectState({ auth }) {\n if (!auth.user) {\n return { unreadNotifications: null }\n }\n\n return {\n unreadNotifications: auth.user.unreadNotifications,\n }\n}\n\nconst NotificationsFetchConnected = connect(selectState)(NotificationsFetch)\n\nexport default NotificationsFetchConnected\n","import NotificationsFetch from \"./NotificationsFetch\"\n\nexport default NotificationsFetch\n","import React from \"react\"\nimport { ListGroupEmpty } from \"../ListGroup\"\n\nexport default function NotificationsListEmpty({ filter }) {\n return (\n \n )\n}\n\nfunction emptyMessage(filter) {\n if (filter === \"read\") {\n return pgettext(\n \"notifications list\",\n \"You don't have any read notifications.\"\n )\n } else if (filter === \"unread\") {\n return pgettext(\n \"notifications list\",\n \"You don't have any unread notifications.\"\n )\n }\n\n return pgettext(\"notifications list\", \"You don't have any notifications.\")\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { ListGroup } from \"../ListGroup\"\n\nexport default function NotificationsListGroup({ className, children }) {\n return (\n
    \n {children}\n
    \n )\n}\n","import React from \"react\"\nimport Avatar from \"../avatar\"\n\nexport default function NotificationsListItemActor({ notification }) {\n if (!!notification.actor) {\n return (\n \n \n \n )\n }\n\n return (\n \n \n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function NotificationsListItemMessage({ notification }) {\n return (\n \n )\n}\n","import React from \"react\"\n\nexport default function NotificationsListItemReadStatus({ notification }) {\n if (notification.isRead) {\n return (\n \n \n \n )\n }\n\n return (\n \n \n \n )\n}\n","import React from \"react\"\nimport Timestamp from \"../Timestamp\"\n\nexport default function NotificationsListItemTimestamp({ notification }) {\n return (\n
    \n \n
    \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { ListGroupItem } from \"../ListGroup\"\nimport NotificationsListItemActor from \"./NotificationsListItemActor\"\nimport NotificationsListItemMessage from \"./NotificationsListItemMessage\"\nimport NotificationsListItemReadStatus from \"./NotificationsListItemReadStatus\"\nimport NotificationsListItemTimestamp from \"./NotificationsListItemTimestamp\"\n\nexport default function NotificationsListItem({ notification }) {\n return (\n \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n \n )\n}\n","import React from \"react\"\nimport NotificationsListEmpty from \"./NotificationsListEmpty\"\nimport NotificationsListGroup from \"./NotificationsListGroup\"\nimport NotificationsListItem from \"./NotificationsListItem\"\n\nexport default function NotificationsList({ filter, items }) {\n return (\n 0\n ? \"notifications-list-ready\"\n : \"notifications-list-pending\"\n }\n >\n {items.length === 0 && }\n {items.map((notification) => (\n \n ))}\n \n )\n}\n","import React from \"react\"\nimport { ListGroupError } from \"../ListGroup\"\nimport NotificationsListGroup from \"./NotificationsListGroup\"\n\nexport default function NotificationsListError({ error }) {\n const detail = errorDetail(error)\n\n return (\n \n \n \n )\n}\n\nfunction errorDetail(error) {\n if (error.status === 0) {\n return gettext(\n \"Check your internet connection and try refreshing the site.\"\n )\n }\n\n if (error.data && error.data.detail) {\n return error.data.detail\n }\n}\n","import React from \"react\"\nimport { ListGroupLoading } from \"../ListGroup\"\nimport NotificationsListGroup from \"./NotificationsListGroup\"\n\nexport default function NotificationsListLoading() {\n return (\n \n \n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { connect } from \"react-redux\"\nimport { close } from \"../../reducers/overlay\"\n\nconst BODY_CLASS = \"has-overlay\"\n\nclass Overlay extends React.Component {\n constructor(props) {\n super(props)\n\n this.scrollOrigin = null\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.open !== this.props.open) {\n if (this.props.open) {\n this.scrollOrigin = window.pageYOffset\n document.body.classList.add(BODY_CLASS)\n if (this.props.onOpen) {\n this.props.onOpen()\n }\n } else {\n document.body.classList.remove(BODY_CLASS)\n window.scrollTo(0, this.scrollOrigin)\n this.scrollOrigin = null\n }\n }\n }\n\n closeOnNavigation = (event) => {\n if (event.target.closest(\"a\")) {\n this.props.dispatch(close())\n }\n }\n\n render() {\n return (\n \n {this.props.children}\n \n )\n }\n}\n\nconst OverlayConnected = connect()(Overlay)\n\nexport default OverlayConnected\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { close } from \"../../reducers/overlay\"\n\nexport function OverlayHeader({ children, dispatch }) {\n return (\n
    \n
    {children}
    \n dispatch(close())}\n >\n close\n \n
    \n )\n}\n\nconst OverlayHeaderConnected = connect()(OverlayHeader)\n\nexport default OverlayHeaderConnected\n","import React from \"react\"\n\nconst PageContainer = ({ children }) => (\n
    {children}
    \n)\n\nexport default PageContainer\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst PageHeader = ({ children, className, styleName }) => (\n \n
    \n
    \n
    \n {children}\n
    \n
    \n
    \n)\n\nexport default PageHeader\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst PageHeaderBanner = ({ children, className, styleName }) => (\n \n
    \n
    {children}
    \n
    \n \n)\n\nexport default PageHeaderBanner\n","import React from \"react\"\n\nconst PageHeaderContainer = ({ children }) => (\n
    {children}
    \n)\n\nexport default PageHeaderContainer\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst PageHeaderDetails = ({ children, className }) => (\n
    {children}
    \n)\n\nexport default PageHeaderDetails\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst PageHeaderHTMLMessage = ({ className, message }) => (\n \n)\n\nexport default PageHeaderHTMLMessage\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst PageHeaderMessage = ({ children, className }) => (\n
    {children}
    \n)\n\nexport default PageHeaderMessage\n","import React from \"react\"\nimport PageHeader from \"./PageHeader\"\nimport PageHeaderBanner from \"./PageHeaderBanner\"\nimport PageHeaderContainer from \"./PageHeaderContainer\"\nimport PageHeaderDetails from \"./PageHeaderDetails\"\n\nconst PageHeaderPlain = ({ styleName, header, message }) => (\n \n \n \n

    {header}

    \n
    \n {message && (\n {message}\n )}\n
    \n
    \n)\n\nexport default PageHeaderPlain\n","import React from \"react\"\nimport zxcvbn from \"misago/services/zxcvbn\"\n\nexport const STYLES = [\n \"progress-bar-danger\",\n \"progress-bar-warning\",\n \"progress-bar-warning\",\n \"progress-bar-primary\",\n \"progress-bar-success\",\n]\n\nexport const LABELS = [\n pgettext(\"password strength indicator\", \"Entered password is very weak.\"),\n pgettext(\"password strength indicator\", \"Entered password is weak.\"),\n pgettext(\"password strength indicator\", \"Entered password is average.\"),\n pgettext(\"password strength indicator\", \"Entered password is strong.\"),\n pgettext(\"password strength indicator\", \"Entered password is very strong.\"),\n]\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this._score = 0\n this._password = null\n this._inputs = []\n\n this.state = {\n loaded: false,\n }\n }\n\n componentDidMount() {\n zxcvbn.load().then(() => {\n this.setState({ loaded: true })\n })\n }\n\n getScore(password, inputs) {\n let cacheStale = false\n\n if (password !== this._password) {\n cacheStale = true\n }\n\n if (inputs.length !== this._inputs.length) {\n cacheStale = true\n } else {\n inputs.map((value, i) => {\n if (value.trim() !== this._inputs[i]) {\n cacheStale = true\n }\n })\n }\n\n if (cacheStale) {\n this._score = zxcvbn.scorePassword(password, inputs)\n this._password = password\n this._inputs = inputs.map(function (value) {\n return value.trim()\n })\n }\n\n return this._score\n }\n\n render() {\n if (!this.state.loaded) return null\n\n let score = this.getScore(this.props.password, this.props.inputs)\n\n return (\n
    \n
    \n \n {LABELS[score]}\n
    \n
    \n

    {LABELS[score]}

    \n \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport PasswordStrength from \"misago/components/password-strength\"\nimport RegisterLegalFootnote from \"misago/components/RegisterLegalFootnote\"\nimport StartSocialAuth from \"misago/components/StartSocialAuth\"\nimport misago from \"misago\"\nimport ajax from \"misago/services/ajax\"\nimport auth from \"misago/services/auth\"\nimport captcha from \"misago/services/captcha\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport showBannedPage from \"misago/utils/banned-page\"\nimport * as validators from \"misago/utils/validators\"\n\nexport class RegisterForm extends Form {\n constructor(props) {\n super(props)\n\n const { username, password } = this.props.criteria\n\n let passwordMinLength = 0\n password.forEach((item) => {\n if (item.name === \"MinimumLengthValidator\") {\n passwordMinLength = item.min_length\n }\n })\n\n const formValidators = {\n username: [\n validators.usernameContent(),\n validators.usernameMinLength(username.min_length),\n validators.usernameMaxLength(username.max_length),\n ],\n email: [validators.email()],\n password: [validators.passwordMinLength(passwordMinLength)],\n captcha: captcha.validator(),\n }\n\n if (!!misago.get(\"TERMS_OF_SERVICE_ID\")) {\n formValidators.termsOfService = [validators.requiredTermsOfService()]\n }\n\n if (!!misago.get(\"PRIVACY_POLICY_ID\")) {\n formValidators.privacyPolicy = [validators.requiredPrivacyPolicy()]\n }\n\n this.state = {\n isLoading: false,\n\n username: \"\",\n email: \"\",\n password: \"\",\n captcha: \"\",\n\n termsOfService: null,\n privacyPolicy: null,\n\n validators: formValidators,\n errors: {},\n }\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(gettext(\"Form contains errors.\"))\n this.setState({\n errors: this.validate(),\n })\n return false\n }\n }\n\n send() {\n return ajax.post(misago.get(\"USERS_API\"), {\n username: this.state.username,\n email: this.state.email,\n password: this.state.password,\n captcha: this.state.captcha,\n terms_of_service: this.state.termsOfService,\n privacy_policy: this.state.privacyPolicy,\n })\n }\n\n handleSuccess(apiResponse) {\n this.props.callback(apiResponse)\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n this.setState({\n errors: Object.assign({}, this.state.errors, rejection),\n })\n\n if (rejection.__all__ && rejection.__all__.length > 0) {\n snackbar.error(rejection.__all__[0])\n } else {\n snackbar.error(gettext(\"Form contains errors.\"))\n }\n } else if (rejection.status === 403 && rejection.ban) {\n showBannedPage(rejection.ban)\n modal.hide()\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n handlePrivacyPolicyChange = (event) => {\n const value = event.target.value\n this.handleToggleAgreement(\"privacyPolicy\", value)\n }\n\n handleTermsOfServiceChange = (event) => {\n const value = event.target.value\n this.handleToggleAgreement(\"termsOfService\", value)\n }\n\n handleToggleAgreement = (agreement, value) => {\n this.setState((prevState, props) => {\n if (prevState[agreement] === null) {\n const errors = { ...prevState.errors, [agreement]: null }\n return { errors, [agreement]: value }\n }\n\n const validator = this.state.validators[agreement][0]\n const errors = { ...prevState.errors, [agreement]: [validator(null)] }\n return { errors, [agreement]: null }\n })\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"register modal title\", \"Register\")}\n

    \n
    \n
    \n \n \n
    \n \n\n \n \n \n\n \n \n \n\n \n }\n >\n \n \n\n {captcha.component({\n form: this,\n })}\n\n \n
    \n
    \n \n {pgettext(\"register modal btn\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport class RegisterComplete extends React.Component {\n getLead() {\n if (this.props.activation === \"user\") {\n return pgettext(\n \"account activation required\",\n \"%(username)s, your account has been created but you need to activate it before you will be able to sign in.\"\n )\n } else if (this.props.activation === \"admin\") {\n return pgettext(\n \"account activation required\",\n \"%(username)s, your account has been created but the site administrator will have to activate it before you will be able to sign in.\"\n )\n }\n }\n\n getSubscript() {\n if (this.props.activation === \"user\") {\n return pgettext(\n \"account activation required\",\n \"We have sent an e-mail to %(email)s with link that you have to click to activate your account.\"\n )\n } else if (this.props.activation === \"admin\") {\n return pgettext(\n \"account activation required\",\n \"We will send an e-mail to %(email)s when this takes place.\"\n )\n }\n }\n\n render() {\n return (\n \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"register modal title\", \"Registration complete\")}\n

    \n
    \n
    \n
    \n info_outline\n
    \n
    \n

    \n {interpolate(\n this.getLead(),\n { username: this.props.username },\n true\n )}\n

    \n

    \n {interpolate(\n this.getSubscript(),\n { email: this.props.email },\n true\n )}\n

    \n \n {pgettext(\"register modal dismiss\", \"Ok\")}\n \n
    \n
    \n
    \n \n )\n }\n}\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n complete: false,\n }\n }\n\n completeRegistration = (apiResponse) => {\n if (apiResponse.activation === \"active\") {\n modal.hide()\n auth.signIn(apiResponse)\n } else {\n this.setState({\n complete: apiResponse,\n })\n }\n }\n\n render() {\n if (this.state.complete) {\n return (\n \n )\n }\n\n return \n }\n}\n","import RegisterButton from \"./RegisterButton\"\n\nexport default RegisterButton\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport ajax from \"../../services/ajax\"\nimport captcha from \"../../services/captcha\"\nimport modal from \"../../services/modal\"\nimport snackbar from \"../../services/snackbar\"\nimport Loader from \"../loader\"\nimport RegisterForm from \"../register.js\"\n\nexport default class RegisterButton extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n isLoaded: false,\n\n criteria: null,\n }\n }\n\n showRegisterForm = () => {\n if (this.props.onClick) {\n this.props.onClick()\n }\n\n if (misago.get(\"SETTINGS\").account_activation === \"closed\") {\n snackbar.info(\n pgettext(\n \"register form\",\n \"Registration form is currently disabled by the site administrator.\"\n )\n )\n } else if (this.state.isLoaded) {\n modal.show()\n } else {\n this.setState({ isLoading: true })\n\n Promise.all([\n captcha.load(),\n ajax.get(misago.get(\"AUTH_CRITERIA_API\")),\n ]).then(\n (result) => {\n this.setState({\n isLoading: false,\n isLoaded: true,\n criteria: result[1],\n })\n\n modal.show()\n },\n () => {\n this.setState({ isLoading: false })\n\n snackbar.error(\n pgettext(\n \"register form\",\n \"Registration form is currently unavailable due to an error.\"\n )\n )\n }\n )\n }\n }\n\n render() {\n return (\n \n {pgettext(\"cta\", \"Register\")}\n {this.state.isLoading ? : null}\n \n )\n }\n}\n","import React from \"react\"\nimport misago from \"misago\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst AGREEMENT_URL = '%(agreement)s'\n\nconst RegisterLegalFootnote = (props) => {\n const {\n errors,\n privacyPolicy,\n termsOfService,\n onPrivacyPolicyChange,\n onTermsOfServiceChange,\n } = props\n\n const termsOfServiceId = misago.get(\"TERMS_OF_SERVICE_ID\")\n const termsOfServiceUrl = misago.get(\"TERMS_OF_SERVICE_URL\")\n\n const privacyPolicyId = misago.get(\"PRIVACY_POLICY_ID\")\n const privacyPolicyUrl = misago.get(\"PRIVACY_POLICY_URL\")\n\n if (!termsOfServiceId && !privacyPolicyId) return null\n\n return (\n
    \n \n \n
    \n )\n}\n\nconst LegalAgreement = (props) => {\n const { agreement, checked, errors, url, value, onChange } = props\n\n if (!url) return null\n\n const agreementHtml = interpolate(\n AGREEMENT_URL,\n { agreement: escapeHtml(agreement), url: escapeHtml(url) },\n true\n )\n const label = interpolate(\n pgettext(\n \"register form agreement prompt\",\n \"I have read and accept %(agreement)s.\"\n ),\n { agreement: agreementHtml },\n true\n )\n\n return (\n
    \n \n {errors &&\n errors.map((error, i) => (\n
    \n {error}\n
    \n ))}\n
    \n )\n}\n\nexport default RegisterLegalFootnote\n","import React from \"react\"\nimport { ListGroup } from \"../ListGroup\"\n\nexport default function SearchResultsList({ children }) {\n return {children}\n}\n","import React from \"react\"\nimport { ListGroupMessage } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\n\nexport default function SearchMessage() {\n return (\n \n \n \n )\n}\n","import React from \"react\"\nimport { ListGroupItem } from \"../ListGroup\"\nimport Timestamp from \"../Timestamp\"\n\nexport default function SearchResultPost({ post }) {\n return (\n \n \n
    \n
    {post.thread.title}
    \n \n
      \n
    • \n {post.category.name}\n
    • \n
    • {post.poster ? post.poster.username : post.poster_name}
    • \n
    • \n \n
    • \n
    \n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport Avatar from \"../avatar\"\nimport { ListGroupItem } from \"../ListGroup\"\nimport Timestamp from \"../Timestamp\"\n\nexport default function SearchResultUser({ user }) {\n const title = user.title || user.rank.title\n\n return (\n \n \n \n
    \n
    {user.username}
    \n
      \n {!!title && (\n
    • \n {title}\n
    • \n )}\n
    • {user.rank.name}
    • \n
    • \n \n
    • \n
    \n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport { ListGroupItem } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\nimport SearchResultPost from \"./SearchResultPost\"\nimport SearchResultUser from \"./SearchResultUser\"\n\nexport default function SearchResults({ query, results }) {\n const threads = results[0]\n const users = results[1]\n\n const { count } = threads.results\n\n return (\n \n {users.results.results.map((user) => (\n \n ))}\n {threads.results.results.map((post) => (\n \n ))}\n {count > 0 && (\n \n \n {npgettext(\n \"search results list\",\n \"See all %(count)s result.\",\n \"See all %(count)s results.\",\n threads.results.count\n ).replace(\"%(count)s\", threads.results.count)}\n \n \n )}\n \n )\n}\n","import React from \"react\"\nimport { ListGroupEmpty } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\n\nexport default function SearchResultsEmpty() {\n return (\n \n \n \n )\n}\n","import React from \"react\"\nimport { ListGroupError } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\n\nexport default function SearchResultsError({ error }) {\n return (\n \n \n \n )\n}\n\nfunction errorDetail(error) {\n if (error.status === 0) {\n return gettext(\n \"Check your internet connection and try refreshing the site.\"\n )\n }\n\n if (error.data && error.data.detail) {\n return error.data.detail\n }\n}\n","import React from \"react\"\nimport { ListGroupLoading } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\n\nexport default function SearchResultsLoading() {\n return (\n \n \n \n )\n}\n","import React from \"react\"\nimport { ApiFetch } from \"../Api\"\nimport SearchMessage from \"./SearchMessage\"\nimport SearchResults from \"./SearchResults\"\nimport SearchResultsEmpty from \"./SearchResultsEmpty\"\nimport SearchResultsError from \"./SearchResultsError\"\nimport SearchResultsLoading from \"./SearchResultsLoading\"\n\nconst DEBOUNCE = 750\nconst CACHE = {}\n\nexport default class SearchFetch extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n query: this.props.query.trim(),\n }\n\n this.debounce = null\n }\n\n componentDidUpdate() {\n const query = this.props.query.trim()\n\n if (this.state.query != query) {\n if (this.debounce) {\n window.clearTimeout(this.debounce)\n }\n\n this.debounce = window.setTimeout(() => {\n this.setState({ query })\n }, DEBOUNCE)\n }\n }\n\n componentWillUnmount() {\n if (this.debounce) {\n window.clearTimeout(this.debounce)\n }\n }\n\n render() {\n return (\n \n {({ data, loading, error }) => {\n if (this.state.query.length < 3) {\n return \n }\n\n if (loading) {\n return \n }\n\n if (error) {\n return \n }\n\n if (isResultEmpty(data)) {\n return \n }\n\n if (data !== null) {\n return \n }\n\n return null\n }}\n \n )\n }\n}\n\nfunction getSearchUrl(query) {\n return misago.get(\"SEARCH_API\") + \"?q=\" + encodeURIComponent(query)\n}\n\nfunction isResultEmpty(results) {\n if (results === null) {\n return true\n }\n\n let resultsCount = 0\n results.forEach((result) => {\n resultsCount += result.results.count\n })\n return resultsCount === 0\n}\n","import React from \"react\"\n\nexport default function SearchInput({ query, setQuery }) {\n return (\n
    \n setQuery(event.target.value)}\n />\n
    \n )\n}\n","import React from \"react\"\n\nexport default class SearchQuery extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n query: \"\",\n }\n }\n\n setQuery = (query) => {\n this.setState({ query })\n }\n\n render() {\n return this.props.children({\n query: this.state.query,\n setQuery: this.setQuery,\n })\n }\n}\n","import React from \"react\"\nimport SearchFetch from \"./SearchFetch\"\nimport SearchInput from \"./SearchInput\"\nimport SearchQuery from \"./SearchQuery\"\n\nexport default function SearchDropdown() {\n return (\n \n {({ query, setQuery }) => {\n return (\n
    \n \n \n
    \n )\n }}\n
    \n )\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { Overlay, OverlayHeader } from \"../Overlay\"\nimport SearchFetch from \"./SearchFetch\"\nimport SearchInput from \"./SearchInput\"\nimport SearchQuery from \"./SearchQuery\"\n\nfunction SearchOverlay({ open }) {\n return (\n {\n window.setTimeout(() => {\n document.querySelector(\"#search-mount .form-control-search\").focus()\n }, 0)\n }}\n >\n {pgettext(\"cta\", \"Search\")}\n \n {({ query, setQuery }) => {\n return (\n
    \n \n
    \n \n
    \n
    \n )\n }}\n
    \n \n )\n}\n\nfunction select(state) {\n return { open: state.overlay.search }\n}\n\nconst SearchOverlayConnected = connect(select)(SearchOverlay)\n\nexport default SearchOverlayConnected\n","import SignInButton from \"./SignInButton\"\n\nexport default SignInButton\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport modal from \"../../services/modal\"\nimport SignInModal from \"../sign-in\"\n\nexport default function SignInButton({ block, className, onClick }) {\n const settings = misago.get(\"SETTINGS\")\n\n if (settings.DELEGATE_AUTH) {\n return (\n \n {pgettext(\"cta\", \"Sign in\")}\n \n )\n }\n\n return (\n {\n if (onClick) {\n onClick()\n }\n\n modal.show()\n }}\n >\n {pgettext(\"cta\", \"Sign in\")}\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { connect } from \"react-redux\"\nimport {\n DropdownDivider,\n DropdownHeader,\n DropdownMenuItem,\n DropdownPills,\n DropdownSubheader,\n} from \"../Dropdown\"\nimport RegisterButton from \"../RegisterButton\"\nimport SignInButton from \"../SignInButton\"\n\nfunction SiteNavMenu({ isAnonymous, close, dropdown, overlay }) {\n const baseUrl = misago.get(\"MISAGO_PATH\")\n const settings = misago.get(\"SETTINGS\")\n const mainItems = misago.get(\"main_menu\")\n const extraItems = misago.get(\"extraMenuItems\")\n const extraFooterItems = misago.get(\"extraFooterItems\")\n const categories = misago.get(\"categories_menu\")\n const users = misago.get(\"usersLists\")\n const authDelegated = settings.enable_oauth2_client\n\n const topNav = []\n mainItems.forEach((item) => {\n topNav.push({ title: item.label, url: item.url })\n })\n\n topNav.push({\n title: pgettext(\"site nav\", \"Search\"),\n url: baseUrl + \"search/\",\n })\n\n const footerNav = []\n\n const tosTitle = misago.get(\"TERMS_OF_SERVICE_TITLE\")\n const tosUrl = misago.get(\"TERMS_OF_SERVICE_URL\")\n if (tosTitle && tosUrl) {\n footerNav.push({\n title: tosTitle,\n url: tosUrl,\n })\n }\n\n const privacyTitle = misago.get(\"PRIVACY_POLICY_TITLE\")\n const privacyUrl = misago.get(\"PRIVACY_POLICY_URL\")\n if (privacyTitle && privacyUrl) {\n footerNav.push({\n title: privacyTitle,\n url: privacyUrl,\n })\n }\n\n return (\n \n {isAnonymous && (\n \n {pgettext(\"cta\", \"You are not signed in\")}\n \n )}\n {isAnonymous && (\n \n \n {!authDelegated && }\n \n )}\n {settings.forum_name}\n {topNav.map((item) => (\n \n {item.title}\n \n ))}\n {extraItems.map((item, index) => (\n \n \n {item.title}\n \n \n ))}\n {!!users.length && }\n {!!users.length && (\n \n {pgettext(\"site nav section\", \"Users\")}\n \n )}\n {users.map((item) => (\n \n {item.name}\n \n ))}\n \n \n {pgettext(\"site nav section\", \"Categories\")}\n \n {categories.map((category) =>\n category.is_vanilla ? (\n \n {category.name}\n \n ) : (\n \n \n {category.name}\n \n {category.short_name || category.name}\n \n \n \n )\n )}\n {(!!footerNav.length || !!extraFooterItems.length) && (\n \n )}\n {(!!footerNav.length || !!extraFooterItems.length) && (\n \n {pgettext(\"site nav section\", \"Footer\")}\n \n )}\n {extraFooterItems.map((item, index) => (\n \n \n {item.title}\n \n \n ))}\n {footerNav.map((item) => (\n \n {item.title}\n \n ))}\n \n )\n}\n\nfunction select(state) {\n return {\n isAnonymous: !state.auth.user.id,\n }\n}\n\nconst SiteNavMenuConnected = connect(select)(SiteNavMenu)\n\nexport default SiteNavMenuConnected\n","import React from \"react\"\nimport SiteNavMenu from \"./SiteNavMenu\"\n\nexport default function SiteNavDropdown({ close }) {\n return \n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { close } from \"../../reducers/overlay\"\nimport { Overlay, OverlayHeader } from \"../Overlay\"\nimport SiteNavMenu from \"./SiteNavMenu\"\n\nexport function SiteNavOverlay({ dispatch, isOpen }) {\n return (\n \n {pgettext(\"site nav title\", \"Menu\")}\n dispatch(close())} overlay />\n \n )\n}\n\nfunction select(state) {\n return {\n isOpen: state.overlay.siteNav,\n }\n}\n\nconst SiteNavOverlayConnected = connect(select)(SiteNavOverlay)\n\nexport default SiteNavOverlayConnected\n","import React from \"react\"\nimport misago from \"misago\"\n\nconst StartSocialAuth = (props) => {\n const { buttonClassName, buttonLabel, formLabel, header, labelClassName } =\n props\n const socialAuth = misago.get(\"SOCIAL_AUTH\")\n\n if (socialAuth.length === 0) return null\n\n return (\n
    \n \n
    \n {socialAuth.map(({ pk, name, button_text, button_color, url }) => {\n const className = \"btn btn-block btn-default btn-social-\" + pk\n const style = button_color ? { color: button_color } : null\n const finalButtonLabel =\n button_text || interpolate(buttonLabel, { site: name }, true)\n\n return (\n \n )\n })}\n
    \n
    \n \n
    \n )\n}\n\nconst FormHeader = ({ className, text }) => {\n if (!text) return null\n return
    {text}
    \n}\n\nexport default StartSocialAuth\n","import React from \"react\"\n\nconst ThreadFlags = ({ thread }) => (\n
      \n {thread.weight == 2 && (\n \n bookmark\n \n )}\n {thread.weight == 1 && (\n \n bookmark_outline\n \n )}\n {thread.best_answer && (\n \n check_circle\n \n )}\n {thread.has_poll && (\n
    • \n poll\n
    • \n )}\n {(thread.is_unapproved || thread.has_unapproved_posts) && (\n \n visibility\n \n )}\n {thread.is_closed && (\n \n lock\n \n )}\n {thread.is_hidden && (\n \n visibility_off\n \n )}\n
    \n)\n\nexport default ThreadFlags\n","import React from \"react\"\n\nconst ThreadReplies = ({ thread }) => (\n \n chat_bubble_outline\n {thread.replies > 980\n ? Math.round(thread.replies / 1000) + \"K\"\n : thread.replies}\n \n)\n\nexport default ThreadReplies\n","import React from \"react\"\nimport {\n formatNarrow,\n formatRelative,\n fullDateTime,\n} from \"../../datetimeFormats\"\n\nclass Timestamp extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = { tick: 0 }\n this.date = new Date(props.datetime)\n this.timeout = null\n }\n\n componentDidMount() {\n this.scheduleNextUpdate()\n }\n\n componentWillUnmount() {\n if (this.timeout) {\n window.clearTimeout(this.timeout)\n }\n }\n\n scheduleNextUpdate = () => {\n const now = new Date()\n const diff = Math.ceil(Math.abs(Math.round((this.date - now) / 1000)))\n\n if (diff < 3600) {\n this.timeout = window.setTimeout(\n () => {\n this.setState(tick)\n this.scheduleNextUpdate()\n },\n 50 * 1000 // Update every 50 seconds\n )\n } else if (diff < 3600 * 24) {\n this.timeout = window.setTimeout(\n () => {\n this.setState(tick)\n },\n 40 * 60 * 1000 // Update every 40 minutes\n )\n }\n }\n\n render() {\n const displayed = this.props.narrow\n ? formatNarrow(this.date)\n : formatRelative(this.date)\n\n return (\n \n {displayed}\n \n )\n }\n}\n\nfunction tick(state) {\n return { tick: state.tick + 1 }\n}\n\nexport default Timestamp\n","import Timestamp from \"./Timestamp\"\n\nexport default Timestamp\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst Toolbar = ({ children, className }) => (\n \n)\n\nexport default Toolbar\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst ToolbarItem = ({ children, className, shrink }) => (\n \n {children}\n \n)\n\nexport default ToolbarItem\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst ToolbarSection = ({ auto, children, className }) => (\n \n {children}\n \n)\n\nexport default ToolbarSection\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst ToolbarSpacer = ({ className }) => (\n
    \n)\n\nexport default ToolbarSpacer\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Button from \"misago/components/button\"\nimport Loader from \"misago/components/loader\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n }\n }\n\n callApi(avatarType) {\n if (this.state.isLoading) {\n return false\n }\n\n this.setState({\n isLoading: true,\n })\n\n ajax\n .post(this.props.user.api.avatar, {\n avatar: avatarType,\n })\n .then(\n (response) => {\n this.setState({\n isLoading: false,\n })\n\n snackbar.success(response.detail)\n this.props.onComplete(response)\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n this.setState({\n isLoading: false,\n })\n } else {\n this.props.showError(rejection)\n }\n }\n )\n }\n\n setGravatar = () => {\n this.callApi(\"gravatar\")\n }\n\n setGenerated = () => {\n this.callApi(\"generated\")\n }\n\n getGravatarButton() {\n if (this.props.options.gravatar) {\n return (\n \n {pgettext(\"avatar modal btn\", \"Download my Gravatar\")}\n \n )\n } else {\n return null\n }\n }\n\n getCropButton() {\n if (!this.props.options.crop_src) return null\n\n return (\n \n {pgettext(\"avatar modal btn\", \"Re-crop uploaded image\")}\n \n )\n }\n\n getUploadButton() {\n if (!this.props.options.upload) return null\n\n return (\n \n {pgettext(\"avatar modal btn\", \"Upload new image\")}\n \n )\n }\n\n getGalleryButton() {\n if (!this.props.options.galleries) return null\n\n return (\n \n {pgettext(\"avatar modal btn\", \"Pick avatar from gallery\")}\n \n )\n }\n\n getAvatarPreview() {\n let userPeview = {\n id: this.props.user.id,\n avatars: this.props.options.avatars,\n }\n\n if (this.state.isLoading) {\n return (\n
    \n \n \n
    \n )\n }\n\n return (\n
    \n \n
    \n )\n }\n\n render() {\n return (\n
    \n
    \n
    {this.getAvatarPreview()}
    \n
    \n {this.getGravatarButton()}\n\n \n {pgettext(\"avatar modal btn\", \"Generate my individual avatar\")}\n \n\n {this.getCropButton()}\n {this.getUploadButton()}\n {this.getGalleryButton()}\n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Button from \"misago/components/button\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n deviceRatio: 1,\n }\n }\n\n getAvatarSize() {\n if (this.props.upload) {\n return this.props.options.crop_tmp.size\n } else {\n return this.props.options.crop_src.size\n }\n }\n\n getImagePath() {\n if (this.props.upload) {\n return this.props.dataUrl\n } else {\n return this.props.options.crop_src.url\n }\n }\n\n componentDidMount() {\n let cropit = $(\".crop-form\")\n let cropperWidth = this.getAvatarSize()\n\n const initialWidth = cropit.width()\n while (initialWidth < cropperWidth) {\n cropperWidth = cropperWidth / 2\n }\n\n const deviceRatio = this.getAvatarSize() / cropperWidth\n\n cropit.width(cropperWidth)\n\n cropit.cropit({\n width: cropperWidth,\n height: cropperWidth,\n exportZoom: deviceRatio,\n imageState: {\n src: this.getImagePath(),\n },\n onImageLoaded: () => {\n if (this.props.upload) {\n // center uploaded image\n let zoomLevel = cropit.cropit(\"zoom\")\n let imageSize = cropit.cropit(\"imageSize\")\n\n // is it wider than taller?\n if (imageSize.width > imageSize.height) {\n let displayedWidth = imageSize.width * zoomLevel\n let offsetX = (displayedWidth - this.getAvatarSize()) / -2\n\n cropit.cropit(\"offset\", {\n x: offsetX,\n y: 0,\n })\n } else if (imageSize.width < imageSize.height) {\n let displayedHeight = imageSize.height * zoomLevel\n let offsetY = (displayedHeight - this.getAvatarSize()) / -2\n\n cropit.cropit(\"offset\", {\n x: 0,\n y: offsetY,\n })\n } else {\n cropit.cropit(\"offset\", {\n x: 0,\n y: 0,\n })\n }\n } else {\n // use preserved crop\n let crop = this.props.options.crop_src.crop\n\n if (crop) {\n cropit.cropit(\"zoom\", crop.zoom)\n cropit.cropit(\"offset\", {\n x: crop.x,\n y: crop.y,\n })\n }\n }\n },\n })\n }\n\n componentWillUnmount() {\n $(\".crop-form\").cropit(\"disable\")\n }\n\n cropAvatar = () => {\n if (this.state.isLoading) {\n return false\n }\n\n this.setState({\n isLoading: true,\n })\n\n let avatarType = this.props.upload ? \"crop_tmp\" : \"crop_src\"\n let cropit = $(\".crop-form\")\n\n const deviceRatio = cropit.cropit(\"exportZoom\")\n const cropitOffset = cropit.cropit(\"offset\")\n\n ajax\n .post(this.props.user.api.avatar, {\n avatar: avatarType,\n crop: {\n offset: {\n x: cropitOffset.x * deviceRatio,\n y: cropitOffset.y * deviceRatio,\n },\n zoom: cropit.cropit(\"zoom\") * deviceRatio,\n },\n })\n .then(\n (data) => {\n this.props.onComplete(data)\n snackbar.success(data.detail)\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n this.setState({\n isLoading: false,\n })\n } else {\n this.props.showError(rejection)\n }\n }\n )\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n \n {this.props.upload\n ? pgettext(\"avatar crop modal btn\", \"Set avatar\")\n : pgettext(\"avatar crop modal btn\", \"Crop image\")}\n \n\n \n {pgettext(\"avatar crop modal btn\", \"Cancel\")}\n \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport AvatarCrop from \"misago/components/change-avatar/crop\"\nimport Button from \"misago/components/button\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport fileSize from \"misago/utils/file-size\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n image: null,\n preview: null,\n progress: 0,\n uploaded: null,\n dataUrl: null,\n }\n }\n\n validateFile(image) {\n if (image.size > this.props.options.upload.limit) {\n return interpolate(\n pgettext(\n \"avatar upload modal\",\n \"Selected file is too big. (%(filesize)s)\"\n ),\n {\n filesize: fileSize(image.size),\n },\n true\n )\n }\n\n let invalidTypeMsg = pgettext(\n \"avatar upload modal\",\n \"Selected file type is not supported.\"\n )\n if (\n this.props.options.upload.allowed_mime_types.indexOf(image.type) === -1\n ) {\n return invalidTypeMsg\n }\n\n let extensionFound = false\n let loweredFilename = image.name.toLowerCase()\n this.props.options.upload.allowed_extensions.map(function (extension) {\n if (loweredFilename.substr(extension.length * -1) === extension) {\n extensionFound = true\n }\n })\n\n if (!extensionFound) {\n return invalidTypeMsg\n }\n\n return false\n }\n\n pickFile = () => {\n document.getElementById(\"avatar-hidden-upload\").click()\n }\n\n uploadFile = () => {\n let image = document.getElementById(\"avatar-hidden-upload\").files[0]\n if (!image) return\n\n let validationError = this.validateFile(image)\n if (validationError) {\n snackbar.error(validationError)\n return\n }\n\n this.setState({\n image,\n preview: URL.createObjectURL(image),\n progress: 0,\n })\n\n let data = new FormData()\n data.append(\"avatar\", \"upload\")\n data.append(\"image\", image)\n\n ajax\n .upload(this.props.user.api.avatar, data, (progress) => {\n this.setState({\n progress,\n })\n })\n .then(\n (data) => {\n this.setState({\n options: data,\n uploaded: data.detail,\n })\n\n snackbar.info(\n pgettext(\n \"avatar upload modal\",\n \"Your image has been uploaded and you may now crop it.\"\n )\n )\n },\n (rejection) => {\n if (rejection.status === 400 || rejection.status === 413) {\n snackbar.error(rejection.detail)\n this.setState({\n isLoading: false,\n image: null,\n progress: 0,\n })\n } else {\n this.props.showError(rejection)\n }\n }\n )\n }\n\n getUploadRequirements(options) {\n let extensions = options.allowed_extensions.map(function (extension) {\n return extension.substr(1)\n })\n\n return interpolate(\n pgettext(\"avatar upload modal\", \"%(files)s files smaller than %(limit)s\"),\n {\n files: extensions.join(\", \"),\n limit: fileSize(options.limit),\n },\n true\n )\n }\n\n getUploadButton() {\n return (\n
    \n \n

    \n {this.getUploadRequirements(this.props.options.upload)}\n

    \n
    \n )\n }\n\n getUploadProgressLabel() {\n return interpolate(\n pgettext(\"avatar upload modal field\", \"%(progress)s % complete\"),\n {\n progress: this.state.progress,\n },\n true\n )\n }\n\n getUploadProgress() {\n return (\n
    \n
    \n \n\n
    \n \n {this.getUploadProgressLabel()}\n
    \n
    \n
    \n
    \n )\n }\n\n renderUpload() {\n return (\n
    \n \n {this.state.image ? this.getUploadProgress() : this.getUploadButton()}\n
    \n
    \n \n {pgettext(\"avatar upload modal btn\", \"Cancel\")}\n \n
    \n
    \n
    \n )\n }\n\n renderCrop() {\n return (\n \n )\n }\n\n render() {\n if (this.state.uploaded) return this.renderCrop()\n\n return this.renderUpload()\n }\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Button from \"misago/components/button\"\nimport misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport batch from \"misago/utils/batch\"\n\nexport class GalleryItem extends React.Component {\n select = () => {\n this.props.select(this.props.id)\n }\n\n getClassName() {\n if (this.props.selection === this.props.id) {\n if (this.props.disabled) {\n return \"btn btn-avatar btn-disabled avatar-selected\"\n } else {\n return \"btn btn-avatar avatar-selected\"\n }\n } else if (this.props.disabled) {\n return \"btn btn-avatar btn-disabled\"\n } else {\n return \"btn btn-avatar\"\n }\n }\n\n render() {\n return (\n \n \n \n )\n }\n}\n\nexport class Gallery extends React.Component {\n render() {\n return (\n
    \n

    {this.props.name}

    \n\n
    \n {batch(this.props.images, 4, null).map((row, i) => {\n return (\n
    \n {row.map((item, i) => {\n return (\n
    \n {item ? (\n \n ) : (\n
    \n )}\n
    \n )\n })}\n
    \n )\n })}\n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n selection: null,\n isLoading: false,\n }\n }\n\n select = (image) => {\n this.setState({\n selection: image,\n })\n }\n\n save = () => {\n if (this.state.isLoading) {\n return false\n }\n\n this.setState({\n isLoading: true,\n })\n\n ajax\n .post(this.props.user.api.avatar, {\n avatar: \"galleries\",\n image: this.state.selection,\n })\n .then(\n (response) => {\n this.setState({\n isLoading: false,\n })\n\n snackbar.success(response.detail)\n this.props.onComplete(response)\n this.props.showIndex()\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n this.setState({\n isLoading: false,\n })\n } else {\n this.props.showError(rejection)\n }\n }\n )\n }\n\n render() {\n return (\n
    \n
    \n {this.props.options.galleries.map((item, i) => {\n return (\n \n )\n })}\n
    \n
    \n
    \n
    \n \n {this.state.selection\n ? pgettext(\"avatar gallery modal btn\", \"Save choice\")\n : pgettext(\"avatar gallery modal btn\", \"Select avatar\")}\n \n\n \n {pgettext(\"avatar gallery modal btn\", \"Cancel\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport AvatarIndex from \"misago/components/change-avatar/index\"\nimport AvatarCrop from \"misago/components/change-avatar/crop\"\nimport AvatarUpload from \"misago/components/change-avatar/upload\"\nimport AvatarGallery from \"misago/components/change-avatar/gallery\"\nimport Loader from \"misago/components/modal-loader\"\nimport { updateAvatar } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport store from \"misago/services/store\"\n\nexport class ChangeAvatarError extends React.Component {\n getErrorReason() {\n if (this.props.reason) {\n return

    \n } else {\n return null\n }\n }\n\n render() {\n return (\n

    \n
    \n remove_circle_outline\n
    \n
    \n

    {this.props.message}

    \n {this.getErrorReason()}\n \n {pgettext(\"avatar modal dismiss\", \"Ok\")}\n \n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n componentDidMount() {\n ajax.get(this.props.user.api.avatar).then(\n (options) => {\n this.setState({\n component: AvatarIndex,\n options: options,\n error: null,\n })\n },\n (rejection) => {\n this.showError(rejection)\n }\n )\n }\n\n showError = (error) => {\n this.setState({\n error,\n })\n }\n\n showIndex = () => {\n this.setState({\n component: AvatarIndex,\n })\n }\n\n showUpload = () => {\n this.setState({\n component: AvatarUpload,\n })\n }\n\n showCrop = () => {\n this.setState({\n component: AvatarCrop,\n })\n }\n\n showGallery = () => {\n this.setState({\n component: AvatarGallery,\n })\n }\n\n completeFlow = (options) => {\n store.dispatch(updateAvatar(this.props.user, options.avatars))\n\n this.setState({\n component: AvatarIndex,\n options,\n })\n }\n\n getBody() {\n if (this.state) {\n if (this.state.error) {\n return (\n \n )\n } else {\n return (\n \n )\n }\n } else {\n return \n }\n }\n\n getClassName() {\n if (this.state && this.state.error) {\n return \"modal-dialog modal-message modal-change-avatar\"\n } else {\n return \"modal-dialog modal-change-avatar\"\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"avatar modal title\", \"Change your avatar\")}\n

    \n
    \n\n {this.getBody()}\n
    \n
    \n )\n }\n}\n\nexport function select(state) {\n return {\n user: state.auth.user,\n }\n}\n","export default function logout() {\n document.getElementById(\"hidden-logout-form\").submit()\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { connect } from \"react-redux\"\nimport modal from \"../../services/modal\"\nimport ChangeAvatarModal, {\n select as selectAvatar,\n} from \"../change-avatar/root\"\nimport {\n DropdownDivider,\n DropdownFooter,\n DropdownMenuItem,\n DropdownSubheader,\n} from \"../Dropdown\"\nimport logout from \"./logout\"\n\nclass UserNavMenu extends React.Component {\n constructor(props) {\n super(props)\n\n if (props.dropdown) {\n // Collapse options on dropdown\n this.state = {\n options: props.options.slice(0, 2),\n optionsMore: props.options.length > 2,\n }\n } else {\n // Reveal all options on mobile overlay\n this.state = {\n options: props.options,\n optionsMore: false,\n }\n }\n }\n\n changeAvatar = () => {\n this.props.close()\n modal.show(connect(selectAvatar)(ChangeAvatarModal))\n }\n\n revealOptions = () => {\n this.setState({\n options: this.props.options,\n optionsMore: false,\n })\n }\n\n render() {\n const { user, close, dropdown, overlay } = this.props\n\n if (!user) {\n return null\n }\n\n const adminUrl = misago.get(\"ADMIN_URL\")\n\n return (\n \n
  • \n \n {user.username}\n {pgettext(\"user nav\", \"Go to your profile\")}\n \n
  • \n \n \n \n \n {user.unreadNotifications\n ? \"notifications_active\"\n : \"notifications_none\"}\n \n {pgettext(\"user nav\", \"Notifications\")}\n {!!user.unreadNotifications && (\n {user.unreadNotifications}\n )}\n \n \n {!!user.showPrivateThreads && (\n \n \n inbox\n {pgettext(\"user nav\", \"Private threads\")}\n {!!user.unreadPrivateThreads && (\n {user.unreadPrivateThreads}\n )}\n \n \n )}\n {!!adminUrl && (\n \n \n security\n {pgettext(\"user nav\", \"Admin control panel\")}\n \n \n )}\n \n \n {pgettext(\"user nav section\", \"Account settings\")}\n \n \n \n portrait\n {pgettext(\"user nav\", \"Change avatar\")}\n \n \n {this.state.options.map((item) => (\n \n \n {item.icon}\n {item.name}\n \n \n ))}\n \n \n more_vertical\n {pgettext(\"user nav\", \"See more\")}\n \n \n {!!dropdown && (\n \n {\n logout()\n close()\n }}\n type=\"button\"\n >\n {pgettext(\"user nav\", \"Log out\")}\n \n \n )}\n \n )\n }\n}\n\nfunction select(state) {\n const user = state.auth.user\n if (!user.id) {\n return { user: null }\n }\n\n return {\n user: {\n username: user.username,\n unreadNotifications: user.unreadNotifications,\n unreadPrivateThreads: user.unread_private_threads,\n showPrivateThreads: user.acl.can_use_private_threads,\n url: user.url,\n },\n options: [...misago.get(\"userOptions\")],\n }\n}\n\nconst UserNavMenuConnected = connect(select)(UserNavMenu)\n\nexport default UserNavMenuConnected\n","import React from \"react\"\nimport UserNavMenu from \"./UserNavMenu\"\n\nexport default function UserNavDropdown({ close }) {\n return \n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { close } from \"../../reducers/overlay\"\nimport { DropdownFooter } from \"../Dropdown\"\nimport { Overlay, OverlayHeader } from \"../Overlay\"\nimport UserNavMenu from \"./UserNavMenu\"\nimport logout from \"./logout\"\n\nexport function UserNavOverlay({ dispatch, isOpen }) {\n return (\n \n \n {pgettext(\"user nav title\", \"Your options\")}\n \n dispatch(close())} overlay />\n \n {\n logout()\n dispatch(close())\n }}\n type=\"button\"\n >\n {pgettext(\"user nav\", \"Log out\")}\n \n \n \n )\n}\n\nfunction select(state) {\n return {\n isOpen: state.overlay.userNav,\n }\n}\n\nconst UserNavOverlayConnected = connect(select)(UserNavOverlay)\n\nexport default UserNavOverlayConnected\n","import React from \"react\"\nimport misago from \"misago\"\n\nexport default function (props) {\n const size = props.size || 100\n const size2x = props.size2x || size * 2\n\n return (\n \n )\n}\n\nexport function getSrc(user, size) {\n if (user && user.id) {\n // just avatar hash, size and user id\n return resolveAvatarForSize(user.avatars, size).url\n } else {\n // just append avatar size to file to produce no-avatar placeholder\n return misago.get(\"BLANK_AVATAR_URL\")\n }\n}\n\nexport function resolveAvatarForSize(avatars, size) {\n let avatar = avatars[0]\n avatars.forEach((av) => {\n if (av.size >= size) {\n avatar = av\n }\n })\n return avatar\n}\n","import React from \"react\"\nimport Loader from \"./loader\"\n\nexport default class Button extends React.Component {\n render() {\n let className = \"btn \" + this.props.className\n let disabled = this.props.disabled\n\n if (this.props.loading) {\n className += \" btn-loading\"\n disabled = true\n }\n\n return (\n \n {this.props.children}\n {this.props.loading ? : null}\n \n )\n }\n}\n\nButton.defaultProps = {\n className: \"btn-default\",\n\n type: \"submit\",\n\n loading: false,\n disabled: false,\n\n onClick: null,\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n \n {props.choices.map((item) => {\n return (\n \n {\"- - \".repeat(item.level) + item.label}\n \n )\n })}\n \n )\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n isValidated() {\n return typeof this.props.validation !== \"undefined\"\n }\n\n getClassName() {\n let className = \"form-group\"\n if (this.isValidated()) {\n className += \" has-feedback\"\n if (this.props.validation === null) {\n className += \" has-success\"\n } else {\n className += \" has-error\"\n }\n }\n return className\n }\n\n getFeedback() {\n if (this.props.validation) {\n return (\n
    \n {this.props.validation.map((error, i) => {\n return

    {error}

    \n })}\n
    \n )\n } else {\n return null\n }\n }\n\n getFeedbackDescription() {\n if (this.isValidated()) {\n return (\n \n {this.props.validation\n ? pgettext(\"field validation status\", \"(error)\")\n : pgettext(\"field validation status\", \"(success)\")}\n \n )\n } else {\n return null\n }\n }\n\n getHelpText() {\n if (this.props.helpText) {\n return

    {this.props.helpText}

    \n } else {\n return null\n }\n }\n\n render() {\n return (\n
    \n \n {this.props.label + \":\"}\n \n
    \n {this.props.children}\n {this.getFeedbackDescription()}\n {this.getFeedback()}\n {this.getHelpText()}\n {this.props.extra || null}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport { required } from \"../utils/validators\"\nimport snackbar from \"../services/snackbar\"\n\nlet validateRequired = required()\n\nexport default class extends React.Component {\n validate() {\n let errors = {}\n if (!this.state.validators) {\n return errors\n }\n\n let validators = {\n required: this.state.validators.required || this.state.validators,\n optional: this.state.validators.optional || {},\n }\n\n let validatedFields = []\n\n // add required fields to validation\n for (let name in validators.required) {\n if (\n validators.required.hasOwnProperty(name) &&\n validators.required[name]\n ) {\n validatedFields.push(name)\n }\n }\n\n // add optional fields to validation\n for (let name in validators.optional) {\n if (\n validators.optional.hasOwnProperty(name) &&\n validators.optional[name]\n ) {\n validatedFields.push(name)\n }\n }\n\n // validate fields values\n for (let i in validatedFields) {\n let name = validatedFields[i]\n let fieldErrors = this.validateField(name, this.state[name])\n\n if (fieldErrors === null) {\n errors[name] = null\n } else if (fieldErrors) {\n errors[name] = fieldErrors\n }\n }\n\n return errors\n }\n\n isValid() {\n let errors = this.validate()\n for (let field in errors) {\n if (errors.hasOwnProperty(field)) {\n if (errors[field] !== null) {\n return false\n }\n }\n }\n\n return true\n }\n\n validateField(name, value) {\n let errors = []\n if (!this.state.validators) {\n return errors\n }\n\n let validators = {\n required: (this.state.validators.required || this.state.validators)[name],\n optional: (this.state.validators.optional || {})[name],\n }\n\n let requiredError = validateRequired(value) || false\n\n if (validators.required) {\n if (requiredError) {\n errors = [requiredError]\n } else {\n for (let i in validators.required) {\n let validationError = validators.required[i](value)\n if (validationError) {\n errors.push(validationError)\n }\n }\n }\n\n return errors.length ? errors : null\n } else if (requiredError === false && validators.optional) {\n for (let i in validators.optional) {\n let validationError = validators.optional[i](value)\n if (validationError) {\n errors.push(validationError)\n }\n }\n\n return errors.length ? errors : null\n }\n\n return false // false === field wasn't validated\n }\n\n bindInput = (name) => {\n return (event) => {\n this.changeValue(name, event.target.value)\n }\n }\n\n changeValue = (name, value) => {\n let newState = {\n [name]: value,\n }\n\n const formErrors = this.state.errors || {}\n formErrors[name] = this.validateField(name, newState[name])\n newState.errors = formErrors\n\n this.setState(newState)\n }\n\n clean() {\n return true\n }\n\n send() {\n return null\n }\n\n handleSuccess(success) {\n return\n }\n\n handleError(rejection) {\n snackbar.apiError(rejection)\n }\n\n handleSubmit = (event) => {\n // we don't reload page on submissions\n if (event) {\n event.preventDefault()\n }\n\n if (this.state.isLoading) {\n return\n }\n\n if (this.clean()) {\n this.setState({ isLoading: true })\n let promise = this.send()\n\n if (promise) {\n promise.then(\n (success) => {\n this.setState({ isLoading: false })\n this.handleSuccess(success)\n },\n (rejection) => {\n this.setState({ isLoading: false })\n this.handleError(rejection)\n }\n )\n } else {\n this.setState({ isLoading: false })\n }\n }\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n isActive() {\n if (this.props.isControlled) {\n return this.props.isActive\n } else {\n if (this.props.path) {\n return document.location.pathname.indexOf(this.props.path) === 0\n } else {\n return false\n }\n }\n }\n\n getClassName() {\n if (this.isActive()) {\n return (\n (this.props.className || \"\") +\n \" \" +\n (this.props.activeClassName || \"active\")\n )\n } else {\n return this.props.className || \"\"\n }\n }\n\n render() {\n return
  • {this.props.children}
  • \n }\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport Button from \"./button\"\nimport Form from \"./form\"\nimport FormGroup from \"./form-group\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n bestAnswer: \"0\",\n poll: \"0\",\n }\n }\n\n clean() {\n if (this.props.polls && this.state.poll === \"0\") {\n const confirmation = window.confirm(\n pgettext(\n \"merge threads conflict form\",\n \"Are you sure you want to delete all polls?\"\n )\n )\n return confirmation\n }\n\n return true\n }\n\n send() {\n const data = Object.assign({}, this.props.data, {\n best_answer: this.state.bestAnswer,\n poll: this.state.poll,\n })\n\n return ajax.post(this.props.api, data)\n }\n\n handleSuccess = (success) => {\n this.props.onSuccess(success)\n modal.hide()\n }\n\n handleError = (rejection) => {\n this.props.onError(rejection)\n }\n\n onBestAnswerChange = (event) => {\n this.changeValue(\"bestAnswer\", event.target.value)\n }\n\n onPollChange = (event) => {\n this.changeValue(\"poll\", event.target.value)\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"merge threads conflict modal title\", \"Merge threads\")}\n

    \n
    \n
    \n
    \n \n \n
    \n
    \n \n {pgettext(\"merge threads conflict btn\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport function BestAnswerSelect({ choices, onChange, value }) {\n if (!choices) return null\n\n return (\n \n \n {choices.map((choice) => {\n return (\n \n )\n })}\n \n \n )\n}\n\nexport function PollSelect({ choices, onChange, value }) {\n if (!choices) return null\n\n return (\n \n \n {choices.map((choice) => {\n return (\n \n )\n })}\n \n \n )\n}\n","const ytRegExp = new RegExp(\n \"^.*(?:(?:youtu.be/|v/|vi/|u/w/|embed/)|(?:(?:watch)??v(?:i)?=|&v(?:i)?=))([^#&?]*).*\"\n)\n\nexport class OneBox {\n constructor() {\n this._youtube = {}\n }\n\n render = (element) => {\n if (!element) return\n this.highlightCode(element)\n this.embedYoutubePlayers(element)\n }\n\n highlightCode(element) {\n import(\"highlight\").then(({ default: hljs }) => {\n const codeblocks = element.querySelectorAll(\"pre>code\")\n for (let i = 0; i < codeblocks.length; i++) {\n hljs.highlightElement(codeblocks[i])\n }\n })\n }\n\n embedYoutubePlayers(element) {\n const anchors = element.querySelectorAll(\"p>a\")\n for (let i = 0; i < anchors.length; i++) {\n const a = anchors[i]\n const p = a.parentNode\n const onlyChild = p.childNodes.length === 1\n\n if (!this._youtube[a.href]) {\n this._youtube[a.href] = parseYoutubeUrl(a.href)\n }\n\n const youtubeMovie = this._youtube[a.href]\n if (onlyChild && !!youtubeMovie && youtubeMovie.data !== false) {\n this.swapYoutubePlayer(a, youtubeMovie)\n }\n }\n }\n\n swapYoutubePlayer(element, youtube) {\n let url = \"https://www.youtube.com/embed/\"\n url += youtube.video\n url += \"?feature=oembed\"\n if (youtube.start) {\n url += \"&start=\" + youtube.start\n }\n\n const player = $(\n '\"\n )\n $(element).replaceWith(player)\n player.wrap('
    ')\n }\n}\n\nexport default new OneBox()\n\nexport function parseYoutubeUrl(url) {\n const cleanedUrl = cleanUrl(url)\n const video = getVideoIdFromUrl(cleanedUrl)\n\n if (!video) return null\n\n let start = 0\n if (cleanedUrl.indexOf(\"?\") > 0) {\n const query = cleanedUrl.substr(cleanedUrl.indexOf(\"?\") + 1)\n const timebit = query.split(\"&\").filter((i) => {\n return i.substr(0, 2) === \"t=\"\n })[0]\n\n if (timebit) {\n const bits = timebit.substr(2).split(\"m\")\n if (bits[0].substr(-1) === \"s\") {\n start += parseInt(bits[0].substr(0, bits[0].length - 1))\n } else {\n start += parseInt(bits[0]) * 60\n if (!!bits[1] && bits[1].substr(-1) === \"s\") {\n start += parseInt(bits[1].substr(0, bits[1].length - 1))\n }\n }\n }\n }\n\n return {\n start,\n video,\n }\n}\n\nexport function cleanUrl(url) {\n let clean = url\n\n if (url.substr(0, 8) === \"https://\") {\n clean = clean.substr(8)\n } else if (url.substr(0, 7) === \"http://\") {\n clean = clean.substr(7)\n }\n\n if (clean.substr(0, 4) === \"www.\") {\n clean = clean.substr(4)\n }\n\n return clean\n}\n\nexport function getVideoIdFromUrl(url) {\n if (url.indexOf(\"youtu\") === -1) return null\n\n const video = url.match(ytRegExp)\n if (video) {\n return video[1]\n }\n return null\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport onebox from \"misago/services/one-box\"\n\nexport default class extends React.Component {\n componentDidMount() {\n onebox.render(this.documentNode)\n $(this.documentNode).find(\".spoiler-reveal\").click(revealSpoiler)\n }\n\n componentDidUpdate(prevProps, prevState) {\n onebox.render(this.documentNode)\n $(this.documentNode).find(\".spoiler-reveal\").click(revealSpoiler)\n }\n\n shouldComponentUpdate(nextProps, nextState) {\n return nextProps.markup !== this.props.markup\n }\n\n render() {\n return (\n {\n this.documentNode = node\n }}\n />\n )\n }\n}\n\nfunction revealSpoiler(event) {\n var btn = event.target\n $(btn).parent().parent().addClass(\"revealed\")\n}\n","import React from \"react\"\nimport Loader from \"misago/components/loader\"\n\nexport default class extends React.Component {\n render() {\n return (\n
    \n \n
    \n )\n }\n}\n","import React from \"react\"\nimport PanelMessage from \"misago/components/panel-message\"\n\nexport default class extends PanelMessage {\n getHelpText() {\n if (this.props.helpText) {\n return

    {this.props.helpText}

    \n } else {\n return null\n }\n }\n\n render() {\n return (\n
    \n
    \n \n {this.props.icon || \"info_outline\"}\n \n
    \n
    \n

    {this.props.message}

    \n {this.getHelpText()}\n \n {pgettext(\"modal message dismiss btn\", \"Ok\")}\n \n
    \n
    \n )\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getHelpText() {\n if (this.props.helpText) {\n return

    {this.props.helpText}

    \n } else {\n return null\n }\n }\n\n render() {\n return (\n
    \n
    \n \n {this.props.icon || \"info_outline\"}\n \n
    \n
    \n

    {this.props.message}

    \n {this.getHelpText()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport MisagoMarkup from \"misago/components/misago-markup\"\n\nexport default function (props) {\n if (props.post.content) {\n return \n } else {\n return \n }\n}\n\nexport function Default(props) {\n return (\n
    \n \n
    \n )\n}\n\nexport function Invalid(props) {\n return (\n
    \n

    \n {pgettext(\n \"post body invalid\",\n \"This post's contents cannot be displayed.\"\n )}\n

    \n

    \n {pgettext(\n \"post body invalid\",\n \"This error is caused by invalid post content manipulation.\"\n )}\n

    \n
    \n )\n}\n","import React from \"react\"\n\nexport default function ({ post }) {\n const { category, thread } = post\n\n const tooltip = interpolate(\n pgettext(\"posts feed item header\", \"posted %(posted_on)s\"),\n {\n posted_on: post.posted_on.format(\"LL, LT\"),\n },\n true\n )\n\n return (\n
    \n \n {thread.title}\n \n \n {category.name}\n \n \n {post.posted_on.fromNow()}\n \n
    \n )\n}\n","import React from \"react\"\n\nexport default function ({ post }) {\n return (\n \n \n {pgettext(\"go to post link\", \"See post\")}\n \n chevron_right\n \n )\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport GoToButton from \"./button\"\n\nexport default function ({ post }) {\n return (\n
    \n \n
    \n
    \n \n \n \n
    \n
    \n
    \n {post.poster_name}\n
    \n \n {pgettext(\"post removed poster username\", \"Removed user\")}\n \n
    \n
    \n
    \n )\n}\n","import React from \"react\"\n\nexport default function ({ rank, title }) {\n let userTitle = title || rank.title || rank.name\n\n let className = \"user-title\"\n if (rank.css_class) {\n className += \" user-title-\" + rank.css_class\n }\n\n if (rank.is_tab) {\n return (\n \n {userTitle}\n \n )\n }\n\n return {userTitle}\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport GoToButton from \"./button\"\nimport UserTitle from \"./user-title\"\n\nexport default function ({ post, poster }) {\n return (\n
    \n \n
    \n
    \n \n \n \n
    \n \n
    \n
    \n )\n}\n","import React from \"react\"\nimport Anonymous from \"./anonymous\"\nimport Registered from \"./registered\"\n\nexport default function ({ post, poster }) {\n if (poster && poster.id) {\n return \n }\n\n return \n}\n","import React from \"react\"\nimport Body from \"./body\"\nimport Header from \"./header\"\nimport PostSide from \"./post-side\"\n\nexport default function ({ post, poster }) {\n const user = poster || post.poster\n\n let className = \"post\"\n if (user && user.rank.css_class) {\n className += \" post-\" + user.rank.css_class\n }\n\n return (\n
  • \n
    \n
    \n
    \n \n
    \n \n
    \n
    \n
    \n
  • \n )\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport * as random from \"misago/utils/random\"\n\nexport default function () {\n return (\n
      \n
    • \n
      \n
      \n
      \n
      \n
      \n
      \n \n \n \n
      \n
      \n
      \n \n \n  \n \n \n
      \n \n \n  \n \n \n
      \n
      \n
      \n
      \n \n  \n \n
      \n
      \n
      \n

      \n \n  \n \n  \n \n  \n \n  \n \n  \n \n

      \n
      \n
      \n
      \n
      \n
      \n
    • \n
    \n )\n}\n","import React from \"react\"\nimport Post from \"./post\"\nimport Preview from \"./preview\"\n\nexport default function ({ isReady, posts, poster }) {\n if (!isReady) {\n return \n }\n\n return (\n
      \n {posts.map((post) => {\n return \n })}\n
    \n )\n}\n","import React from \"react\"\nimport posting from \"../../services/posting\"\nimport { getGlobalState, getQuoteMarkup } from \"../posting\"\n\nexport default class PostingQuoteSelection extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n range: null,\n rect: null,\n }\n\n this.element = null\n }\n\n selected = () => {\n if (this.element) {\n const range = getQuoteSelection(this.element) || null\n const rect = range ? range.getBoundingClientRect() : null\n\n this.setState({ range, rect })\n }\n }\n\n reply = () => {\n if (!posting.isOpen()) {\n const content = getQuoteMarkup(this.state.range)\n posting.open(Object.assign({}, this.props.posting, { default: content }))\n\n this.setState({ range: null, rect: null })\n\n window.setTimeout(focusEditor, 1000)\n } else {\n const globalState = getGlobalState()\n if (globalState && !globalState.disabled) {\n globalState.quote(getQuoteMarkup(this.state.range))\n this.setState({ range: null, rect: null })\n focusEditor()\n }\n }\n }\n\n render = () => (\n
    \n {\n if (element) {\n this.element = element\n }\n }}\n onMouseUp={this.selected}\n onTouchEnd={this.selected}\n >\n {this.props.children}\n
    \n {!!this.state.rect && (\n \n
    \n
    \n \n {pgettext(\"post reply\", \"Quote\")}\n \n
    \n
    \n )}\n
    \n )\n}\n\nfunction focusEditor() {\n const textarea = document.querySelector(\"#posting-mount textarea\")\n textarea.focus()\n textarea.selectionStart = textarea.selectionEnd = textarea.value.length\n}\n\nconst getQuoteSelection = (container) => {\n if (typeof window.getSelection === \"undefined\") return\n\n // Validate that selection is of valid type and has one range\n const selection = window.getSelection()\n if (!selection) return\n if (selection.type !== \"Range\") return\n if (selection.rangeCount !== 1) return\n\n // Validate that selection is within the container and post's article\n const range = selection.getRangeAt(0)\n if (!isRangeContained(range, container)) return\n if (!isPostContained(range)) return\n if (!isAnyTextSelected(range.cloneContents())) return\n\n return range\n}\n\nconst isRangeContained = (range, container) => {\n const node = range.commonAncestorContainer\n if (node === container) return true\n\n let p = node.parentNode\n while (p) {\n if (p === container) return true\n p = p.parentNode\n }\n\n return false\n}\n\nconst isPostContained = (range) => {\n const element = range.commonAncestorContainer\n if (element.nodeName === \"ARTICLE\") return true\n if (element.dataset && element.dataset.noquote === \"1\") return false\n let p = element.parentNode\n while (p) {\n if (p.dataset && p.dataset.noquote === \"1\") return false\n if (p.nodeName === \"ARTICLE\") return true\n p = p.parentNode\n }\n return false\n}\n\nconst isAnyTextSelected = (node) => {\n for (let i = 0; i < node.childNodes.length; i++) {\n const child = node.childNodes[i]\n if (child.nodeType === Node.TEXT_NODE) {\n if (child.textContent && child.textContent.trim().length > 0) return true\n }\n if (child.nodeName === \"IMG\") return true\n if (isAnyTextSelected(child)) return true\n }\n\n return false\n}\n","const getQuoteMarkup = (range) => {\n const metadata = getQuoteMetadata(range)\n let markup = convertNodesToMarkup(range.cloneContents().childNodes, [])\n let prefix = metadata ? `[quote=\"${metadata}\"]\\n` : \"[quote]\\n\"\n let suffix = \"\\n[/quote]\\n\\n\"\n\n const codeBlock = getQuoteCodeBlock(range)\n if (codeBlock) {\n prefix += codeBlock.syntax ? `[code=${codeBlock.syntax}]\\n` : \"[code]\\n\"\n suffix = \"\\n[/code]\" + suffix\n } else if (isNodeInlineCodeBlock(range)) {\n markup = markup.trim()\n prefix += \"`\"\n suffix = \"`\" + suffix\n } else {\n markup = markup.trim()\n }\n\n return prefix + markup + suffix\n}\n\nexport default getQuoteMarkup\n\nconst getQuoteMetadata = (range) => {\n const node = range.commonAncestorContainer\n if (isNodeElementWithQuoteMetadata(node)) {\n return getQuoteMetadataFromNode(node)\n }\n\n let p = node.parentNode\n while (p) {\n if (isNodeElementWithQuoteMetadata(p)) {\n return getQuoteMetadataFromNode(p)\n }\n p = p.parentNode\n }\n\n return \"\"\n}\n\nconst isNodeElementWithQuoteMetadata = (node) => {\n if (node.nodeType !== Node.ELEMENT_NODE) return false\n if (node.nodeName === \"ARTICLE\") return true\n if (node.nodeName === \"BLOCKQUOTE\") {\n return node.dataset && node.dataset.block === \"quote\"\n }\n\n return false\n}\n\nconst getQuoteMetadataFromNode = (element) => {\n if (element.dataset) {\n return element.dataset.author || null\n }\n return null\n}\n\nconst getQuoteCodeBlock = (range) => {\n const node = range.commonAncestorContainer\n if (isNodeCodeBlock(node)) {\n return getNodeCodeBlockMeta(node)\n }\n\n let p = node.parentNode\n while (p) {\n if (isNodeCodeBlock(p)) {\n return getNodeCodeBlockMeta(p)\n }\n p = p.parentNode\n }\n\n return null\n}\n\nconst isNodeCodeBlock = (node) => {\n return node.nodeName === \"PRE\"\n}\n\nconst isNodeInlineCodeBlock = (range) => {\n const node = range.commonAncestorContainer\n if (node.nodeName === \"CODE\") {\n return true\n }\n\n let p = node.parentNode\n while (p) {\n if (isNodeElementWithQuoteMetadata(p)) {\n return false\n }\n\n if (p.nodeName === \"CODE\") {\n return true\n }\n\n p = p.parentNode\n }\n\n return false\n}\n\nconst getNodeCodeBlockMeta = (node) => {\n if (!node.dataset) {\n return { syntax: null }\n }\n\n return { syntax: node.dataset.syntax || null }\n}\n\nconst convertNodesToMarkup = (nodes, stack) => {\n let markup = \"\"\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]\n markup += convertNodeToMarkup(node, stack)\n }\n return markup\n}\n\nconst SIMPLE_NODE_MAPPINGS = {\n H1: [\"\\n\\n# \", \"\"],\n H2: [\"\\n\\n## \", \"\"],\n H3: [\"\\n\\n### \", \"\"],\n H4: [\"\\n\\n#### \", \"\"],\n H5: [\"\\n\\n##### \", \"\"],\n H6: [\"\\n\\n###### \", \"\"],\n STRONG: [\"**\", \"**\"],\n EM: [\"*\", \"*\"],\n DEL: [\"~~\", \"~~\"],\n B: [\"[b]\", \"[/b]\"],\n U: [\"[u]\", \"[/u]\"],\n I: [\"[i]\", \"[/i]\"],\n SUB: [\"[sub]\", \"[/sub]\"],\n SUP: [\"[sup]\", \"[/sup]\"],\n}\n\nconst convertNodeToMarkup = (node, stack) => {\n const dataset = node.dataset || {}\n\n if (node.nodeType === Node.TEXT_NODE) {\n return node.textContent || \"\"\n }\n\n if (node.nodeType === Node.ELEMENT_NODE) {\n if (dataset.quote) {\n return dataset.quote || \"\"\n }\n if (dataset.noquote === \"1\") return \"\"\n }\n\n if (\n node.nodeType === Node.ELEMENT_NODE &&\n dataset.quote &&\n dataset.quote.trim()\n ) {\n return \"\"\n }\n\n if (node.nodeName === \"HR\") {\n return \"\\n\\n- - -\"\n }\n\n if (SIMPLE_NODE_MAPPINGS[node.nodeName]) {\n const [prefix, suffix] = SIMPLE_NODE_MAPPINGS[node.nodeName]\n return (\n prefix +\n convertNodesToMarkup(node.childNodes, [...stack, node.nodeName]) +\n suffix\n )\n }\n\n if (node.nodeName === \"A\") {\n const href = node.href\n const text = convertNodesToMarkup(node.childNodes, [\n ...stack,\n node.nodeName,\n ])\n if (text) {\n return `[${text}](${href})`\n } else {\n return `!(${href})`\n }\n }\n\n if (node.nodeName === \"IMG\") {\n const src = node.src\n const alt = node.alt\n if (alt) {\n return `![${alt}](${src})`\n } else {\n return `!(${src})`\n }\n }\n\n if (node.nodeName === \"DIV\" || node.nodeName === \"ASIDE\") {\n const block = dataset.block && dataset.block.toUpperCase()\n if (block && SIMPLE_NODE_MAPPINGS[block]) {\n const [prefix, suffix] = SIMPLE_NODE_MAPPINGS[block]\n return (\n prefix +\n convertNodesToMarkup(node.childNodes, [...stack, block]) +\n suffix\n )\n } else {\n return convertNodesToMarkup(node.childNodes, stack)\n }\n }\n\n if (node.nodeName === \"BLOCKQUOTE\") {\n if (dataset.block === \"spoiler\") {\n const content = convertNodesToMarkup(node.childNodes, [\n ...stack,\n \"SPOILER\",\n ]).trim()\n\n if (!content) return \"\"\n\n let markup = \"\\n[spoiler]\\n\"\n markup += content\n markup += \"\\n[/spoiler]\"\n return markup\n }\n\n const content = convertNodesToMarkup(node.childNodes, [\n ...stack,\n \"QUOTE\",\n ]).trim()\n\n if (!content) return \"\"\n\n const metadata = getQuoteMetadataFromNode(node)\n let markup = metadata ? `\\n[quote=${metadata}]\\n` : \"\\n\\n[quote]\\n\"\n markup += content\n markup += \"\\n[/quote]\"\n return markup\n }\n\n if (node.nodeName === \"PRE\") {\n const syntax = dataset.syntax || null\n const code = node.querySelector(\"code\")\n const content = code ? code.innerText || \"\" : \"\"\n\n if (!content.trim()) return \"\"\n\n return \"\\n[code\" + (syntax ? \"=\" + syntax : \"\") + \"]\" + content + \"[/code]\"\n }\n\n if (node.nodeName === \"CODE\") {\n return \"`\" + node.innerText + \"`\"\n }\n\n if (node.nodeName === \"P\") {\n return (\n \"\\n\" + convertNodesToMarkup(node.childNodes, [...stack, node.nodeName])\n )\n }\n\n if (node.nodeName === \"UL\" || node.nodeName === \"OL\") {\n const level = stack.filter((item) => item === \"OL\" || item === \"UL\").length\n const prefix = level === 0 ? \"\\n\" : \"\"\n return (\n prefix + convertNodesToMarkup(node.childNodes, [...stack, node.nodeName])\n )\n }\n\n if (node.nodeName === \"LI\") {\n let prefix = \"\"\n const level = stack.filter((item) => item === \"OL\" || item === \"UL\").length\n for (let i = 1; i < level; i++) {\n prefix += \" \"\n }\n\n const ordered = stack[stack.length - 1] === \"OL\"\n if (ordered) {\n prefix += dataset.index ? dataset.index + \". \" : \"1. \"\n } else {\n prefix += \"- \"\n }\n\n const content = convertNodesToMarkup(node.childNodes, [\n ...stack,\n node.nodeName,\n ])\n if (!content.trim()) return \"\"\n\n return \"\\n\" + prefix + content\n }\n\n if (node.nodeName === \"SPAN\") {\n return convertNodesToMarkup(node.childNodes, stack)\n }\n\n return \"\"\n}\n","export function getGlobalState() {\n return window.misagoReply\n}\n\nexport function setGlobalState(disabled, quote) {\n window.misagoReply = { disabled, quote }\n}\n\nexport function clearGlobalState() {\n window.misagoReply = null\n}\n","import moment from \"moment\"\n\nexport function clean(attachments) {\n return attachments\n .filter((attachment) => {\n return attachment.id && !attachment.isRemoved\n })\n .map((a) => {\n return a.id\n })\n}\n\nexport function hydrate(attachments) {\n return attachments.map((attachment) => {\n return Object.assign({}, attachment, {\n uploaded_on: moment(attachment.uploaded_on),\n })\n })\n}\n","import React from \"react\"\nimport formatFilesize from \"../../utils/file-size\"\n\nexport default function MarkupAttachmentModal({ attachment }) {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"markup editor\", \"Attachment details\")}\n

    \n
    \n
    \n {!!attachment.is_image && (\n
    \n \n \"\"\n \n
    \n )}\n
    \n {attachment.filename}\n
    \n
    \n
    \n \n {attachment.filetype + \", \" + formatFilesize(attachment.size)}\n \n
    \n {pgettext(\"markup editor\", \"Type and size\")}\n
    \n
    \n
    \n \n \n {attachment.uploaded_on.fromNow()}\n \n \n
    \n {pgettext(\"markup editor\", \"Uploaded at\")}\n
    \n
    \n
    \n {attachment.url.uploader ? (\n \n {attachment.uploader_name}\n \n ) : (\n {attachment.uploader_name}\n )}\n
    \n {pgettext(\"markup editor\", \"Uploader\")}\n
    \n
    \n
    \n
    \n
    \n \n {pgettext(\"modal\", \"Close\")}\n \n
    \n
    \n
    \n )\n}\n","const wrapSelection = (selection, update, prefix, suffix, def) => {\n const text = selection.text || def || \"\"\n let newValue = selection.prefix\n newValue += prefix + text + suffix\n newValue += selection.suffix\n update(newValue)\n\n window.setTimeout(() => {\n focus(selection.textarea)\n\n const caret = selection.start + prefix.length\n selection.textarea.setSelectionRange(caret, caret + text.length)\n }, 250)\n}\n\nconst replaceSelection = (selection, update, text) => {\n let newValue = selection.prefix\n newValue += text\n newValue += selection.suffix\n update(newValue)\n\n window.setTimeout(() => {\n focus(selection.textarea)\n\n const caret = selection.end + text.length\n selection.textarea.setSelectionRange(caret, caret)\n }, 250)\n}\n\nconst getSelection = (textarea) => {\n if (document.selection) {\n textarea.focus()\n const range = document.selection.createRange()\n const length = range.text.length\n range.moveStart(\"character\", -textarea.value.length)\n return createRange(textarea, range.text.length - length, range.text.length)\n }\n\n if (textarea.selectionStart || textarea.selectionStart == \"0\") {\n return createRange(textarea, textarea.selectionStart, textarea.selectionEnd)\n }\n}\n\nconst createRange = (textarea, start, end) => {\n return {\n textarea: textarea,\n start: start,\n end: end,\n text: textarea.value.substring(start, end),\n prefix: textarea.value.substring(0, start),\n suffix: textarea.value.substring(end),\n }\n}\n\nexport function focus(textarea) {\n const scroll = textarea.scrollTop\n textarea.focus()\n textarea.scrollTop = scroll\n}\n\nexport { getSelection, replaceSelection, wrapSelection }\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport snackbar from \"../../services/snackbar\"\nimport formatFilesize from \"../../utils/file-size\"\nimport MarkupAttachmentModal from \"./MarkupAttachmentModal\"\nimport { getSelection, replaceSelection } from \"./operations\"\n\nconst MarkupEditorAttachment = ({\n attachment,\n disabled,\n element,\n setState,\n update,\n}) => (\n
    \n
    \n
    \n {attachment.id ? (\n {\n event.preventDefault()\n modal.show()\n }}\n >\n {attachment.filename}\n \n ) : (\n {attachment.filename}\n )}\n
    \n
      \n {!attachment.id &&
    • {attachment.progress + \"%\"}
    • }\n {!!attachment.filetype &&
    • {attachment.filetype}
    • }\n {attachment.size > 0 &&
    • {formatFilesize(attachment.size)}
    • }\n
    \n
    \n
    \n {!!attachment.id && (\n
    \n {\n const markup = getAttachmentMarkup(attachment)\n const selection = getSelection(element)\n replaceSelection(selection, update, markup)\n }}\n >\n flip_to_front\n \n {\n setState(({ attachments }) => {\n const confirm = window.confirm(\n pgettext(\"markup editor\", \"Remove this attachment?\")\n )\n\n if (confirm) {\n return {\n attachments: attachments.filter(\n ({ id }) => id !== attachment.id\n ),\n }\n }\n })\n }}\n >\n close\n \n
    \n )}\n {!attachment.id && !!attachment.key && (\n
    \n {attachment.error && (\n {\n snackbar.error(\n interpolate(\n pgettext(\"markup editor\", \"%(filename)s: %(error)s\"),\n { filename: attachment.filename, error: attachment.error },\n true\n )\n )\n }}\n >\n warning\n \n )}\n {\n setState(({ attachments }) => {\n return {\n attachments: attachments.filter(\n ({ key }) => key !== attachment.key\n ),\n }\n })\n }}\n >\n close\n \n
    \n )}\n
    \n
    \n)\n\nexport default MarkupEditorAttachment\n\nfunction getAttachmentMarkup(attachment) {\n let markup = \"[\"\n\n if (attachment.is_image) {\n markup += \"![\" + attachment.filename + \"]\"\n markup += \"(\" + (attachment.url.thumb || attachment.url.index) + \"?shva=1)\"\n } else {\n markup += attachment.filename\n }\n\n markup += \"](\" + attachment.url.index + \"?shva=1)\"\n return markup\n}\n","import React from \"react\"\nimport MarkupEditorAttachment from \"./MarkupEditorAttachment\"\n\nconst MarkupEditorAttachments = ({\n attachments,\n disabled,\n element,\n setState,\n update,\n}) => (\n
    \n
    \n {attachments.map((attachment) => (\n \n ))}\n
    \n
    \n)\n\nexport default MarkupEditorAttachments\n","import React from \"react\"\nimport Button from \"../button\"\n\nconst MarkupEditorFooter = ({\n canProtect,\n disabled,\n empty,\n preview,\n isProtected,\n submitText,\n showPreview,\n closePreview,\n enableProtection,\n disableProtection,\n}) => (\n
    \n {!!canProtect && (\n {\n if (isProtected) {\n disableProtection()\n } else {\n enableProtection()\n }\n }}\n >\n \n {isProtected ? \"lock\" : \"lock_open\"}\n \n \n )}\n {!!canProtect && (\n
    \n {\n if (isProtected) {\n disableProtection()\n } else {\n enableProtection()\n }\n }}\n >\n \n {isProtected ? \"lock\" : \"lock_open\"}\n \n {isProtected\n ? pgettext(\"markup editor\", \"Protected\")\n : pgettext(\"markup editor\", \"Protect\")}\n \n
    \n )}\n
    \n {preview ? (\n \n {pgettext(\"markup editor\", \"Edit\")}\n \n ) : (\n \n {pgettext(\"markup editor\", \"Preview\")}\n \n )}\n \n
    \n)\n\nexport default MarkupEditorFooter\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport FormGroup from \"../form-group\"\nimport { replaceSelection } from \"./operations\"\n\nclass MarkupCodeModal extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n error: null,\n syntax: \"\",\n text: props.selection.text,\n }\n }\n\n handleSubmit = (ev) => {\n ev.preventDefault()\n\n const { selection, update } = this.props\n const syntax = this.state.syntax.trim()\n const text = this.state.text.trim()\n\n if (text.length === 0) {\n this.setState({ error: gettext(\"This field is required.\") })\n return false\n }\n\n const prefix = selection.prefix.trim().length ? \"\\n\\n\" : \"\"\n\n replaceSelection(\n Object.assign({}, selection, { text }),\n update,\n prefix + \"```\" + syntax + \"\\n\" + text + \"\\n```\\n\\n\"\n )\n\n modal.hide()\n\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    {pgettext(\"markup editor\", \"Code\")}

    \n
    \n
    \n
    \n \n \n this.setState({ syntax: event.target.value })\n }\n >\n \n {LANGUAGES.map(({ value, name }) => (\n \n ))}\n \n \n \n \n this.setState({ text: event.target.value })\n }\n />\n \n
    \n
    \n \n {pgettext(\"markup editor\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nconst LANGUAGES = [\n { value: \"bash\", name: \"Bash\" },\n { value: \"c\", name: \"C\" },\n { value: \"c#\", name: \"C#\" },\n { value: \"c++\", name: \"C++\" },\n { value: \"css\", name: \"CSS\" },\n { value: \"diff\", name: \"Diff\" },\n { value: \"go\", name: \"Go\" },\n { value: \"graphql\", name: \"GraphQL\" },\n { value: \"html,\", name: \"HTML\" },\n { value: \"xml\", name: \"XML\" },\n { value: \"json\", name: \"JSON\" },\n { value: \"java\", name: \"Java\" },\n { value: \"javascript\", name: \"JavaScript\" },\n { value: \"kotlin\", name: \"Kotlin\" },\n { value: \"less\", name: \"Less\" },\n { value: \"lua\", name: \"Lua\" },\n { value: \"makefile\", name: \"Makefile\" },\n { value: \"markdown\", name: \"Markdown\" },\n { value: \"objective-C\", name: \"Objective-C\" },\n { value: \"php\", name: \"PHP\" },\n { value: \"perl\", name: \"Perl\" },\n { value: \"plain\", name: \"Plain\" },\n { value: \"text\", name: \"text\" },\n { value: \"python\", name: \"Python\" },\n { value: \"repl\", name: \"REPL\" },\n { value: \"r\", name: \"R\" },\n { value: \"ruby\", name: \"Ruby\" },\n { value: \"rust\", name: \"Rust\" },\n { value: \"scss\", name: \"SCSS\" },\n { value: \"sql\", name: \"SQL\" },\n { value: \"shell\", name: \"Shell Session\" },\n { value: \"swift\", name: \"Swift\" },\n { value: \"toml\", name: \"TOML\" },\n { value: \"ini\", name: \"INI\" },\n { value: \"typescript\", name: \"TypeScript\" },\n { value: \"visualbasic\", name: \"Visual Basic .NET\" },\n { value: \"webassembly\", name: \"WebAssembly\" },\n { value: \"yaml\", name: \"YAML\" },\n]\n\nexport default MarkupCodeModal\n","import React from \"react\"\nimport formatFilesize from \"../../utils/file-size\"\n\nexport default function MarkupFormattingHelpModal() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"markup help\", \"Formatting help\")}\n

    \n
    \n
    \n

    {pgettext(\"markup help\", \"Emphasis text\")}

    \n \n \n {pgettext(\"markup help\", \"This text will have emphasis\")}\n \n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Bold text\")}

    \n \n \n {pgettext(\"markup help\", \"This text will be bold\")}\n \n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Removed text\")}

    \n \n \n {pgettext(\"markup help\", \"This text will be removed\")}\n \n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Bold text (BBCode)\")}

    \n \n {pgettext(\"markup help\", \"This text will be bold\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Underlined text (BBCode)\")}

    \n \n {pgettext(\"markup help\", \"This text will be underlined\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Italics text (BBCode)\")}

    \n \n {pgettext(\"markup help\", \"This text will be in italics\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Link\")}

    \n \"\n result={\n

    \n example.com\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Link with text\")}

    \n \n {pgettext(\"markup help\", \"Link text\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Link (BBCode)\")}

    \n \n example.com\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Link with text (BBCode)\")}

    \n \n {pgettext(\"markup help\", \"Link text\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Image\")}

    \n \n \"\"\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Image with alternate text\")}

    \n \n \n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Image (BBCode)\")}

    \n \n \"\"\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Mention user by their name\")}

    \n \n @username\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 1\")}

    \n {pgettext(\"markup help\", \"First level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 2\")}

    \n {pgettext(\"markup help\", \"Second level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 3\")}

    \n {pgettext(\"markup help\", \"Third level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 4\")}

    \n {pgettext(\"markup help\", \"Fourth level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 5\")}

    \n {pgettext(\"markup help\", \"Fifth level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Unordered list\")}

    \n \n
  • Lorem ipsum
  • \n
  • Dolor met
  • \n
  • Vulputate lectus
  • \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Ordered list\")}

    \n \n
  • Lorem ipsum
  • \n
  • Dolor met
  • \n
  • Vulputate lectus
  • \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Quote text\")}

    \n \" + pgettext(\"markup help\", \"Quoted text\")}\n result={\n
    \n

    {pgettext(\"markup help\", \"Quoted text\")}

    \n
    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Quote text (BBCode)\")}

    \n \n
    \n {gettext(\"Quoted message:\")}\n
    \n
    \n

    {pgettext(\"markup help\", \"Quoted text\")}

    \n
    \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Quote text with author (BBCode)\")}

    \n \n
    \n {pgettext(\"markup help\", \"Quote author has written:\")}\n
    \n
    \n

    {pgettext(\"markup help\", \"Quoted text\")}

    \n
    \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Spoiler\")}

    \n \n {pgettext(\"markup help\", \"Secret text\")}\n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Inline code\")}

    \n \n {pgettext(\"markup help\", \"Inline code\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Code block\")}

    \n \n alert(\"Hello world!\");\n \n }\n />\n\n
    \n\n

    \n {pgettext(\"markup help\", \"Code block with syntax highlighting\")}\n

    \n \n \n print(\"Hello world!\");\n \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Code block (BBCode)\")}

    \n \n alert(\"Hello world!\");\n \n }\n />\n\n
    \n\n

    \n {pgettext(\n \"markup help\",\n \"Code block with syntax highlighting (BBCode)\"\n )}\n

    \n \n \n print(\"Hello world!\");\n \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Horizontal rule\")}

    \n \n

    Lorem ipsum

    \n
    \n

    Dolor met

    \n
    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Horizontal rule (BBCode)\")}

    \n \n

    Lorem ipsum

    \n
    \n

    Dolor met

    \n
    \n }\n />\n
    \n
    \n \n {pgettext(\"modal\", \"Close\")}\n \n
    \n
    \n
    \n )\n}\n\nfunction ExampleFormatting({ markup, result }) {\n return (\n
    \n
    \n
    \n          {markup}\n        
    \n
    \n
    \n
    {result}
    \n
    \n
    \n )\n}\n\nclass ExampleFormattingSpoiler extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n reveal: false,\n }\n }\n\n render() {\n return (\n \n
    \n

    {this.props.children}

    \n
    \n {!this.state.reveal && (\n
    \n {\n this.setState({ reveal: true })\n }}\n >\n {gettext(\"Reveal spoiler\")}\n \n
    \n )}\n \n )\n }\n}\n","const URL_PATTERN = new RegExp(\"^(((ftps?)|(https?))://)\", \"i\")\n\nexport default function isUrl(str) {\n return URL_PATTERN.test(str.trim())\n}\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport FormGroup from \"../form-group\"\nimport isUrl from \"./isUrl\"\nimport { replaceSelection } from \"./operations\"\n\nclass MarkupImageModal extends React.Component {\n constructor(props) {\n super(props)\n\n const text = props.selection.text.trim()\n const textUrl = isUrl(text)\n\n this.state = {\n error: null,\n text: textUrl ? \"\" : text,\n url: textUrl ? text : \"\",\n }\n }\n\n handleSubmit = (ev) => {\n ev.preventDefault()\n\n const { selection, update } = this.props\n const text = this.state.text.trim()\n const url = this.state.url.trim()\n\n if (url.length === 0) {\n this.setState({ error: gettext(\"This field is required.\") })\n return false\n }\n\n if (text.length > 0) {\n replaceSelection(selection, update, \"![\" + text + \"](\" + url + \")\")\n } else {\n replaceSelection(selection, update, \"!(\" + url + \")\")\n }\n\n modal.hide()\n\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"markup editor\", \"Image\")}\n

    \n
    \n
    \n
    \n \n \n this.setState({ text: event.target.value })\n }\n />\n \n \n \n this.setState({ url: event.target.value })\n }\n />\n \n
    \n
    \n \n {pgettext(\"markup editor\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default MarkupImageModal\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport FormGroup from \"../form-group\"\nimport isUrl from \"./isUrl\"\nimport { replaceSelection } from \"./operations\"\n\nclass MarkupLinkModal extends React.Component {\n constructor(props) {\n super(props)\n\n const text = props.selection.text.trim()\n const textUrl = isUrl(text)\n\n this.state = {\n error: null,\n text: textUrl ? \"\" : text,\n url: textUrl ? text : \"\",\n }\n }\n\n handleSubmit = (ev) => {\n ev.preventDefault()\n\n const { selection, update } = this.props\n const text = this.state.text.trim()\n const url = this.state.url.trim()\n\n if (url.length === 0) {\n this.setState({ error: gettext(\"This field is required.\") })\n return false\n }\n\n if (text.length > 0) {\n replaceSelection(selection, update, \"[\" + text + \"](\" + url + \")\")\n } else {\n replaceSelection(selection, update, \"<\" + url + \">\")\n }\n\n modal.hide()\n\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    {pgettext(\"markup editor\", \"Link\")}

    \n
    \n
    \n
    \n \n \n this.setState({ text: event.target.value })\n }\n />\n \n \n \n this.setState({ url: event.target.value })\n }\n />\n \n
    \n
    \n \n {pgettext(\"markup editor\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default MarkupLinkModal\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport FormGroup from \"../form-group\"\nimport { replaceSelection } from \"./operations\"\n\nclass MarkupQuoteModal extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n error: null,\n author: \"\",\n text: props.selection.text,\n }\n }\n\n handleSubmit = (ev) => {\n ev.preventDefault()\n\n const { selection, update } = this.props\n const author = this.state.author.trim()\n const text = this.state.text.trim()\n\n if (text.length === 0) {\n this.setState({ error: gettext(\"This field is required.\") })\n return false\n }\n\n const prefix = selection.prefix.trim().length ? \"\\n\\n\" : \"\"\n\n if (author) {\n replaceSelection(\n selection,\n update,\n prefix + '[quote=\"' + author + '\"]\\n' + text + \"\\n[/quote]\\n\\n\"\n )\n } else {\n replaceSelection(\n selection,\n update,\n prefix + \"[quote]\\n\" + text + \"\\n[/quote]\\n\\n\"\n )\n }\n\n modal.hide()\n\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"markup editor\", \"Quote\")}\n

    \n
    \n
    \n
    \n \n \n this.setState({ author: event.target.value })\n }\n />\n \n \n \n this.setState({ text: event.target.value })\n }\n />\n \n
    \n
    \n \n {pgettext(\"markup editor\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default MarkupQuoteModal\n","import React from \"react\"\n\nconst MarkupEditorButton = ({ disabled, icon, title, onClick }) => (\n \n {icon}\n \n)\n\nexport default MarkupEditorButton\n","import moment from \"moment\"\nimport misago from \"../../\"\nimport ajax from \"../../services/ajax\"\nimport snackbar from \"../../services/snackbar\"\nimport formatFilesize from \"../../utils/file-size\"\nimport getRandomString from \"../../utils/getRandomString\"\n\nconst ID_LEN = 32\n\nconst uploadFile = (file, setState) => {\n const maxSize = misago.get(\"user\").acl.max_attachment_size * 1024\n\n if (file.size > maxSize) {\n snackbar.error(\n interpolate(\n pgettext(\n \"markup editor\",\n \"File %(filename)s is bigger than %(limit)s.\"\n ),\n { filename: file.name, limit: formatFilesize(maxSize) },\n true\n )\n )\n\n return\n }\n\n let upload = {\n id: null,\n key: getRandomString(ID_LEN),\n error: null,\n uploaded_on: null,\n progress: 0,\n filename: file.name,\n filetype: null,\n is_image: false,\n size: file.size,\n url: null,\n uploader_name: null,\n }\n\n setState(({ attachments }) => {\n return { attachments: [upload].concat(attachments) }\n })\n\n const refreshState = () => {\n setState(({ attachments }) => {\n return { attachments: attachments.concat() }\n })\n }\n\n const data = new FormData()\n data.append(\"upload\", file)\n\n ajax\n .upload(misago.get(\"ATTACHMENTS_API\"), data, (progress) => {\n upload.progress = progress\n refreshState()\n })\n .then(\n (data) => {\n Object.assign(upload, data, { uploaded_on: moment(data.uploaded_on) })\n refreshState()\n },\n (rejection) => {\n if (rejection.status === 400 || rejection.status === 413) {\n upload.error = rejection.detail\n snackbar.error(rejection.detail)\n refreshState()\n } else {\n snackbar.apiError(rejection)\n }\n }\n )\n}\n\nexport default uploadFile\n","import React from \"react\"\nimport misago from \"../../\"\nimport modal from \"../../services/modal\"\nimport MarkupCodeModal from \"./MarkupCodeModal\"\nimport MarkupFormattingHelpModal from \"./MarkupFormattingHelpModal\"\nimport MarkupImageModal from \"./MarkupImageModal\"\nimport MarkupLinkModal from \"./MarkupLinkModal\"\nimport MarkupQuoteModal from \"./MarkupQuoteModal\"\nimport MarkupEditorButton from \"./MarkupEditorButton\"\nimport { getSelection, replaceSelection, wrapSelection } from \"./operations\"\nimport uploadFile from \"./uploadFile\"\n\nconst MarkupEditorToolbar = ({\n disabled,\n element,\n update,\n updateAttachments,\n}) => {\n const actions = [\n {\n name: pgettext(\"markup editor\", \"Strong\"),\n icon: \"format_bold\",\n onClick: () => {\n wrapSelection(\n getSelection(element),\n update,\n \"**\",\n \"**\",\n pgettext(\"example markup\", \"Strong text\")\n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Emphasis\"),\n icon: \"format_italic\",\n onClick: () => {\n wrapSelection(\n getSelection(element),\n update,\n \"*\",\n \"*\",\n pgettext(\"example markup\", \"Text with emphasis\")\n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Strikethrough\"),\n icon: \"format_strikethrough\",\n onClick: () => {\n wrapSelection(\n getSelection(element),\n update,\n \"~~\",\n \"~~\",\n pgettext(\"example markup\", \"Text with strikethrough\")\n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Horizontal ruler\"),\n icon: \"remove\",\n onClick: () => {\n replaceSelection(getSelection(element), update, \"\\n\\n- - -\\n\\n\")\n },\n },\n {\n name: pgettext(\"markup editor\", \"Link\"),\n icon: \"insert_link\",\n onClick: () => {\n const selection = getSelection(element)\n modal.show(\n \n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Image\"),\n icon: \"insert_photo\",\n onClick: () => {\n const selection = getSelection(element)\n modal.show(\n \n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Quote\"),\n icon: \"format_quote\",\n onClick: () => {\n const selection = getSelection(element)\n modal.show(\n \n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Spoiler\"),\n icon: \"visibility_off\",\n onClick: () => {\n insertSpoiler(element, update)\n },\n },\n {\n name: pgettext(\"markup editor\", \"Code\"),\n icon: \"code\",\n onClick: () => {\n const selection = getSelection(element)\n modal.show(\n \n )\n },\n },\n ]\n\n if (misago.get(\"user\").acl.max_attachment_size) {\n actions.push({\n name: pgettext(\"markup editor\", \"Upload file\"),\n icon: \"file_upload\",\n onClick: () => uploadFiles(updateAttachments),\n })\n }\n\n return (\n
    \n
    \n {actions.map(({ name, icon, onClick }) => (\n \n ))}\n
    \n
    \n
    \n \n more_vert\n \n
      \n {actions.map(({ name, icon, onClick }) => (\n
    • \n \n {icon}\n {name}\n \n
    • \n ))}\n
    \n
    \n {\n modal.show()\n }}\n />\n
    \n
    \n )\n}\n\nconst insertSpoiler = (element, update) => {\n const selection = getSelection(element)\n const prefix = selection.prefix.trim().length ? \"\\n\\n\" : \"\"\n\n wrapSelection(\n selection,\n update,\n prefix + \"[spoiler]\\n\",\n \"\\n[/spoiler]\\n\\n\",\n pgettext(\"markup editor\", \"Spoiler text\")\n )\n}\n\nconst uploadFiles = (setState) => {\n const input = document.createElement(\"input\")\n input.type = \"file\"\n input.multiple = \"multiple\"\n\n input.addEventListener(\"change\", function () {\n for (let i = 0; i < input.files.length; i++) {\n uploadFile(input.files[i], setState)\n }\n })\n\n input.click()\n}\n\nexport default MarkupEditorToolbar\n","import React from \"react\"\nimport classnames from \"classnames\"\n\nimport misago from \"../../\"\nimport ajax from \"../../services/ajax\"\nimport snackbar from \"../../services/snackbar\"\nimport MisagoMarkup from \"../misago-markup\"\nimport MarkupEditorAttachments from \"./MarkupEditorAttachments\"\nimport MarkupEditorFooter from \"./MarkupEditorFooter\"\nimport MarkupEditorToolbar from \"./MarkupEditorToolbar\"\nimport uploadFile from \"./uploadFile\"\n\nclass MarkupEditor extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n element: null,\n focused: false,\n loading: false,\n preview: false,\n parsed: null,\n }\n }\n\n showPreview = () => {\n if (this.state.loading) return\n\n this.setState({ loading: true, preview: true, element: null })\n\n ajax.post(misago.get(\"PARSE_MARKUP_API\"), { post: this.props.value }).then(\n (data) => {\n this.setState({ loading: false, parsed: data.parsed })\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n\n this.setState({ loading: false, preview: false })\n }\n )\n }\n\n closePreview = () => {\n this.setState({ loading: false, preview: false })\n }\n\n onDrop = (event) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!event.dataTransfer.files) return\n\n const { onAttachmentsChange: setState } = this.props\n\n if (misago.get(\"user\").acl.max_attachment_size) {\n for (let i = 0; i < event.dataTransfer.files.length; i++) {\n const file = event.dataTransfer.files[i]\n uploadFile(file, setState)\n }\n }\n }\n\n onPaste = (event) => {\n const { onAttachmentsChange: setState } = this.props\n\n const files = []\n for (let i = 0; i < event.clipboardData.items.length; i++) {\n const item = event.clipboardData.items[i]\n if (item.kind === \"file\") {\n files.push(item.getAsFile())\n }\n }\n\n if (files.length) {\n event.preventDefault()\n event.stopPropagation()\n\n if (misago.get(\"user\").acl.max_attachment_size) {\n for (let i = 0; i < files.length; i++) {\n uploadFile(files[i], setState)\n }\n }\n }\n }\n\n render = () => (\n \n this.props.onChange({ target: { value } })}\n updateAttachments={this.props.onAttachmentsChange}\n />\n {this.state.preview ? (\n
    \n {this.state.loading ? (\n
    \n
    \n \n
    \n
    \n ) : (\n \n )}\n
    \n ) : (\n {\n if (element && this.state.element !== element) {\n this.setState({ element })\n setMentions(this.props, element)\n }\n }}\n onChange={this.props.onChange}\n onDrop={this.onDrop}\n onFocus={() => this.setState({ focused: true })}\n onPaste={this.onPaste}\n onBlur={() => this.setState({ focused: false })}\n />\n )}\n {this.props.attachments.length > 0 && (\n this.props.onChange({ target: { value } })}\n />\n )}\n \n
    \n )\n}\n\nfunction setMentions(props, element) {\n $(element).atwho({\n at: \"@\",\n displayTpl: '
  • \"\"${username}
  • ',\n insertTpl: \"@${username}\",\n searchKey: \"username\",\n callbacks: {\n remoteFilter: function (query, callback) {\n $.getJSON(misago.get(\"MENTION_API\"), { q: query }, callback)\n },\n },\n })\n\n $(element).on(\"inserted.atwho\", (event, _storage, source, controller) => {\n const { query } = controller\n const username = source.target.innerText.trim()\n const prefix = event.target.value.substr(0, query.headPos)\n const suffix = event.target.value.substr(query.endPos)\n\n event.target.value = prefix + username + suffix\n props.onChange(event)\n\n const caret = query.headPos + username.length\n event.target.setSelectionRange(caret, caret)\n event.target.focus()\n })\n}\n\nexport default MarkupEditor\n","import MarkupEditor from \"./MarkupEditor\"\n\nexport default MarkupEditor\n","import React from \"react\"\nimport classnames from \"classnames\"\n\nconst CLASS_ACTIVE = \"posting-active\"\nconst CLASS_DEFAULT = \"posting-default\"\nconst CLASS_MINIMIZED = \"posting-minimized\"\nconst CLASS_FULLSCREEN = \"posting-fullscreen\"\n\nclass PostingDialog extends React.Component {\n componentDidMount() {\n document.body.classList.add(CLASS_ACTIVE, CLASS_DEFAULT)\n }\n\n componentWillUnmount() {\n document.body.classList.remove(\n CLASS_ACTIVE,\n CLASS_DEFAULT,\n CLASS_MINIMIZED,\n CLASS_FULLSCREEN\n )\n }\n\n componentWillReceiveProps({ fullscreen, minimized }) {\n if (minimized) {\n document.body.classList.remove(CLASS_DEFAULT, CLASS_FULLSCREEN)\n document.body.classList.add(CLASS_MINIMIZED)\n } else {\n if (fullscreen) {\n document.body.classList.remove(CLASS_DEFAULT, CLASS_MINIMIZED)\n document.body.classList.add(CLASS_FULLSCREEN)\n } else {\n document.body.classList.remove(CLASS_FULLSCREEN, CLASS_MINIMIZED)\n document.body.classList.add(CLASS_DEFAULT)\n }\n }\n }\n\n render() {\n const { children, fullscreen, minimized } = this.props\n\n return (\n \n
    {children}
    \n \n )\n }\n}\n\nexport default PostingDialog\n","import React from \"react\"\n\nconst PostingDialogBody = ({ children }) => (\n
    {children}
    \n)\n\nexport default PostingDialogBody\n","import React from \"react\"\n\nconst PostingDialogError = ({ close, message }) => (\n
    \n
    \n error_outlined\n
    \n
    \n

    {message}

    \n \n
    \n
    \n)\n\nexport default PostingDialogError\n","import React from \"react\"\n\nconst PostingDialogHeader = ({\n children,\n close,\n fullscreen,\n minimize,\n minimized,\n fullscreenEnter,\n fullscreenExit,\n open,\n}) => (\n
    \n
    {children}
    \n {minimized ? (\n \n expand_less\n \n ) : (\n \n expand_more\n \n )}\n {fullscreen ? (\n \n fullscreen_exit\n \n ) : (\n \n fullscreen\n \n )}\n \n close\n \n
    \n)\n\nexport default PostingDialogHeader\n","import React from \"react\"\n\nexport default function PostingThreadOptions({\n isClosed,\n isHidden,\n isPinned,\n disabled,\n options,\n close,\n open,\n hide,\n unhide,\n pinGlobally,\n pinLocally,\n unpin,\n}) {\n const icons = getIcons(isClosed, isHidden, isPinned)\n\n return (\n
    \n \n {icons.length > 0 ? (\n \n {icons.map((icon) => (\n \n {icon}\n \n ))}\n \n ) : (\n more_horiz\n )}\n \n
      \n {options.pin === 2 && isPinned !== 2 && (\n
    • \n \n bookmark\n {pgettext(\"post thread\", \"Pinned globally\")}\n \n
    • \n )}\n {options.pin >= isPinned && isPinned !== 1 && (\n
    • \n \n bookmark_outline\n {pgettext(\"post thread\", \"Pinned in category\")}\n \n
    • \n )}\n {options.pin >= isPinned && isPinned !== 0 && (\n
    • \n \n radio_button_unchecked\n {pgettext(\"post thread\", \"Not pinned\")}\n \n
    • \n )}\n {options.close && !!isClosed && (\n
    • \n \n lock_outline\n {pgettext(\"post thread\", \"Open\")}\n \n
    • \n )}\n {options.close && !isClosed && (\n
    • \n \n lock\n {pgettext(\"post thread\", \"Closed\")}\n \n
    • \n )}\n {options.hide && !!isHidden && (\n
    • \n \n visibility\n {pgettext(\"post thread\", \"Visible\")}\n \n
    • \n )}\n {options.hide && !isHidden && (\n
    • \n \n visibility_off\n {pgettext(\"post thread\", \"Hidden\")}\n \n
    • \n )}\n
    \n
    \n )\n}\n\nfunction getIcons(closed, hidden, pinned) {\n const icons = []\n if (pinned === 2) icons.push(\"bookmark\")\n if (pinned === 1) icons.push(\"bookmark_outline\")\n if (closed) icons.push(\"lock\")\n if (hidden) icons.push(\"visibility_off\")\n return icons\n}\n","import React from \"react\"\nimport CategorySelect from \"misago/components/category-select\"\nimport Form from \"misago/components/form\"\nimport * as attachments from \"./utils/attachments\"\nimport { getPostValidators, getTitleValidators } from \"./utils/validators\"\nimport ajax from \"misago/services/ajax\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport MarkupEditor from \"../MarkupEditor\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../Toolbar\"\nimport PostingDialog from \"./PostingDialog\"\nimport PostingDialogBody from \"./PostingDialogBody\"\nimport PostingDialogError from \"./PostingDialogError\"\nimport PostingDialogHeader from \"./PostingDialogHeader\"\nimport PostingThreadOptions from \"./PostingThreadOptions\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n isLoading: false,\n\n error: null,\n\n minimized: false,\n fullscreen: false,\n\n options: null,\n\n title: \"\",\n category: props.category || null,\n categories: [],\n post: \"\",\n attachments: [],\n close: false,\n hide: false,\n pin: 0,\n\n validators: {\n title: getTitleValidators(),\n post: getPostValidators(),\n },\n errors: {},\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.config).then(this.loadSuccess, this.loadError)\n }\n\n loadSuccess = (data) => {\n let category = null\n let options = null\n\n // hydrate categories, extract posting options\n const categories = data.map((item) => {\n // pick first category that allows posting and if it may, override it with initial one\n if (\n item.post !== false &&\n (!category || item.id == this.state.category)\n ) {\n category = item.id\n options = item.post\n }\n\n return Object.assign(item, {\n disabled: item.post === false,\n label: item.name,\n value: item.id,\n })\n })\n\n this.setState({\n isReady: true,\n options,\n\n categories,\n category,\n })\n }\n\n loadError = (rejection) => {\n this.setState({\n error: rejection.detail,\n })\n }\n\n onCancel = () => {\n const formEmpty = !!(\n this.state.post.length === 0 &&\n this.state.title.length === 0 &&\n this.state.attachments.length === 0\n )\n\n if (formEmpty) {\n this.minimize()\n return posting.close()\n }\n\n const cancel = window.confirm(\n pgettext(\"post thread\", \"Are you sure you want to discard thread?\")\n )\n if (cancel) {\n this.minimize()\n posting.close()\n }\n }\n\n onTitleChange = (event) => {\n this.changeValue(\"title\", event.target.value)\n }\n\n onCategoryChange = (event) => {\n const category = this.state.categories.find((item) => {\n return event.target.value == item.value\n })\n\n // if selected pin is greater than allowed, reduce it\n let pin = this.state.pin\n if (category.post.pin && category.post.pin < pin) {\n pin = category.post.pin\n }\n\n this.setState({\n category: category.id,\n categoryOptions: category.post,\n\n pin,\n })\n }\n\n onPostChange = (event) => {\n this.changeValue(\"post\", event.target.value)\n }\n\n onAttachmentsChange = (attachments) => {\n this.setState(attachments)\n }\n\n onClose = () => {\n this.changeValue(\"close\", true)\n }\n\n onOpen = () => {\n this.changeValue(\"close\", false)\n }\n\n onPinGlobally = () => {\n this.changeValue(\"pin\", 2)\n }\n\n onPinLocally = () => {\n this.changeValue(\"pin\", 1)\n }\n\n onUnpin = () => {\n this.changeValue(\"pin\", 0)\n }\n\n onHide = () => {\n this.changeValue(\"hide\", true)\n }\n\n onUnhide = () => {\n this.changeValue(\"hide\", false)\n }\n\n close = () => {\n this.minimize()\n posting.close()\n }\n\n minimize = () => {\n this.setState({ fullscreen: false, minimized: true })\n }\n\n open = () => {\n this.setState({ minimized: false })\n if (this.state.fullscreen) {\n }\n }\n\n fullscreenEnter = () => {\n this.setState({ fullscreen: true, minimized: false })\n }\n\n fullscreenExit = () => {\n this.setState({ fullscreen: false, minimized: false })\n }\n\n clean() {\n if (!this.state.title.trim().length) {\n snackbar.error(\n pgettext(\"posting form\", \"You have to enter thread title.\")\n )\n return false\n }\n\n if (!this.state.post.trim().length) {\n snackbar.error(pgettext(\"posting form\", \"You have to enter a message.\"))\n return false\n }\n\n const errors = this.validate()\n\n if (errors.title) {\n snackbar.error(errors.title[0])\n return false\n }\n\n if (errors.post) {\n snackbar.error(errors.post[0])\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.post(this.props.submit, {\n title: this.state.title,\n category: this.state.category,\n post: this.state.post,\n attachments: attachments.clean(this.state.attachments),\n close: this.state.close,\n hide: this.state.hide,\n pin: this.state.pin,\n })\n }\n\n handleSuccess(success) {\n this.setState({ isLoading: true })\n this.close()\n\n snackbar.success(pgettext(\"post thread\", \"Your thread has been posted.\"))\n window.location = success.url\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n const errors = [].concat(\n rejection.non_field_errors || [],\n rejection.category || [],\n rejection.title || [],\n rejection.post || [],\n rejection.attachments || []\n )\n\n snackbar.error(errors[0])\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n const dialogProps = {\n minimized: this.state.minimized,\n minimize: this.minimize,\n open: this.open,\n\n fullscreen: this.state.fullscreen,\n fullscreenEnter: this.fullscreenEnter,\n fullscreenExit: this.fullscreenExit,\n\n close: this.onCancel,\n }\n\n if (this.state.error) {\n return (\n \n \n \n )\n }\n\n if (!this.state.isReady) {\n return (\n \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n {}}\n onChange={() => {}}\n />\n
    \n
    \n )\n }\n\n const showOptions = !!(\n this.state.options.close ||\n this.state.options.hide ||\n this.state.options.pin\n )\n\n return (\n \n
    \n \n \n \n \n \n \n \n \n \n \n {showOptions && (\n \n \n \n )}\n \n \n \n \n
    \n )\n }\n}\n\nconst PostingDialogStart = ({\n children,\n close,\n minimized,\n minimize,\n open,\n fullscreen,\n fullscreenEnter,\n fullscreenExit,\n}) => (\n \n \n {pgettext(\"post thread\", \"Start new thread\")}\n \n {children}\n \n)\n","export default function (usernames) {\n const normalisedNames = usernames\n .split(\",\")\n .map((i) => i.trim().toLowerCase())\n const removedBlanks = normalisedNames.filter((i) => i.length > 0)\n const removedDuplicates = removedBlanks.filter((name, pos) => {\n return removedBlanks.indexOf(name) == pos\n })\n\n return removedDuplicates\n}\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport * as attachments from \"./utils/attachments\"\nimport cleanUsernames from \"./utils/usernames\"\nimport { getPostValidators, getTitleValidators } from \"./utils/validators\"\nimport ajax from \"misago/services/ajax\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport MarkupEditor from \"../MarkupEditor\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../Toolbar\"\nimport PostingDialog from \"./PostingDialog\"\nimport PostingDialogBody from \"./PostingDialogBody\"\nimport PostingDialogHeader from \"./PostingDialogHeader\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n const to = (props.to || []).map((user) => user.username).join(\", \")\n\n this.state = {\n isLoading: false,\n\n error: null,\n\n minimized: false,\n fullscreen: false,\n\n to: to,\n title: \"\",\n post: \"\",\n attachments: [],\n\n validators: {\n title: getTitleValidators(),\n post: getPostValidators(),\n },\n errors: {},\n }\n }\n\n onCancel = () => {\n const formEmpty = !!(\n this.state.post.length === 0 &&\n this.state.title.length === 0 &&\n this.state.to.length === 0 &&\n this.state.attachments.length === 0\n )\n\n if (formEmpty) {\n return this.close()\n }\n\n const cancel = window.confirm(\n pgettext(\n \"post thread\",\n \"Are you sure you want to discard private thread?\"\n )\n )\n if (cancel) {\n this.close()\n }\n }\n\n onToChange = (event) => {\n this.changeValue(\"to\", event.target.value)\n }\n\n onTitleChange = (event) => {\n this.changeValue(\"title\", event.target.value)\n }\n\n onPostChange = (event) => {\n this.changeValue(\"post\", event.target.value)\n }\n\n onAttachmentsChange = (attachments) => {\n this.setState(attachments)\n }\n\n clean() {\n if (!cleanUsernames(this.state.to).length) {\n snackbar.error(\n pgettext(\"posting form\", \"You have to enter at least one recipient.\")\n )\n return false\n }\n\n if (!this.state.title.trim().length) {\n snackbar.error(\n pgettext(\"posting form\", \"You have to enter thread title.\")\n )\n return false\n }\n\n if (!this.state.post.trim().length) {\n snackbar.error(pgettext(\"posting form\", \"You have to enter a message.\"))\n return false\n }\n\n const errors = this.validate()\n\n if (errors.title) {\n snackbar.error(errors.title[0])\n return false\n }\n\n if (errors.post) {\n snackbar.error(errors.post[0])\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.post(this.props.submit, {\n to: cleanUsernames(this.state.to),\n title: this.state.title,\n post: this.state.post,\n attachments: attachments.clean(this.state.attachments),\n })\n }\n\n handleSuccess(success) {\n this.setState({ isLoading: true })\n this.close()\n\n snackbar.success(pgettext(\"post thread\", \"Your thread has been posted.\"))\n window.location = success.url\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n const errors = [].concat(\n rejection.non_field_errors || [],\n rejection.to || [],\n rejection.title || [],\n rejection.post || [],\n rejection.attachments || []\n )\n\n snackbar.error(errors[0])\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n close = () => {\n this.minimize()\n posting.close()\n }\n\n minimize = () => {\n this.setState({ fullscreen: false, minimized: true })\n }\n\n open = () => {\n this.setState({ minimized: false })\n if (this.state.fullscreen) {\n }\n }\n\n fullscreenEnter = () => {\n this.setState({ fullscreen: true, minimized: false })\n }\n\n fullscreenExit = () => {\n this.setState({ fullscreen: false, minimized: false })\n }\n\n render() {\n const dialogProps = {\n minimized: this.state.minimized,\n minimize: this.minimize,\n open: this.open,\n\n fullscreen: this.state.fullscreen,\n fullscreenEnter: this.fullscreenEnter,\n fullscreenExit: this.fullscreenExit,\n\n close: this.onCancel,\n }\n\n return (\n \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n )\n }\n}\n\nconst PostingDialogStartPrivate = ({\n children,\n close,\n minimized,\n minimize,\n open,\n fullscreen,\n fullscreenEnter,\n fullscreenExit,\n}) => (\n \n \n {pgettext(\"post thread\", \"Start private thread\")}\n \n {children}\n \n)\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport * as attachments from \"./utils/attachments\"\nimport { getPostValidators } from \"./utils/validators\"\nimport ajax from \"misago/services/ajax\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport MarkupEditor from \"../MarkupEditor\"\nimport PostingDialog from \"./PostingDialog\"\nimport PostingDialogBody from \"./PostingDialogBody\"\nimport PostingDialogError from \"./PostingDialogError\"\nimport PostingDialogHeader from \"./PostingDialogHeader\"\nimport { clearGlobalState, setGlobalState } from \"./globalState\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n isLoading: false,\n\n error: null,\n\n minimized: false,\n fullscreen: false,\n\n post: this.props.default || \"\",\n attachments: [],\n\n validators: {\n post: getPostValidators(),\n },\n errors: {},\n }\n\n this.quoteText = \"\"\n }\n\n componentDidMount() {\n ajax\n .get(this.props.config, this.props.context || null)\n .then(this.loadSuccess, this.loadError)\n\n setGlobalState(false, this.onQuote)\n }\n\n componentWillUnmount() {\n clearGlobalState()\n }\n\n componentWillReceiveProps(nextProps) {\n const context = this.props.context\n const newContext = nextProps.context\n\n // User clicked \"reply\" instead of \"quote\"\n if (context && newContext && !newContext.reply) return\n\n ajax\n .get(nextProps.config, nextProps.context || null)\n .then(this.appendData, snackbar.apiError)\n }\n\n loadSuccess = (data) => {\n this.setState({\n isReady: true,\n\n post: data.post\n ? '[quote=\"@' + data.poster + '\"]\\n' + data.post + \"\\n[/quote]\"\n : this.state.post,\n })\n\n this.quoteText = data.post\n ? '[quote=\"@' + data.poster + '\"]\\n' + data.post + \"\\n[/quote]\"\n : this.state.post\n }\n\n loadError = (rejection) => {\n this.setState({\n error: rejection.detail,\n })\n }\n\n appendData = (data) => {\n const newPost = data.post\n ? '[quote=\"@' + data.poster + '\"]\\n' + data.post + \"\\n[/quote]\\n\\n\"\n : \"\"\n\n this.setState((prevState, props) => {\n if (prevState.post.length > 0) {\n return {\n post: prevState.post.trim() + \"\\n\\n\" + newPost,\n }\n }\n\n return {\n post: newPost,\n }\n })\n\n this.open()\n }\n\n onCancel = () => {\n // If only the quote text is on editor user didn't add anything\n // so no changes to discard\n const onlyQuoteTextInEditor = this.state.post === this.quoteText\n\n if (onlyQuoteTextInEditor && this.state.attachments.length === 0) {\n return this.close()\n }\n\n const cancel = window.confirm(\n pgettext(\"post reply\", \"Are you sure you want to discard your reply?\")\n )\n if (cancel) {\n this.close()\n }\n }\n\n onPostChange = (event) => {\n this.changeValue(\"post\", event.target.value)\n }\n\n onAttachmentsChange = (attachments) => {\n this.setState(attachments)\n }\n\n onQuote = (quote) => {\n this.setState(({ post }) => {\n if (post.length > 0) {\n return { post: post.trim() + \"\\n\\n\" + quote }\n }\n\n return { post: quote }\n })\n\n this.open()\n }\n\n clean() {\n if (!this.state.post.trim().length) {\n snackbar.error(pgettext(\"posting form\", \"You have to enter a message.\"))\n return false\n }\n\n const errors = this.validate()\n\n if (errors.post) {\n snackbar.error(errors.post[0])\n return false\n }\n\n return true\n }\n\n send() {\n setGlobalState(true, this.onQuote)\n\n return ajax.post(this.props.submit, {\n post: this.state.post,\n attachments: attachments.clean(this.state.attachments),\n })\n }\n\n handleSuccess(success) {\n this.setState({ isLoading: true })\n this.close()\n\n setGlobalState(false, this.onQuote)\n\n snackbar.success(pgettext(\"post reply\", \"Your reply has been posted.\"))\n window.location = success.url.index\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n const errors = [].concat(\n rejection.non_field_errors || [],\n rejection.post || [],\n rejection.attachments || []\n )\n\n snackbar.error(errors[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n setGlobalState(false, this.onQuote)\n }\n\n close = () => {\n this.minimize()\n posting.close()\n }\n\n minimize = () => {\n this.setState({ fullscreen: false, minimized: true })\n }\n\n open = () => {\n this.setState({ minimized: false })\n if (this.state.fullscreen) {\n }\n }\n\n fullscreenEnter = () => {\n this.setState({ fullscreen: true, minimized: false })\n }\n\n fullscreenExit = () => {\n this.setState({ fullscreen: false, minimized: false })\n }\n\n render() {\n const dialogProps = {\n thread: this.props.thread,\n\n minimized: this.state.minimized,\n minimize: this.minimize,\n open: this.open,\n\n fullscreen: this.state.fullscreen,\n fullscreenEnter: this.fullscreenEnter,\n fullscreenExit: this.fullscreenExit,\n\n close: this.onCancel,\n }\n\n if (this.state.error) {\n return (\n \n \n \n )\n }\n\n if (!this.state.isReady) {\n return (\n \n
    \n {}}\n onChange={() => {}}\n />\n
    \n
    \n )\n }\n\n return (\n \n \n \n \n \n )\n }\n}\n\nconst PostingDialogReply = ({\n children,\n close,\n minimized,\n minimize,\n open,\n fullscreen,\n fullscreenEnter,\n fullscreenExit,\n thread,\n}) => (\n \n \n {interpolate(\n pgettext(\"post reply\", \"Reply to: %(thread)s\"),\n { thread: thread.title },\n true\n )}\n \n {children}\n \n)\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport * as attachments from \"./utils/attachments\"\nimport { getPostValidators } from \"./utils/validators\"\nimport ajax from \"misago/services/ajax\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport MarkupEditor from \"../MarkupEditor\"\nimport PostingDialog from \"./PostingDialog\"\nimport PostingDialogBody from \"./PostingDialogBody\"\nimport PostingDialogError from \"./PostingDialogError\"\nimport PostingDialogHeader from \"./PostingDialogHeader\"\nimport { clearGlobalState, setGlobalState } from \"./globalState\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n isLoading: false,\n\n error: false,\n\n minimized: false,\n fullscreen: false,\n\n post: \"\",\n attachments: [],\n protect: false,\n\n canProtect: false,\n\n validators: {\n post: getPostValidators(),\n },\n errors: {},\n }\n\n this.originalPost = \"\"\n }\n\n componentDidMount() {\n ajax.get(this.props.config).then(this.loadSuccess, this.loadError)\n\n setGlobalState(false, this.onQuote)\n }\n\n componentWillUnmount() {\n clearGlobalState()\n }\n\n componentWillReceiveProps(nextProps) {\n const context = this.props.context\n const newContext = nextProps.context\n\n if (context && newContext && context.reply === newContext.reply) return\n\n ajax\n .get(nextProps.config, nextProps.context || null)\n .then(this.appendData, snackbar.apiError)\n }\n\n loadSuccess = (data) => {\n this.originalPost = data.post\n\n this.setState({\n isReady: true,\n\n post: data.post,\n attachments: attachments.hydrate(data.attachments),\n protect: data.is_protected,\n\n canProtect: data.can_protect,\n })\n }\n\n loadError = (rejection) => {\n this.setState({\n error: rejection.detail,\n })\n }\n\n appendData = (data) => {\n const newPost = data.post\n ? '[quote=\"@' + data.poster + '\"]\\n' + data.post + \"\\n[/quote]\\n\\n\"\n : \"\"\n\n this.setState((prevState, props) => {\n if (prevState.post.length > 0) {\n return {\n post: prevState.post.trim() + \"\\n\\n\" + newPost,\n }\n }\n\n return {\n post: newPost,\n }\n })\n\n this.open()\n }\n\n onCancel = () => {\n const originalPostSameAsCurrentPost =\n this.state.originalPost === this.state.post\n const noAttachementsAdded = this.state.attachments.length === 0\n\n if (originalPostSameAsCurrentPost && noAttachementsAdded) {\n return this.close()\n }\n\n const cancel = window.confirm(\n pgettext(\"edit reply\", \"Are you sure you want to discard changes?\")\n )\n if (cancel) {\n this.close()\n }\n }\n\n onProtect = () => {\n this.setState({\n protect: true,\n })\n }\n\n onUnprotect = () => {\n this.setState({\n protect: false,\n })\n }\n\n onPostChange = (event) => {\n this.changeValue(\"post\", event.target.value)\n }\n\n onAttachmentsChange = (attachments) => {\n this.setState(attachments)\n }\n\n onQuote = (quote) => {\n this.setState(({ post }) => {\n if (post.length > 0) {\n return { post: post.trim() + \"\\n\\n\" + quote }\n }\n\n return { post: quote }\n })\n\n this.open()\n }\n\n clean() {\n if (!this.state.post.trim().length) {\n snackbar.error(pgettext(\"posting form\", \"You have to enter a message.\"))\n return false\n }\n\n const errors = this.validate()\n\n if (errors.post) {\n snackbar.error(errors.post[0])\n return false\n }\n\n return true\n }\n\n send() {\n setGlobalState(true, this.onQuote)\n\n return ajax.put(this.props.submit, {\n post: this.state.post,\n attachments: attachments.clean(this.state.attachments),\n protect: this.state.protect,\n })\n }\n\n handleSuccess(success) {\n this.setState({ isLoading: true })\n this.close()\n\n setGlobalState(false, this.onQuote)\n\n snackbar.success(pgettext(\"edit reply\", \"Reply has been edited.\"))\n window.location = success.url.index\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n const errors = [].concat(\n rejection.non_field_errors || [],\n rejection.category || [],\n rejection.title || [],\n rejection.post || [],\n rejection.attachments || []\n )\n\n snackbar.error(errors[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n setGlobalState(false, this.onQuote)\n }\n\n close = () => {\n this.minimize()\n posting.close()\n }\n\n minimize = () => {\n this.setState({ fullscreen: false, minimized: true })\n }\n\n open = () => {\n this.setState({ minimized: false })\n if (this.state.fullscreen) {\n }\n }\n\n fullscreenEnter = () => {\n this.setState({ fullscreen: true, minimized: false })\n }\n\n fullscreenExit = () => {\n this.setState({ fullscreen: false, minimized: false })\n }\n\n render() {\n const dialogProps = {\n post: this.props.post,\n\n minimized: this.state.minimized,\n minimize: this.minimize,\n open: this.open,\n\n fullscreen: this.state.fullscreen,\n fullscreenEnter: this.fullscreenEnter,\n fullscreenExit: this.fullscreenExit,\n\n close: this.onCancel,\n }\n\n if (this.state.error) {\n return (\n \n \n \n )\n }\n\n if (!this.state.isReady) {\n return (\n \n
    \n {}}\n onChange={() => {}}\n />\n
    \n
    \n )\n }\n\n return (\n \n \n this.setState({ protect: true })}\n disableProtection={() => this.setState({ protect: false })}\n value={this.state.post}\n submitText={pgettext(\"edit reply submit\", \"Edit reply\")}\n disabled={this.state.isLoading}\n onAttachmentsChange={this.onAttachmentsChange}\n onChange={this.onPostChange}\n />\n \n \n )\n }\n}\n\nconst PostingDialogEditReply = ({\n children,\n close,\n minimized,\n minimize,\n open,\n fullscreen,\n fullscreenEnter,\n fullscreenExit,\n post,\n}) => (\n \n \n {interpolate(\n pgettext(\"edit reply\", \"Edit reply by %(poster)s from %(date)s\"),\n {\n poster: post.poster ? post.poster.username : post.poster_name,\n date: post.posted_on.fromNow(),\n },\n true\n )}\n \n {children}\n \n)\n","import React from \"react\"\nimport PostingQuoteSelection from \"./PostingQuoteSelection\"\nimport getQuoteMarkup from \"./getQuoteMarkup\"\nimport { clearGlobalState, getGlobalState, setGlobalState } from \"./globalState\"\nimport Start from \"./start\"\nimport StartPrivate from \"./start-private\"\nimport Reply from \"./reply\"\nimport Edit from \"./edit\"\n\nexport default function (props) {\n switch (props.mode) {\n case \"START\":\n return \n\n case \"START_PRIVATE\":\n return \n\n case \"REPLY\":\n return \n\n case \"EDIT\":\n return \n\n default:\n return null\n }\n}\n\nexport {\n PostingQuoteSelection,\n clearGlobalState,\n getGlobalState,\n getQuoteMarkup,\n setGlobalState,\n}\n","import { maxLength, minLength } from \"misago/utils/validators\"\nimport misago from \"misago\"\n\nexport function getTitleValidators() {\n return [getTitleLengthMin(), getTitleLengthMax()]\n}\n\nexport function getPostValidators() {\n if (misago.get(\"SETTINGS\").post_length_max) {\n return [validatePostLengthMin(), validatePostLengthMax()]\n } else {\n return [validatePostLengthMin()]\n }\n}\n\nexport function getTitleLengthMin() {\n return minLength(\n misago.get(\"SETTINGS\").thread_title_length_min,\n (limitValue, length) => {\n const message = npgettext(\n \"thread title length validator\",\n \"Thread title should be at least %(limit_value)s character long (it has %(show_value)s).\",\n \"Thread title should be at least %(limit_value)s characters long (it has %(show_value)s).\",\n limitValue\n )\n\n return interpolate(\n message,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n )\n}\n\nexport function getTitleLengthMax() {\n return maxLength(\n misago.get(\"SETTINGS\").thread_title_length_max,\n (limitValue, length) => {\n const message = npgettext(\n \"thread title length validator\",\n \"Thread title cannot be longer than %(limit_value)s character (it has %(show_value)s).\",\n \"Thread title cannot be longer than %(limit_value)s characters (it has %(show_value)s).\",\n limitValue\n )\n\n return interpolate(\n message,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n )\n}\n\nexport function validatePostLengthMin() {\n return minLength(\n misago.get(\"SETTINGS\").post_length_min,\n (limitValue, length) => {\n const message = npgettext(\n \"post length validator\",\n \"Posted message should be at least %(limit_value)s character long (it has %(show_value)s).\",\n \"Posted message should be at least %(limit_value)s characters long (it has %(show_value)s).\",\n limitValue\n )\n\n return interpolate(\n message,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n )\n}\n\nexport function validatePostLengthMax() {\n return maxLength(\n misago.get(\"SETTINGS\").post_length_max || 1000000,\n (limitValue, length) => {\n const message = npgettext(\n \"post length validator\",\n \"Posted message cannot be longer than %(limit_value)s character (it has %(show_value)s).\",\n \"Posted message cannot be longer than %(limit_value)s characters (it has %(show_value)s).\",\n limitValue\n )\n\n return interpolate(\n message,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n )\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getChoice() {\n let choice = null\n this.props.choices.map((item) => {\n if (item.value === this.props.value) {\n choice = item\n }\n })\n return choice\n }\n\n getIcon() {\n return this.getChoice().icon\n }\n\n getLabel() {\n return this.getChoice().label\n }\n\n change = (value) => {\n return () => {\n this.props.onChange({\n target: {\n value: value,\n },\n })\n }\n }\n\n render() {\n return (\n
    \n \n \n {this.getLabel()}\n \n
      \n {this.props.choices.map((item, i) => {\n return (\n
    • \n \n \n {item.label}\n \n
    • \n )\n })}\n
    \n
    \n )\n }\n}\n\nexport function Icon({ icon }) {\n if (!icon) return null\n\n return {icon}\n}\n","import React from \"react\"\nimport misago from \"misago/index\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport StartSocialAuth from \"misago/components/StartSocialAuth\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n showActivation: false,\n\n username: \"\",\n password: \"\",\n\n validators: {\n username: [],\n password: [],\n },\n }\n }\n\n clean() {\n if (!this.isValid()) {\n snackbar.error(pgettext(\"sign in modal\", \"Fill out both fields.\"))\n return false\n } else {\n return true\n }\n }\n\n send() {\n return ajax.post(misago.get(\"AUTH_API\"), {\n username: this.state.username,\n password: this.state.password,\n })\n }\n\n handleSuccess() {\n let form = $(\"#hidden-login-form\")\n\n form.append('')\n form.append('')\n\n // fill out form with user credentials and submit it, this will tell\n // Misago to redirect user back to right page, and will trigger browser's\n // key ring feature\n form.find('input[type=\"hidden\"]').val(ajax.getCsrfToken())\n form.find('input[name=\"redirect_to\"]').val(window.location.pathname)\n form.find('input[name=\"username\"]').val(this.state.username)\n form.find('input[name=\"password\"]').val(this.state.password)\n form.submit()\n\n // keep form loading\n this.setState({\n isLoading: true,\n })\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n if (rejection.code === \"inactive_admin\") {\n snackbar.info(rejection.detail)\n } else if (rejection.code === \"inactive_user\") {\n snackbar.info(rejection.detail)\n this.setState({\n showActivation: true,\n })\n } else if (rejection.code === \"banned\") {\n showBannedPage(rejection.detail)\n modal.hide()\n } else {\n snackbar.error(rejection.detail)\n }\n } else if (rejection.status === 403 && rejection.ban) {\n showBannedPage(rejection.ban)\n modal.hide()\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n getActivationButton() {\n if (!this.state.showActivation) return null\n\n return (\n \n {pgettext(\"sign in modal btn\", \"Activate account\")}\n \n )\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"sign in modal title\", \"Sign in\")}\n

    \n
    \n
    \n
    \n \n\n
    \n
    \n \n
    \n
    \n\n
    \n
    \n \n
    \n
    \n
    \n
    \n {this.getActivationButton()}\n \n {pgettext(\"sign in modal btn\", \"Sign in\")}\n \n \n {pgettext(\"sign in modal btn\", \"Forgot password?\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getClass() {\n return getStatusClassName(this.props.status)\n }\n\n render() {\n return {this.props.children}\n }\n}\n\nexport class StatusIcon extends React.Component {\n getIcon() {\n if (this.props.status.is_banned) {\n return \"remove_circle_outline\"\n } else if (this.props.status.is_hidden) {\n return \"help_outline\"\n } else if (this.props.status.is_online_hidden) {\n return \"label\"\n } else if (this.props.status.is_offline_hidden) {\n return \"label_outline\"\n } else if (this.props.status.is_online) {\n return \"lens\"\n } else if (this.props.status.is_offline) {\n return \"panorama_fish_eye\"\n }\n }\n\n render() {\n return {this.getIcon()}\n }\n}\n\nexport class StatusLabel extends React.Component {\n getHelp() {\n return getStatusDescription(this.props.user, this.props.status)\n }\n\n getLabel() {\n if (this.props.status.is_banned) {\n return pgettext(\"user status\", \"Banned\")\n } else if (this.props.status.is_hidden) {\n return pgettext(\"user status\", \"Hidden\")\n } else if (this.props.status.is_online_hidden) {\n return pgettext(\"user status\", \"Online (hidden)\")\n } else if (this.props.status.is_offline_hidden) {\n return pgettext(\"user status\", \"Offline (hidden)\")\n } else if (this.props.status.is_online) {\n return pgettext(\"user status\", \"Online\")\n } else if (this.props.status.is_offline) {\n return pgettext(\"user status\", \"Offline\")\n }\n }\n\n render() {\n return (\n \n {this.getLabel()}\n \n )\n }\n}\n\nexport function getStatusClassName(status) {\n let className = \"\"\n if (status.is_banned) {\n className = \"banned\"\n } else if (status.is_hidden) {\n className = \"offline\"\n } else if (status.is_online_hidden) {\n className = \"online\"\n } else if (status.is_offline_hidden) {\n className = \"offline\"\n } else if (status.is_online) {\n className = \"online\"\n } else if (status.is_offline) {\n className = \"offline\"\n }\n\n return \"user-status user-\" + className\n}\n\nexport function getStatusDescription(user, status) {\n if (status.is_banned) {\n if (status.banned_until) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is banned until %(ban_expires)s\"),\n {\n username: user.username,\n ban_expires: status.banned_until.format(\"LL, LT\"),\n },\n true\n )\n } else {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is banned\"),\n {\n username: user.username,\n },\n true\n )\n }\n } else if (status.is_hidden) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is hiding presence\"),\n {\n username: user.username,\n },\n true\n )\n } else if (status.is_online_hidden) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is online (hidden)\"),\n {\n username: user.username,\n },\n true\n )\n } else if (status.is_offline_hidden) {\n return interpolate(\n pgettext(\n \"user status\",\n \"%(username)s was last seen %(last_click)s (hidden)\"\n ),\n {\n username: user.username,\n last_click: status.last_click.fromNow(),\n },\n true\n )\n } else if (status.is_online) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is online\"),\n {\n username: user.username,\n },\n true\n )\n } else if (status.is_offline) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s was last seen %(last_click)s\"),\n {\n username: user.username,\n last_click: status.last_click.fromNow(),\n },\n true\n )\n }\n}\n","import React from \"react\"\nimport UserStatus, { StatusLabel } from \"misago/components/user-status\"\n\nexport default function ({ showStatus, user }) {\n return (\n
      \n \n \n
    • \n \n \n \n
    \n )\n}\n\nexport function Status({ showStatus, user }) {\n if (!showStatus) return null\n\n return (\n
  • \n \n \n \n
  • \n )\n}\n\nexport function JoinDate({ user }) {\n const { joined_on } = user\n\n let title = interpolate(\n pgettext(\"users list item\", \"Joined on %(joined_on)s\"),\n {\n joined_on: joined_on.format(\"LL, LT\"),\n },\n true\n )\n\n let message = interpolate(\n pgettext(\"users list item\", \"Joined %(joined_on)s\"),\n {\n joined_on: joined_on.fromNow(),\n },\n true\n )\n\n return (\n
  • \n {message}\n
  • \n )\n}\n\nexport function Posts({ user }) {\n const className = getStatClassName(\"user-stat-posts\", user.posts)\n const message = npgettext(\n \"users list item\",\n \"%(posts)s post\",\n \"%(posts)s posts\",\n user.posts\n )\n\n return (\n
  • \n {interpolate(\n message,\n {\n posts: user.posts,\n },\n true\n )}\n
  • \n )\n}\n\nexport function Threads({ user }) {\n const className = getStatClassName(\"user-stat-threads\", user.threads)\n const message = npgettext(\n \"users list item\",\n \"%(threads)s thread\",\n \"%(threads)s threads\",\n user.threads\n )\n\n return (\n
  • \n {interpolate(\n message,\n {\n threads: user.threads,\n },\n true\n )}\n
  • \n )\n}\n\nexport function Followers({ user }) {\n const className = getStatClassName(\"user-stat-followers\", user.followers)\n const message = npgettext(\n \"users list item\",\n \"%(followers)s follower\",\n \"%(followers)s followers\",\n user.followers\n )\n\n return (\n
  • \n {interpolate(\n message,\n {\n followers: user.followers,\n },\n true\n )}\n
  • \n )\n}\n\nexport function getStatClassName(className, stat) {\n if (stat === 0) {\n return className + \" user-stat-empty\"\n }\n return className\n}\n","import React from \"react\"\n\nexport default function ({ rank, title }) {\n let userTitle = title || rank.title || rank.name\n\n let className = \"user-title\"\n if (rank.css_class) {\n className += \" user-title-\" + rank.css_class\n }\n\n if (rank.is_tab) {\n return (\n \n {userTitle}\n \n )\n }\n\n return {userTitle}\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Stats from \"./stats\"\nimport UserTitle from \"./user-title\"\n\nexport default function ({ showStatus, user }) {\n const { rank } = user\n\n let className = \"panel user-card\"\n if (rank.css_class) {\n className += \" user-card-\" + rank.css_class\n }\n\n return (\n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n \n \n \n
    \n\n \n
    \n \n
    \n\n
    \n \n
    \n
    \n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport * as random from \"misago/utils/random\"\n\nexport default class extends React.Component {\n shouldComponentUpdate() {\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n \n \n \n
    \n\n
    \n \n  \n \n
    \n
    \n \n  \n \n
    \n\n
    \n
      \n
    • \n \n  \n \n
    • \n
    • \n \n  \n \n
    • \n
    • \n
    • \n \n  \n \n
    • \n
    • \n \n  \n \n
    • \n
    \n
    \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Card from \"./card\"\n\nexport default function ({ colClassName, cols }) {\n const list = Array.apply(null, { length: cols }).map(Number.call, Number)\n\n return (\n
    \n
    \n {list.map((i) => {\n let className = colClassName\n if (i !== 0) className += \" hidden-xs\"\n if (i === 3) className += \" hidden-sm\"\n\n return (\n
    \n \n
    \n )\n })}\n
    \n
    \n )\n}\n","import React from \"react\"\nimport Card from \"./card\"\nimport Preview from \"./preview\"\n\nexport default function ({ cols, isReady, showStatus, users }) {\n let colClassName = \"col-xs-12 col-sm-4\"\n if (cols === 4) {\n colClassName += \" col-md-3\"\n }\n\n if (!isReady) {\n return \n }\n\n return (\n
    \n
    \n {users.map((user) => {\n return (\n
    \n \n
    \n )\n })}\n
    \n
    \n )\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n dropdown: false,\n }\n }\n\n toggleNav = () => {\n this.setState({\n dropdown: !this.state.dropdown,\n })\n }\n\n hideNav = () => {\n this.setState({\n dropdown: false,\n })\n }\n\n getCompactNavClassName() {\n if (this.state.dropdown) {\n return \"compact-nav open\"\n } else {\n return \"compact-nav\"\n }\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getClassName() {\n if (this.props.value) {\n return \"btn btn-yes-no btn-yes-no-on\"\n } else {\n return \"btn btn-yes-no btn-yes-no-off\"\n }\n }\n\n getIcon() {\n if (!!this.props.value) {\n return this.props.iconOn || \"check_box\"\n } else {\n return this.props.iconOff || \"check_box_outline_blank\"\n }\n }\n\n getLabel() {\n if (!!this.props.value) {\n return this.props.labelOn || pgettext(\"yesno switch choice\", \"yes\")\n } else {\n return this.props.labelOff || pgettext(\"yesno switch choice\", \"no\")\n }\n }\n\n toggle = () => {\n this.props.onChange({\n target: {\n value: !this.props.value,\n },\n })\n }\n\n render() {\n return (\n \n {this.getIcon()}\n {this.getLabel()}\n \n )\n }\n}\n","export const locale = window.misago_locale || \"en-us\"\n\nexport const momentAgo = pgettext(\"time ago\", \"moment ago\")\nexport const momentAgoNarrow = pgettext(\"time ago\", \"now\")\nexport const dayAt = pgettext(\"day at time\", \"%(day)s at %(time)s\")\nexport const soonAt = pgettext(\"day at time\", \"at %(time)s\")\nexport const tomorrowAt = pgettext(\"day at time\", \"Tomorrow at %(time)s\")\nexport const yesterdayAt = pgettext(\"day at time\", \"Yesterday at %(time)s\")\n\nexport const minuteShort = pgettext(\"short minutes\", \"%(time)sm\")\nexport const hourShort = pgettext(\"short hours\", \"%(time)sh\")\nexport const dayShort = pgettext(\"short days\", \"%(time)sd\")\nexport const thisYearShort = pgettext(\"short month\", \"%(day)s %(month)s\")\nexport const otherYearShort = pgettext(\"short month\", \"%(month)s %(year)s\")\n\nexport const relativeNumeric = new Intl.RelativeTimeFormat(locale, {\n numeric: \"always\",\n style: \"long\",\n})\n\nexport const fullDateTime = new Intl.DateTimeFormat(locale, {\n dateStyle: \"full\",\n timeStyle: \"medium\",\n})\n\nexport const thisYearDate = new Intl.DateTimeFormat(locale, {\n month: \"long\",\n day: \"numeric\",\n})\n\nexport const otherYearDate = new Intl.DateTimeFormat(locale, {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n})\n\nexport const short = new Intl.DateTimeFormat(locale, {\n year: \"2-digit\",\n month: \"short\",\n day: \"numeric\",\n})\n\nexport const weekday = new Intl.DateTimeFormat(locale, {\n weekday: \"long\",\n})\n\nexport const shortTime = new Intl.DateTimeFormat(locale, { timeStyle: \"short\" })\n\nexport function formatShort(date) {\n const now = new Date()\n const absDiff = Math.abs(Math.round((date - now) / 1000))\n\n if (absDiff < 60) {\n return momentAgoNarrow\n }\n\n if (absDiff < 60 * 55) {\n const minutes = Math.ceil(absDiff / 60)\n return minuteShort.replace(\"%(time)s\", minutes)\n }\n\n if (absDiff < 3600 * 24) {\n const hours = Math.ceil(absDiff / 3600)\n return hourShort.replace(\"%(time)s\", hours)\n }\n\n if (absDiff < 86400 * 7) {\n const days = Math.ceil(absDiff / 86400)\n return dayShort.replace(\"%(time)s\", days)\n }\n\n const parts = {}\n short.formatToParts(date).forEach(function ({ type, value }) {\n parts[type] = value\n })\n\n if (date.getFullYear() === now.getFullYear()) {\n return thisYearShort\n .replace(\"%(day)s\", parts.day)\n .replace(\"%(month)s\", parts.month)\n }\n\n return otherYearShort\n .replace(\"%(year)s\", parts.year)\n .replace(\"%(month)s\", parts.month)\n}\n\nexport function formatRelative(date) {\n const now = new Date()\n const diff = Math.round((date - now) / 1000)\n const absDiff = Math.abs(diff)\n const sign = diff < 1 ? -1 : 1\n\n if (absDiff < 90) {\n return momentAgo\n }\n\n if (absDiff < 60 * 47) {\n const minutes = Math.ceil(absDiff / 60) * sign\n return relativeNumeric.format(minutes, \"minute\")\n }\n\n if (absDiff < 3600 * 3) {\n const hours = Math.ceil(absDiff / 3600) * sign\n return relativeNumeric.format(hours, \"hour\")\n }\n\n if (isSameDay(now, date)) {\n if (diff > 0) {\n return soonAt.replace(\"%(time)s\", shortTime.format(date))\n }\n\n return shortTime.format(date)\n }\n\n if (isYesterday(date)) {\n return yesterdayAt.replace(\"%(time)s\", shortTime.format(date))\n }\n\n if (isTomorrow(date)) {\n return tomorrowAt.replace(\"%(time)s\", shortTime.format(date))\n }\n\n if (diff < 0 && absDiff < 3600 * 24 * 6) {\n const day = weekday.format(date)\n return formatDayAtTime(day, date)\n }\n\n if (now.getFullYear() == date.getFullYear()) {\n return thisYearDate.format(date)\n }\n\n return otherYearDate.format(date)\n}\n\nexport function isSameDay(now, date) {\n return (\n now.getFullYear() == date.getFullYear() &&\n now.getMonth() == date.getMonth() &&\n now.getDate() == date.getDate()\n )\n}\n\nexport function isYesterday(date) {\n const yesterday = new Date()\n yesterday.setDate(yesterday.getDate() - 1)\n return isSameDay(yesterday, date)\n}\n\nexport function isTomorrow(date) {\n const yesterday = new Date()\n yesterday.setDate(yesterday.getDate() + 1)\n return isSameDay(yesterday, date)\n}\n\nexport function formatDayAtTime(day, date) {\n return dayAt\n .replace(\"%(day)s\", day)\n .replace(\"%(time)s\", shortTime.format(date))\n}\n","class OrderedList {\n constructor(items) {\n this.isOrdered = false\n this._items = items || []\n }\n\n add(key, item, order) {\n this._items.push({\n key: key,\n item: item,\n\n after: order ? order.after || null : null,\n before: order ? order.before || null : null,\n })\n }\n\n get(key, value) {\n for (var i = 0; i < this._items.length; i++) {\n if (this._items[i].key === key) {\n return this._items[i].item\n }\n }\n\n return value\n }\n\n has(key) {\n return this.get(key) !== undefined\n }\n\n values() {\n var values = []\n for (var i = 0; i < this._items.length; i++) {\n values.push(this._items[i].item)\n }\n return values\n }\n\n order(values_only) {\n if (!this.isOrdered) {\n this._items = this._order(this._items)\n this.isOrdered = true\n }\n\n if (values_only || typeof values_only === \"undefined\") {\n return this.values()\n } else {\n return this._items\n }\n }\n\n orderedValues() {\n return this.order(true)\n }\n\n _order(unordered) {\n // Index of unordered items\n var index = []\n unordered.forEach(function (item) {\n index.push(item.key)\n })\n\n // Ordered items\n var ordered = []\n var ordering = []\n\n // First pass: register items that\n // don't specify their order\n unordered.forEach(function (item) {\n if (!item.after && !item.before) {\n ordered.push(item)\n ordering.push(item.key)\n }\n })\n\n // Second pass: register items that\n // specify their before to \"_end\"\n unordered.forEach(function (item) {\n if (item.before === \"_end\") {\n ordered.push(item)\n ordering.push(item.key)\n }\n })\n\n // Third pass: keep iterating items\n // until we hit iterations limit or finish\n // ordering list\n function insertItem(item) {\n var insertAt = -1\n if (ordering.indexOf(item.key) === -1) {\n if (item.after) {\n insertAt = ordering.indexOf(item.after)\n if (insertAt !== -1) {\n insertAt += 1\n }\n } else if (item.before) {\n insertAt = ordering.indexOf(item.before)\n }\n\n if (insertAt !== -1) {\n ordered.splice(insertAt, 0, item)\n ordering.splice(insertAt, 0, item.key)\n }\n }\n }\n\n var iterations = 200\n while (iterations > 0 && index.length !== ordering.length) {\n iterations -= 1\n unordered.forEach(insertItem)\n }\n\n return ordered\n }\n}\n\nexport default OrderedList\n","class AjaxLoader {\n constructor() {\n this.element = document.getElementById(\"misago-ajax-loader\")\n this.requests = 0\n this.timeout = null\n }\n\n show = () => {\n this.requests += 1\n this.update()\n }\n\n hide = () => {\n if (this.requests) {\n this.requests -= 1\n this.update()\n }\n }\n\n update = () => {\n if (this.timeout) {\n window.clearTimeout(this.timeout)\n }\n\n if (this.requests) {\n this.element.classList.add(\"busy\")\n this.element.classList.remove(\"complete\")\n } else {\n this.element.classList.remove(\"busy\")\n this.element.classList.add(\"complete\")\n\n this.timeout = setTimeout(() => {\n this.element.classList.remove(\"complete\")\n }, 1500)\n }\n }\n}\n\nexport function useLoader(target) {\n const silent = target.closest(\"[hx-silent]\")\n if (silent) {\n return silent.getAttribute(\"hx-silent\") !== \"true\"\n }\n\n return true\n}\n\nexport default AjaxLoader\n","import htmx from \"htmx.org\"\n\nclass BulkModeration {\n constructor(options) {\n this.menu = options.menu ? document.querySelector(options.menu) : null\n this.form = options.form\n this.modal = options.modal\n this.actions = document.querySelectorAll(options.actions)\n this.selection = options.selection\n this.control = document.querySelector(options.button.selector)\n this.text = options.button.text\n\n this.update()\n this.registerEvents()\n this.registerActions()\n }\n\n registerActions = () => {\n this.actions.forEach((element) => {\n if (element.getAttribute(\"moderation-action\") === \"remove-selection\") {\n element.addEventListener(\"click\", this.onRemoveSelection)\n } else {\n element.addEventListener(\"click\", this.onAction)\n }\n })\n }\n\n onAction = (event) => {\n const form = document.querySelector(this.form)\n const data = {}\n\n new FormData(form).forEach((value, key) => {\n if (typeof data[key] === \"undefined\") {\n data[key] = []\n }\n data[key].push(value)\n })\n\n const target = event.target\n data.moderation = target.getAttribute(\"moderation-action\")\n\n if (target.getAttribute(\"moderation-multistage\") === \"true\") {\n htmx\n .ajax(\"POST\", document.location.href, {\n target: this.modal,\n swap: \"innerHTML\",\n values: data,\n })\n .then(() => {\n $(this.modal).modal(\"show\")\n })\n } else {\n htmx.ajax(\"POST\", document.location.href, {\n target: \"#misago-htmx-root\",\n swap: \"outerHTML\",\n values: data,\n })\n }\n }\n\n onRemoveSelection = (event) => {\n document.querySelectorAll(this.selection).forEach((element) => {\n element.checked = false\n })\n this.update()\n }\n\n registerEvents = () => {\n document.body.addEventListener(\"click\", ({ target }) => {\n if (target.tagName === \"INPUT\" && target.type === \"checkbox\") {\n this.update()\n }\n })\n\n htmx.onLoad(() => this.update())\n }\n\n update = () => {\n const selection = document.querySelectorAll(this.selection).length\n\n this.control.innerText = this.text.replace(\"%(number)s\", selection)\n this.control.disabled = !selection\n\n if (this.menu) {\n if (selection) {\n this.menu.classList.add(\"visible\")\n } else {\n this.menu.classList.remove(\"visible\")\n }\n }\n }\n}\n\nexport default BulkModeration\n","import htmx from \"htmx.org\"\n\nconst DEBOUNCE = 1000\n\nconst cache = {}\n\nexport function registerElementValidator(element) {\n const active = element.getAttribute(\"misago-validate-active\")\n if (active) {\n return\n }\n\n const url = element.getAttribute(\"misago-validate\")\n const user = element.getAttribute(\"misago-validate-user\")\n const strip =\n element.getAttribute(\"misago-validate-strip\") == \"false\" ? false : true\n const input = element.querySelector(\"input\")\n const csrf = input.closest(\"form\").querySelector(\"input[type=hidden]\")\n\n if (!url || !input) {\n return\n }\n\n if (!cache[url]) {\n cache[url] = {}\n }\n\n element.setAttribute(\"misago-validate-active\", \"true\")\n\n let timeout = null\n\n input.addEventListener(\"keyup\", (event) => {\n let value = event.target.value\n if (strip) {\n value = value.trim()\n }\n\n if (value.trim().length === 0) {\n clearFormControlValidationState(element)\n return\n }\n\n if (cache[url][value]) {\n setFormControlValidationState(element, input, cache[url][value])\n } else {\n if (timeout) {\n window.clearTimeout(timeout)\n }\n\n timeout = window.setTimeout(async () => {\n const { errors } = await callValidationUrl(url, csrf, value, user)\n cache[url][value] = errors\n setFormControlValidationState(element, input, errors)\n }, DEBOUNCE)\n }\n })\n}\n\nfunction setFormControlValidationState(element, input, errors) {\n if (errors.length) {\n setFormControlErrorValidationState(element, input, errors)\n } else {\n setFormControlSuccessValidationState(element)\n }\n}\n\nfunction setFormControlErrorValidationState(element, input, errors) {\n element.classList.remove(\"has-success\")\n element.classList.add(\"has-error\")\n\n clearFormControlValidationMessages(element)\n\n errors.forEach((error) => {\n const message = document.createElement(\"p\")\n message.className = \"help-block\"\n message.setAttribute(\"misago-dynamic-message\", \"true\")\n message.innerText = error\n input.after(message)\n })\n}\n\nfunction setFormControlSuccessValidationState(element) {\n element.classList.remove(\"has-error\")\n element.classList.add(\"has-success\")\n\n clearFormControlValidationMessages(element)\n}\n\nfunction clearFormControlValidationState(element) {\n element.classList.remove(\"has-error\")\n element.classList.remove(\"has-success\")\n\n clearFormControlValidationMessages(element)\n}\n\nfunction clearFormControlValidationMessages(element) {\n element\n .querySelectorAll(\"[misago-dynamic-message]\")\n .forEach((i) => i.remove())\n}\n\nasync function callValidationUrl(url, csrf, value, user) {\n const data = new FormData()\n data.set(csrf.name, csrf.value)\n data.set(\"value\", value)\n if (user) {\n data.set(\"user\", user)\n }\n\n const response = await fetch(url, {\n method: \"POST\",\n mode: \"cors\",\n credentials: \"same-origin\",\n body: data,\n })\n return await response.json()\n}\n\nexport function registerValidators(element) {\n const target = element || document\n target.querySelectorAll(\"[misago-validate]\").forEach(registerElementValidator)\n}\n\nhtmx.onLoad(registerValidators)\n","import htmx from \"htmx.org\"\n\nconst SNACKBAR_TTL = 6\n\nconst container = document.getElementById(\"misago-snackbars\")\nlet timeout = null\n\nexport function removeSnackbars() {\n container.replaceChildren()\n}\n\nfunction renderSnackbars() {\n if (timeout) {\n window.clearTimeout(timeout)\n }\n\n container.querySelectorAll(\".snackbar\").forEach((element) => {\n element.classList.add(\"in\")\n })\n\n timeout = window.setTimeout(() => {\n container.querySelectorAll(\".snackbar\").forEach((element) => {\n element.classList.add(\"out\")\n timeout = window.setTimeout(removeSnackbars, 1000)\n })\n }, SNACKBAR_TTL * 1000)\n}\n\nexport function snackbar(type, message) {\n removeSnackbars()\n\n if (timeout) {\n window.clearTimeout(timeout)\n }\n\n const element = document.createElement(\"div\")\n element.classList.add(\"snackbar\")\n element.classList.add(\"snackbar-\" + type)\n element.innerText = message\n element.role = \"alert\"\n container.appendChild(element)\n\n timeout = window.setTimeout(renderSnackbars, 100)\n}\n\nexport function info(message) {\n snackbar(\"info\", message)\n}\n\nexport function success(message) {\n snackbar(\"success\", message)\n}\n\nexport function warning(message) {\n snackbar(\"warning\", message)\n}\n\nexport function error(message) {\n snackbar(\"danger\", message)\n}\n\nhtmx.onLoad(renderSnackbars)\n","import { error } from \"./snackbars\"\n\nfunction handleResponseError(event) {\n if (isEventVisible(event)) {\n const message = getResponseErrorMessage(event.detail.xhr)\n error(message)\n }\n}\n\nfunction getResponseErrorMessage(xhr) {\n if (xhr.getResponseHeader(\"content-type\") === \"application/json\") {\n const data = JSON.parse(xhr.response)\n if (data.error) {\n return data.error\n }\n }\n\n if (xhr.status === 404) {\n return pgettext(\"htmx response error\", \"Not found\")\n }\n\n if (xhr.status === 403) {\n return pgettext(\"htmx response error\", \"Permission denied\")\n }\n\n return pgettext(\"htmx response error\", \"Unexpected error\")\n}\n\nfunction handleSendError(event) {\n if (isEventVisible(event)) {\n const message = pgettext(\"htmx response error\", \"Site could not be reached\")\n error(message)\n }\n}\n\nfunction handleTimeoutError(event) {\n if (isEventVisible(event)) {\n const message = pgettext(\n \"htmx response error\",\n \"Site took too long to reply\"\n )\n error(message)\n }\n}\n\nfunction isEventVisible({ detail }) {\n const silent = getEventTargetSilentAttr(detail.target)\n return !(silent === \"true\" && detail.requestConfig.verb === \"get\")\n}\n\nfunction getEventTargetSilentAttr(target) {\n const element = target.closest(\"[hx-silent]\")\n if (element) {\n return element.getAttribute(\"hx-silent\")\n }\n return null\n}\n\nexport function setupHtmxErrors() {\n document.addEventListener(\"htmx:responseError\", handleResponseError)\n document.addEventListener(\"htmx:sendError\", handleSendError)\n document.addEventListener(\"htmx:timeout\", handleTimeoutError)\n}\n\nsetupHtmxErrors()\n","import htmx from \"htmx.org\"\n\nimport { formatRelative, formatShort, fullDateTime } from \"./datetimeFormats\"\n\nconst cache = {}\n\nexport function updateTimestamp(element) {\n const timestamp = element.getAttribute(\"misago-timestamp\")\n if (!cache[timestamp]) {\n cache[timestamp] = new Date(timestamp)\n }\n\n if (!element.hasAttribute(\"title\")) {\n element.setAttribute(\"title\", fullDateTime.format(cache[timestamp]))\n }\n\n const format = element.getAttribute(\"misago-timestamp-format\")\n\n if (format == \"short\") {\n element.textContent = formatShort(cache[timestamp])\n } else {\n element.textContent = formatRelative(cache[timestamp])\n }\n}\n\nexport function startLiveTimestamps() {\n document.querySelectorAll(\"[misago-timestamp]\").forEach(updateTimestamp)\n\n updateLiveTimestamps()\n window.setInterval(updateLiveTimestamps, 1000 * 55)\n}\n\nexport function updateLiveTimestamps(element) {\n const target = element || document\n target.querySelectorAll(\"[misago-timestamp]\").forEach(updateTimestamp)\n}\n\nstartLiveTimestamps()\nhtmx.onLoad(updateLiveTimestamps)\n","import \"bootstrap/js/transition\"\nimport \"bootstrap/js/affix\"\nimport \"bootstrap/js/modal\"\nimport \"bootstrap/js/dropdown\"\nimport \"at-js\"\nimport \"cropit\"\nimport \"jquery-caret\"\nimport htmx from \"htmx.org\"\nimport OrderedList from \"misago/utils/ordered-list\"\nimport \"misago/style/index.less\"\nimport AjaxLoader, { useLoader } from \"./AjaxLoader\"\nimport BulkModeration from \"./BulkModeration\"\nimport \"./formValidators\"\nimport \"./htmxErrors\"\nimport \"./liveTimestamps\"\nimport * as snackbars from \"./snackbars\"\n\nconst loader = new AjaxLoader()\n\nexport class Misago {\n constructor() {\n this._initializers = []\n this._context = {}\n\n this.loader = loader\n }\n\n addInitializer(initializer) {\n this._initializers.push({\n key: initializer.name,\n\n item: initializer.initializer,\n\n after: initializer.after,\n before: initializer.before,\n })\n }\n\n init(context) {\n this._context = context\n\n var initOrder = new OrderedList(this._initializers).orderedValues()\n initOrder.forEach((initializer) => {\n initializer(this)\n })\n }\n\n // context accessors\n has(key) {\n return !!this._context[key]\n }\n\n get(key, fallback) {\n if (this.has(key)) {\n return this._context[key]\n } else {\n return fallback || undefined\n }\n }\n\n pop(key) {\n if (this.has(key)) {\n let value = this._context[key]\n this._context[key] = null\n return value\n } else {\n return undefined\n }\n }\n\n snackbar(type, message) {\n snackbars.snackbar(type, message)\n }\n\n snackbarInfo(message) {\n snackbars.info(message)\n }\n\n snackbarSuccess(message) {\n snackbars.success(message)\n }\n\n snackbarWarning(message) {\n snackbars.warning(message)\n }\n\n snackbarError(message) {\n snackbars.error(message)\n }\n\n bulkModeration(options) {\n return new BulkModeration(options)\n }\n}\n\n// create the singleton\nconst misago = new Misago()\n\n// expose it globally\nwindow.misago = misago\n\n// and export it for tests and stuff\nexport default misago\n\n// Register ajax loader events\ndocument.addEventListener(\"htmx:beforeRequest\", ({ target }) => {\n if (useLoader(target)) {\n loader.show()\n }\n})\n\ndocument.addEventListener(\"htmx:afterRequest\", ({ target }) => {\n if (useLoader(target)) {\n loader.hide()\n }\n})\n\n// Hide moderation modal after moderation action completes\ndocument.addEventListener(\"misago:afterModeration\", () => {\n $(\"#threads-moderation-modal\").modal(\"hide\")\n})\n","import misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\n\nexport default function initializer() {\n ajax.init(misago.get(\"CSRF_COOKIE_NAME\"))\n}\n\nmisago.addInitializer({\n name: \"ajax\",\n initializer: initializer,\n})\n","import misago from \"misago/index\"\nimport { patch } from \"misago/reducers/auth\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nconst AUTH_SYNC_RATE = 45 // sync user with backend every 45 seconds\n\nexport default function initializer(context) {\n if (context.get(\"isAuthenticated\")) {\n window.setInterval(function () {\n ajax.get(context.get(\"AUTH_API\")).then(\n function (data) {\n store.dispatch(patch(data))\n },\n function (rejection) {\n snackbar.apiError(rejection)\n }\n )\n }, AUTH_SYNC_RATE * 1000)\n }\n}\n\nmisago.addInitializer({\n name: \"auth-sync\",\n initializer: initializer,\n after: \"auth\",\n})\n","import misago from \"misago/index\"\nimport auth from \"misago/services/auth\"\nimport modal from \"misago/services/modal\"\nimport store from \"misago/services/store\"\nimport storage from \"misago/services/local-storage\"\n\nexport default function initializer() {\n auth.init(store, storage, modal)\n}\n\nmisago.addInitializer({\n name: \"auth\",\n initializer: initializer,\n after: \"store\",\n})\n","import misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\nimport captcha from \"misago/services/captcha\"\nimport include from \"misago/services/include\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default function initializer(context) {\n captcha.init(context, ajax, include, snackbar)\n}\n\nmisago.addInitializer({\n name: \"captcha\",\n initializer: initializer,\n})\n","import React from \"react\"\nimport ajax from \"misago/services/ajax\"\n\nexport default class AcceptAgreement extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = { submiting: false }\n }\n\n handleDecline = () => {\n if (this.state.submiting) return\n\n const confirmation = window.confirm(\n pgettext(\n \"accept agreement prompt\",\n \"Declining will result in immediate deactivation and deletion of your account. This action is not reversible.\"\n )\n )\n if (!confirmation) return\n\n this.setState({ submiting: true })\n\n ajax.post(this.props.api, { accept: false }).then(() => {\n window.location.reload(true)\n })\n }\n\n handleAccept = () => {\n if (this.state.submiting) return\n\n this.setState({ submiting: true })\n\n ajax.post(this.props.api, { accept: true }).then(() => {\n window.location.reload(true)\n })\n }\n\n render() {\n return (\n
    \n \n {pgettext(\"accept agreement choice\", \"Decline\")}\n \n \n {pgettext(\"accept agreement choice\", \"Accept and continue\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport misago from \"misago/index\"\nimport AcceptAgreement from \"misago/components/accept-agreement\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer(context) {\n if (document.getElementById(\"required-agreement-mount\")) {\n mount(\n ,\n \"required-agreement-mount\",\n false\n )\n }\n}\n\nmisago.addInitializer({\n name: \"component:accept-agreement\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\n\nexport default class extends React.Component {\n refresh() {\n window.location.reload()\n }\n\n getMessage() {\n if (this.props.signedIn) {\n return interpolate(\n pgettext(\n \"auth message\",\n \"You have signed in as %(username)s. Please refresh the page before continuing.\"\n ),\n { username: this.props.signedIn.username },\n true\n )\n } else if (this.props.signedOut) {\n return interpolate(\n pgettext(\n \"auth message\",\n \"%(username)s, you have been signed out. Please refresh the page before continuing.\"\n ),\n { username: this.props.user.username },\n true\n )\n }\n }\n\n render() {\n let className = \"auth-message\"\n if (this.props.signedIn || this.props.signedOut) {\n className += \" show\"\n }\n\n return (\n
    \n
    \n

    {this.getMessage()}

    \n

    \n \n {pgettext(\"auth message\", \"Reload page\")}\n \n \n {\" \" + pgettext(\"auth message\", \"or press F5 key.\")}\n \n

    \n
    \n
    \n )\n }\n}\n\nexport function select(state) {\n return {\n user: state.auth.user,\n signedIn: state.auth.signedIn,\n signedOut: state.auth.signedOut,\n }\n}\n","import { connect } from \"react-redux\"\nimport misago from \"misago/index\"\nimport AuthMessage, { select } from \"misago/components/auth-message\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n mount(connect(select)(AuthMessage), \"auth-message-mount\")\n}\n\nmisago.addInitializer({\n name: \"component:auth-message\",\n initializer: initializer,\n after: \"store\",\n})\n","import misago from \"misago/index\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport default function initializer(context) {\n if (context.has(\"BAN_MESSAGE\")) {\n showBannedPage(context.get(\"BAN_MESSAGE\"), false)\n }\n}\n\nmisago.addInitializer({\n name: \"component:banmed-page\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport modal from \"../services/modal\"\nimport SignInModal from \"./sign-in\"\n\nclass SignInModalAutoOpen extends React.Component {\n componentDidMount() {\n const query = window.document.location.search\n if (query === \"?modal=login\") {\n window.setTimeout(() => modal.show(), 300)\n }\n }\n\n render() {\n return null\n }\n}\n\nexport default SignInModalAutoOpen\n","import React from \"react\"\n\nexport default function NavbarBranding({ logo, logoXs, text, url }) {\n if (logo) {\n return (\n
    \n \n {text}\n \n
    \n )\n }\n\n return (\n
    \n {!!logoXs && (\n \n {text}\n \n )}\n {!!text && (\n \n {text}\n \n )}\n
    \n )\n}\n","import React from \"react\"\n\nexport default function NavbarExtraMenu({ items }) {\n return (\n
      \n {items.map((item, index) => (\n
    • \n \n {item.title}\n \n
    • \n ))}\n
    \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { DropdownFooter, DropdownHeader, DropdownPills } from \"../Dropdown\"\n\nexport default function NotificationsDropdownBody({\n children,\n showAll,\n showUnread,\n unread,\n}) {\n return (\n
    \n \n {pgettext(\"notifications title\", \"Notifications\")}\n \n \n \n {pgettext(\"notifications dropdown\", \"All\")}\n \n \n {pgettext(\"notifications dropdown\", \"Unread\")}\n \n \n {children}\n \n \n {pgettext(\"notifications\", \"See all notifications\")}\n \n \n
    \n )\n}\n\nfunction NotificationsDropdownBodyPill({ active, children, onClick }) {\n return (\n \n {children}\n \n )\n}\n","import NotificationsDropdown from \"./NotificationsDropdown\"\n\nexport default NotificationsDropdown\n","import React from \"react\"\nimport NotificationsFetch from \"../NotificationsFetch\"\nimport {\n NotificationsList,\n NotificationsListError,\n NotificationsListLoading,\n} from \"../NotificationsList\"\nimport NotificationsDropdownBody from \"./NotificationsDropdownBody\"\n\nexport default class NotificationsDropdown extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n unread: false,\n url: \"\",\n }\n }\n\n getApiUrl() {\n let url = misago.get(\"NOTIFICATIONS_API\") + \"?limit=20\"\n url += this.state.unread ? \"&filter=unread\" : \"\"\n return url\n }\n\n render = () => (\n this.setState({ unread: false })}\n showUnread={() => this.setState({ unread: true })}\n >\n \n {({ data, loading, error }) => {\n if (loading) {\n return \n }\n\n if (error) {\n return \n }\n\n return (\n \n )\n }}\n \n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function NavbarNotificationsToggle({\n id,\n className,\n badge,\n url,\n active,\n onClick,\n}) {\n const title = !!badge\n ? pgettext(\"navbar\", \"You have unread notifications!\")\n : pgettext(\"navbar\", \"Open notifications\")\n\n return (\n \n {!!badge && {badge}}\n \n {!!badge ? \"notifications_active\" : \"notifications_none\"}\n \n \n )\n}\n","import React from \"react\"\nimport { Dropdown } from \"../Dropdown\"\nimport NotificationsDropdown from \"../NotificationsDropdown\"\nimport NavbarNotificationsToggle from \"./NavbarNotificationsToggle\"\n\nexport default function NavbarNotificationsDropdown({\n id,\n className,\n badge,\n url,\n}) {\n return (\n (\n {\n event.preventDefault()\n toggle()\n }}\n />\n )}\n menuClassName=\"notifications-dropdown\"\n menuAlignRight\n >\n {({ isOpen }) => }\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function NavbarPrivateThreads({\n id,\n className,\n badge,\n url,\n active,\n onClick,\n}) {\n const title = !!badge\n ? pgettext(\"navbar\", \"You have unread private threads!\")\n : pgettext(\"navbar\", \"Open private threads\")\n\n return (\n \n {!!badge && {badge}}\n inbox\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function NavbarSearchToggle({\n id,\n className,\n url,\n active,\n onClick,\n}) {\n return (\n \n search\n \n )\n}\n","import React from \"react\"\nimport { Dropdown } from \"../Dropdown\"\nimport { SearchDropdown } from \"../Search\"\nimport NavbarSearchToggle from \"./NavbarSearchToggle\"\n\nexport default function NavbarSearchDropdown({ id, className, url }) {\n return (\n (\n {\n event.preventDefault()\n toggle()\n\n window.setTimeout(() => {\n document\n .querySelector(\".search-dropdown .form-control-search\")\n .focus()\n }, 0)\n }}\n />\n )}\n menuClassName=\"search-dropdown\"\n menuAlignRight\n >\n {() => }\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function NavbarSiteNavToggle({\n id,\n className,\n active,\n onClick,\n}) {\n return (\n \n menu\n \n )\n}\n","import React from \"react\"\nimport { Dropdown } from \"../Dropdown\"\nimport NavbarSiteNavToggle from \"./NavbarSiteNavToggle\"\nimport { SiteNavDropdown } from \"../SiteNav\"\n\nexport default function NavbarSiteNavDropdown({ id, className }) {\n return (\n (\n \n )}\n menuClassName=\"site-nav-dropdown\"\n menuAlignRight\n >\n {({ isOpen, close }) => }\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport Avatar from \"../avatar\"\n\nexport default function NavbarUserNavToggle({\n id,\n className,\n user,\n active,\n onClick,\n}) {\n return (\n \n \n \n )\n}\n","import React from \"react\"\nimport { Dropdown } from \"../Dropdown\"\nimport NavbarUserNavToggle from \"./NavbarUserNavToggle\"\nimport { UserNavDropdown } from \"../UserNav\"\n\nexport default function NavbarUserNavDropdown({ id, className, user }) {\n return (\n (\n {\n event.preventDefault()\n toggle()\n }}\n />\n )}\n menuClassName=\"user-nav-dropdown\"\n menuAlignRight\n >\n {({ isOpen, close }) => }\n \n )\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport * as overlay from \"../../reducers/overlay\"\nimport RegisterButton from \"../RegisterButton\"\nimport SignInButton from \"../SignInButton\"\nimport SignInModalAutoOpen from \"../SignInModalAutoOpen\"\nimport NavbarBranding from \"./NavbarBranding\"\nimport NavbarExtraMenu from \"./NavbarExtraMenu\"\nimport NavbarNotificationsDropdown from \"./NavbarNotificationsDropdown\"\nimport NavbarNotificationsToggle from \"./NavbarNotificationsToggle\"\nimport NavbarPrivateThreads from \"./NavbarPrivateThreads\"\nimport NavbarSearchDropdown from \"./NavbarSearchDropdown\"\nimport NavbarSearchToggle from \"./NavbarSearchToggle\"\nimport NavbarSiteNavDropdown from \"./NavbarSiteNavDropdown\"\nimport NavbarSiteNavToggle from \"./NavbarSiteNavToggle\"\nimport NavbarUserNavDropdown from \"./NavbarUserNavDropdown\"\nimport NavbarUserNavToggle from \"./NavbarUserNavToggle\"\n\nexport function Navbar({\n dispatch,\n branding,\n extraMenuItems,\n authDelegated,\n user,\n searchUrl,\n notificationsUrl,\n privateThreadsUrl,\n showSearch,\n showPrivateThreads,\n}) {\n return (\n
    \n \n
    \n {extraMenuItems.length > 0 && (\n \n )}\n {!!showSearch && (\n \n )}\n {!!showSearch && (\n {\n dispatch(overlay.openSearch())\n event.preventDefault()\n }}\n />\n )}\n \n {\n dispatch(overlay.openSiteNav())\n }}\n />\n {!!showPrivateThreads && (\n \n )}\n {!!user && (\n \n )}\n {!!user && (\n {\n dispatch(overlay.openNotifications())\n event.preventDefault()\n }}\n />\n )}\n {!!user && (\n \n )}\n {!!user && (\n {\n dispatch(overlay.openUserNav())\n event.preventDefault()\n }}\n />\n )}\n {!user && }\n {!user && !authDelegated && (\n \n )}\n {!user && !authDelegated && }\n
    \n
    \n )\n}\n\nfunction select(state) {\n const settings = misago.get(\"SETTINGS\")\n const user = state.auth.user\n\n return {\n branding: {\n logo: settings.logo,\n logoXs: settings.logo_small,\n text: settings.logo_text,\n url: misago.get(\"MISAGO_PATH\"),\n },\n extraMenuItems: misago.get(\"extraMenuItems\"),\n\n user: !user.id\n ? null\n : {\n id: user.id,\n username: user.username,\n email: user.email,\n avatars: user.avatars,\n unreadNotifications: user.unreadNotifications,\n unreadPrivateThreads: user.unread_private_threads,\n url: user.url,\n },\n\n searchUrl: misago.get(\"SEARCH_URL\"),\n notificationsUrl: misago.get(\"NOTIFICATIONS_URL\"),\n privateThreadsUrl: misago.get(\"PRIVATE_THREADS_URL\"),\n\n authDelegated: settings.enable_oauth2_client,\n showSearch: !!user.acl.can_search,\n showPrivateThreads: !!user && !!user.acl.can_use_private_threads,\n }\n}\n\nconst NavbarConnected = connect(select)(Navbar)\n\nexport default NavbarConnected\n","import Navbar from \"./Navbar\"\n\nexport default Navbar\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport Navbar from \"../../components/Navbar\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n const root = document.getElementById(\"misago-navbar\")\n ReactDOM.render(\n \n \n ,\n root\n )\n}\n\nmisago.addInitializer({\n name: \"component:navbar\",\n initializer: initializer,\n after: \"store\",\n})\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { DropdownFooter, DropdownPills } from \"../Dropdown\"\nimport { Overlay, OverlayHeader } from \"../Overlay\"\n\nexport default function NotificationsOverlayBody({\n children,\n open,\n showAll,\n showUnread,\n unread,\n}) {\n return (\n \n \n {pgettext(\"notifications title\", \"Notifications\")}\n \n \n \n {pgettext(\"notifications dropdown\", \"All\")}\n \n \n {pgettext(\"notifications dropdown\", \"Unread\")}\n \n \n {children}\n \n \n {pgettext(\"notifications\", \"See all notifications\")}\n \n \n \n )\n}\n\nfunction NotificationsOverlayBodyPill({ active, children, onClick }) {\n return (\n \n {children}\n \n )\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport NotificationsFetch from \"../NotificationsFetch\"\nimport {\n NotificationsList,\n NotificationsListError,\n NotificationsListLoading,\n} from \"../NotificationsList\"\nimport NotificationsOverlayBody from \"./NotificationsOverlayBody\"\n\nclass NotificationsOverlay extends React.Component {\n constructor(props) {\n super(props)\n\n this.body = document.body\n\n this.state = {\n unread: false,\n url: \"\",\n }\n }\n\n getApiUrl() {\n let url = misago.get(\"NOTIFICATIONS_API\") + \"?limit=20\"\n url += this.state.unread ? \"&filter=unread\" : \"\"\n return url\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (prevProps.open !== this.props.open) {\n if (this.props.open) {\n this.body.classList.add(\"notifications-fullscreen\")\n } else {\n this.body.classList.remove(\"notifications-fullscreen\")\n }\n }\n }\n\n render = () => (\n this.setState({ unread: false })}\n showUnread={() => this.setState({ unread: true })}\n >\n \n {({ data, loading, error }) => {\n if (loading) {\n return \n }\n\n if (error) {\n return \n }\n\n return (\n \n )\n }}\n \n \n )\n}\n\nfunction select(state) {\n return { open: state.overlay.notifications }\n}\n\nconst NotificationsOverlayConnected = connect(select)(NotificationsOverlay)\n\nexport default NotificationsOverlayConnected\n","import NotificationsOverlay from \"./NotificationsOverlay\"\n\nexport default NotificationsOverlay\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport NotificationsOverlay from \"../../components/NotificationsOverlay\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n if (context.get(\"isAuthenticated\")) {\n const root = document.getElementById(\"notifications-mount\")\n ReactDOM.render(\n \n \n ,\n root\n )\n }\n}\n\nmisago.addInitializer({\n name: \"component:notifications-overlay\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport { PageHeaderPlain } from \"../PageHeader\"\n\nexport default function NotificationsHeader() {\n return (\n \n )\n}\n","import PageTitle from \"./PageTitle\"\n\nexport default PageTitle\n","export default function PageTitle({ title, subtitle }) {\n const parts = []\n if (subtitle) {\n parts.push(subtitle)\n }\n if (title) {\n parts.push(title)\n }\n parts.push(misago.get(\"SETTINGS\").forum_name)\n\n document.title = parts.join(\" | \")\n return null\n}\n","import React from \"react\"\n\nexport default function PillsNav({ children }) {\n return
      {children}
    \n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { Link } from \"react-router\"\n\nexport default function PillsNavLink({ active, link, icon, children }) {\n return (\n
  • \n \n {!!icon && {icon}}\n {children}\n \n
  • \n )\n}\n","import React from \"react\"\nimport { PillsNav, PillsNavLink } from \"../PillsNav\"\nimport { Toolbar, ToolbarSection, ToolbarItem } from \"../Toolbar\"\n\nexport default function NotificationsPills({ filter }) {\n const basename = misago.get(\"NOTIFICATIONS_URL\")\n\n return (\n \n \n \n \n \n {pgettext(\"notifications nav\", \"All\")}\n \n \n {pgettext(\"notifications nav\", \"Unread\")}\n \n \n {pgettext(\"notifications nav\", \"Read\")}\n \n \n \n \n \n )\n}\n","import React from \"react\"\nimport { Link } from \"react-router\"\n\nexport default function NotificationsPagination({ baseUrl, data, disabled }) {\n return (\n
    \n \n {pgettext(\"notifications pagination\", \"Latest\")}\n \n \n {pgettext(\"notifications pagination\", \"Newer\")}\n \n \n {pgettext(\"notifications pagination\", \"Older\")}\n \n
    \n )\n}\n\nfunction NotificationsPaginationLink({ disabled, children, url }) {\n if (disabled) {\n return (\n \n )\n }\n\n return (\n \n {children}\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport Button from \"../button\"\nimport { Toolbar, ToolbarSection, ToolbarItem, ToolbarSpacer } from \"../Toolbar\"\nimport NotificationsPagination from \"./NotificationsPagination\"\n\nexport default function NotificationsToolbar({\n baseUrl,\n data,\n disabled,\n bottom,\n markAllAsRead,\n}) {\n return (\n \n \n \n \n \n \n \n \n \n \n done_all\n {pgettext(\"notifications\", \"Mark all as read\")}\n \n \n \n \n )\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { updateAuthenticatedUser } from \"../../reducers/auth\"\nimport snackbar from \"../../services/snackbar\"\nimport { ApiMutation } from \"../Api\"\nimport NotificationsFetch from \"../NotificationsFetch\"\nimport PageTitle from \"../PageTitle\"\nimport PageContainer from \"../PageContainer\"\nimport {\n NotificationsList,\n NotificationsListError,\n NotificationsListLoading,\n} from \"../NotificationsList\"\nimport NotificationsPills from \"./NotificationsPills\"\nimport NotificationsToolbar from \"./NotificationsToolbar\"\n\nfunction NotificationsRoute({ dispatch, location, route }) {\n const { query } = location\n const { filter } = route.props\n\n const baseUrl = getBaseUrl(filter)\n\n return (\n \n \n\n \n\n \n {({ data, loading, error, refetch }) => (\n \n {(readAll, { loading: mutating }) => {\n const toolbarProps = {\n baseUrl,\n data,\n disabled:\n loading || mutating || !data || data.results.length === 0,\n markAllAsRead: async () => {\n const confirmed = window.confirm(\n pgettext(\"notifications\", \"Mark all notifications as read?\")\n )\n\n if (confirmed) {\n readAll({\n onSuccess: async () => {\n refetch()\n dispatch(\n updateAuthenticatedUser({ unreadNotifications: null })\n )\n snackbar.success(\n pgettext(\n \"notifications\",\n \"All notifications have been marked as read.\"\n )\n )\n },\n onError: snackbar.apiError,\n })\n }\n },\n }\n\n if (loading || mutating) {\n return (\n
    \n \n \n \n
    \n )\n }\n\n if (error) {\n return (\n
    \n \n \n \n
    \n )\n }\n\n if (data) {\n if (!data.hasPrevious && query) {\n window.history.replaceState({}, \"\", baseUrl)\n }\n\n return (\n
    \n \n \n \n
    \n )\n }\n\n return null\n }}\n
    \n )}\n
    \n
    \n )\n}\n\nfunction getSubtitle(filter) {\n if (filter === \"unread\") {\n return pgettext(\"notifications title\", \"Unread notifications\")\n } else if (filter === \"read\") {\n return pgettext(\"notifications title\", \"Read notifications\")\n } else {\n return null\n }\n}\n\nfunction getBaseUrl(filter) {\n let url = misago.get(\"NOTIFICATIONS_URL\")\n if (filter !== \"all\") {\n url += filter + \"/\"\n }\n return url\n}\n\nconst NotificationsRouteConnected = connect()(NotificationsRoute)\n\nexport default NotificationsRouteConnected\n","import Notifications from \"./Notifications\"\nimport NotificationsFetch from \"../NotificationsFetch/NotificationsFetch\"\n\nexport default Notifications\n\nexport { NotificationsFetch }\n","import React from \"react\"\nimport { Router, browserHistory } from \"react-router\"\nimport NotificationsHeader from \"./NotificationsHeader\"\nimport NotificationsRoute from \"./NotificationsRoute\"\n\nexport default function Notifications() {\n const basename = misago.get(\"NOTIFICATIONS_URL\")\n\n return (\n
    \n \n \n
    \n )\n}\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport Notifications from \"../../components/Notifications\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n const basename = misago.get(\"NOTIFICATIONS_URL\")\n if (\n document.location.pathname.startsWith(basename) &&\n !document.location.pathname.startsWith(basename + \"disable-email/\") &&\n context.get(\"isAuthenticated\")\n ) {\n const root = document.getElementById(\"page-mount\")\n ReactDOM.render(\n \n \n ,\n root\n )\n }\n}\n\nmisago.addInitializer({\n name: \"component:notifications\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport Loader from \"misago/components/loader\"\n\nexport default class extends React.Component {\n render() {\n return (\n
    \n \n
    \n )\n }\n}\n","import moment from \"moment\"\nimport React from \"react\"\nimport PanelLoader from \"misago/components/panel-loader\"\nimport PanelMessage from \"misago/components/panel-message\"\nimport misago from \"misago/index\"\nimport polls from \"misago/services/polls\"\nimport title from \"misago/services/page-title\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n if (misago.has(\"PROFILE_BAN\")) {\n this.initWithPreloadedData(misago.pop(\"PROFILE_BAN\"))\n } else {\n this.initWithoutPreloadedData()\n }\n\n this.startPolling(props.profile.api.ban)\n }\n\n initWithPreloadedData(ban) {\n if (ban.expires_on) {\n ban.expires_on = moment(ban.expires_on)\n }\n\n this.state = {\n isLoaded: true,\n ban,\n }\n }\n\n initWithoutPreloadedData() {\n this.state = {\n isLoaded: false,\n }\n }\n\n startPolling(api) {\n polls.start({\n poll: \"ban-details\",\n url: api,\n frequency: 90 * 1000,\n update: this.update,\n error: this.error,\n })\n }\n\n update = (ban) => {\n if (ban.expires_on) {\n ban.expires_on = moment(ban.expires_on)\n }\n\n this.setState({\n isLoaded: true,\n error: null,\n\n ban,\n })\n }\n\n error = (error) => {\n this.setState({\n isLoaded: true,\n error: error.detail,\n ban: null,\n })\n }\n\n componentDidMount() {\n title.set({\n title: pgettext(\"profile ban details title\", \"Ban details\"),\n parent: this.props.profile.username,\n })\n }\n\n componentWillUnmount() {\n polls.stop(\"ban-details\")\n }\n\n getUserMessage() {\n if (this.state.ban.user_message) {\n return (\n
    \n

    {pgettext(\"profile ban details\", \"User-shown ban message\")}

    \n \n
    \n )\n } else {\n return null\n }\n }\n\n getStaffMessage() {\n if (this.state.ban.staff_message) {\n return (\n
    \n

    {pgettext(\"profile ban details\", \"Team-shown ban message\")}

    \n \n
    \n )\n } else {\n return null\n }\n }\n\n getExpirationMessage() {\n if (this.state.ban.expires_on) {\n if (this.state.ban.expires_on.isAfter(moment())) {\n let title = interpolate(\n pgettext(\n \"profile ban details\",\n \"This ban expires on %(expires_on)s.\"\n ),\n {\n expires_on: this.state.ban.expires_on.format(\"LL, LT\"),\n },\n true\n )\n\n let message = interpolate(\n pgettext(\"profile ban details\", \"This ban expires %(expires_on)s.\"),\n {\n expires_on: this.state.ban.expires_on.fromNow(),\n },\n true\n )\n\n return {message}\n } else {\n return pgettext(\"profile ban details\", \"This ban has expired.\")\n }\n } else {\n return interpolate(\n pgettext(\"profile ban details\", \"%(username)s's ban is permanent.\"),\n {\n username: this.props.profile.username,\n },\n true\n )\n }\n }\n\n getPanelBody() {\n if (this.state.ban) {\n if (Object.keys(this.state.ban).length) {\n return (\n
    \n {this.getUserMessage()}\n {this.getStaffMessage()}\n\n
    \n

    {pgettext(\"profile ban details\", \"Ban expiration\")}

    \n

    {this.getExpirationMessage()}

    \n
    \n
    \n )\n } else {\n return (\n
    \n \n
    \n )\n }\n } else if (this.state.error) {\n return (\n
    \n \n
    \n )\n } else {\n return (\n
    \n \n
    \n )\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n

    \n {pgettext(\"profile ban details title\", \"Ban details\")}\n

    \n
    \n\n {this.getPanelBody()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport PanelMessage from \"misago/components/panel-message\"\n\nexport default function ({ display }) {\n if (!display) return null\n\n return (\n \n )\n}\n","import React from \"react\"\nimport Loader from \"misago/components/loader\"\n\nexport default function ({ display }) {\n if (!display) return null\n\n return (\n
    \n \n
    \n )\n}\n","import React from \"react\"\nimport Select from \"misago/components/select\"\n\nexport default class extends React.Component {\n onChange = (ev) => {\n const { field, onChange } = this.props\n onChange(field.fieldname, ev.target.value)\n }\n\n render() {\n const { disabled, field, value } = this.props\n const { input } = field\n\n if (input.type === \"select\") {\n return (\n \n )\n }\n\n if (input.type === \"textarea\") {\n return (\n \n )\n }\n\n if (input.type === \"text\") {\n return (\n \n )\n }\n\n return null\n }\n}\n","import React from \"react\"\nimport FieldInput from \"./field-input\"\nimport FormGroup from \"misago/components/form-group\"\n\nexport default function ({ disabled, errors, fields, name, onChange, value }) {\n return (\n
    \n {name}\n {fields.map((field) => {\n return (\n \n \n \n )\n })}\n
    \n )\n}\n","import React from \"react\"\nimport Fieldset from \"./fieldset\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n errors: {},\n }\n\n const groups = props.groups.length\n for (let i = 0; i < groups; i++) {\n const group = props.groups[i]\n const fields = group.fields.length\n for (let f = 0; f < fields; f++) {\n const fieldname = group.fields[f].fieldname\n const initial = group.fields[f].initial\n this.state[fieldname] = initial\n }\n }\n }\n\n send() {\n const data = Object.assign({}, this.state, {\n errors: null,\n isLoading: null,\n })\n\n return ajax.post(this.props.api, data)\n }\n\n handleSuccess(data) {\n this.props.onSuccess(data)\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n snackbar.error(gettext(\"Form contains errors.\"))\n this.setState({ errors: rejection })\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onChange = (name, value) => {\n this.setState({\n [name]: value,\n })\n }\n\n render() {\n return (\n
    \n
    \n {this.props.groups.map((group, i) => {\n return (\n \n )\n })}\n
    \n
    \n {\" \"}\n \n
    \n
    \n )\n }\n}\n\nexport function CancelButton({ onCancel, disabled }) {\n if (!onCancel) return null\n\n return (\n \n {pgettext(\"user profile details form btn\", \"Cancel\")}\n \n )\n}\n","import React from \"react\"\nimport Blankslate from \"./blankslate\"\nimport Loader from \"./loader\"\nimport Form from \"./form\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n loading: true,\n groups: null,\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.api).then(\n (groups) => {\n this.setState({\n loading: false,\n\n groups,\n })\n },\n (rejection) => {\n snackbar.apiError(rejection)\n if (this.props.cancel) {\n this.props.cancel()\n }\n }\n )\n }\n\n render() {\n const { groups, loading } = this.state\n\n return (\n
    \n
    \n

    \n {pgettext(\"user profile details form title\", \"Edit details\")}\n

    \n
    \n \n \n \n
    \n )\n }\n}\n\nexport function FormDisplay({ api, display, groups, onCancel, onSuccess }) {\n if (!display) return null\n\n return (\n
    \n )\n}\n","import React from \"react\"\nimport Form from \"misago/components/edit-details\"\n\nexport default function ({ api, display, onCancel, onSuccess }) {\n if (!display) return null\n\n return \n}\n","import React from \"react\"\n\nexport default function ({ isAuthenticated, profile }) {\n let message = null\n if (isAuthenticated) {\n message = pgettext(\n \"profile details empty\",\n \"You are not sharing any details with others.\"\n )\n } else {\n message = interpolate(\n pgettext(\n \"profile details empty\",\n \"%(username)s is not sharing any details with others.\"\n ),\n {\n username: profile.username,\n },\n true\n )\n }\n\n return (\n
    \n
    {message}
    \n
    \n )\n}\n","import React from \"react\"\n\nexport default function ({ html, text, url }) {\n if (html) {\n return (\n \n )\n }\n\n return (\n
    \n \n
    \n )\n}\n\nexport function SafeValue({ text, url }) {\n if (url) {\n return (\n

    \n \n {text || url}\n \n

    \n )\n }\n\n if (text) {\n return

    {text}

    \n }\n\n return null\n}\n","import React from \"react\"\nimport FieldValue from \"./field-value\"\n\nexport default function (props) {\n return (\n
    \n {props.name}:\n \n
    \n )\n}\n","import React from \"react\"\nimport Field from \"./field\"\n\nexport default function ({ fields, name }) {\n return (\n
    \n
    \n

    {name}

    \n
    \n
    \n
    \n {fields.map(({ fieldname, html, name, text, url }) => {\n return (\n \n )\n })}\n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport EmptyMessage from \"./empty-message\"\nimport Group from \"./group\"\nimport Loader from \"misago/components/loader\"\n\nexport default function ({\n display,\n groups,\n isAuthenticated,\n loading,\n profile,\n}) {\n if (!display) return null\n\n if (loading) {\n return \n }\n\n if (!groups.length) {\n return \n }\n\n return (\n
    \n {groups.map((group, i) => {\n return \n })}\n
    \n )\n}\n","import React from \"react\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../../Toolbar\"\n\nconst ProfileDetailsHeader = ({ onEdit, showEditButton }) => (\n \n \n \n

    {pgettext(\"profile details title\", \"Details\")}

    \n
    \n
    \n {showEditButton && (\n \n \n \n {pgettext(\"profile details edit btn\", \"Edit\")}\n \n \n \n )}\n
    \n)\n\nexport default ProfileDetailsHeader\n","import React from \"react\"\nimport { load } from \"misago/reducers/profile-details\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n componentDidMount() {\n const { data, dispatch, user } = this.props\n if (data && data.id === user.id) return\n\n ajax.get(this.props.user.api.details).then(\n (data) => {\n dispatch(load(data))\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n }\n\n render() {\n return this.props.children\n }\n}\n","import React from \"react\"\nimport Form from \"./form\"\nimport GroupsList from \"./groups-list\"\nimport Header from \"./header\"\nimport ProfileDetailsData from \"misago/data/profile-details\"\nimport { load as loadDetails } from \"misago/reducers/profile-details\"\nimport title from \"misago/services/page-title\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n editing: false,\n }\n }\n\n componentDidMount() {\n title.set({\n title: pgettext(\"profile details title\", \"Details\"),\n parent: this.props.profile.username,\n })\n }\n\n onCancel = () => {\n this.setState({ editing: false })\n }\n\n onEdit = () => {\n this.setState({ editing: true })\n }\n\n onSuccess = (newDetails) => {\n const { dispatch, isAuthenticated, profile } = this.props\n\n let message = null\n if (isAuthenticated) {\n message = pgettext(\n \"profile details form\",\n \"Your details have been changed.\"\n )\n } else {\n message = interpolate(\n pgettext(\n \"profile details form\",\n \"%(username)s's details have been changed.\"\n ),\n {\n username: profile.username,\n },\n true\n )\n }\n\n snackbar.info(message)\n dispatch(loadDetails(newDetails))\n this.setState({ editing: false })\n }\n\n render() {\n const { dispatch, isAuthenticated, profile, profileDetails } = this.props\n const loading = profileDetails.id !== profile.id\n\n return (\n \n
    \n \n \n \n
    \n \n )\n }\n}\n","import React from \"react\"\nimport PostFeed from \"misago/components/post-feed\"\nimport Button from \"misago/components/button\"\nimport * as posts from \"misago/reducers/posts\"\nimport title from \"misago/services/page-title\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../../Toolbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n }\n }\n\n loadItems(start = 0) {\n ajax\n .get(this.props.api, {\n start: start || 0,\n })\n .then(\n (data) => {\n if (start === 0) {\n store.dispatch(posts.load(data))\n } else {\n store.dispatch(posts.append(data))\n }\n\n this.setState({\n isLoading: false,\n })\n },\n (rejection) => {\n this.setState({\n isLoading: false,\n })\n\n snackbar.apiError(rejection)\n }\n )\n }\n\n loadMore = () => {\n this.setState({\n isLoading: true,\n })\n\n this.loadItems(this.props.posts.next)\n }\n\n componentDidMount() {\n title.set({\n title: this.props.title,\n parent: this.props.profile.username,\n })\n\n this.loadItems()\n }\n\n render() {\n return (\n
    \n \n \n \n

    {this.props.header}

    \n
    \n
    \n
    \n \n
    \n )\n }\n}\n\nexport function Feed(props) {\n if (props.posts.isLoaded && !props.posts.results.length) {\n return

    {props.emptyMessage}

    \n }\n\n return (\n
    \n \n \n
    \n )\n}\n\nexport function LoadMoreButton(props) {\n if (!props.next) return null\n\n return (\n
    \n \n {pgettext(\"profile load more btn\", \"Show older activity\")}\n \n
    \n )\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getClassName() {\n if (this.props.className) {\n return \"form-search \" + this.props.className\n } else {\n return \"form-search\"\n }\n }\n\n render() {\n return (\n
    \n \n search\n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Search from \"misago/components/quick-search\"\nimport UsersList from \"misago/components/users-list\"\nimport misago from \"misago/index\"\nimport { hydrate, append } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport title from \"misago/services/page-title\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../Toolbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.setSpecialProps()\n\n if (misago.has(this.PRELOADED_DATA_KEY)) {\n this.initWithPreloadedData(misago.pop(this.PRELOADED_DATA_KEY))\n } else {\n this.initWithoutPreloadedData()\n }\n }\n\n setSpecialProps() {\n this.PRELOADED_DATA_KEY = \"PROFILE_FOLLOWERS\"\n this.TITLE = pgettext(\"profile followers title\", \"Followers\")\n this.API_FILTER = \"followers\"\n }\n\n initWithPreloadedData(data) {\n this.state = {\n isLoaded: true,\n isBusy: false,\n\n search: \"\",\n\n count: data.count,\n more: data.more,\n\n page: data.page,\n pages: data.pages,\n }\n\n store.dispatch(hydrate(data.results))\n }\n\n initWithoutPreloadedData() {\n this.state = {\n isLoaded: false,\n isBusy: false,\n\n search: \"\",\n\n count: 0,\n more: 0,\n\n page: 1,\n pages: 1,\n }\n\n this.loadUsers()\n }\n\n loadUsers(page = 1, search = null) {\n const apiUrl = this.props.profile.api[this.API_FILTER]\n\n ajax\n .get(\n apiUrl,\n {\n search: search,\n page: page || 1,\n },\n \"user-\" + this.API_FILTER\n )\n .then(\n (data) => {\n if (page === 1) {\n store.dispatch(hydrate(data.results))\n } else {\n store.dispatch(append(data.results))\n }\n\n this.setState({\n isLoaded: true,\n isBusy: false,\n\n count: data.count,\n more: data.more,\n\n page: data.page,\n pages: data.pages,\n })\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n }\n\n componentDidMount() {\n title.set({\n title: this.TITLE,\n parent: this.props.profile.username,\n })\n }\n\n loadMore = () => {\n this.setState({\n isBusy: true,\n })\n\n this.loadUsers(this.state.page + 1, this.state.search)\n }\n\n search = (ev) => {\n this.setState({\n isLoaded: false,\n isBusy: true,\n\n search: ev.target.value,\n\n count: 0,\n more: 0,\n\n page: 1,\n pages: 1,\n })\n\n this.loadUsers(1, ev.target.value)\n }\n\n getLabel() {\n if (!this.state.isLoaded) {\n return pgettext(\"Loading...\")\n } else if (this.state.search) {\n let message = npgettext(\n \"profile followers\",\n \"Found %(users)s user.\",\n \"Found %(users)s users.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n users: this.state.count,\n },\n true\n )\n } else if (this.props.profile.id === this.props.user.id) {\n let message = npgettext(\n \"profile followers\",\n \"You have %(users)s follower.\",\n \"You have %(users)s followers.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n users: this.state.count,\n },\n true\n )\n } else {\n let message = npgettext(\n \"profile followers\",\n \"%(username)s has %(users)s follower.\",\n \"%(username)s has %(users)s followers.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n username: this.props.profile.username,\n users: this.state.count,\n },\n true\n )\n }\n }\n\n getEmptyMessage() {\n if (this.state.search) {\n return pgettext(\n \"profile followers\",\n \"Search returned no users matching specified criteria.\"\n )\n } else if (this.props.user.id === this.props.profile.id) {\n return pgettext(\"profile followers\", \"You have no followers.\")\n } else {\n return interpolate(\n pgettext(\"profile followers\", \"%(username)s has no followers.\"),\n {\n username: this.props.profile.username,\n },\n true\n )\n }\n }\n\n getMoreButton() {\n if (!this.state.more) return null\n\n return (\n
    \n \n {interpolate(\n pgettext(\"profile followers\", \"Show more (%(more)s)\"),\n {\n more: this.state.more,\n },\n true\n )}\n \n
    \n )\n }\n\n getListBody() {\n if (this.state.isLoaded && this.state.count === 0) {\n return

    {this.getEmptyMessage()}

    \n }\n\n return (\n
    \n \n\n {this.getMoreButton()}\n
    \n )\n }\n\n getClassName() {\n return \"profile-\" + this.API_FILTER\n }\n\n render() {\n return (\n
    \n \n \n \n

    {this.getLabel()}

    \n
    \n
    \n \n \n \n \n \n
    \n\n {this.getListBody()}\n
    \n )\n }\n}\n","import React from \"react\"\nimport Followers from \"misago/components/profile/followers\"\n\nexport default class extends Followers {\n setSpecialProps() {\n this.PRELOADED_DATA_KEY = \"PROFILE_FOLLOWS\"\n this.TITLE = pgettext(\"profile follows title\", \"Follows\")\n this.API_FILTER = \"follows\"\n }\n\n getLabel() {\n if (!this.state.isLoaded) {\n return pgettext(\"profile follows\", \"Loading...\")\n } else if (this.state.search) {\n let message = npgettext(\n \"profile follows\",\n \"Found %(users)s user.\",\n \"Found %(users)s users.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n users: this.state.count,\n },\n true\n )\n } else if (this.props.profile.id === this.props.user.id) {\n let message = npgettext(\n \"profile follows\",\n \"You are following %(users)s user.\",\n \"You are following %(users)s users.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n users: this.state.count,\n },\n true\n )\n } else {\n let message = npgettext(\n \"profile follows\",\n \"%(username)s is following %(users)s user.\",\n \"%(username)s is following %(users)s users.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n username: this.props.profile.username,\n users: this.state.count,\n },\n true\n )\n }\n }\n\n getEmptyMessage() {\n if (this.state.search) {\n return pgettext(\n \"profile follows\",\n \"Search returned no users matching specified criteria.\"\n )\n } else if (this.props.user.id === this.props.profile.id) {\n return pgettext(\"profile follows\", \"You are not following any users.\")\n } else {\n return interpolate(\n pgettext(\"profile follows\", \"%(username)s is not following any users.\"),\n {\n username: this.props.profile.username,\n },\n true\n )\n }\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getEmptyMessage() {\n if (this.props.emptyMessage) {\n return this.props.emptyMessage\n } else {\n return pgettext(\n \"username history empty\",\n \"Your account has no history of name changes.\"\n )\n }\n }\n\n render() {\n return (\n
    \n
      \n
    • \n {this.getEmptyMessage()}\n
    • \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\n\nexport default class extends React.Component {\n renderUserAvatar() {\n if (this.props.change.changed_by) {\n return (\n \n \n \n )\n } else {\n return (\n \n \n \n )\n }\n }\n\n renderUsername() {\n if (this.props.change.changed_by) {\n return (\n \n {this.props.change.changed_by.username}\n \n )\n } else {\n return (\n \n {this.props.change.changed_by_username}\n \n )\n }\n }\n\n render() {\n return (\n
  • \n
    {this.renderUserAvatar()}
    \n
    {this.renderUsername()}
    \n
    \n {this.props.change.old_username}\n arrow_forward\n {this.props.change.new_username}\n
    \n
    \n \n {this.props.change.changed_on.fromNow()}\n \n
    \n
  • \n )\n }\n}\n","import React from \"react\"\nimport Change from \"misago/components/username-history/change\"\n\nexport default class extends React.Component {\n render() {\n return (\n
    \n
      \n {this.props.changes.map((change) => {\n return \n })}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport * as random from \"misago/utils/random\"\n\nexport default class extends React.Component {\n shouldComponentUpdate() {\n return false\n }\n\n getClassName() {\n if (this.props.hiddenOnMobile) {\n return \"list-group-item hidden-xs hidden-sm\"\n } else {\n return \"list-group-item\"\n }\n }\n\n render() {\n return (\n
  • \n
    \n \n \n \n
    \n
    \n \n  \n \n
    \n
    \n \n  \n \n arrow_forward\n \n  \n \n
    \n
    \n \n  \n \n
    \n
  • \n )\n }\n}\n","import React from \"react\"\nimport ChangePreview from \"misago/components/username-history/change-preview\"\n\nexport default class extends React.Component {\n shouldComponentUpdate() {\n return false\n }\n\n render() {\n return (\n
    \n
      \n {[0, 1, 2].map((i) => {\n return 0} key={i} />\n })}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport ListEmpty from \"misago/components/username-history/list-empty\"\nimport ListReady from \"misago/components/username-history/list-ready\"\nimport ListPreview from \"misago/components/username-history/list-preview\"\n\nexport default class extends React.Component {\n render() {\n if (this.props.isLoaded) {\n if (this.props.changes.length) {\n return \n } else {\n return \n }\n } else {\n return \n }\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Search from \"misago/components/quick-search\"\nimport UsernameHistory from \"misago/components/username-history/root\"\nimport misago from \"misago/index\"\nimport { hydrate, append } from \"misago/reducers/username-history\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport title from \"misago/services/page-title\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../Toolbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n if (misago.has(\"PROFILE_NAME_HISTORY\")) {\n this.initWithPreloadedData(misago.pop(\"PROFILE_NAME_HISTORY\"))\n } else {\n this.initWithoutPreloadedData()\n }\n }\n\n initWithPreloadedData(data) {\n this.state = {\n isLoaded: true,\n isBusy: false,\n\n search: \"\",\n\n count: data.count,\n more: data.more,\n\n page: data.page,\n pages: data.pages,\n }\n\n store.dispatch(hydrate(data.results))\n }\n\n initWithoutPreloadedData() {\n this.state = {\n isLoaded: false,\n isBusy: false,\n\n search: \"\",\n\n count: 0,\n more: 0,\n\n page: 1,\n pages: 1,\n }\n\n this.loadChanges()\n }\n\n loadChanges(page = 1, search = null) {\n ajax\n .get(\n misago.get(\"USERNAME_CHANGES_API\"),\n {\n user: this.props.profile.id,\n search: search,\n page: page || 1,\n },\n \"search-username-history\"\n )\n .then(\n (data) => {\n if (page === 1) {\n store.dispatch(hydrate(data.results))\n } else {\n store.dispatch(append(data.results))\n }\n\n this.setState({\n isLoaded: true,\n isBusy: false,\n\n count: data.count,\n more: data.more,\n\n page: data.page,\n pages: data.pages,\n })\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n }\n\n componentDidMount() {\n title.set({\n title: pgettext(\"profile username history title\", \"Username history\"),\n parent: this.props.profile.username,\n })\n }\n\n loadMore = () => {\n this.setState({\n isBusy: true,\n })\n\n this.loadChanges(this.state.page + 1, this.state.search)\n }\n\n search = (ev) => {\n this.setState({\n isLoaded: false,\n isBusy: true,\n\n search: ev.target.value,\n\n count: 0,\n more: 0,\n\n page: 1,\n pages: 1,\n })\n\n this.loadChanges(1, ev.target.value)\n }\n\n getLabel() {\n if (!this.state.isLoaded) {\n return pgettext(\"profile username history\", \"Loading...\")\n } else if (this.state.search) {\n let message = npgettext(\n \"profile username history\",\n \"Found %(changes)s username change.\",\n \"Found %(changes)s username changes.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n changes: this.state.count,\n },\n true\n )\n } else if (this.props.profile.id === this.props.user.id) {\n let message = npgettext(\n \"profile username history\",\n \"Your username was changed %(changes)s time.\",\n \"Your username was changed %(changes)s times.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n changes: this.state.count,\n },\n true\n )\n } else {\n let message = npgettext(\n \"profile username history\",\n \"%(username)s's username was changed %(changes)s time.\",\n \"%(username)s's username was changed %(changes)s times.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n username: this.props.profile.username,\n changes: this.state.count,\n },\n true\n )\n }\n }\n\n getEmptyMessage() {\n if (this.state.search) {\n return pgettext(\n \"profile username history\",\n \"Search returned no username changes matching specified criteria.\"\n )\n } else if (this.props.user.id === this.props.profile.id) {\n return pgettext(\n \"username history empty\",\n \"Your account has no history of name changes.\"\n )\n } else {\n return interpolate(\n pgettext(\n \"profile username history\",\n \"%(username)s's username was never changed.\"\n ),\n {\n username: this.props.profile.username,\n },\n true\n )\n }\n }\n\n getMoreButton() {\n if (!this.state.more) return null\n\n return (\n
    \n \n {interpolate(\n pgettext(\"profile username history\", \"Show older (%(more)s)\"),\n {\n more: this.state.more,\n },\n true\n )}\n \n
    \n )\n }\n\n render() {\n return (\n
    \n \n \n \n

    {this.getLabel()}

    \n
    \n
    \n \n \n \n \n \n
    \n\n \n\n {this.getMoreButton()}\n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport { patch } from \"misago/reducers/profile\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n }\n }\n\n getClassName() {\n if (this.props.profile.is_followed) {\n return this.props.className + \" btn-default btn-following\"\n } else {\n return this.props.className + \" btn-default btn-follow\"\n }\n }\n\n getIcon() {\n if (this.props.profile.is_followed) {\n return \"favorite\"\n } else {\n return \"favorite_border\"\n }\n }\n\n getLabel() {\n if (this.props.profile.is_followed) {\n return pgettext(\"user profile follow btn\", \"Following\")\n } else {\n return pgettext(\"user profile follow btn\", \"Follow\")\n }\n }\n\n action = () => {\n this.setState({\n isLoading: true,\n })\n\n if (this.props.profile.is_followed) {\n store.dispatch(\n patch({\n is_followed: false,\n followers: this.props.profile.followers - 1,\n })\n )\n } else {\n store.dispatch(\n patch({\n is_followed: true,\n followers: this.props.profile.followers + 1,\n })\n )\n }\n\n ajax.post(this.props.profile.api.follow).then(\n (data) => {\n this.setState({\n isLoading: false,\n })\n\n store.dispatch(patch(data))\n },\n (rejection) => {\n this.setState({\n isLoading: false,\n })\n snackbar.apiError(rejection)\n }\n )\n }\n\n render() {\n return (\n \n {this.getIcon()}\n {this.getLabel()}\n \n )\n }\n}\n","import React from \"react\"\nimport posting from \"misago/services/posting\"\nimport misago from \"misago\"\n\nexport default class extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"START_PRIVATE\",\n submit: misago.get(\"PRIVATE_THREADS_API\"),\n\n to: [this.props.profile],\n })\n }\n\n render() {\n const canMessage = this.props.user.acl.can_start_private_threads\n const isProfileOwner = this.props.user.id === this.props.profile.id\n\n if (!canMessage || isProfileOwner) return null\n\n return (\n \n comment\n {pgettext(\"profile message btn\", \"Message\")}\n \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport Loader from \"misago/components/modal-loader\"\nimport YesNoSwitch from \"misago/components/yes-no-switch\"\nimport ModalMessage from \"misago/components/modal-message\"\nimport { updateAvatar } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoaded: false,\n isLoading: false,\n error: null,\n\n is_avatar_locked: \"\",\n avatar_lock_user_message: \"\",\n avatar_lock_staff_message: \"\",\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.profile.api.moderate_avatar).then(\n (options) => {\n this.setState({\n isLoaded: true,\n\n is_avatar_locked: options.is_avatar_locked,\n avatar_lock_user_message: options.avatar_lock_user_message || \"\",\n avatar_lock_staff_message: options.avatar_lock_staff_message || \"\",\n })\n },\n (rejection) => {\n this.setState({\n isLoaded: true,\n error: rejection.detail,\n })\n }\n )\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(this.validate().username[0])\n return false\n }\n }\n\n send() {\n return ajax.post(this.props.profile.api.moderate_avatar, {\n is_avatar_locked: this.state.is_avatar_locked,\n avatar_lock_user_message: this.state.avatar_lock_user_message,\n avatar_lock_staff_message: this.state.avatar_lock_staff_message,\n })\n }\n\n handleSuccess(apiResponse) {\n store.dispatch(updateAvatar(this.props.profile, apiResponse.avatar_hash))\n snackbar.success(\n pgettext(\n \"profile avatar moderation\",\n \"Avatar controls have been changed.\"\n )\n )\n }\n\n getFormBody() {\n return (\n \n
    \n \n \n \n\n \n \n \n\n \n \n \n
    \n
    \n \n {pgettext(\"profile avatar moderation btn\", \"Close\")}\n \n \n
    \n \n )\n }\n\n getModalBody() {\n if (this.state.error) {\n return (\n \n )\n } else if (this.state.isLoaded) {\n return this.getFormBody()\n } else {\n return \n }\n }\n\n getClassName() {\n if (this.state.error) {\n return \"modal-dialog modal-message modal-avatar-controls\"\n } else {\n return \"modal-dialog modal-avatar-controls\"\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"profile avatar moderation title\", \"Avatar controls\")}\n

    \n
    \n {this.getModalBody()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport Loader from \"misago/components/modal-loader\"\nimport ModalMessage from \"misago/components/modal-message\"\nimport { addNameChange } from \"misago/reducers/username-history\"\nimport { updateUsername } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport * as validators from \"misago/utils/validators\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoaded: false,\n isLoading: false,\n error: null,\n\n username: \"\",\n validators: {\n username: [validators.usernameContent()],\n },\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.profile.api.moderate_username).then(\n () => {\n this.setState({\n isLoaded: true,\n })\n },\n (rejection) => {\n this.setState({\n isLoaded: true,\n error: rejection.detail,\n })\n }\n )\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(this.validate().username[0])\n return false\n }\n }\n\n send() {\n return ajax.post(this.props.profile.api.moderate_username, {\n username: this.state.username,\n })\n }\n\n handleSuccess(apiResponse) {\n this.setState({\n username: \"\",\n })\n\n store.dispatch(\n addNameChange(apiResponse, this.props.profile, this.props.user)\n )\n store.dispatch(\n updateUsername(this.props.profile, apiResponse.username, apiResponse.slug)\n )\n\n snackbar.success(\n pgettext(\"profile username moderation\", \"Username has been changed.\")\n )\n }\n\n getFormBody() {\n return (\n
    \n
    \n \n \n \n
    \n
    \n \n {pgettext(\"profile username moderation btn\", \"Cancel\")}\n \n \n
    \n
    \n )\n }\n\n getModalBody() {\n if (this.state.error) {\n return (\n \n )\n } else if (this.state.isLoaded) {\n return this.getFormBody()\n } else {\n return \n }\n }\n\n getClassName() {\n if (this.state.error) {\n return \"modal-dialog modal-message modal-rename-user\"\n } else {\n return \"modal-dialog modal-rename-user\"\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"profile username moderation title\", \"Change username\")}\n

    \n
    \n {this.getModalBody()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport Loader from \"misago/components/modal-loader\"\nimport ModalMessage from \"misago/components/modal-message\"\nimport YesNoSwitch from \"misago/components/yes-no-switch\"\nimport misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\nimport polls from \"misago/services/polls\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoaded: false,\n isLoading: false,\n isDeleted: false,\n error: null,\n\n countdown: 5,\n confirm: false,\n\n with_content: false,\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.profile.api.delete).then(\n () => {\n this.setState({\n isLoaded: true,\n })\n\n this.countdown()\n },\n (rejection) => {\n this.setState({\n isLoaded: true,\n error: rejection.detail,\n })\n }\n )\n }\n\n countdown = () => {\n window.setTimeout(() => {\n if (this.state.countdown > 1) {\n this.setState({\n countdown: this.state.countdown - 1,\n })\n this.countdown()\n } else if (!this.state.confirm) {\n this.setState({\n confirm: true,\n })\n }\n }, 1000)\n }\n\n send() {\n return ajax.post(this.props.profile.api.delete, {\n with_content: this.state.with_content,\n })\n }\n\n handleSuccess() {\n polls.stop(\"user-profile\")\n\n if (this.state.with_content) {\n this.setState({\n isDeleted: interpolate(\n pgettext(\n \"profile delete\",\n \"%(username)s's account, threads, posts and other content has been deleted.\"\n ),\n {\n username: this.props.profile.username,\n },\n true\n ),\n })\n } else {\n this.setState({\n isDeleted: interpolate(\n pgettext(\n \"profile delete\",\n \"%(username)s's account has been deleted and other content has been hidden.\"\n ),\n {\n username: this.props.profile.username,\n },\n true\n ),\n })\n }\n }\n\n getButtonLabel() {\n if (this.state.confirm) {\n return interpolate(\n pgettext(\"profile delete btn\", \"Delete %(username)s\"),\n {\n username: this.props.profile.username,\n },\n true\n )\n } else {\n return interpolate(\n pgettext(\"profile delete btn\", \"Please wait... (%(countdown)ss)\"),\n {\n countdown: this.state.countdown,\n },\n true\n )\n }\n }\n\n getForm() {\n return (\n
    \n
    \n \n \n \n
    \n
    \n \n {pgettext(\"profile delete btn\", \"Cancel\")}\n \n\n \n {this.getButtonLabel()}\n \n
    \n
    \n )\n }\n\n getDeletedBody() {\n return (\n
    \n
    \n info_outline\n
    \n \n
    \n )\n }\n\n getModalBody() {\n if (this.state.error) {\n return (\n \n )\n } else if (this.state.isLoaded) {\n if (this.state.isDeleted) {\n return this.getDeletedBody()\n } else {\n return this.getForm()\n }\n } else {\n return \n }\n }\n\n getClassName() {\n if (this.state.error || this.state.isDeleted) {\n return \"modal-dialog modal-message modal-delete-account\"\n } else {\n return \"modal-dialog modal-delete-account\"\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"profile delete title\", \"Delete user account\")}\n

    \n
    \n {this.getModalBody()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport AvatarControls from \"misago/components/profile/moderation/avatar-controls\"\nimport ChangeUsername from \"misago/components/profile/moderation/change-username\"\nimport DeleteAccount from \"misago/components/profile/moderation/delete-account\"\nimport modal from \"misago/services/modal\"\n\nlet select = function (store) {\n return {\n tick: store.tick,\n user: store.auth,\n profile: store.profile,\n }\n}\n\nexport default class extends React.Component {\n showAvatarDialog = () => {\n modal.show(connect(select)(AvatarControls))\n }\n\n showRenameDialog = () => {\n modal.show(connect(select)(ChangeUsername))\n }\n\n showDeleteDialog = () => {\n modal.show(connect(select)(DeleteAccount))\n }\n\n render() {\n const { moderation } = this.props\n\n return (\n
      \n {!!moderation.avatar && (\n
    • \n \n portrait\n {pgettext(\"profile moderation menu\", \"Avatar controls\")}\n \n
    • \n )}\n {!!moderation.rename && (\n
    • \n \n credit_card\n {pgettext(\"profile moderation menu\", \"Change username\")}\n \n
    • \n )}\n {!!moderation.delete && (\n
    • \n \n clear\n {pgettext(\"profile moderation menu\", \"Delete account\")}\n \n
    • \n )}\n
    \n )\n }\n}\n","import React from \"react\"\nimport Status, { StatusIcon, StatusLabel } from \"../user-status\"\n\nconst ProfileDataList = ({ profile }) => (\n
      \n {profile.is_active === false && (\n
    • \n \n {pgettext(\"profile data list\", \"Account disabled\")}\n \n
    • \n )}\n
    • \n \n \n \n \n
    • \n {profile.rank.is_tab ? (\n
    • \n \n {profile.rank.name}\n \n
    • \n ) : (\n
    • \n {profile.rank.name}\n
    • \n )}\n {(profile.title || profile.rank.title) && (\n
    • {profile.title || profile.rank.title}
    • \n )}\n
    • \n \n {interpolate(\n pgettext(\"profile data list\", \"Joined %(joined_on)s\"),\n {\n joined_on: profile.joined_on.fromNow(),\n },\n true\n )}\n \n
    • \n {profile.email && (\n
    • \n \n {profile.email}\n \n
    • \n )}\n
    \n)\n\nexport default ProfileDataList\n","import React from \"react\"\nimport Avatar from \"../avatar\"\nimport { FlexRow, FlexRowCol, FlexRowSection } from \"../FlexRow\"\nimport {\n PageHeader,\n PageHeaderBanner,\n PageHeaderContainer,\n PageHeaderDetails,\n} from \"../PageHeader\"\nimport FollowButton from \"./follow-button\"\nimport MessageButton from \"./message-button\"\nimport ModerationOptions from \"./moderation/nav\"\nimport ProfileDataList from \"./ProfileDataList\"\n\nconst ProfileHeader = ({ profile, user, moderation, message, follow }) => (\n \n \n \n
    \n
    \n \n \n \n
    \n

    {profile.username}

    \n
    \n \n \n \n \n \n \n \n \n {message && (\n \n \n \n \n {moderation.available && !follow && (\n \n
    \n \n \n
    \n
    \n )}\n
    \n )}\n {follow && (\n \n \n \n \n {moderation.available && (\n \n
    \n \n \n
    \n
    \n )}\n
    \n )}\n {moderation.available && !follow && !message && (\n \n \n
    \n \n \n
    \n
    \n \n
    \n \n settings\n {pgettext(\"profile options btn\", \"Options\")}\n \n \n
    \n
    \n
    \n )}\n
    \n
    \n \n
    \n)\n\nconst ProfileModerationButton = () => (\n \n settings\n \n)\n\nexport default ProfileHeader\n","import React from \"react\"\nimport { Link } from \"react-router\"\nimport Li from \"misago/components/li\"\n\nconst ProfileNav = ({ baseUrl, page, pages }) => (\n
    \n
    \n \n {page.icon}\n {page.name}\n \n
      \n {pages.map((page) => (\n
    • \n \n {page.icon}\n {page.name}\n \n
    • \n ))}\n
    \n
    \n
      \n {pages.map((page) => (\n
    • \n \n {page.icon}\n {page.name}\n \n
    • \n ))}\n
    \n
    \n)\n\nexport default ProfileNav\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport BanDetails from \"./ban-details\"\nimport Details from \"./details\"\nimport { Posts, Threads } from \"./feed\"\nimport Followers from \"./followers\"\nimport Follows from \"./follows\"\nimport UsernameHistory from \"./username-history\"\nimport WithDropdown from \"misago/components/with-dropdown\"\nimport misago from \"misago\"\nimport { hydrate } from \"misago/reducers/profile\"\nimport polls from \"misago/services/polls\"\nimport store from \"misago/services/store\"\nimport PageContainer from \"../PageContainer\"\nimport ProfileHeader from \"./ProfileHeader\"\nimport ProfileNav from \"./ProfileNav\"\n\nexport default class extends WithDropdown {\n constructor(props) {\n super(props)\n\n this.startPolling(props.profile.api.index)\n }\n\n startPolling(api) {\n polls.start({\n poll: \"user-profile\",\n url: api,\n frequency: 90 * 1000,\n update: this.update,\n })\n }\n\n update = (data) => {\n store.dispatch(hydrate(data))\n }\n\n render() {\n const baseUrl = misago.get(\"PROFILE\").url\n const pages = misago.get(\"PROFILE_PAGES\")\n const page = pages.filter((page) => {\n const url = baseUrl + page.component + \"/\"\n return this.props.location.pathname === url\n })[0]\n const { profile, user } = this.props\n const moderation = getModeration(profile, user)\n const message =\n !!user.acl.can_start_private_threads && profile.id !== user.id\n const follow = !!profile.acl.can_follow && profile.id !== user.id\n\n return (\n
    \n \n \n \n\n {this.props.children}\n \n
    \n )\n }\n}\n\nconst getModeration = (profile, user) => {\n const moderation = {\n available: false,\n rename: false,\n avatar: false,\n delete: false,\n }\n\n if (user.is_anonymous) return moderation\n\n moderation.rename = profile.acl.can_rename\n moderation.avatar = profile.acl.can_moderate_avatar\n moderation.delete = profile.acl.can_delete\n moderation.available = !!(\n moderation.rename ||\n moderation.avatar ||\n moderation.delete\n )\n\n return moderation\n}\n\nexport function select(store) {\n return {\n isAuthenticated: store.auth.user.id === store.profile.id,\n\n tick: store.tick.tick,\n user: store.auth.user,\n users: store.users,\n posts: store.posts,\n profile: store.profile,\n profileDetails: store[\"profile-details\"],\n \"username-history\": store[\"username-history\"],\n }\n}\n\nconst COMPONENTS = {\n posts: Posts,\n threads: Threads,\n followers: Followers,\n follows: Follows,\n details: Details,\n \"username-history\": UsernameHistory,\n \"ban-details\": BanDetails,\n}\n\nexport function paths() {\n let paths = []\n misago.get(\"PROFILE_PAGES\").forEach(function (item) {\n paths.push(\n Object.assign({}, item, {\n path: misago.get(\"PROFILE\").url + item.component + \"/\",\n component: connect(select)(COMPONENTS[item.component]),\n })\n )\n })\n\n return paths\n}\n","import React from \"react\"\nimport Route from \"./route\"\n\nexport function Threads(props) {\n let emptyMessage = null\n if (props.user.id === props.profile.id) {\n emptyMessage = pgettext(\n \"profile threads\",\n \"You haven't started any threads.\"\n )\n } else {\n emptyMessage = interpolate(\n pgettext(\"profile threads\", \"%(username)s hasn't started any threads\"),\n {\n username: props.profile.username,\n },\n true\n )\n }\n\n let header = null\n if (!props.posts.isLoaded) {\n header = pgettext(\"profile threads\", \"Loading...\")\n } else if (props.profile.id === props.user.id) {\n const message = npgettext(\n \"profile threads\",\n \"You have started %(threads)s thread.\",\n \"You have started %(threads)s threads.\",\n props.profile.threads\n )\n\n header = interpolate(\n message,\n {\n threads: props.profile.threads,\n },\n true\n )\n } else {\n const message = npgettext(\n \"profile threads\",\n \"%(username)s has started %(threads)s thread.\",\n \"%(username)s has started %(threads)s threads.\",\n props.profile.threads\n )\n\n header = interpolate(\n message,\n {\n username: props.profile.username,\n threads: props.profile.threads,\n },\n true\n )\n }\n\n return (\n \n )\n}\n\nexport function Posts(props) {\n let emptyMessage = null\n if (props.user.id === props.profile.id) {\n emptyMessage = pgettext(\"profile posts\", \"You have posted no messages.\")\n } else {\n emptyMessage = interpolate(\n pgettext(\"profile posts\", \"%(username)s posted no messages.\"),\n {\n username: props.profile.username,\n },\n true\n )\n }\n\n let header = null\n if (!props.posts.isLoaded) {\n header = pgettext(\"profile posts\", \"Loading...\")\n } else if (props.profile.id === props.user.id) {\n const message = npgettext(\n \"profile posts\",\n \"You have posted %(posts)s message.\",\n \"You have posted %(posts)s messages.\",\n props.profile.posts\n )\n\n header = interpolate(\n message,\n {\n posts: props.profile.posts,\n },\n true\n )\n } else {\n const message = npgettext(\n \"profile posts\",\n \"%(username)s has posted %(posts)s message.\",\n \"%(username)s has posted %(posts)s messages.\",\n props.profile.posts\n )\n\n header = interpolate(\n message,\n {\n username: props.profile.username,\n posts: props.profile.posts,\n },\n true\n )\n }\n\n return (\n \n )\n}\n","import { connect } from \"react-redux\"\nimport Profile, { paths, select } from \"misago/components/profile/root\"\nimport misago from \"misago/index\"\nimport mount from \"misago/utils/routed-component\"\n\nexport default function initializer(context) {\n if (context.has(\"PROFILE\") && context.has(\"PROFILE_PAGES\")) {\n mount({\n root: misago.get(\"PROFILE\").url,\n component: connect(select)(Profile),\n paths: paths(),\n })\n }\n}\n\nmisago.addInitializer({\n name: \"component:profile\",\n initializer: initializer,\n after: \"reducer:profile-hydrate\",\n})\n","import React from \"react\"\nimport misago from \"misago/index\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport * as validators from \"misago/utils/validators\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport class RequestLinkForm extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n email: \"\",\n\n validators: {\n email: [validators.email()],\n },\n }\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(\n pgettext(\n \"request activation link form\",\n \"Enter a valid e-mail address.\"\n )\n )\n return false\n }\n }\n\n send() {\n return ajax.post(misago.get(\"SEND_ACTIVATION_API\"), {\n email: this.state.email,\n })\n }\n\n handleSuccess(apiResponse) {\n this.props.callback(apiResponse)\n }\n\n handleError(rejection) {\n if ([\"already_active\", \"inactive_admin\"].indexOf(rejection.code) > -1) {\n snackbar.info(rejection.detail)\n } else if (rejection.status === 403 && rejection.ban) {\n showBannedPage(rejection.ban)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n \n
    \n
    \n\n \n {pgettext(\"request activation link form btn\", \"Send link\")}\n \n \n
    \n )\n }\n}\n\nexport class LinkSent extends React.Component {\n getMessage() {\n return interpolate(\n pgettext(\n \"request activation link form\",\n \"Activation link was sent to %(email)s\"\n ),\n {\n email: this.props.user.email,\n },\n true\n )\n }\n\n render() {\n return (\n
    \n
    \n
    \n check\n
    \n
    \n

    {this.getMessage()}

    \n
    \n \n {pgettext(\n \"request activation link form btn\",\n \"Request another link\"\n )}\n \n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n complete: false,\n }\n }\n\n complete = (apiResponse) => {\n this.setState({\n complete: apiResponse,\n })\n }\n\n reset = () => {\n this.setState({\n complete: false,\n })\n }\n\n render() {\n if (this.state.complete) {\n return \n } else {\n return \n }\n }\n}\n","import misago from \"misago/index\"\nimport RequestActivationLink from \"misago/components/request-activation-link\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n if (document.getElementById(\"request-activation-link-mount\")) {\n mount(RequestActivationLink, \"request-activation-link-mount\", false)\n }\n}\n\nmisago.addInitializer({\n name: \"component:request-activation-link\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport misago from \"misago/index\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport * as validators from \"misago/utils/validators\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport class RequestResetForm extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n email: \"\",\n\n validators: {\n email: [validators.email()],\n },\n }\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(\n pgettext(\"request password reset form\", \"Enter a valid e-mail address.\")\n )\n return false\n }\n }\n\n send() {\n return ajax.post(misago.get(\"SEND_PASSWORD_RESET_API\"), {\n email: this.state.email,\n })\n }\n\n handleSuccess(apiResponse) {\n this.props.callback(apiResponse)\n }\n\n handleError(rejection) {\n if ([\"inactive_user\", \"inactive_admin\"].indexOf(rejection.code) > -1) {\n this.props.showInactivePage(rejection)\n } else if (rejection.status === 403 && rejection.ban) {\n showBannedPage(rejection.ban)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n \n
    \n
    \n\n \n {pgettext(\"request password reset form btn\", \"Send link\")}\n \n \n
    \n )\n }\n}\n\nexport class LinkSent extends React.Component {\n getMessage() {\n return interpolate(\n pgettext(\n \"request password reset form\",\n \"Reset password link was sent to %(email)s\"\n ),\n {\n email: this.props.user.email,\n },\n true\n )\n }\n\n render() {\n return (\n
    \n
    \n
    \n check\n
    \n
    \n

    {this.getMessage()}

    \n
    \n \n {pgettext(\n \"request password reset form btn\",\n \"Request another link\"\n )}\n \n
    \n
    \n )\n }\n}\n\nexport class AccountInactivePage extends React.Component {\n getActivateButton() {\n if (this.props.activation === \"inactive_user\") {\n return (\n

    \n \n {pgettext(\n \"request password reset form error\",\n \"Activate your account.\"\n )}\n \n

    \n )\n } else {\n return null\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n info_outline\n
    \n\n
    \n

    \n {pgettext(\n \"request password reset form error\",\n \"Your account is inactive.\"\n )}\n

    \n

    {this.props.message}

    \n {this.getActivateButton()}\n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n complete: false,\n }\n }\n\n complete = (apiResponse) => {\n this.setState({\n complete: apiResponse,\n })\n }\n\n reset = () => {\n this.setState({\n complete: false,\n })\n }\n\n showInactivePage(apiResponse) {\n ReactDOM.render(\n ,\n document.getElementById(\"page-mount\")\n )\n }\n\n render() {\n if (this.state.complete) {\n return \n }\n\n return (\n \n )\n }\n}\n","import misago from \"misago/index\"\nimport RequestPasswordReset from \"misago/components/request-password-reset\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n if (document.getElementById(\"request-password-reset-mount\")) {\n mount(RequestPasswordReset, \"request-password-reset-mount\", false)\n }\n}\n\nmisago.addInitializer({\n name: \"component:request-password-reset\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport misago from \"misago/index\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport SignInModal from \"misago/components/sign-in.js\"\nimport ajax from \"misago/services/ajax\"\nimport auth from \"misago/services/auth\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport class ResetPasswordForm extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n password: \"\",\n }\n }\n\n clean() {\n if (this.state.password.trim().length) {\n return true\n } else {\n snackbar.error(pgettext(\"password reset form\", \"Enter new password.\"))\n return false\n }\n }\n\n send() {\n return ajax.post(misago.get(\"CHANGE_PASSWORD_API\"), {\n password: this.state.password,\n })\n }\n\n handleSuccess(apiResponse) {\n this.props.callback(apiResponse)\n }\n\n handleError(rejection) {\n if (rejection.status === 403 && rejection.ban) {\n showBannedPage(rejection.ban)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n \n
    \n
    \n\n \n {pgettext(\"password reset form btn\", \"Change password\")}\n \n \n
    \n )\n }\n}\n\nexport class PasswordChangedPage extends React.Component {\n getMessage() {\n return interpolate(\n pgettext(\n \"password reset form\",\n \"%(username)s, your password has been changed.\"\n ),\n {\n username: this.props.user.username,\n },\n true\n )\n }\n\n showSignIn() {\n modal.show(SignInModal)\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n check\n
    \n\n
    \n

    {this.getMessage()}

    \n

    \n {pgettext(\n \"password reset form\",\n \"Sign in using new password to continue.\"\n )}\n

    \n

    \n \n {pgettext(\"password reset form btn\", \"Sign in\")}\n \n

    \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n complete = (apiResponse) => {\n auth.softSignOut()\n\n // nuke \"redirect_to\" field so we don't end\n // coming back to error page after sign in\n $('#hidden-login-form input[name=\"redirect_to\"]').remove()\n\n ReactDOM.render(\n ,\n document.getElementById(\"page-mount\")\n )\n }\n\n render() {\n return \n }\n}\n","import misago from \"misago\"\nimport ResetPasswordForm from \"misago/components/reset-password-form\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n if (document.getElementById(\"reset-password-form-mount\")) {\n mount(ResetPasswordForm, \"reset-password-form-mount\", false)\n }\n}\n\nmisago.addInitializer({\n name: \"component:reset-password-form\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport { SearchOverlay } from \"../../components/Search\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n const root = document.getElementById(\"search-mount\")\n ReactDOM.render(\n \n \n ,\n root\n )\n}\n\nmisago.addInitializer({\n name: \"component:search-overlay\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport misago from \"misago\"\nimport Form from \"misago/components/form\"\nimport { load as updatePosts } from \"misago/reducers/posts\"\nimport { update as updateSearch } from \"misago/reducers/search\"\nimport { hydrate as updateUsers } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport { FlexRow, FlexRowCol, FlexRowSection } from \"../FlexRow\"\nimport {\n PageHeader,\n PageHeaderContainer,\n PageHeaderBanner,\n PageHeaderDetails,\n} from \"../PageHeader\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n query: props.search.query,\n }\n }\n\n componentDidMount() {\n if (this.state.query.length) {\n this.handleSubmit()\n }\n }\n\n onQueryChange = (event) => {\n this.changeValue(\"query\", event.target.value)\n }\n\n clean() {\n if (!this.state.query.trim().length) {\n snackbar.error(pgettext(\"search form\", \"You have to enter search query.\"))\n return false\n }\n\n return true\n }\n\n send() {\n store.dispatch(\n updateSearch({\n isLoading: true,\n })\n )\n\n const query = this.state.query.trim()\n\n let url = window.location.href\n const urlQuery = url.indexOf(\"?q=\")\n if (urlQuery > 0) {\n url = url.substring(0, urlQuery + 3)\n }\n window.history.pushState({}, \"\", url + encodeURIComponent(query))\n\n return ajax.get(misago.get(\"SEARCH_API\"), { q: query })\n }\n\n handleSuccess(providers) {\n store.dispatch(\n updateSearch({\n query: this.state.query.trim(),\n isLoading: false,\n providers,\n })\n )\n\n providers.forEach((provider) => {\n if (provider.id === \"users\") {\n store.dispatch(updateUsers(provider.results.results))\n } else if (provider.id === \"threads\") {\n store.dispatch(updatePosts(provider.results))\n }\n })\n }\n\n handleError(rejection) {\n snackbar.apiError(rejection)\n\n store.dispatch(\n updateSearch({\n isLoading: false,\n })\n )\n }\n\n render() {\n return (\n
    \n \n \n \n

    {pgettext(\"search form title\", \"Search\")}

    \n
    \n \n \n \n \n \n \n \n \n search\n \n \n \n \n \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport { Link } from \"react-router\"\n\nexport default function (props) {\n return (\n
    \n {props.providers.map((provider) => {\n return (\n \n {provider.icon}\n {provider.name}\n \n \n )\n })}\n
    \n )\n}\n\nexport function Badge(props) {\n if (!props.results) return null\n\n let count = props.results.count\n if (count > 1000000) {\n count = Math.ceil(count / 1000000) + \"KK\"\n } else if (count > 1000) {\n count = Math.ceil(count / 1000) + \"K\"\n }\n\n return {count}\n}\n","import React from \"react\"\nimport PageContainer from \"../PageContainer\"\nimport SearchForm from \"./form\"\nimport SideNav from \"./sidenav\"\n\nexport default function (props) {\n return (\n
    \n \n \n
    \n
    \n \n
    \n
    \n {props.children}\n \n
    \n
    \n
    \n
    \n )\n}\n\nexport function SearchTime(props) {\n let time = null\n props.search.providers.forEach((p) => {\n if (p.id === props.provider.id) {\n time = p.time\n }\n })\n\n if (time === null) return null\n\n const copy = pgettext(\"search time\", \"Search took %(time)s s\")\n\n return (\n
    \n

    {interpolate(copy, { time }, true)}

    \n
    \n )\n}\n","import React from \"react\"\nimport PostFeed from \"misago/components/post-feed\"\nimport Button from \"misago/components/button\"\nimport MisagoMarkup from \"misago/components/misago-markup\"\nimport {\n update as updatePosts,\n append as appendPosts,\n} from \"misago/reducers/posts\"\nimport { updateProvider } from \"misago/reducers/search\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default function (props) {\n return (\n
    \n \n \n
    \n )\n}\n\nexport class LoadMore extends React.Component {\n onClick = () => {\n store.dispatch(\n updatePosts({\n isBusy: true,\n })\n )\n\n ajax\n .get(this.props.provider.api, {\n q: this.props.query,\n page: this.props.next,\n })\n .then(\n (providers) => {\n providers.forEach((provider) => {\n if (provider.id !== \"threads\") return\n store.dispatch(appendPosts(provider.results))\n store.dispatch(updateProvider(provider))\n })\n\n store.dispatch(\n updatePosts({\n isBusy: false,\n })\n )\n },\n (rejection) => {\n snackbar.apiError(rejection)\n\n store.dispatch(\n updatePosts({\n isBusy: false,\n })\n )\n }\n )\n }\n\n render() {\n if (!this.props.more) return null\n\n return (\n
    \n \n {pgettext(\"search threads btn\", \"Show more\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport SearchPage from \"../page\"\nimport Results from \"./results\"\n\nexport default function (props) {\n return (\n \n \n \n \n \n )\n}\n\nexport function Blankslate({ children, loading, posts, query }) {\n if (posts && posts.count) return children\n\n if (query.length) {\n return (\n

    \n {loading\n ? pgettext(\"search threads\", \"Loading results...\")\n : pgettext(\n \"search threads\",\n \"No threads matching search query have been found.\"\n )}\n

    \n )\n }\n\n return (\n

    \n {pgettext(\n \"search threads\",\n \"Enter at least two characters to search threads.\"\n )}\n

    \n )\n}\n","import React from \"react\"\nimport SearchPage from \"../page\"\nimport UsersList from \"misago/components/users-list\"\n\nexport default function (props) {\n return (\n \n \n \n \n \n )\n}\n\nexport function Blankslate({ children, loading, query, users }) {\n if (users.length) return children\n\n if (query.length) {\n return (\n

    \n {loading\n ? pgettext(\"search users\", \"Loading results...\")\n : pgettext(\n \"search users\",\n \"No users matching search query have been found.\"\n )}\n

    \n )\n }\n\n return (\n

    \n {pgettext(\n \"search users\",\n \"Enter at least two characters to search users.\"\n )}\n

    \n )\n}\n","import { connect } from \"react-redux\"\nimport SearchThreads from \"./threads\"\nimport SearchUsers from \"./users\"\n\nconst components = {\n threads: SearchThreads,\n users: SearchUsers,\n}\n\nexport function select(store) {\n return {\n posts: store.posts,\n search: store.search,\n tick: store.tick.tick,\n user: store.auth.user,\n users: store.users,\n }\n}\n\nexport default function (providers) {\n return providers.map((provider) => {\n return {\n path: provider.url,\n component: connect(select)(components[provider.id]),\n provider: provider,\n }\n })\n}\n","import paths from \"misago/components/search-route\"\nimport misago from \"misago\"\nimport mount from \"misago/utils/routed-component\"\n\nexport default function initializer(context) {\n if (context.get(\"CURRENT_LINK\") === \"misago:search\") {\n mount({\n paths: paths(misago.get(\"SEARCH_PROVIDERS\")),\n })\n }\n}\n\nmisago.addInitializer({\n name: \"component:search\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport { SiteNavOverlay } from \"../../components/SiteNav\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n const root = document.getElementById(\"site-nav-mount\")\n ReactDOM.render(\n \n \n ,\n root\n )\n}\n\nmisago.addInitializer({\n name: \"component:site-nav-overlay\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\n\nconst TYPES_CLASSES = {\n info: \"alert-info\",\n success: \"alert-success\",\n warning: \"alert-warning\",\n error: \"alert-danger\",\n}\n\nexport class Snackbar extends React.Component {\n getSnackbarClass() {\n let snackbarClass = \"alerts-snackbar\"\n if (this.props.isVisible) {\n snackbarClass += \" in\"\n } else {\n snackbarClass += \" out\"\n }\n return snackbarClass\n }\n\n render() {\n return (\n
    \n

    \n {this.props.message}\n

    \n
    \n )\n }\n}\n\nexport function select(state) {\n return state.snackbar\n}\n","import { connect } from \"react-redux\"\nimport misago from \"misago/index\"\nimport { Snackbar, select } from \"misago/components/snackbar\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n mount(connect(select)(Snackbar), \"snackbar-mount\")\n}\n\nmisago.addInitializer({\n name: \"component:snackbar\",\n initializer: initializer,\n after: \"snackbar\",\n})\n","import React from \"react\"\nimport {\n PageHeader,\n PageHeaderBanner,\n PageHeaderContainer,\n} from \"../PageHeader\"\n\nconst Header = ({ backendName }) => {\n const pageTitleTpl = pgettext(\"social auth title\", \"Sign in with %(backend)s\")\n const pageTitle = interpolate(pageTitleTpl, { backend: backendName }, true)\n\n return (\n \n \n \n

    {pageTitle}

    \n
    \n
    \n
    \n )\n}\n\nexport default Header\n","import React from \"react\"\nimport misago from \"misago\"\nimport RegisterLegalFootnote from \"misago/components/RegisterLegalFootnote\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport * as validators from \"misago/utils/validators\"\nimport PageContainer from \"../PageContainer\"\nimport Header from \"./header\"\n\nexport default class Register extends Form {\n constructor(props) {\n super(props)\n\n const formValidators = {\n email: [validators.email()],\n username: [validators.usernameContent()],\n }\n\n if (!!misago.get(\"TERMS_OF_SERVICE_ID\")) {\n formValidators.termsOfService = [validators.requiredTermsOfService()]\n }\n\n if (!!misago.get(\"PRIVACY_POLICY_ID\")) {\n formValidators.privacyPolicy = [validators.requiredPrivacyPolicy()]\n }\n\n this.state = {\n email: props.email || \"\",\n emailProtected: !!props.email,\n username: props.username || \"\",\n\n termsOfService: null,\n privacyPolicy: null,\n\n validators: formValidators,\n errors: {},\n\n isLoading: false,\n }\n }\n\n clean() {\n let errors = this.validate()\n let lengths = [\n this.state.email.trim().length,\n this.state.username.trim().length,\n ]\n\n if (lengths.indexOf(0) !== -1) {\n snackbar.error(pgettext(\"social auth form\", \"Fill out all fields.\"))\n return false\n }\n\n const { validators } = this.state\n\n const checkTermsOfService = !!misago.get(\"TERMS_OF_SERVICE_ID\")\n if (checkTermsOfService && this.state.termsOfService === null) {\n snackbar.error(validators.termsOfService[0](null))\n return false\n }\n\n const checkPrivacyPolicy = !!misago.get(\"PRIVACY_POLICY_ID\")\n if (checkPrivacyPolicy && this.state.privacyPolicy === null) {\n snackbar.error(validators.privacyPolicy[0](null))\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.post(this.props.url, {\n email: this.state.email,\n username: this.state.username,\n terms_of_service: this.state.termsOfService,\n privacy_policy: this.state.privacyPolicy,\n })\n }\n\n handleSuccess(response) {\n const { onRegistrationComplete } = this.props\n onRegistrationComplete(response)\n }\n\n handleError(rejection) {\n if (rejection.status === 200) {\n // We've entered \"errored\" state because response is HTML instead of exptected JSON\n const { onRegistrationComplete } = this.props\n const { username } = this.state\n onRegistrationComplete({ activation: \"active\", step: \"done\", username })\n } else if (rejection.status === 400) {\n const stateUpdate = { errors: rejection }\n if (rejection.email) {\n stateUpdate.emailProtected = false\n }\n this.setState(stateUpdate)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n handlePrivacyPolicyChange = (event) => {\n const value = event.target.value\n this.handleToggleAgreement(\"privacyPolicy\", value)\n }\n\n handleTermsOfServiceChange = (event) => {\n const value = event.target.value\n this.handleToggleAgreement(\"termsOfService\", value)\n }\n\n handleToggleAgreement = (agreement, value) => {\n this.setState((prevState, props) => {\n if (prevState[agreement] === null) {\n const errors = { ...prevState.errors, [agreement]: null }\n return { errors, [agreement]: value }\n }\n\n const validator = this.state.validators[agreement][0]\n const errors = { ...prevState.errors, [agreement]: [validator(null)] }\n return { errors, [agreement]: null }\n })\n }\n\n render() {\n const { backend_name } = this.props\n const { email, emailProtected, username, isLoading } = this.state\n\n let emailHelpText = null\n if (emailProtected) {\n const emailHelpTextTpl = pgettext(\n \"social auth form\",\n \"Your e-mail address has been verified by %(backend)s.\"\n )\n emailHelpText = interpolate(\n emailHelpTextTpl,\n { backend: backend_name },\n true\n )\n }\n\n return (\n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n

    \n {pgettext(\n \"social auth form title\",\n \"Complete your account\"\n )}\n

    \n
    \n
    \n \n \n \n \n \n \n \n
    \n
    \n \n {pgettext(\"social auth form btn\", \"Sign in\")}\n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport misago from \"misago\"\nimport PageContainer from \"../PageContainer\"\nimport Header from \"./header\"\n\nconst Complete = ({ activation, backend_name, username }) => {\n let icon = \"\"\n let message = \"\"\n if (activation === \"user\") {\n message = pgettext(\n \"account activation required\",\n \"%(username)s, your account has been created but you need to activate it before you will be able to sign in.\"\n )\n } else if (activation === \"admin\") {\n message = pgettext(\n \"account activation required\",\n \"%(username)s, your account has been created but the site administrator will have to activate it before you will be able to sign in.\"\n )\n } else {\n message = pgettext(\n \"social auth complete\",\n \"%(username)s, your account has been created and you have been signed in to it.\"\n )\n }\n\n if (activation === \"active\") {\n icon = \"check\"\n } else {\n icon = \"info_outline\"\n }\n\n return (\n
    \n
    \n \n
    \n
    \n
    \n
    \n

    \n {pgettext(\n \"social auth complete title\",\n \"Registration completed!\"\n )}\n

    \n
    \n
    \n
    \n {icon}\n
    \n
    \n

    \n {interpolate(message, { username }, true)}\n

    \n

    \n \n {pgettext(\n \"social auth complete link\",\n \"Return to forum index\"\n )}\n \n

    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n )\n}\n\nexport default Complete\n","import React from \"react\"\nimport Register from \"./register\"\nimport Complete from \"./complete\"\n\nexport default class SocialAuth extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n step: props.step,\n\n activation: props.activation || \"\",\n email: props.email || \"\",\n username: props.username || \"\",\n }\n }\n\n handleRegistrationComplete = ({ activation, email, step, username }) => {\n this.setState({ activation, email, step, username })\n }\n\n render() {\n const { backend_name, url } = this.props\n const { activation, email, step, username } = this.state\n\n if (step === \"register\") {\n return (\n \n )\n }\n\n return (\n \n )\n }\n}\n","import React from \"react\"\nimport SocialAuth from \"misago/components/social-auth\"\nimport misago from \"misago\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer(context) {\n if (context.get(\"CURRENT_LINK\") === \"misago:social-complete\") {\n const props = context.get(\"SOCIAL_AUTH_FORM\")\n mount(, \"page-mount\")\n }\n}\n\nmisago.addInitializer({\n name: \"component:social-auth\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport Form from \"./form\"\nimport FormGroup from \"misago/components/form-group\"\nimport * as participants from \"misago/reducers/participants\"\nimport { updateAcl } from \"misago/reducers/thread\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n username: \"\",\n }\n }\n\n onUsernameChange = (event) => {\n this.changeValue(\"username\", event.target.value)\n }\n\n clean() {\n if (!this.state.username.trim().length) {\n snackbar.error(\n pgettext(\n \"add private thread participant\",\n \"You have to enter user name.\"\n )\n )\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.patch(this.props.thread.api.index, [\n { op: \"add\", path: \"participants\", value: this.state.username },\n { op: \"add\", path: \"acl\", value: 1 },\n ])\n }\n\n handleSuccess(data) {\n store.dispatch(updateAcl(data))\n store.dispatch(participants.replace(data.participants))\n\n snackbar.success(\n pgettext(\n \"add private thread participant\",\n \"New participant has been added to thread.\"\n )\n )\n\n modal.hide()\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n
    \n \n \n \n
    \n
    \n \n {pgettext(\n \"add private thread participant btn\",\n \"Add participant\"\n )}\n \n \n {pgettext(\"add private thread participant btn\", \"Cancel\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport function ModalHeader(props) {\n return (\n
    \n \n ×\n \n

    \n {pgettext(\n \"add private thread participant modal title\",\n \"Add participant\"\n )}\n

    \n
    \n )\n}\n","import React from \"react\"\nimport AddParticipantModal from \"misago/components/add-participant\"\nimport modal from \"misago/services/modal\"\n\nexport default class extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n if (!this.props.thread.acl.can_add_participants) return null\n\n return (\n
    \n \n person_add\n {pgettext(\"add participant btn\", \"Add participant\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport { changeOwner } from \"./actions\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.isUser = props.participant.id === props.user.id\n }\n\n onClick = () => {\n let confirmed = false\n if (this.isUser) {\n confirmed = window.confirm(\n pgettext(\n \"private thread owner change\",\n \"Are you sure you want to take over this thread?\"\n )\n )\n } else {\n const message = pgettext(\n \"private thread owner change\",\n \"Are you sure you want to change thread owner to %(user)s?\"\n )\n confirmed = window.confirm(\n interpolate(\n message,\n {\n user: this.props.participant.username,\n },\n true\n )\n )\n }\n\n if (!confirmed) return\n\n changeOwner(this.props.thread, this.props.participant)\n }\n\n render() {\n if (this.props.participant.is_owner) return null\n if (!this.props.thread.acl.can_change_owner) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n","import * as participants from \"misago/reducers/participants\"\nimport { updateAcl } from \"misago/reducers/thread\"\nimport misago from \"misago\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport function leave(thread, participant) {\n ajax\n .patch(thread.api.index, [\n { op: \"remove\", path: \"participants\", value: participant.id },\n ])\n .then(\n () => {\n snackbar.success(\n pgettext(\"thread participants actions\", \"You have left this thread.\")\n )\n window.setTimeout(() => {\n window.location = misago.get(\"PRIVATE_THREADS_URL\")\n }, 3 * 1000)\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n}\n\nexport function remove(thread, participant) {\n ajax\n .patch(thread.api.index, [\n { op: \"remove\", path: \"participants\", value: participant.id },\n { op: \"add\", path: \"acl\", value: 1 },\n ])\n .then(\n (data) => {\n store.dispatch(updateAcl(data))\n store.dispatch(participants.replace(data.participants))\n\n const message = pgettext(\n \"thread participants actions\",\n \"%(user)s has been removed from this thread.\"\n )\n snackbar.success(\n interpolate(\n message,\n {\n user: participant.username,\n },\n true\n )\n )\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n}\n\nexport function changeOwner(thread, participant) {\n ajax\n .patch(thread.api.index, [\n { op: \"replace\", path: \"owner\", value: participant.id },\n { op: \"add\", path: \"acl\", value: 1 },\n ])\n .then(\n (data) => {\n store.dispatch(updateAcl(data))\n store.dispatch(participants.replace(data.participants))\n\n const message = pgettext(\n \"thread participants actions\",\n \"%(user)s has been made new thread owner.\"\n )\n snackbar.success(\n interpolate(\n message,\n {\n user: participant.username,\n },\n true\n )\n )\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n}\n","import React from \"react\"\nimport { remove, leave } from \"./actions\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.isUser = props.participant.id === props.user.id\n }\n\n onClick = () => {\n let confirmed = false\n if (this.isUser) {\n confirmed = window.confirm(\n pgettext(\n \"private thread leave\",\n \"Are you sure you want to leave this thread?\"\n )\n )\n } else {\n const message = pgettext(\n \"private thread leave\",\n \"Are you sure you want to remove %(user)s from this thread?\"\n )\n confirmed = window.confirm(\n interpolate(\n message,\n {\n user: this.props.participant.username,\n },\n true\n )\n )\n }\n\n if (!confirmed) return\n\n if (this.isUser) {\n leave(this.props.thread, this.props.participant)\n } else {\n remove(this.props.thread, this.props.participant)\n }\n }\n\n render() {\n const isModerator = this.props.user.acl.can_moderate_private_threads\n\n if (!(this.props.userIsOwner || this.isUser || isModerator)) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n","import React from \"react\"\nimport MakeOwner from \"./make-owner\"\nimport Remove from \"./remove\"\nimport Avatar from \"misago/components/avatar\"\n\nexport default function (props) {\n const participant = props.participant\n\n let className = \"btn btn-default\"\n if (participant.is_owner) {\n className = \"btn btn-primary\"\n }\n className += \" btn-user btn-block\"\n\n return (\n
    \n
    \n \n \n {participant.username}\n \n \n
    \n
    \n )\n}\n\nexport function UserStatus({ isOwner }) {\n if (!isOwner) return null\n\n return (\n
  • \n start\n \n {pgettext(\"thread participants owner status\", \"Thread owner\")}\n \n
  • \n )\n}\n","import React from \"react\"\nimport Card from \"./card\"\n\nexport default function ({ participants, thread, user, userIsOwner }) {\n return (\n
    \n
    \n {participants.map((participant) => {\n return (\n \n )\n })}\n
    \n
    \n )\n}\n","import React from \"react\"\nimport AddParticipant from \"./add-participant\"\nimport CardsList from \"./cards-list\"\nimport * as utils from \"./utils\"\n\nexport default function (props) {\n if (!props.participants.length) return null\n\n return (\n
    \n
    \n \n
    \n \n
    \n

    {utils.getParticipantsCopy(props.participants)}

    \n
    \n
    \n
    \n
    \n )\n}\n\nexport function getUserIsOwner(user, participants) {\n return participants[0].id === user.id\n}\n","export function getParticipantsCopy(participants) {\n const count = participants.length\n const message = npgettext(\n \"thread participants stat\",\n \"This thread has %(users)s participant.\",\n \"This thread has %(users)s participants.\",\n count\n )\n\n return interpolate(\n message,\n {\n users: count,\n },\n true\n )\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n
    \n {props.poll.choices.map((choice) => {\n return (\n \n )\n })}\n
    \n )\n}\n\nexport function PollChoice(props) {\n let proc = 0\n if (props.choice.votes && props.poll.votes) {\n proc = Math.ceil((props.choice.votes * 100) / props.poll.votes)\n }\n\n return (\n
    \n
    {props.choice.label}
    \n
    \n
    \n \n \n {getVotesLabel(props.votes, props.proc)}\n \n
    \n \n
      \n \n \n
    \n
    \n
    \n )\n}\n\nexport function ChoiceVotes(props) {\n return (\n
  • \n {getVotesLabel(props.votes, props.proc)}\n
  • \n )\n}\n\nexport function getVotesLabel(votes, proc) {\n const message = npgettext(\n \"thread poll\",\n \"%(votes)s vote, %(proc)s% of total.\",\n \"%(votes)s votes, %(proc)s% of total.\",\n votes\n )\n\n return interpolate(\n message,\n {\n votes: votes,\n proc: proc,\n },\n true\n )\n}\n\nexport function UserChoice(props) {\n if (!props.selected) return null\n\n return (\n
  • \n check_box\n {pgettext(\"thread poll\", \"You've voted on this choice.\")}\n
  • \n )\n}\n","import React from \"react\"\nimport moment from \"moment\"\nimport Message from \"misago/components/modal-message\"\nimport Loader from \"misago/components/modal-loader\"\nimport ajax from \"misago/services/ajax\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: true,\n error: null,\n data: [],\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.poll.api.votes).then(\n (data) => {\n const hydratedData = data.map((choice) => {\n return Object.assign({}, choice, {\n voters: choice.voters.map((voter) => {\n return Object.assign({}, voter, {\n voted_on: moment(voter.voted_on),\n })\n }),\n })\n })\n\n this.setState({\n isLoading: false,\n data: hydratedData,\n })\n },\n (rejection) => {\n this.setState({\n isLoading: false,\n error: rejection.detail,\n })\n }\n )\n }\n\n render() {\n return (\n \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"thread poll\", \"Poll votes\")}\n

    \n
    \n\n \n
    \n \n )\n }\n}\n\nexport function ModalBody(props) {\n if (props.isLoading) {\n return \n } else if (props.error) {\n return \n }\n\n return \n}\n\nexport function ChoicesList(props) {\n return (\n
    \n
      \n {props.data.map((choice) => {\n return \n })}\n
    \n
    \n )\n}\n\nexport function ChoiceDetails(props) {\n return (\n
  • \n

    {props.label}

    \n \n \n
    \n
  • \n )\n}\n\nexport function VotesCount(props) {\n const message = npgettext(\n \"thread poll\",\n \"%(votes)s user has voted for this choice.\",\n \"%(votes)s users have voted for this choice.\",\n props.votes\n )\n\n const label = interpolate(\n message,\n {\n votes: props.votes,\n },\n true\n )\n\n return

    {label}

    \n}\n\nexport function VotesList(props) {\n if (!props.voters.length) return null\n\n return (\n
      \n {props.voters.map((user) => {\n return \n })}\n
    \n )\n}\n\nexport function Voter(props) {\n if (props.url) {\n return (\n
  • \n \n {props.username}\n {\" \"}\n \n
  • \n )\n }\n\n return (\n
  • \n {props.username} \n
  • \n )\n}\n\nexport function VoteDate(props) {\n return (\n \n {props.voted_on.fromNow()}\n \n )\n}\n","import React from \"react\"\nimport Modal from \"./modal\"\nimport * as poll from \"misago/reducers/poll\"\nimport * as thread from \"misago/reducers/thread\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default function (props) {\n const { isPollOver, poll, showVoting, thread } = props\n\n if (!isVisible(isPollOver, poll.acl, poll)) return null\n\n const controls = []\n\n const canVote = poll.acl.can_vote\n const canChangeVote = !poll.hasSelectedChoices || poll.allow_revotes\n\n if (canVote && canChangeVote) controls.push(0)\n if (poll.is_public || poll.acl.can_see_votes) controls.push(1)\n if (poll.acl.can_edit) controls.push(2)\n if (poll.acl.can_delete) controls.push(3)\n\n return (\n
    \n \n \n \n \n
    \n )\n}\n\nexport function isVisible(isPollOver, acl, poll) {\n return (\n poll.is_public ||\n acl.can_delete ||\n acl.can_edit ||\n acl.can_see_votes ||\n (acl.can_vote &&\n !isPollOver &&\n (!poll.hasSelectedChoices || poll.allow_revotes))\n )\n}\n\nexport function getClassName(controls, control) {\n let className = \"col-xs-6\"\n\n if (controls.length === 1) {\n className = \"col-xs-12\"\n }\n\n if (controls.length === 3 && controls[0] === control) {\n className = \"col-xs-12\"\n }\n\n return className + \" col-sm-3 col-md-2\"\n}\n\nexport function ChangeVote(props) {\n const canVote = props.poll.acl.can_vote\n const canChangeVote =\n !props.poll.hasSelectedChoices || props.poll.allow_revotes\n\n if (!(canVote && canChangeVote)) return null\n\n return (\n
    \n \n {pgettext(\"thread poll\", \"Vote\")}\n \n
    \n )\n}\n\nexport class SeeVotes extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n const seeVotes =\n this.props.poll.is_public || this.props.poll.acl.can_see_votes\n if (!seeVotes) return null\n\n return (\n
    \n \n {pgettext(\"thread poll\", \"See votes\")}\n \n
    \n )\n }\n}\n\nexport function Edit(props) {\n if (!props.poll.acl.can_edit) return null\n\n return (\n
    \n \n {pgettext(\"thread poll\", \"Edit\")}\n \n
    \n )\n}\n\nexport class Delete extends React.Component {\n onClick = () => {\n const deletePoll = window.confirm(\n pgettext(\n \"thread poll\",\n \"Are you sure you want to delete this poll? This action is not reversible.\"\n )\n )\n if (!deletePoll) return false\n\n store.dispatch(poll.busy())\n\n ajax\n .delete(this.props.poll.api.index)\n .then(this.handleSuccess, this.handleError)\n }\n\n handleSuccess = (newThreadAcl) => {\n snackbar.success(pgettext(\"thread poll\", \"Poll has been deleted\"))\n store.dispatch(poll.remove())\n store.dispatch(thread.updateAcl(newThreadAcl))\n }\n\n handleError = (rejection) => {\n snackbar.apiError(rejection)\n store.dispatch(poll.release())\n }\n\n render() {\n if (!this.props.poll.acl.can_delete) return null\n\n return (\n
    \n \n {pgettext(\"thread poll\", \"Delete\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst DATE_ABBR = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default function (props) {\n return (\n
      \n \n \n \n \n
    \n )\n}\n\nexport function PollCreation(props) {\n const message = interpolate(\n escapeHtml(pgettext(\"thread poll\", \"Started by %(poster)s %(posted_on)s.\")),\n {\n poster: getPoster(props.poll),\n posted_on: getPostedOn(props.poll),\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function getPoster(poll) {\n if (poll.url.poster) {\n return interpolate(\n USER_URL,\n {\n url: escapeHtml(poll.url.poster),\n user: escapeHtml(poll.poster_name),\n },\n true\n )\n }\n\n return interpolate(\n USER_SPAN,\n {\n user: escapeHtml(poll.poster_name),\n },\n true\n )\n}\n\nexport function getPostedOn(poll) {\n return interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(poll.posted_on.format(\"LLL\")),\n relative: escapeHtml(poll.posted_on.fromNow()),\n },\n true\n )\n}\n\nexport function PollLength(props) {\n if (!props.poll.length) {\n return null\n }\n\n const message = interpolate(\n escapeHtml(pgettext(\"thread poll\", \"Voting ends %(ends_on)s.\")),\n {\n ends_on: getEndsOn(props.poll),\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function getEndsOn(poll) {\n return interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(poll.endsOn.format(\"LLL\")),\n relative: escapeHtml(poll.endsOn.fromNow()),\n },\n true\n )\n}\n\nexport function PollVotes(props) {\n const message = npgettext(\n \"thread poll\",\n \"%(votes)s vote.\",\n \"%(votes)s votes.\",\n props.votes\n )\n const label = interpolate(\n message,\n {\n votes: props.votes,\n },\n true\n )\n\n return
  • {label}
  • \n}\n\nexport function PollIsPublic(props) {\n if (!props.poll.is_public) {\n return null\n }\n\n return (\n
  • \n {pgettext(\"thread poll\", \"Voting is public.\")}\n
  • \n )\n}\n","import React from \"react\"\nimport Chart from \"./chart\"\nimport Options from \"./options\"\nimport PollInfo from \"../info\"\n\nexport default function (props) {\n return (\n
    \n
    \n

    {props.poll.question}

    \n \n \n \n
    \n
    \n )\n}\n","import React from \"react\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst DATE_ABBR = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default function (props) {\n return (\n
      \n \n \n
    \n )\n}\n\nexport function PollChoicesLeft({ choicesLeft }) {\n if (choicesLeft === 0) {\n return (\n
  • \n {pgettext(\"thread poll\", \"You can't select any more choices.\")}\n
  • \n )\n }\n\n const message = npgettext(\n \"thread poll\",\n \"You can select %(choices)s more choice.\",\n \"You can select %(choices)s more choices.\",\n choicesLeft\n )\n\n const label = interpolate(\n message,\n {\n choices: choicesLeft,\n },\n true\n )\n\n return
  • {label}
  • \n}\n\nexport function PollAllowRevote(props) {\n if (props.poll.allow_revotes) {\n return (\n
  • \n {pgettext(\"thread poll\", \"You can change your vote later.\")}\n
  • \n )\n }\n\n return (\n
  • \n {pgettext(\"thread poll\", \"Votes are final.\")}\n
  • \n )\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n
      \n {props.choices.map((choice) => {\n return (\n \n )\n })}\n
    \n )\n}\n\nexport class ChoiceSelect extends React.Component {\n onClick = () => {\n this.props.toggleChoice(this.props.choice.hash)\n }\n\n render() {\n return (\n
  • \n \n \n {this.props.choice.selected\n ? \"check_box\"\n : \"check_box_outline_blank\"}\n \n {this.props.choice.label}\n \n
  • \n )\n }\n}\n","export function getChoiceFromHash(choices, hash) {\n for (const i in choices) {\n const choice = choices[i]\n if (choice.hash === hash) {\n return choice\n }\n }\n\n return null\n}\n\nexport function getChoicesLeft(poll, choices) {\n let selection = []\n for (const i in choices) {\n const choice = choices[i]\n if (choice.selected) {\n selection.push(choice)\n }\n }\n\n return poll.allowed_choices - selection.length\n}\n","import React from \"react\"\nimport ChoicesHelp from \"./help\"\nimport ChoicesSelect from \"./select\"\nimport { getChoicesLeft, getChoiceFromHash } from \"./utils\"\nimport PollInfo from \"../info\"\nimport { Delete, Edit, getClassName } from \"../results/options\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport * as poll from \"misago/reducers/poll\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n choices: props.poll.choices,\n choicesLeft: getChoicesLeft(props.poll, props.poll.choices),\n }\n }\n\n toggleChoice = (hash) => {\n const choice = getChoiceFromHash(this.state.choices, hash)\n\n let choices = null\n if (!choice.selected) {\n choices = this.selectChoice(choice, hash)\n } else {\n choices = this.deselectChoice(choice, hash)\n }\n\n this.setState({\n choices,\n choicesLeft: getChoicesLeft(this.props.poll, choices),\n })\n }\n\n selectChoice = (choice, hash) => {\n const choicesLeft = getChoicesLeft(this.props.poll, this.state.choices)\n\n if (!choicesLeft) {\n for (const i in this.state.choices.slice()) {\n const item = this.state.choices[i]\n if (item.selected && item.hash != hash) {\n item.selected = false\n break\n }\n }\n }\n\n return this.state.choices.map((choice) => {\n return Object.assign({}, choice, {\n selected: choice.hash == hash ? true : choice.selected,\n })\n })\n }\n\n deselectChoice = (choice, hash) => {\n return this.state.choices.map((choice) => {\n return Object.assign({}, choice, {\n selected: choice.hash == hash ? false : choice.selected,\n })\n })\n }\n\n clean() {\n if (this.state.choicesLeft === this.props.poll.allowed_choices) {\n snackbar.error(\n pgettext(\"thread poll vote\", \"You need to select at least one choice.\")\n )\n return false\n }\n\n return true\n }\n\n send() {\n let data = []\n for (const i in this.state.choices.slice()) {\n const item = this.state.choices[i]\n if (item.selected) {\n data.push(item.hash)\n }\n }\n\n return ajax.post(this.props.poll.api.votes, data)\n }\n\n handleSuccess(data) {\n store.dispatch(poll.replace(data))\n snackbar.success(pgettext(\"thread poll vote\", \"Your vote has been saved.\"))\n\n this.props.showResults()\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n const controls = []\n\n if (this.props.poll.acl.can_vote) controls.push(0)\n if (this.props.poll.is_public || this.props.poll.acl.can_see_votes)\n controls.push(1)\n if (this.props.poll.acl.can_edit) controls.push(2)\n if (this.props.poll.acl.can_delete) controls.push(3)\n\n return (\n
    \n
    \n
    \n

    {this.props.poll.question}

    \n \n \n \n
    \n
    \n
    \n
    \n \n {pgettext(\"thread poll vote btn\", \"Save your vote\")}\n \n
    \n
    \n \n {pgettext(\"thread poll vote btn\", \"See results\")}\n \n
    \n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport moment from \"moment\"\nimport Results from \"./results\"\nimport Voting from \"./voting\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n let showResults = true\n if (props.user.id && !props.poll.hasSelectedChoices) {\n showResults = false\n }\n\n this.state = {\n showResults,\n }\n }\n\n showResults = () => {\n this.setState({\n showResults: true,\n })\n }\n\n showVoting = () => {\n this.setState({\n showResults: false,\n })\n }\n\n render() {\n if (!this.props.thread.poll) return null\n\n const isPollOver = getIsPollOver(this.props.poll)\n\n if (\n !isPollOver &&\n this.props.poll.acl.can_vote &&\n !this.state.showResults\n ) {\n return \n } else {\n return (\n \n )\n }\n }\n}\n\nexport function getIsPollOver(poll) {\n if (poll.length) {\n return moment().isAfter(poll.endsOn)\n }\n return false\n}\n","import React from \"react\"\nimport getRandomString from \"../../../utils/getRandomString\"\n\nconst HASH_LENGTH = 12\n\nexport default class extends React.Component {\n onAdd = () => {\n let choices = this.props.choices.slice()\n choices.push({\n hash: getRandomString(HASH_LENGTH),\n label: \"\",\n })\n\n this.props.setChoices(choices)\n }\n\n onChange = (hash, label) => {\n const choices = this.props.choices.map((choice) => {\n if (choice.hash === hash) {\n choice.label = label\n }\n\n return choice\n })\n this.props.setChoices(choices)\n }\n\n onDelete = (hash) => {\n const choices = this.props.choices.filter((choice) => {\n return choice.hash !== hash\n })\n this.props.setChoices(choices)\n }\n\n render() {\n return (\n
    \n
      \n {this.props.choices.map((choice) => {\n return (\n 2}\n choice={choice}\n disabled={this.props.disabled}\n key={choice.hash}\n onChange={this.onChange}\n onDelete={this.onDelete}\n />\n )\n })}\n
    \n \n {pgettext(\"thread poll\", \"Add choice\")}\n \n
    \n )\n }\n}\n\nexport class PollChoice extends React.Component {\n onChange = (event) => {\n this.props.onChange(this.props.choice.hash, event.target.value)\n }\n\n onDelete = () => {\n const deleteItem =\n this.props.choice.label.length === 0\n ? true\n : window.confirm(\n pgettext(\n \"thread poll\",\n \"Are you sure you want to remove this choice?\"\n )\n )\n if (deleteItem) {\n this.props.onDelete(this.props.choice.hash)\n }\n }\n\n render() {\n return (\n
  • \n \n close\n \n \n
  • \n )\n }\n}\n","import React from \"react\"\nimport ChoicesControl from \"./choices-control\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport YesNoSwitch from \"misago/components/yes-no-switch\"\nimport * as poll from \"misago/reducers/poll\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n const poll = props.poll.id\n ? props.poll\n : {\n question: \"\",\n choices: [\n {\n hash: \"choice-10000\",\n label: \"\",\n },\n {\n hash: \"choice-20000\",\n label: \"\",\n },\n ],\n length: 0,\n allowed_choices: 1,\n allow_revotes: 0,\n is_public: 0,\n }\n\n this.state = {\n isLoading: false,\n isEdit: !!poll.id,\n\n question: poll.question,\n choices: poll.choices,\n length: poll.length,\n allowed_choices: poll.allowed_choices,\n allow_revotes: poll.allow_revotes,\n is_public: poll.is_public,\n\n validators: {\n question: [],\n choices: [],\n length: [],\n allowed_choices: [],\n },\n\n errors: {},\n }\n }\n\n setChoices = (choices) => {\n this.setState((state) => {\n return {\n choices,\n errors: Object.assign({}, state.errors, { choices: null }),\n }\n })\n }\n\n onCancel = () => {\n let cancel = false\n\n // Nothing added to the poll so no changes to discard\n const formEmpty = !!(\n this.state.question === \"\" &&\n this.state.choices &&\n this.state.choices.every((choice) => choice.label === \"\") &&\n this.state.length === 0 &&\n this.state.allowed_choices === 1\n )\n\n if (formEmpty) {\n return this.props.close()\n }\n\n if (!!this.props.poll) {\n cancel = window.confirm(\n pgettext(\"thread poll\", \"Are you sure you want to discard changes?\")\n )\n } else {\n cancel = window.confirm(\n pgettext(\"thread poll\", \"Are you sure you want to discard new poll?\")\n )\n }\n\n if (cancel) {\n this.props.close()\n }\n }\n\n send() {\n const data = {\n question: this.state.question,\n choices: this.state.choices,\n length: this.state.length,\n allowed_choices: this.state.allowed_choices,\n allow_revotes: this.state.allow_revotes,\n is_public: this.state.is_public,\n }\n\n if (this.state.isEdit) {\n return ajax.put(this.props.poll.api.index, data)\n }\n\n return ajax.post(this.props.thread.api.poll, data)\n }\n\n handleSuccess(data) {\n store.dispatch(poll.replace(data))\n\n if (this.state.isEdit) {\n snackbar.success(pgettext(\"thread poll\", \"Poll has been edited.\"))\n } else {\n snackbar.success(pgettext(\"thread poll\", \"Poll has been posted.\"))\n }\n\n this.props.close()\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n if (rejection.non_field_errors) {\n rejection.allowed_choices = rejection.non_field_errors\n }\n\n this.setState({\n errors: Object.assign({}, rejection),\n })\n\n snackbar.error(gettext(\"Form contains errors.\"))\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n

    \n {this.state.isEdit\n ? pgettext(\"thread poll\", \"Edit poll\")\n : pgettext(\"thread poll\", \"Add poll\")}\n

    \n
    \n
    \n
    \n \n {pgettext(\"thread poll\", \"Question and choices\")}\n \n\n \n \n \n\n \n \n \n
    \n\n
    \n {pgettext(\"thread poll\", \"Voting\")}\n\n
    \n
    \n \n \n \n
    \n
    \n \n \n \n
    \n
    \n\n
    \n \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n {pgettext(\"thread poll\", \"Cancel\")}\n {\" \"}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport function PollPublicSwitch(props) {\n if (props.isEdit) return null\n\n return (\n
    \n \n \n \n
    \n )\n}\n","import React from \"react\"\n\nconst ICON = {\n changed_title: \"edit\",\n\n pinned_globally: \"bookmark\",\n pinned_locally: \"bookmark_border\",\n unpinned: \"panorama_fish_eye\",\n\n moved: \"arrow_forward\",\n merged: \"call_merge\",\n\n approved: \"done\",\n\n opened: \"lock_open\",\n closed: \"lock_outline\",\n\n unhid: \"visibility\",\n hid: \"visibility_off\",\n\n changed_owner: \"grade\",\n tookover: \"grade\",\n\n added_participant: \"person_add\",\n\n owner_left: \"person_outline\",\n participant_left: \"person_outline\",\n removed_participant: \"remove_circle_outline\",\n}\n\nconst EventIcon = (props) => (\n \n {ICON[props.post.event_type]}\n \n)\n\nexport default EventIcon\n","import React from \"react\"\nimport moment from \"moment\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default function (props) {\n if (isVisible(props.post.acl)) {\n return (\n
  • \n \n \n \n
  • \n )\n } else {\n return null\n }\n}\n\nexport function isVisible(acl) {\n return acl.can_hide\n}\n\nexport class Hide extends React.Component {\n onClick = () => {\n store.dispatch(\n post.patch(this.props.post, {\n is_hidden: true,\n hidden_on: moment(),\n hidden_by_name: this.props.user.username,\n url: Object.assign(this.props.post.url, {\n hidden_by: this.props.user.url,\n }),\n })\n )\n\n const op = { op: \"replace\", path: \"is-hidden\", value: true }\n\n ajax.patch(this.props.post.api.index, [op]).then(\n (patch) => {\n store.dispatch(post.patch(this.props.post, patch))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(\n post.patch(this.props.post, {\n is_hidden: false,\n })\n )\n }\n )\n }\n\n render() {\n if (!this.props.post.is_hidden) {\n return (\n \n )\n } else {\n return null\n }\n }\n}\n\nexport class Unhide extends React.Component {\n onClick = () => {\n store.dispatch(\n post.patch(this.props.post, {\n is_hidden: false,\n })\n )\n\n const op = { op: \"replace\", path: \"is-hidden\", value: false }\n\n ajax.patch(this.props.post.api.index, [op]).then(\n (patch) => {\n store.dispatch(post.patch(this.props.post, patch))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(\n post.patch(this.props.post, {\n is_hidden: true,\n })\n )\n }\n )\n }\n\n render() {\n if (this.props.post.is_hidden) {\n return (\n \n )\n } else {\n return null\n }\n }\n}\n\nexport class Delete extends React.Component {\n onClick = () => {\n const decision = window.confirm(\n pgettext(\n \"event delete\",\n \"Are you sure you wish to delete this event? This action is not reversible!\"\n )\n )\n if (decision) {\n this.delete()\n }\n }\n\n delete = () => {\n store.dispatch(\n post.patch(this.props.post, {\n isDeleted: true,\n })\n )\n\n ajax.delete(this.props.post.api.index).then(\n () => {\n snackbar.success(pgettext(\"event delete\", \"Event has been deleted.\"))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(\n post.patch(this.props.post, {\n isDeleted: false,\n })\n )\n }\n )\n }\n\n render() {\n return (\n \n )\n }\n}\n","import React from \"react\"\nimport escapeHtml from \"misago/utils/escape-html\"\nimport Controls from \"./controls\"\n\nconst DATE_ABBR = '%(relative)s'\nconst DATE_URL = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default function (props) {\n return (\n
      \n \n \n \n
    \n )\n}\n\nexport function Hidden(props) {\n if (props.post.is_hidden) {\n let user = null\n if (props.post.url.hidden_by) {\n user = interpolate(\n USER_URL,\n {\n url: escapeHtml(props.post.url.hidden_by),\n user: escapeHtml(props.post.hidden_by_name),\n },\n true\n )\n } else {\n user = interpolate(\n USER_SPAN,\n {\n user: escapeHtml(props.post.hidden_by_name),\n },\n true\n )\n }\n\n const date = interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(props.post.hidden_on.format(\"LLL\")),\n relative: escapeHtml(props.post.hidden_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(\n pgettext(\"event info\", \"Hidden by %(event_by)s %(event_on)s.\")\n ),\n {\n event_by: user,\n event_on: date,\n },\n true\n )\n\n return (\n \n )\n } else {\n return null\n }\n}\n\nexport function Poster(props) {\n let user = null\n if (props.post.poster) {\n user = interpolate(\n USER_URL,\n {\n url: escapeHtml(props.post.poster.url),\n user: escapeHtml(props.post.poster_name),\n },\n true\n )\n } else {\n user = interpolate(\n USER_SPAN,\n {\n user: escapeHtml(props.post.poster_name),\n },\n true\n )\n }\n\n const date = interpolate(\n DATE_URL,\n {\n url: escapeHtml(props.post.url.index),\n absolute: escapeHtml(props.post.posted_on.format(\"LLL\")),\n relative: escapeHtml(props.post.posted_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(pgettext(\"event info\", \"By %(event_by)s %(event_on)s.\")),\n {\n event_by: user,\n event_on: date,\n },\n true\n )\n\n return (\n \n )\n}\n","import React from \"react\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst MESSAGE = {\n pinned_globally: pgettext(\n \"event message\",\n \"Thread has been pinned globally.\"\n ),\n pinned_locally: pgettext(\n \"event message\",\n \"Thread has been pinned in category.\"\n ),\n unpinned: pgettext(\"event message\", \"Thread has been unpinned.\"),\n\n approved: pgettext(\"event message\", \"Thread has been approved.\"),\n\n opened: pgettext(\"event message\", \"Thread has been opened.\"),\n closed: pgettext(\"event message\", \"Thread has been closed.\"),\n\n unhid: pgettext(\"event message\", \"Thread has been revealed.\"),\n hid: pgettext(\"event message\", \"Thread has been made hidden.\"),\n\n tookover: pgettext(\"event message\", \"Took thread over.\"),\n\n owner_left: pgettext(\n \"event message\",\n \"Owner has left thread. This thread is now closed.\"\n ),\n participant_left: pgettext(\"event message\", \"Participant has left thread.\"),\n}\n\nconst ITEM_LINK = '%(name)s'\nconst ITEM_SPAN = '%(name)s'\n\nexport default function (props) {\n if (MESSAGE[props.post.event_type]) {\n return

    {MESSAGE[props.post.event_type]}

    \n } else if (props.post.event_type === \"changed_title\") {\n return \n } else if (props.post.event_type === \"moved\") {\n return \n } else if (props.post.event_type === \"merged\") {\n return \n } else if (props.post.event_type === \"changed_owner\") {\n return \n } else if (props.post.event_type === \"added_participant\") {\n return \n } else if (props.post.event_type === \"removed_participant\") {\n return \n } else {\n return null\n }\n}\n\nexport function ChangedTitle(props) {\n const msgstring = escapeHtml(\n pgettext(\n \"event message\",\n \"Thread title has been changed from %(old_title)s.\"\n )\n )\n const oldTitle = interpolate(\n ITEM_SPAN,\n {\n name: escapeHtml(props.post.event_context.old_title),\n },\n true\n )\n const message = interpolate(\n msgstring,\n {\n old_title: oldTitle,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function Moved(props) {\n const msgstring = escapeHtml(\n pgettext(\"event message\", \"Thread has been moved from %(from_category)s.\")\n )\n const fromCategory = interpolate(\n ITEM_LINK,\n {\n url: escapeHtml(props.post.event_context.from_category.url),\n name: escapeHtml(props.post.event_context.from_category.name),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n from_category: fromCategory,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function Merged(props) {\n const msgstring = escapeHtml(\n pgettext(\n \"event message\",\n \"The %(merged_thread)s thread has been merged into this thread.\"\n )\n )\n const mergedThread = interpolate(\n ITEM_SPAN,\n {\n name: escapeHtml(props.post.event_context.merged_thread),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n merged_thread: mergedThread,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function ChangedOwner(props) {\n const msgstring = escapeHtml(\n pgettext(\"event message\", \"Changed thread owner to %(user)s.\")\n )\n const newOwner = interpolate(\n ITEM_LINK,\n {\n url: escapeHtml(props.post.event_context.user.url),\n name: escapeHtml(props.post.event_context.user.username),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n user: newOwner,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function AddedParticipant(props) {\n const msgstring = escapeHtml(\n pgettext(\"event message\", \"Added %(user)s to thread.\")\n )\n const newOwner = interpolate(\n ITEM_LINK,\n {\n url: escapeHtml(props.post.event_context.user.url),\n name: escapeHtml(props.post.event_context.user.username),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n user: newOwner,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function RemovedParticipant(props) {\n const msgstring = escapeHtml(\n pgettext(\"event message\", \"Removed %(user)s from thread.\")\n )\n const newOwner = interpolate(\n ITEM_LINK,\n {\n url: escapeHtml(props.post.event_context.user.url),\n name: escapeHtml(props.post.event_context.user.username),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n user: newOwner,\n },\n true\n )\n\n return (\n \n )\n}\n","import React from \"react\"\n\nexport default function ({ post }) {\n if (post.is_read) return null\n\n return (\n
    \n \n {pgettext(\"event unread label\", \"New event\")}\n \n
    \n )\n}\n","import React from \"react\"\nimport ajax from \"misago/services/ajax\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.initialized = false\n this.primed = false\n this.observer = null\n }\n\n initialize = (element) => {\n this.initialized = true\n\n this.observer = new IntersectionObserver((entries) =>\n entries.forEach(this.callback)\n )\n this.observer.observe(element)\n }\n\n callback = (entry) => {\n if (!entry.isIntersecting || this.props.post.is_read || this.primed) {\n return\n }\n\n window.setTimeout(() => {\n ajax.post(this.props.post.api.read)\n }, 0)\n\n this.primed = true\n this.destroy()\n }\n\n destroy() {\n if (this.observer) {\n this.observer.disconnect()\n this.observer = null\n }\n }\n\n componentWillUnmount() {\n this.destroy()\n }\n\n render() {\n const ready = !this.initialized && !this.primed && !this.props.post.is_read\n\n return (\n {\n if (node && ready) {\n this.initialize(node)\n }\n }}\n >\n {this.props.children}\n \n )\n }\n}\n","import React from \"react\"\nimport Icon from \"./icon\"\nimport Info from \"./info\"\nimport Message from \"./message\"\nimport UnreadLabel from \"./unread-label\"\nimport Waypoint from \"../waypoint\"\n\nexport default function (props) {\n let className = \"event\"\n if (props.post.isDeleted) {\n className = \"hide\"\n } else if (props.post.is_hidden) {\n className = \"event post-hidden\"\n }\n\n return (\n
  • \n \n
    \n
    \n \n
    \n \n \n \n \n
    \n
  • \n )\n}\n","import React from \"react\"\nimport misago from \"misago\"\nimport escapeHtml from \"misago/utils/escape-html\"\nimport formatFilesize from \"misago/utils/file-size\"\n\nconst DATE_ABBR = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default function (props) {\n return (\n
    \n \n
    \n \n {props.attachment.filename}\n \n \n
    \n
    \n )\n}\n\nexport function AttachmentPreview(props) {\n if (props.attachment.is_image) {\n return (\n
    \n \n
    \n )\n } else {\n return (\n
    \n \n
    \n )\n }\n}\n\nexport function AttachmentIcon(props) {\n return (\n \n insert_drive_file\n \n )\n}\n\nexport function AttachmentThumbnail(props) {\n const url = props.attachment.url.thumb || props.attachment.url.index\n return (\n \n )\n}\n\nexport function AttachmentDetails(props) {\n let user = null\n if (props.attachment.url.uploader) {\n user = interpolate(\n USER_URL,\n {\n url: escapeHtml(props.attachment.url.uploader),\n user: escapeHtml(props.attachment.uploader_name),\n },\n true\n )\n } else {\n user = interpolate(\n USER_SPAN,\n {\n user: escapeHtml(props.attachment.uploader_name),\n },\n true\n )\n }\n\n const date = interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(props.attachment.uploaded_on.format(\"LLL\")),\n relative: escapeHtml(props.attachment.uploaded_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(\n pgettext(\n \"post attachment\",\n \"%(filetype)s, %(size)s, uploaded by %(uploader)s %(uploaded_on)s.\"\n )\n ),\n {\n filetype: props.attachment.filetype,\n size: formatFilesize(props.attachment.size),\n uploader: user,\n uploaded_on: date,\n },\n true\n )\n\n return (\n \n )\n}\n","import React from \"react\"\nimport batch from \"misago/utils/batch\"\nimport Attachment from \"./attachment\"\n\nexport default function (props) {\n if (!isVisible(props.post)) {\n return null\n }\n\n return (\n
    \n {batch(props.post.attachments, 2).map((row) => {\n const key = row\n .map((a) => {\n return a ? a.id : 0\n })\n .join(\"_\")\n return \n })}\n
    \n )\n}\n\nexport function isVisible(post) {\n return (!post.is_hidden || post.acl.can_see_hidden) && post.attachments\n}\n\nexport function Row(props) {\n return (\n
    \n {props.row.map((attachment) => {\n return (\n \n )\n })}\n
    \n )\n}\n","import React from \"react\"\nimport Waypoint from \"../waypoint\"\nimport MisagoMarkup from \"misago/components/misago-markup\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst HIDDEN_BY_URL = '%(user)s'\nconst HIDDEN_BY_SPAN = '%(user)s'\nconst HIDDEN_ON =\n '%(relative)s'\n\nexport default function (props) {\n if (props.post.is_hidden && !props.post.acl.can_see_hidden) {\n return \n } else if (props.post.content) {\n return \n } else {\n return \n }\n}\n\nexport function Default({ post }) {\n const poster = \"@\" + (post.poster ? post.poster.username : post.poster_name)\n\n return (\n \n \n \n )\n}\n\nexport function Hidden(props) {\n let user = null\n if (props.post.hidden_by) {\n user = interpolate(\n HIDDEN_BY_URL,\n {\n url: escapeHtml(props.post.url.hidden_by),\n user: escapeHtml(props.post.hidden_by_name),\n },\n true\n )\n } else {\n user = interpolate(\n HIDDEN_BY_SPAN,\n {\n user: escapeHtml(props.post.hidden_by_name),\n },\n true\n )\n }\n\n const date = interpolate(\n HIDDEN_ON,\n {\n absolute: escapeHtml(props.post.hidden_on.format(\"LLL\")),\n relative: escapeHtml(props.post.hidden_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(\n pgettext(\"post body hidden\", \"Hidden by %(hidden_by)s %(hidden_on)s.\")\n ),\n {\n hidden_by: user,\n hidden_on: date,\n },\n true\n )\n\n return (\n \n

    \n {pgettext(\n \"post body hidden\",\n \"This post is hidden. You cannot see its contents.\"\n )}\n

    \n

    \n \n )\n}\n\nexport function Invalid(props) {\n return (\n \n

    \n {pgettext(\n \"post body invalid\",\n \"This post's contents cannot be displayed.\"\n )}\n

    \n

    \n {pgettext(\n \"post body invalid\",\n \"This error is caused by invalid post content manipulation.\"\n )}\n

    \n
    \n )\n}\n","import React from \"react\"\n\nexport function FlagBestAnswer({ post, thread, user }) {\n if (!(isVisible(post) && post.id === thread.best_answer)) {\n return null\n }\n\n let message = null\n if (user.id && thread.best_answer_marked_by === user.id) {\n message = interpolate(\n pgettext(\n \"post best answer flag\",\n \"Marked as best answer by you %(marked_on)s.\"\n ),\n {\n marked_on: thread.best_answer_marked_on.fromNow(),\n },\n true\n )\n } else {\n message = interpolate(\n pgettext(\n \"post best answer flag\",\n \"Marked as best answer by %(marked_by)s %(marked_on)s.\"\n ),\n {\n marked_by: thread.best_answer_marked_by_name,\n marked_on: thread.best_answer_marked_on.fromNow(),\n },\n true\n )\n }\n\n return (\n
    \n check_box\n

    {message}

    \n
    \n )\n}\n\nexport function FlagHidden(props) {\n if (!(isVisible(props.post) && props.post.is_hidden)) {\n return null\n }\n\n return (\n
    \n visibility_off\n

    \n {pgettext(\n \"post hidden flag\",\n \"This post is hidden. Only users with permission may see its contents.\"\n )}\n

    \n
    \n )\n}\n\nexport function FlagUnapproved(props) {\n if (!(isVisible(props.post) && props.post.is_unapproved)) {\n return null\n }\n\n return (\n
    \n remove_circle_outline\n

    \n {pgettext(\n \"post unapproved flag\",\n \"This post is unapproved. Only users with permission to approve posts and its author may see its contents.\"\n )}\n

    \n
    \n )\n}\n\nexport function FlagProtected(props) {\n if (!(isVisible(props.post) && props.post.is_protected)) {\n return null\n }\n\n return (\n
    \n lock_outline\n

    \n {pgettext(\n \"post protected flag\",\n \"This post is protected. Only moderators may change it.\"\n )}\n

    \n
    \n )\n}\n\nexport function isVisible(post) {\n return !post.is_hidden || post.acl.can_see_hidden\n}\n","import moment from \"moment\"\nimport * as thread from \"misago/reducers/thread\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport function approve(props) {\n store.dispatch(\n post.patch(props.post, {\n is_unapproved: false,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-unapproved\", value: false }]\n\n const previousState = {\n is_unapproved: props.post.is_unapproved,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function protect(props) {\n store.dispatch(\n post.patch(props.post, {\n is_protected: true,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-protected\", value: true }]\n\n const previousState = {\n is_protected: props.post.is_protected,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function unprotect(props) {\n store.dispatch(\n post.patch(props.post, {\n is_protected: false,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-protected\", value: false }]\n\n const previousState = {\n is_protected: props.post.is_protected,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function hide(props) {\n store.dispatch(\n post.patch(props.post, {\n is_hidden: true,\n hidden_on: moment(),\n hidden_by_name: props.user.username,\n url: Object.assign(props.post.url, {\n hidden_by: props.user.url,\n }),\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-hidden\", value: true }]\n\n const previousState = {\n is_hidden: props.post.is_hidden,\n hidden_on: props.post.hidden_on,\n hidden_by_name: props.post.hidden_by_name,\n url: props.post.url,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function unhide(props) {\n store.dispatch(\n post.patch(props.post, {\n is_hidden: false,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-hidden\", value: false }]\n\n const previousState = {\n is_hidden: props.post.is_hidden,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function like(props) {\n const lastLikes = props.post.last_likes || []\n const concatedLikes = [props.user].concat(lastLikes)\n const finalLikes =\n concatedLikes.length > 3 ? concatedLikes.slice(0, -1) : concatedLikes\n\n store.dispatch(\n post.patch(props.post, {\n is_liked: true,\n likes: props.post.likes + 1,\n last_likes: finalLikes,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-liked\", value: true }]\n\n const previousState = {\n is_liked: props.post.is_liked,\n likes: props.post.likes,\n last_likes: props.post.last_likes,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function unlike(props) {\n store.dispatch(\n post.patch(props.post, {\n is_liked: false,\n likes: props.post.likes - 1,\n last_likes: props.post.last_likes.filter((user) => {\n return !user.id || user.id !== props.user.id\n }),\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-liked\", value: false }]\n\n const previousState = {\n is_liked: props.post.is_liked,\n likes: props.post.likes,\n last_likes: props.post.last_likes,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function patch(props, ops, previousState) {\n ajax.patch(props.post.api.index, ops).then(\n (newState) => {\n store.dispatch(post.patch(props.post, newState))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(post.patch(props.post, previousState))\n }\n )\n}\n\nexport function remove(props) {\n let confirmed = window.confirm(\n pgettext(\n \"post delete\",\n \"Are you sure you want to delete this post? This action is not reversible!\"\n )\n )\n if (!confirmed) {\n return\n }\n\n store.dispatch(\n post.patch(props.post, {\n isDeleted: true,\n })\n )\n\n ajax.delete(props.post.api.index).then(\n () => {\n snackbar.success(pgettext(\"post delete\", \"Post has been deleted.\"))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(\n post.patch(props.post, {\n isDeleted: false,\n })\n )\n }\n )\n}\n\nexport function markAsBestAnswer(props) {\n const { post, user } = props\n\n store.dispatch(\n thread.update({\n best_answer: post.id,\n best_answer_is_protected: post.is_protected,\n best_answer_marked_on: moment(),\n best_answer_marked_by: user.id,\n best_answer_marked_by_name: user.username,\n best_answer_marked_by_slug: user.slug,\n })\n )\n\n const ops = [\n { op: \"replace\", path: \"best-answer\", value: post.id },\n { op: \"add\", path: \"acl\", value: true },\n ]\n\n const previousState = {\n best_answer: props.thread.best_answer,\n best_answer_is_protected: props.thread.best_answer_is_protected,\n best_answer_marked_on: props.thread.best_answer_marked_on,\n best_answer_marked_by: props.thread.best_answer_marked_by,\n best_answer_marked_by_name: props.thread.best_answer_marked_by_name,\n best_answer_marked_by_slug: props.thread.best_answer_marked_by_slug,\n }\n\n patchThread(props, ops, previousState)\n}\n\nexport function unmarkBestAnswer(props) {\n const { post } = props\n\n store.dispatch(\n thread.update({\n best_answer: null,\n best_answer_is_protected: false,\n best_answer_marked_on: null,\n best_answer_marked_by: null,\n best_answer_marked_by_name: null,\n best_answer_marked_by_slug: null,\n })\n )\n\n const ops = [\n { op: \"remove\", path: \"best-answer\", value: post.id },\n { op: \"add\", path: \"acl\", value: true },\n ]\n\n const previousState = {\n best_answer: props.thread.best_answer,\n best_answer_is_protected: props.thread.best_answer_is_protected,\n best_answer_marked_on: props.thread.best_answer_marked_on,\n best_answer_marked_by: props.thread.best_answer_marked_by,\n best_answer_marked_by_name: props.thread.best_answer_marked_by_name,\n best_answer_marked_by_slug: props.thread.best_answer_marked_by_slug,\n }\n\n patchThread(props, ops, previousState)\n}\n\nexport function patchThread(props, ops, previousState) {\n ajax.patch(props.thread.api.index, ops).then(\n (newState) => {\n if (newState.best_answer_marked_on) {\n newState.best_answer_marked_on = moment(newState.best_answer_marked_on)\n }\n store.dispatch(thread.update(newState))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(thread.update(previousState))\n }\n )\n}\n","import React from \"react\"\nimport moment from \"moment\"\nimport Avatar from \"misago/components/avatar\"\nimport Message from \"misago/components/modal-message\"\nimport Loader from \"misago/components/modal-loader\"\nimport ajax from \"misago/services/ajax\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n\n error: null,\n likes: [],\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.post.api.likes).then(\n (data) => {\n this.setState({\n isReady: true,\n likes: data.map(hydrateLike),\n })\n },\n (rejection) => {\n this.setState({\n isReady: true,\n error: rejection.detail,\n })\n }\n )\n }\n\n render() {\n if (this.state.error) {\n return (\n \n \n \n )\n } else if (this.state.isReady) {\n if (this.state.likes.length) {\n return (\n \n \n \n )\n }\n\n return (\n \n \n \n )\n }\n\n return (\n \n \n \n )\n }\n}\n\nexport function hydrateLike(data) {\n return Object.assign({}, data, {\n liked_on: moment(data.liked_on),\n })\n}\n\nexport function ModalDialog({ className, children, likes }) {\n let title = pgettext(\"post likes modal title\", \"Post Likes\")\n if (likes) {\n const likesCount = likes.length\n const message = npgettext(\n \"post likes modal\",\n \"%(likes)s like\",\n \"%(likes)s likes\",\n likesCount\n )\n\n title = interpolate(message, { likes: likesCount }, true)\n }\n\n return (\n
    \n
    \n
    \n \n ×\n \n

    {title}

    \n
    \n {children}\n
    \n
    \n )\n}\n\nexport function LikesList(props) {\n return (\n
    \n
      \n {props.likes.map((like) => {\n return \n })}\n
    \n
    \n )\n}\n\nexport function LikeDetails(props) {\n if (props.url) {\n const user = {\n id: props.liker_id,\n avatars: props.avatars,\n }\n\n return (\n
  • \n
    \n \n \n \n
    \n
    \n \n {props.username}\n {\" \"}\n \n
    \n
  • \n )\n }\n\n return (\n
  • \n
    \n \n \n \n
    \n
    \n {props.username} \n
    \n
  • \n )\n}\n\nexport function LikeDate(props) {\n return (\n \n {props.likedOn.fromNow()}\n \n )\n}\n","import React from \"react\"\nimport * as actions from \"./controls/actions\"\nimport LikesModal from \"misago/components/post-likes\"\nimport modal from \"misago/services/modal\"\nimport posting from \"misago/services/posting\"\n\nexport default function (props) {\n if (!isVisible(props.post)) return null\n\n return (\n
    \n \n \n \n \n \n \n \n \n
    \n )\n}\n\nexport function isVisible(post) {\n return (\n (!post.is_hidden || post.acl.can_see_hidden) &&\n (post.acl.can_reply ||\n post.acl.can_edit ||\n (post.acl.can_see_likes && (post.last_likes || []).length) ||\n post.acl.can_like)\n )\n}\n\nexport class MarkAsBestAnswer extends React.Component {\n onClick = () => {\n actions.markAsBestAnswer(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (!thread.acl.can_mark_best_answer) return null\n if (!post.acl.can_mark_as_best_answer) return null\n if (thread.best_answer && !thread.acl.can_change_best_answer) return null\n\n return (\n \n check_box\n {pgettext(\"post footer btn\", \"Best answer\")}\n \n )\n }\n}\n\nexport class MarkAsBestAnswerCompact extends React.Component {\n onClick = () => {\n actions.markAsBestAnswer(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (!thread.acl.can_mark_best_answer) return null\n if (!post.acl.can_mark_as_best_answer) return null\n if (thread.best_answer && !thread.acl.can_change_best_answer) return null\n\n return (\n \n check_box\n \n )\n }\n}\n\nexport class Like extends React.Component {\n onClick = () => {\n if (this.props.post.is_liked) {\n actions.unlike(this.props)\n } else {\n actions.like(this.props)\n }\n }\n\n render() {\n if (!this.props.post.acl.can_like) return null\n\n let className = \"btn btn-default btn-sm pull-left\"\n if (this.props.post.is_liked) {\n className = \"btn btn-success btn-sm pull-left\"\n }\n\n return (\n \n {this.props.post.is_liked\n ? pgettext(\"post footer btn\", \"Liked\")\n : pgettext(\"post footer btn\", \"Like\")}\n \n )\n }\n}\n\nexport class Likes extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n const hasLikes = (this.props.post.last_likes || []).length > 0\n if (!this.props.post.acl.can_see_likes || !hasLikes) return null\n\n if (this.props.post.acl.can_see_likes === 2) {\n return (\n \n {getLikesMessage(this.props.likes, this.props.lastLikes)}\n \n )\n }\n\n return (\n

    \n {getLikesMessage(this.props.likes, this.props.lastLikes)}\n

    \n )\n }\n}\n\nexport class LikesCompact extends Likes {\n render() {\n const hasLikes = (this.props.post.last_likes || []).length > 0\n if (!this.props.post.acl.can_see_likes || !hasLikes) return null\n\n if (this.props.post.acl.can_see_likes === 2) {\n return (\n \n favorite\n {this.props.likes}\n \n )\n }\n\n return (\n

    \n favorite\n {this.props.likes}\n

    \n )\n }\n}\n\nexport function getLikesMessage(likes, users) {\n const usernames = users.slice(0, 3).map((u) => u.username)\n\n if (usernames.length == 1) {\n return interpolate(\n pgettext(\"post likes\", \"%(user)s likes this.\"),\n {\n user: usernames[0],\n },\n true\n )\n }\n\n const hiddenLikes = likes - usernames.length\n\n const otherUsers = usernames.slice(0, -1).join(\", \")\n const lastUser = usernames.slice(-1)[0]\n\n const usernamesList = interpolate(\n pgettext(\"post likes\", \"%(users)s and %(last_user)s\"),\n {\n users: otherUsers,\n last_user: lastUser,\n },\n true\n )\n\n if (hiddenLikes === 0) {\n return interpolate(\n pgettext(\"post likes\", \"%(users)s like this.\"),\n {\n users: usernamesList,\n },\n true\n )\n }\n\n const message = npgettext(\n \"post likes\",\n \"%(users)s and %(likes)s other user like this.\",\n \"%(users)s and %(likes)s other users like this.\",\n hiddenLikes\n )\n\n return interpolate(\n message,\n {\n users: usernames.join(\", \"),\n likes: hiddenLikes,\n },\n true\n )\n}\n\nexport class Reply extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"REPLY\",\n\n thread: this.props.thread,\n config: this.props.thread.api.editor,\n submit: this.props.thread.api.posts.index,\n })\n }\n\n render() {\n if (this.props.post.acl.can_reply) {\n return (\n \n {pgettext(\"post footer btn\", \"Reply\")}\n \n )\n } else {\n return null\n }\n }\n}\n\nexport class Quote extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"QUOTE\",\n\n thread: this.props.thread,\n config: this.props.thread.api.editor,\n submit: this.props.thread.api.posts.index,\n\n context: {\n reply: this.props.post.id,\n },\n })\n }\n\n render() {\n if (this.props.post.acl.can_reply) {\n return (\n \n {pgettext(\"post footer btn\", \"Quote\")}\n \n )\n } else {\n return null\n }\n }\n}\n\nexport class Edit extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"EDIT\",\n\n thread: this.props.thread,\n post: this.props.post,\n config: this.props.post.api.editor,\n submit: this.props.post.api.index,\n })\n }\n\n render() {\n if (this.props.post.acl.can_edit) {\n return (\n \n {pgettext(\"post footer btn\", \"Edit\")}\n \n )\n } else {\n return null\n }\n }\n}\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n url: \"\",\n\n validators: {\n url: [],\n },\n errors: {},\n }\n }\n\n clean() {\n if (!this.state.url.trim().length) {\n snackbar.error(\n pgettext(\n \"post move modal\",\n \"You have to enter link to the other thread.\"\n )\n )\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.post(this.props.thread.api.posts.move, {\n new_thread: this.state.url,\n posts: [this.props.post.id],\n })\n }\n\n handleSuccess(success) {\n store.dispatch(\n post.patch(this.props.post, {\n isDeleted: true,\n })\n )\n\n modal.hide()\n\n snackbar.success(\n pgettext(\n \"post move modal\",\n \"Selected post was moved to the other thread.\"\n )\n )\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onUrlChange = (event) => {\n this.changeValue(\"url\", event.target.value)\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n
    \n \n \n \n
    \n
    \n \n {pgettext(\"post move modal btn\", \"Move post\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport function ModalHeader(props) {\n return (\n
    \n \n ×\n \n

    \n {pgettext(\"post move modal title\", \"Move post\")}\n

    \n
    \n )\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n
    \n
      \n {props.diff.map((item, i) => {\n return \n })}\n
    \n
    \n )\n}\n\nexport function DiffItem(props) {\n if (props.item[0] === \"?\") return null\n\n return (\n
  • {cleanItem(props.item)}
  • \n )\n}\n\nexport function getItemClassName(item) {\n let className = \"diff-item\"\n if (item[0] === \"-\") {\n className += \" diff-item-sub\"\n } else if (item[0] === \"+\") {\n className += \" diff-item-add\"\n }\n return className\n}\n\nexport function cleanItem(item) {\n return item.substr(2)\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\n\nexport default class extends React.Component {\n onClick = () => {\n this.props.revertEdit(this.props.edit.id)\n }\n\n render() {\n if (!this.props.canRevert) return null\n\n return (\n
    \n \n {pgettext(\"post revert btn\", \"Revert\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst DATE_ABBR = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default class extends React.Component {\n goLast = () => {\n this.props.goToEdit()\n }\n\n goForward = () => {\n this.props.goToEdit(this.props.edit.next)\n }\n\n goBack = () => {\n this.props.goToEdit(this.props.edit.previous)\n }\n\n revertEdit = () => {\n this.props.revertEdit(this.props.edit.id)\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n )\n }\n}\n\nexport function GoBackBtn(props) {\n return (\n \n chevron_left\n \n )\n}\n\nexport function GoForwardBtn(props) {\n return (\n \n chevron_right\n \n )\n}\n\nexport function GoLastBtn(props) {\n return (\n \n last_page\n \n )\n}\n\nexport function RevertBtn(props) {\n if (!props.canRevert) return null\n\n return (\n
    \n \n {pgettext(\"post revert btn\", \"Revert\")}\n \n
    \n )\n}\n\nexport function Label(props) {\n let user = null\n if (props.edit.url.editor) {\n user = interpolate(\n USER_URL,\n {\n url: escapeHtml(props.edit.url.editor),\n user: escapeHtml(props.edit.editor_name),\n },\n true\n )\n } else {\n user = interpolate(\n USER_SPAN,\n {\n user: escapeHtml(props.edit.editor_name),\n },\n true\n )\n }\n\n const date = interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(props.edit.edited_on.format(\"LLL\")),\n relative: escapeHtml(props.edit.edited_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(\n pgettext(\"post history modal\", \"By %(edited_by)s %(edited_on)s.\")\n ),\n {\n edited_by: user,\n edited_on: date,\n },\n true\n )\n\n return

    \n}\n","import moment from \"moment\"\n\nexport function hydrateEdit(json) {\n return Object.assign({}, json, {\n edited_on: moment(json.edited_on),\n })\n}\n","import React from \"react\"\nimport Diff from \"./diff\"\nimport Footer from \"./footer\"\nimport Toolbar from \"./toolbar\"\nimport { hydrateEdit } from \"./utils\"\nimport Message from \"misago/components/modal-message\"\nimport Loader from \"misago/components/modal-loader\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n isBusy: true,\n\n canRevert: props.post.acl.can_edit,\n\n error: null,\n edit: null,\n }\n }\n\n componentDidMount() {\n this.goToEdit()\n }\n\n goToEdit = (edit = null) => {\n this.setState({\n isBusy: true,\n })\n\n let url = this.props.post.api.edits\n if (edit !== null) {\n url += \"?edit=\" + edit\n }\n\n ajax.get(url).then(\n (data) => {\n this.setState({\n isReady: true,\n isBusy: false,\n edit: hydrateEdit(data),\n })\n },\n (rejection) => {\n this.setState({\n isReady: true,\n isBusy: false,\n error: rejection.detail,\n })\n }\n )\n }\n\n revertEdit = (edit) => {\n if (this.state.isBusy) return\n\n const confirmation = window.confirm(\n pgettext(\n \"post revert\",\n \"Are you sure you with to revert this post to the state from before this edit?\"\n )\n )\n if (!confirmation) return\n\n this.setState({\n isBusy: true,\n })\n\n const url = this.props.post.api.edits + \"?edit=\" + edit\n ajax.post(url).then(\n (data) => {\n const hydratedPost = post.hydrate(data)\n store.dispatch(post.patch(data, hydratedPost))\n\n snackbar.success(\n pgettext(\"post revert\", \"Post has been reverted to previous state.\")\n )\n modal.hide()\n },\n (rejection) => {\n snackbar.apiError(rejection)\n\n this.setState({\n isBusy: false,\n })\n }\n )\n }\n\n render() {\n if (this.state.error) {\n return (\n \n \n \n )\n } else if (this.state.isReady) {\n return (\n \n \n \n \n \n )\n }\n\n return (\n \n \n \n )\n }\n}\n\nexport function ModalDialog(props) {\n return (\n

    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"post history modal title\", \"Post edits history\")}\n

    \n
    \n {props.children}\n
    \n
    \n )\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport CategorySelect from \"misago/components/category-select\"\nimport ModalLoader from \"misago/components/modal-loader\"\nimport Select from \"misago/components/select\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport * as validators from \"misago/utils/validators\"\n\nexport default function (props) {\n return \n}\n\nexport class PostingConfig extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoaded: false,\n isError: false,\n\n categories: [],\n }\n }\n\n componentDidMount() {\n ajax.get(misago.get(\"THREAD_EDITOR_API\")).then(\n (data) => {\n // hydrate categories, extract posting options\n const categories = data.map((item) => {\n return Object.assign(item, {\n disabled: item.post === false,\n label: item.name,\n value: item.id,\n post: item.post,\n })\n })\n\n this.setState({\n isLoaded: true,\n categories,\n })\n },\n (rejection) => {\n this.setState({\n isError: rejection.detail,\n })\n }\n )\n }\n\n render() {\n if (this.state.isError) {\n return \n } else if (this.state.isLoaded) {\n return (\n \n )\n } else {\n return \n }\n }\n}\n\nexport class ModerationForm extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n title: \"\",\n category: null,\n categories: props.categories,\n weight: 0,\n is_hidden: 0,\n is_closed: false,\n\n validators: {\n title: [validators.required()],\n },\n\n errors: {},\n }\n\n this.isHiddenChoices = [\n {\n value: 0,\n icon: \"visibility\",\n label: pgettext(\"thread hidden switch choice\", \"No\"),\n },\n {\n value: 1,\n icon: \"visibility_off\",\n label: pgettext(\"thread hidden switch choice\", \"Yes\"),\n },\n ]\n\n this.isClosedChoices = [\n {\n value: false,\n icon: \"lock_outline\",\n label: pgettext(\"thread closed switch choice\", \"No\"),\n },\n {\n value: true,\n icon: \"lock\",\n label: pgettext(\"thread closed switch choice\", \"Yes\"),\n },\n ]\n\n this.acl = {}\n this.props.categories.forEach((category) => {\n if (category.post) {\n if (!this.state.category) {\n this.state.category = category.id\n }\n\n this.acl[category.id] = {\n can_pin_threads: category.post.pin,\n can_close_threads: category.post.close,\n can_hide_threads: category.post.hide,\n }\n }\n })\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(gettext(\"Form contains errors.\"))\n this.setState({\n errors: this.validate(),\n })\n return false\n }\n }\n\n send() {\n return ajax.post(this.props.thread.api.posts.split, {\n title: this.state.title,\n category: this.state.category,\n weight: this.state.weight,\n is_hidden: this.state.is_hidden,\n is_closed: this.state.is_closed,\n posts: [this.props.post.id],\n })\n }\n\n handleSuccess(apiResponse) {\n store.dispatch(\n post.patch(this.props.post, {\n isDeleted: true,\n })\n )\n\n modal.hide()\n\n snackbar.success(\n pgettext(\"post split modal\", \"Selected post was split into new thread.\")\n )\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n this.setState({\n errors: Object.assign({}, this.state.errors, rejection),\n })\n snackbar.error(gettext(\"Form contains errors.\"))\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onCategoryChange = (ev) => {\n const categoryId = ev.target.value\n const newState = {\n category: categoryId,\n }\n\n if (this.acl[categoryId].can_pin_threads < newState.weight) {\n newState.weight = 0\n }\n\n if (!this.acl[categoryId].can_hide_threads) {\n newState.is_hidden = 0\n }\n\n if (!this.acl[categoryId].can_close_threads) {\n newState.is_closed = false\n }\n\n this.setState(newState)\n }\n\n getWeightChoices() {\n const choices = [\n {\n value: 0,\n icon: \"remove\",\n label: pgettext(\"thread weight choice\", \"Not pinned\"),\n },\n {\n value: 1,\n icon: \"bookmark_border\",\n label: pgettext(\"thread weight choice\", \"Pinned in category\"),\n },\n ]\n\n if (this.acl[this.state.category].can_pin_threads == 2) {\n choices.push({\n value: 2,\n icon: \"bookmark\",\n label: pgettext(\"thread weight choice\", \"Pinned globally\"),\n })\n }\n\n return choices\n }\n\n renderWeightField() {\n if (this.acl[this.state.category].can_pin_threads) {\n return (\n \n \n \n )\n } else {\n return null\n }\n }\n\n renderHiddenField() {\n if (this.acl[this.state.category].can_hide_threads) {\n return (\n \n \n \n )\n } else {\n return null\n }\n }\n\n renderClosedField() {\n if (this.acl[this.state.category].can_close_threads) {\n return (\n \n \n \n )\n } else {\n return null\n }\n }\n\n render() {\n return (\n \n
    \n
    \n \n \n \n
    \n\n \n \n \n
    \n\n {this.renderWeightField()}\n {this.renderHiddenField()}\n {this.renderClosedField()}\n
    \n
    \n \n
    \n \n \n )\n }\n}\n\nexport function Loader() {\n return (\n \n \n \n )\n}\n\nexport function Error(props) {\n return (\n \n
    \n info_outline\n
    \n
    \n

    \n {pgettext(\n \"post split modal\",\n \"You can't move this post at the moment.\"\n )}\n

    \n

    {props.message}

    \n
    \n
    \n )\n}\n\nexport function Modal(props) {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"posts split modal title\", \"Split post into new thread\")}\n

    \n
    \n {props.children}\n
    \n
    \n )\n}\n","import React from \"react\"\nimport modal from \"misago/services/modal\"\nimport posting from \"misago/services/posting\"\nimport * as moderation from \"./actions\"\nimport MoveModal from \"./move\"\nimport PostChangelog from \"misago/components/post-changelog\"\nimport SplitModal from \"./split\"\n\nexport default function (props) {\n return (\n
      \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n )\n}\n\nexport class Permalink extends React.Component {\n onClick = () => {\n let permaUrl = window.location.protocol + \"//\"\n permaUrl += window.location.host\n permaUrl += this.props.post.url.index\n\n prompt(pgettext(\"post permalink\", \"Permament link to this post:\"), permaUrl)\n }\n\n render() {\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Edit extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"EDIT\",\n\n thread: this.props.thread,\n post: this.props.post,\n config: this.props.post.api.editor,\n submit: this.props.post.api.index,\n })\n }\n\n render() {\n if (!this.props.post.acl.can_edit) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class MarkAsBestAnswer extends React.Component {\n onClick = () => {\n moderation.markAsBestAnswer(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (!thread.acl.can_mark_best_answer) return null\n if (!post.acl.can_mark_as_best_answer) return null\n if (post.id === thread.best_answer) return null\n if (thread.best_answer && !thread.acl.can_change_best_answer) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class UnmarkMarkBestAnswer extends React.Component {\n onClick = () => {\n moderation.unmarkBestAnswer(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (post.id !== thread.best_answer) return null\n if (!thread.acl.can_unmark_best_answer) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class PostEdits extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n const isHidden =\n this.props.post.is_hidden && !this.props.post.acl.can_see_hidden\n const isUnedited = this.props.post.edits === 0\n if (isHidden || isUnedited) return null\n\n const message = npgettext(\n \"post edits\",\n \"This post was edited %(edits)s time.\",\n \"This post was edited %(edits)s times.\",\n this.props.post.edits\n )\n\n const title = interpolate(\n message,\n {\n edits: this.props.post.edits,\n },\n true\n )\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Approve extends React.Component {\n onClick = () => {\n moderation.approve(this.props)\n }\n\n render() {\n if (!this.props.post.acl.can_approve) return null\n if (!this.props.post.is_unapproved) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Move extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n if (!this.props.post.acl.can_move) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Split extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n if (!this.props.post.acl.can_move) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Protect extends React.Component {\n onClick = () => {\n moderation.protect(this.props)\n }\n\n render() {\n if (!this.props.post.acl.can_protect) return null\n if (this.props.post.is_protected) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Unprotect extends React.Component {\n onClick = () => {\n moderation.unprotect(this.props)\n }\n\n render() {\n if (!this.props.post.acl.can_protect) return null\n if (!this.props.post.is_protected) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Hide extends React.Component {\n onClick = () => {\n moderation.hide(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (post.id === thread.best_answer) return null\n if (!post.acl.can_hide) return null\n if (post.is_hidden) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Unhide extends React.Component {\n onClick = () => {\n moderation.unhide(this.props)\n }\n\n render() {\n if (!this.props.post.acl.can_unhide) return null\n if (!this.props.post.is_hidden) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Delete extends React.Component {\n onClick = () => {\n moderation.remove(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (post.id === thread.best_answer) return null\n if (!post.acl.can_delete) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n","import React from \"react\"\nimport Dropdown from \"./dropdown\"\n\nexport default function (props) {\n return (\n
    \n \n expand_more\n \n \n
    \n )\n}\n","import React from \"react\"\nimport * as posts from \"misago/reducers/posts\"\nimport store from \"misago/services/store\"\n\nexport default class extends React.Component {\n onClick = () => {\n if (this.props.post.isSelected) {\n store.dispatch(posts.deselect(this.props.post))\n } else {\n store.dispatch(posts.select(this.props.post))\n }\n }\n\n render() {\n if (\n !(this.props.thread.acl.can_merge_posts || isVisible(this.props.post.acl))\n ) {\n return null\n }\n\n return (\n
    \n \n \n {this.props.post.isSelected\n ? \"check_box\"\n : \"check_box_outline_blank\"}\n \n \n
    \n )\n }\n}\n\nexport function isVisible(acl) {\n return (\n acl.can_approve ||\n acl.can_hide ||\n acl.can_protect ||\n acl.can_unhide ||\n acl.can_delete ||\n acl.can_move\n )\n}\n","import React from \"react\"\nimport Controls from \"./controls\"\nimport Select from \"./select\"\nimport {\n StatusIcon,\n getStatusClassName,\n getStatusDescription,\n} from \"misago/components/user-status\"\nimport PostChangelog from \"misago/components/post-changelog\"\nimport modal from \"misago/services/modal\"\n\nexport default function (props) {\n return (\n
    \n \n \n \n \n \n \n \n \n \n
    \n
    \n \n \n \n
    \n
    \n {post.poster_name}\n\n \n {pgettext(\"post removed poster username\", \"Removed user\")}\n \n
    \n
    \n
    \n )\n}\n","export default function ({ title, rank }) {\n return rank.is_tab || !!title || !!rank.title\n}\n","import React from \"react\"\nimport hasVisibleTitle from \"./has-visible-title\"\n\nexport default function ({ poster }) {\n const message = npgettext(\n \"poster stats\",\n \"%(posts)s post\",\n \"%(posts)s posts\",\n poster.posts\n )\n\n let className = \"user-postcount\"\n if (hasVisibleTitle(poster)) {\n className += \" hidden-xs hidden-sm\"\n }\n\n return (\n \n {interpolate(\n message,\n {\n posts: poster.posts,\n },\n true\n )}\n \n )\n}\n","import React from \"react\"\nimport UserStatus, { StatusLabel } from \"misago/components/user-status\"\nimport hasVisibleTitle from \"./has-visible-title\"\n\nexport default function ({ poster }) {\n let className = \"hidden-xs\"\n if (hasVisibleTitle(poster)) {\n className += \" hidden-sm\"\n }\n\n return (\n \n \n \n \n \n )\n}\n","import React from \"react\"\n\nexport default function ({ rank, title }) {\n let userTitle = title || rank.title\n if (!userTitle && rank.is_tab) {\n userTitle = rank.name\n }\n\n if (!userTitle) return null\n\n let className = \"user-title\"\n if (rank.css_class) {\n className += \" user-title-\" + rank.css_class\n }\n\n if (rank.is_tab) {\n return (\n \n )\n }\n\n return
    {userTitle}
    \n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Controls from \"misago/components/posts-list/post/controls\"\nimport Select from \"misago/components/posts-list/post/select\"\nimport UserStatus, { StatusIcon } from \"misago/components/user-status\"\nimport UserPostcount from \"./user-postcount\"\nimport UserStatusLabel from \"./user-status\"\nimport UserTitle from \"./user-title\"\n\nexport default function ({ post, thread }) {\n const { poster } = post\n\n return (\n
    \n \n \n
    \n \n\n \n \n \n\n \n \n \n\n \n }\n >\n \n \n\n {captcha.component({\n form: this,\n })}\n\n \n
    \n
    \n \n {pgettext(\"register modal btn\", \"Cancel\")}\n \n \n
    \n \n
    \n
    \n )\n }\n}\n\nexport class RegisterComplete extends React.Component {\n getLead() {\n if (this.props.activation === \"user\") {\n return pgettext(\n \"account activation required\",\n \"%(username)s, your account has been created but you need to activate it before you will be able to sign in.\"\n )\n } else if (this.props.activation === \"admin\") {\n return pgettext(\n \"account activation required\",\n \"%(username)s, your account has been created but the site administrator will have to activate it before you will be able to sign in.\"\n )\n }\n }\n\n getSubscript() {\n if (this.props.activation === \"user\") {\n return pgettext(\n \"account activation required\",\n \"We have sent an e-mail to %(email)s with link that you have to click to activate your account.\"\n )\n } else if (this.props.activation === \"admin\") {\n return pgettext(\n \"account activation required\",\n \"We will send an e-mail to %(email)s when this takes place.\"\n )\n }\n }\n\n render() {\n return (\n \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"register modal title\", \"Registration complete\")}\n

    \n
    \n
    \n
    \n info_outline\n
    \n
    \n

    \n {interpolate(\n this.getLead(),\n { username: this.props.username },\n true\n )}\n

    \n

    \n {interpolate(\n this.getSubscript(),\n { email: this.props.email },\n true\n )}\n

    \n \n {pgettext(\"register modal dismiss\", \"Ok\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n complete: false,\n }\n }\n\n completeRegistration = (apiResponse) => {\n if (apiResponse.activation === \"active\") {\n modal.hide()\n auth.signIn(apiResponse)\n } else {\n this.setState({\n complete: apiResponse,\n })\n }\n }\n\n render() {\n if (this.state.complete) {\n return (\n \n )\n }\n\n return \n }\n}\n","import RegisterButton from \"./RegisterButton\"\n\nexport default RegisterButton\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport ajax from \"../../services/ajax\"\nimport captcha from \"../../services/captcha\"\nimport modal from \"../../services/modal\"\nimport snackbar from \"../../services/snackbar\"\nimport Loader from \"../loader\"\nimport RegisterForm from \"../register.js\"\n\nexport default class RegisterButton extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n isLoaded: false,\n\n criteria: null,\n }\n }\n\n showRegisterForm = () => {\n if (this.props.onClick) {\n this.props.onClick()\n }\n\n if (misago.get(\"SETTINGS\").account_activation === \"closed\") {\n snackbar.info(\n pgettext(\n \"register form\",\n \"Registration form is currently disabled by the site administrator.\"\n )\n )\n } else if (this.state.isLoaded) {\n modal.show()\n } else {\n this.setState({ isLoading: true })\n\n Promise.all([\n captcha.load(),\n ajax.get(misago.get(\"AUTH_CRITERIA_API\")),\n ]).then(\n (result) => {\n this.setState({\n isLoading: false,\n isLoaded: true,\n criteria: result[1],\n })\n\n modal.show()\n },\n () => {\n this.setState({ isLoading: false })\n\n snackbar.error(\n pgettext(\n \"register form\",\n \"Registration form is currently unavailable due to an error.\"\n )\n )\n }\n )\n }\n }\n\n render() {\n return (\n \n {pgettext(\"cta\", \"Register\")}\n {this.state.isLoading ? : null}\n \n )\n }\n}\n","import React from \"react\"\nimport misago from \"misago\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst AGREEMENT_URL = '%(agreement)s'\n\nconst RegisterLegalFootnote = (props) => {\n const {\n errors,\n privacyPolicy,\n termsOfService,\n onPrivacyPolicyChange,\n onTermsOfServiceChange,\n } = props\n\n const termsOfServiceId = misago.get(\"TERMS_OF_SERVICE_ID\")\n const termsOfServiceUrl = misago.get(\"TERMS_OF_SERVICE_URL\")\n\n const privacyPolicyId = misago.get(\"PRIVACY_POLICY_ID\")\n const privacyPolicyUrl = misago.get(\"PRIVACY_POLICY_URL\")\n\n if (!termsOfServiceId && !privacyPolicyId) return null\n\n return (\n
    \n \n \n
    \n )\n}\n\nconst LegalAgreement = (props) => {\n const { agreement, checked, errors, url, value, onChange } = props\n\n if (!url) return null\n\n const agreementHtml = interpolate(\n AGREEMENT_URL,\n { agreement: escapeHtml(agreement), url: escapeHtml(url) },\n true\n )\n const label = interpolate(\n pgettext(\n \"register form agreement prompt\",\n \"I have read and accept %(agreement)s.\"\n ),\n { agreement: agreementHtml },\n true\n )\n\n return (\n
    \n \n {errors &&\n errors.map((error, i) => (\n
    \n {error}\n
    \n ))}\n
    \n )\n}\n\nexport default RegisterLegalFootnote\n","import React from \"react\"\nimport { ListGroup } from \"../ListGroup\"\n\nexport default function SearchResultsList({ children }) {\n return {children}\n}\n","import React from \"react\"\nimport { ListGroupMessage } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\n\nexport default function SearchMessage() {\n return (\n \n \n \n )\n}\n","import React from \"react\"\nimport { ListGroupItem } from \"../ListGroup\"\nimport Timestamp from \"../Timestamp\"\n\nexport default function SearchResultPost({ post }) {\n return (\n \n \n
    \n
    {post.thread.title}
    \n \n
      \n
    • \n {post.category.name}\n
    • \n
    • {post.poster ? post.poster.username : post.poster_name}
    • \n
    • \n \n
    • \n
    \n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport Avatar from \"../avatar\"\nimport { ListGroupItem } from \"../ListGroup\"\nimport Timestamp from \"../Timestamp\"\n\nexport default function SearchResultUser({ user }) {\n const title = user.title || user.rank.title\n\n return (\n \n \n \n
    \n
    {user.username}
    \n
      \n {!!title && (\n
    • \n {title}\n
    • \n )}\n
    • {user.rank.name}
    • \n
    • \n \n
    • \n
    \n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport { ListGroupItem } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\nimport SearchResultPost from \"./SearchResultPost\"\nimport SearchResultUser from \"./SearchResultUser\"\n\nexport default function SearchResults({ query, results }) {\n const threads = results[0]\n const users = results[1]\n\n const { count } = threads.results\n\n return (\n \n {users.results.results.map((user) => (\n \n ))}\n {threads.results.results.map((post) => (\n \n ))}\n {count > 0 && (\n \n \n {npgettext(\n \"search results list\",\n \"See all %(count)s result.\",\n \"See all %(count)s results.\",\n threads.results.count\n ).replace(\"%(count)s\", threads.results.count)}\n \n \n )}\n \n )\n}\n","import React from \"react\"\nimport { ListGroupEmpty } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\n\nexport default function SearchResultsEmpty() {\n return (\n \n \n \n )\n}\n","import React from \"react\"\nimport { ListGroupError } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\n\nexport default function SearchResultsError({ error }) {\n return (\n \n \n \n )\n}\n\nfunction errorDetail(error) {\n if (error.status === 0) {\n return gettext(\n \"Check your internet connection and try refreshing the site.\"\n )\n }\n\n if (error.data && error.data.detail) {\n return error.data.detail\n }\n}\n","import React from \"react\"\nimport { ListGroupLoading } from \"../ListGroup\"\nimport SearchResultsList from \"./SearchResultsList\"\n\nexport default function SearchResultsLoading() {\n return (\n \n \n \n )\n}\n","import React from \"react\"\nimport { ApiFetch } from \"../Api\"\nimport SearchMessage from \"./SearchMessage\"\nimport SearchResults from \"./SearchResults\"\nimport SearchResultsEmpty from \"./SearchResultsEmpty\"\nimport SearchResultsError from \"./SearchResultsError\"\nimport SearchResultsLoading from \"./SearchResultsLoading\"\n\nconst DEBOUNCE = 750\nconst CACHE = {}\n\nexport default class SearchFetch extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n query: this.props.query.trim(),\n }\n\n this.debounce = null\n }\n\n componentDidUpdate() {\n const query = this.props.query.trim()\n\n if (this.state.query != query) {\n if (this.debounce) {\n window.clearTimeout(this.debounce)\n }\n\n this.debounce = window.setTimeout(() => {\n this.setState({ query })\n }, DEBOUNCE)\n }\n }\n\n componentWillUnmount() {\n if (this.debounce) {\n window.clearTimeout(this.debounce)\n }\n }\n\n render() {\n return (\n \n {({ data, loading, error }) => {\n if (this.state.query.length < 3) {\n return \n }\n\n if (loading) {\n return \n }\n\n if (error) {\n return \n }\n\n if (isResultEmpty(data)) {\n return \n }\n\n if (data !== null) {\n return \n }\n\n return null\n }}\n \n )\n }\n}\n\nfunction getSearchUrl(query) {\n return misago.get(\"SEARCH_API\") + \"?q=\" + encodeURIComponent(query)\n}\n\nfunction isResultEmpty(results) {\n if (results === null) {\n return true\n }\n\n let resultsCount = 0\n results.forEach((result) => {\n resultsCount += result.results.count\n })\n return resultsCount === 0\n}\n","import React from \"react\"\n\nexport default function SearchInput({ query, setQuery }) {\n return (\n
    \n setQuery(event.target.value)}\n />\n
    \n )\n}\n","import React from \"react\"\n\nexport default class SearchQuery extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n query: \"\",\n }\n }\n\n setQuery = (query) => {\n this.setState({ query })\n }\n\n render() {\n return this.props.children({\n query: this.state.query,\n setQuery: this.setQuery,\n })\n }\n}\n","import React from \"react\"\nimport SearchFetch from \"./SearchFetch\"\nimport SearchInput from \"./SearchInput\"\nimport SearchQuery from \"./SearchQuery\"\n\nexport default function SearchDropdown() {\n return (\n \n {({ query, setQuery }) => {\n return (\n
    \n \n \n
    \n )\n }}\n
    \n )\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { Overlay, OverlayHeader } from \"../Overlay\"\nimport SearchFetch from \"./SearchFetch\"\nimport SearchInput from \"./SearchInput\"\nimport SearchQuery from \"./SearchQuery\"\n\nfunction SearchOverlay({ open }) {\n return (\n {\n window.setTimeout(() => {\n document.querySelector(\"#search-mount .form-control-search\").focus()\n }, 0)\n }}\n >\n {pgettext(\"cta\", \"Search\")}\n \n {({ query, setQuery }) => {\n return (\n
    \n \n
    \n \n
    \n
    \n )\n }}\n
    \n \n )\n}\n\nfunction select(state) {\n return { open: state.overlay.search }\n}\n\nconst SearchOverlayConnected = connect(select)(SearchOverlay)\n\nexport default SearchOverlayConnected\n","import SignInButton from \"./SignInButton\"\n\nexport default SignInButton\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport modal from \"../../services/modal\"\nimport SignInModal from \"../sign-in\"\n\nexport default function SignInButton({ block, className, onClick }) {\n const settings = misago.get(\"SETTINGS\")\n\n if (settings.DELEGATE_AUTH) {\n return (\n \n {pgettext(\"cta\", \"Sign in\")}\n \n )\n }\n\n return (\n {\n if (onClick) {\n onClick()\n }\n\n modal.show()\n }}\n >\n {pgettext(\"cta\", \"Sign in\")}\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { connect } from \"react-redux\"\nimport {\n DropdownDivider,\n DropdownHeader,\n DropdownMenuItem,\n DropdownPills,\n DropdownSubheader,\n} from \"../Dropdown\"\nimport RegisterButton from \"../RegisterButton\"\nimport SignInButton from \"../SignInButton\"\n\nfunction SiteNavMenu({ isAnonymous, close, dropdown, overlay }) {\n const baseUrl = misago.get(\"MISAGO_PATH\")\n const settings = misago.get(\"SETTINGS\")\n const mainItems = misago.get(\"main_menu\")\n const extraItems = misago.get(\"extraMenuItems\")\n const extraFooterItems = misago.get(\"extraFooterItems\")\n const categories = misago.get(\"categories_menu\")\n const users = misago.get(\"usersLists\")\n const authDelegated = settings.enable_oauth2_client\n\n const topNav = []\n mainItems.forEach((item) => {\n topNav.push({ title: item.label, url: item.url })\n })\n\n topNav.push({\n title: pgettext(\"site nav\", \"Search\"),\n url: baseUrl + \"search/\",\n })\n\n const footerNav = []\n\n const tosTitle = misago.get(\"TERMS_OF_SERVICE_TITLE\")\n const tosUrl = misago.get(\"TERMS_OF_SERVICE_URL\")\n if (tosTitle && tosUrl) {\n footerNav.push({\n title: tosTitle,\n url: tosUrl,\n })\n }\n\n const privacyTitle = misago.get(\"PRIVACY_POLICY_TITLE\")\n const privacyUrl = misago.get(\"PRIVACY_POLICY_URL\")\n if (privacyTitle && privacyUrl) {\n footerNav.push({\n title: privacyTitle,\n url: privacyUrl,\n })\n }\n\n return (\n \n {isAnonymous && (\n \n {pgettext(\"cta\", \"You are not signed in\")}\n \n )}\n {isAnonymous && (\n \n \n {!authDelegated && }\n \n )}\n {settings.forum_name}\n {topNav.map((item) => (\n \n {item.title}\n \n ))}\n {extraItems.map((item, index) => (\n \n \n {item.title}\n \n \n ))}\n {!!users.length && }\n {!!users.length && (\n \n {pgettext(\"site nav section\", \"Users\")}\n \n )}\n {users.map((item) => (\n \n {item.name}\n \n ))}\n \n \n {pgettext(\"site nav section\", \"Categories\")}\n \n {categories.map((category) =>\n category.is_vanilla ? (\n \n {category.name}\n \n ) : (\n \n \n {category.name}\n \n {category.short_name || category.name}\n \n \n \n )\n )}\n {(!!footerNav.length || !!extraFooterItems.length) && (\n \n )}\n {(!!footerNav.length || !!extraFooterItems.length) && (\n \n {pgettext(\"site nav section\", \"Footer\")}\n \n )}\n {extraFooterItems.map((item, index) => (\n \n \n {item.title}\n \n \n ))}\n {footerNav.map((item) => (\n \n {item.title}\n \n ))}\n \n )\n}\n\nfunction select(state) {\n return {\n isAnonymous: !state.auth.user.id,\n }\n}\n\nconst SiteNavMenuConnected = connect(select)(SiteNavMenu)\n\nexport default SiteNavMenuConnected\n","import React from \"react\"\nimport SiteNavMenu from \"./SiteNavMenu\"\n\nexport default function SiteNavDropdown({ close }) {\n return \n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { close } from \"../../reducers/overlay\"\nimport { Overlay, OverlayHeader } from \"../Overlay\"\nimport SiteNavMenu from \"./SiteNavMenu\"\n\nexport function SiteNavOverlay({ dispatch, isOpen }) {\n return (\n \n {pgettext(\"site nav title\", \"Menu\")}\n dispatch(close())} overlay />\n \n )\n}\n\nfunction select(state) {\n return {\n isOpen: state.overlay.siteNav,\n }\n}\n\nconst SiteNavOverlayConnected = connect(select)(SiteNavOverlay)\n\nexport default SiteNavOverlayConnected\n","import React from \"react\"\nimport misago from \"misago\"\n\nconst StartSocialAuth = (props) => {\n const { buttonClassName, buttonLabel, formLabel, header, labelClassName } =\n props\n const socialAuth = misago.get(\"SOCIAL_AUTH\")\n\n if (socialAuth.length === 0) return null\n\n return (\n
    \n \n
    \n {socialAuth.map(({ pk, name, button_text, button_color, url }) => {\n const className = \"btn btn-block btn-default btn-social-\" + pk\n const style = button_color ? { color: button_color } : null\n const finalButtonLabel =\n button_text || interpolate(buttonLabel, { site: name }, true)\n\n return (\n \n )\n })}\n
    \n
    \n \n
    \n )\n}\n\nconst FormHeader = ({ className, text }) => {\n if (!text) return null\n return
    {text}
    \n}\n\nexport default StartSocialAuth\n","import React from \"react\"\nimport {\n formatNarrow,\n formatRelative,\n fullDateTime,\n} from \"../../datetimeFormats\"\n\nclass Timestamp extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = { tick: 0 }\n this.date = new Date(props.datetime)\n this.timeout = null\n }\n\n componentDidMount() {\n this.scheduleNextUpdate()\n }\n\n componentWillUnmount() {\n if (this.timeout) {\n window.clearTimeout(this.timeout)\n }\n }\n\n scheduleNextUpdate = () => {\n const now = new Date()\n const diff = Math.ceil(Math.abs(Math.round((this.date - now) / 1000)))\n\n if (diff < 3600) {\n this.timeout = window.setTimeout(\n () => {\n this.setState(tick)\n this.scheduleNextUpdate()\n },\n 50 * 1000 // Update every 50 seconds\n )\n } else if (diff < 3600 * 24) {\n this.timeout = window.setTimeout(\n () => {\n this.setState(tick)\n },\n 40 * 60 * 1000 // Update every 40 minutes\n )\n }\n }\n\n render() {\n const displayed = this.props.narrow\n ? formatNarrow(this.date)\n : formatRelative(this.date)\n\n return (\n \n {displayed}\n \n )\n }\n}\n\nfunction tick(state) {\n return { tick: state.tick + 1 }\n}\n\nexport default Timestamp\n","import Timestamp from \"./Timestamp\"\n\nexport default Timestamp\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst Toolbar = ({ children, className }) => (\n \n)\n\nexport default Toolbar\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst ToolbarItem = ({ children, className, shrink }) => (\n \n {children}\n \n)\n\nexport default ToolbarItem\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst ToolbarSection = ({ auto, children, className }) => (\n \n {children}\n \n)\n\nexport default ToolbarSection\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst ToolbarSpacer = ({ className }) => (\n
    \n)\n\nexport default ToolbarSpacer\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Button from \"misago/components/button\"\nimport Loader from \"misago/components/loader\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n }\n }\n\n callApi(avatarType) {\n if (this.state.isLoading) {\n return false\n }\n\n this.setState({\n isLoading: true,\n })\n\n ajax\n .post(this.props.user.api.avatar, {\n avatar: avatarType,\n })\n .then(\n (response) => {\n this.setState({\n isLoading: false,\n })\n\n snackbar.success(response.detail)\n this.props.onComplete(response)\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n this.setState({\n isLoading: false,\n })\n } else {\n this.props.showError(rejection)\n }\n }\n )\n }\n\n setGravatar = () => {\n this.callApi(\"gravatar\")\n }\n\n setGenerated = () => {\n this.callApi(\"generated\")\n }\n\n getGravatarButton() {\n if (this.props.options.gravatar) {\n return (\n \n {pgettext(\"avatar modal btn\", \"Download my Gravatar\")}\n \n )\n } else {\n return null\n }\n }\n\n getCropButton() {\n if (!this.props.options.crop_src) return null\n\n return (\n \n {pgettext(\"avatar modal btn\", \"Re-crop uploaded image\")}\n \n )\n }\n\n getUploadButton() {\n if (!this.props.options.upload) return null\n\n return (\n \n {pgettext(\"avatar modal btn\", \"Upload new image\")}\n \n )\n }\n\n getGalleryButton() {\n if (!this.props.options.galleries) return null\n\n return (\n \n {pgettext(\"avatar modal btn\", \"Pick avatar from gallery\")}\n \n )\n }\n\n getAvatarPreview() {\n let userPeview = {\n id: this.props.user.id,\n avatars: this.props.options.avatars,\n }\n\n if (this.state.isLoading) {\n return (\n
    \n \n \n
    \n )\n }\n\n return (\n
    \n \n
    \n )\n }\n\n render() {\n return (\n
    \n
    \n
    {this.getAvatarPreview()}
    \n
    \n {this.getGravatarButton()}\n\n \n {pgettext(\"avatar modal btn\", \"Generate my individual avatar\")}\n \n\n {this.getCropButton()}\n {this.getUploadButton()}\n {this.getGalleryButton()}\n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Button from \"misago/components/button\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n deviceRatio: 1,\n }\n }\n\n getAvatarSize() {\n if (this.props.upload) {\n return this.props.options.crop_tmp.size\n } else {\n return this.props.options.crop_src.size\n }\n }\n\n getImagePath() {\n if (this.props.upload) {\n return this.props.dataUrl\n } else {\n return this.props.options.crop_src.url\n }\n }\n\n componentDidMount() {\n let cropit = $(\".crop-form\")\n let cropperWidth = this.getAvatarSize()\n\n const initialWidth = cropit.width()\n while (initialWidth < cropperWidth) {\n cropperWidth = cropperWidth / 2\n }\n\n const deviceRatio = this.getAvatarSize() / cropperWidth\n\n cropit.width(cropperWidth)\n\n cropit.cropit({\n width: cropperWidth,\n height: cropperWidth,\n exportZoom: deviceRatio,\n imageState: {\n src: this.getImagePath(),\n },\n onImageLoaded: () => {\n if (this.props.upload) {\n // center uploaded image\n let zoomLevel = cropit.cropit(\"zoom\")\n let imageSize = cropit.cropit(\"imageSize\")\n\n // is it wider than taller?\n if (imageSize.width > imageSize.height) {\n let displayedWidth = imageSize.width * zoomLevel\n let offsetX = (displayedWidth - this.getAvatarSize()) / -2\n\n cropit.cropit(\"offset\", {\n x: offsetX,\n y: 0,\n })\n } else if (imageSize.width < imageSize.height) {\n let displayedHeight = imageSize.height * zoomLevel\n let offsetY = (displayedHeight - this.getAvatarSize()) / -2\n\n cropit.cropit(\"offset\", {\n x: 0,\n y: offsetY,\n })\n } else {\n cropit.cropit(\"offset\", {\n x: 0,\n y: 0,\n })\n }\n } else {\n // use preserved crop\n let crop = this.props.options.crop_src.crop\n\n if (crop) {\n cropit.cropit(\"zoom\", crop.zoom)\n cropit.cropit(\"offset\", {\n x: crop.x,\n y: crop.y,\n })\n }\n }\n },\n })\n }\n\n componentWillUnmount() {\n $(\".crop-form\").cropit(\"disable\")\n }\n\n cropAvatar = () => {\n if (this.state.isLoading) {\n return false\n }\n\n this.setState({\n isLoading: true,\n })\n\n let avatarType = this.props.upload ? \"crop_tmp\" : \"crop_src\"\n let cropit = $(\".crop-form\")\n\n const deviceRatio = cropit.cropit(\"exportZoom\")\n const cropitOffset = cropit.cropit(\"offset\")\n\n ajax\n .post(this.props.user.api.avatar, {\n avatar: avatarType,\n crop: {\n offset: {\n x: cropitOffset.x * deviceRatio,\n y: cropitOffset.y * deviceRatio,\n },\n zoom: cropit.cropit(\"zoom\") * deviceRatio,\n },\n })\n .then(\n (data) => {\n this.props.onComplete(data)\n snackbar.success(data.detail)\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n this.setState({\n isLoading: false,\n })\n } else {\n this.props.showError(rejection)\n }\n }\n )\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n \n {this.props.upload\n ? pgettext(\"avatar crop modal btn\", \"Set avatar\")\n : pgettext(\"avatar crop modal btn\", \"Crop image\")}\n \n\n \n {pgettext(\"avatar crop modal btn\", \"Cancel\")}\n \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport AvatarCrop from \"misago/components/change-avatar/crop\"\nimport Button from \"misago/components/button\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport fileSize from \"misago/utils/file-size\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n image: null,\n preview: null,\n progress: 0,\n uploaded: null,\n dataUrl: null,\n }\n }\n\n validateFile(image) {\n if (image.size > this.props.options.upload.limit) {\n return interpolate(\n pgettext(\n \"avatar upload modal\",\n \"Selected file is too big. (%(filesize)s)\"\n ),\n {\n filesize: fileSize(image.size),\n },\n true\n )\n }\n\n let invalidTypeMsg = pgettext(\n \"avatar upload modal\",\n \"Selected file type is not supported.\"\n )\n if (\n this.props.options.upload.allowed_mime_types.indexOf(image.type) === -1\n ) {\n return invalidTypeMsg\n }\n\n let extensionFound = false\n let loweredFilename = image.name.toLowerCase()\n this.props.options.upload.allowed_extensions.map(function (extension) {\n if (loweredFilename.substr(extension.length * -1) === extension) {\n extensionFound = true\n }\n })\n\n if (!extensionFound) {\n return invalidTypeMsg\n }\n\n return false\n }\n\n pickFile = () => {\n document.getElementById(\"avatar-hidden-upload\").click()\n }\n\n uploadFile = () => {\n let image = document.getElementById(\"avatar-hidden-upload\").files[0]\n if (!image) return\n\n let validationError = this.validateFile(image)\n if (validationError) {\n snackbar.error(validationError)\n return\n }\n\n this.setState({\n image,\n preview: URL.createObjectURL(image),\n progress: 0,\n })\n\n let data = new FormData()\n data.append(\"avatar\", \"upload\")\n data.append(\"image\", image)\n\n ajax\n .upload(this.props.user.api.avatar, data, (progress) => {\n this.setState({\n progress,\n })\n })\n .then(\n (data) => {\n this.setState({\n options: data,\n uploaded: data.detail,\n })\n\n snackbar.info(\n pgettext(\n \"avatar upload modal\",\n \"Your image has been uploaded and you may now crop it.\"\n )\n )\n },\n (rejection) => {\n if (rejection.status === 400 || rejection.status === 413) {\n snackbar.error(rejection.detail)\n this.setState({\n isLoading: false,\n image: null,\n progress: 0,\n })\n } else {\n this.props.showError(rejection)\n }\n }\n )\n }\n\n getUploadRequirements(options) {\n let extensions = options.allowed_extensions.map(function (extension) {\n return extension.substr(1)\n })\n\n return interpolate(\n pgettext(\"avatar upload modal\", \"%(files)s files smaller than %(limit)s\"),\n {\n files: extensions.join(\", \"),\n limit: fileSize(options.limit),\n },\n true\n )\n }\n\n getUploadButton() {\n return (\n
    \n \n

    \n {this.getUploadRequirements(this.props.options.upload)}\n

    \n
    \n )\n }\n\n getUploadProgressLabel() {\n return interpolate(\n pgettext(\"avatar upload modal field\", \"%(progress)s % complete\"),\n {\n progress: this.state.progress,\n },\n true\n )\n }\n\n getUploadProgress() {\n return (\n
    \n
    \n \n\n
    \n \n {this.getUploadProgressLabel()}\n
    \n
    \n
    \n
    \n )\n }\n\n renderUpload() {\n return (\n
    \n \n {this.state.image ? this.getUploadProgress() : this.getUploadButton()}\n
    \n
    \n \n {pgettext(\"avatar upload modal btn\", \"Cancel\")}\n \n
    \n
    \n
    \n )\n }\n\n renderCrop() {\n return (\n \n )\n }\n\n render() {\n if (this.state.uploaded) return this.renderCrop()\n\n return this.renderUpload()\n }\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Button from \"misago/components/button\"\nimport misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport batch from \"misago/utils/batch\"\n\nexport class GalleryItem extends React.Component {\n select = () => {\n this.props.select(this.props.id)\n }\n\n getClassName() {\n if (this.props.selection === this.props.id) {\n if (this.props.disabled) {\n return \"btn btn-avatar btn-disabled avatar-selected\"\n } else {\n return \"btn btn-avatar avatar-selected\"\n }\n } else if (this.props.disabled) {\n return \"btn btn-avatar btn-disabled\"\n } else {\n return \"btn btn-avatar\"\n }\n }\n\n render() {\n return (\n \n \n \n )\n }\n}\n\nexport class Gallery extends React.Component {\n render() {\n return (\n
    \n

    {this.props.name}

    \n\n
    \n {batch(this.props.images, 4, null).map((row, i) => {\n return (\n
    \n {row.map((item, i) => {\n return (\n
    \n {item ? (\n \n ) : (\n
    \n )}\n
    \n )\n })}\n
    \n )\n })}\n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n selection: null,\n isLoading: false,\n }\n }\n\n select = (image) => {\n this.setState({\n selection: image,\n })\n }\n\n save = () => {\n if (this.state.isLoading) {\n return false\n }\n\n this.setState({\n isLoading: true,\n })\n\n ajax\n .post(this.props.user.api.avatar, {\n avatar: \"galleries\",\n image: this.state.selection,\n })\n .then(\n (response) => {\n this.setState({\n isLoading: false,\n })\n\n snackbar.success(response.detail)\n this.props.onComplete(response)\n this.props.showIndex()\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n this.setState({\n isLoading: false,\n })\n } else {\n this.props.showError(rejection)\n }\n }\n )\n }\n\n render() {\n return (\n
    \n
    \n {this.props.options.galleries.map((item, i) => {\n return (\n \n )\n })}\n
    \n
    \n
    \n
    \n \n {this.state.selection\n ? pgettext(\"avatar gallery modal btn\", \"Save choice\")\n : pgettext(\"avatar gallery modal btn\", \"Select avatar\")}\n \n\n \n {pgettext(\"avatar gallery modal btn\", \"Cancel\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport AvatarIndex from \"misago/components/change-avatar/index\"\nimport AvatarCrop from \"misago/components/change-avatar/crop\"\nimport AvatarUpload from \"misago/components/change-avatar/upload\"\nimport AvatarGallery from \"misago/components/change-avatar/gallery\"\nimport Loader from \"misago/components/modal-loader\"\nimport { updateAvatar } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport store from \"misago/services/store\"\n\nexport class ChangeAvatarError extends React.Component {\n getErrorReason() {\n if (this.props.reason) {\n return

    \n } else {\n return null\n }\n }\n\n render() {\n return (\n

    \n
    \n remove_circle_outline\n
    \n
    \n

    {this.props.message}

    \n {this.getErrorReason()}\n \n {pgettext(\"avatar modal dismiss\", \"Ok\")}\n \n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n componentDidMount() {\n ajax.get(this.props.user.api.avatar).then(\n (options) => {\n this.setState({\n component: AvatarIndex,\n options: options,\n error: null,\n })\n },\n (rejection) => {\n this.showError(rejection)\n }\n )\n }\n\n showError = (error) => {\n this.setState({\n error,\n })\n }\n\n showIndex = () => {\n this.setState({\n component: AvatarIndex,\n })\n }\n\n showUpload = () => {\n this.setState({\n component: AvatarUpload,\n })\n }\n\n showCrop = () => {\n this.setState({\n component: AvatarCrop,\n })\n }\n\n showGallery = () => {\n this.setState({\n component: AvatarGallery,\n })\n }\n\n completeFlow = (options) => {\n store.dispatch(updateAvatar(this.props.user, options.avatars))\n\n this.setState({\n component: AvatarIndex,\n options,\n })\n }\n\n getBody() {\n if (this.state) {\n if (this.state.error) {\n return (\n \n )\n } else {\n return (\n \n )\n }\n } else {\n return \n }\n }\n\n getClassName() {\n if (this.state && this.state.error) {\n return \"modal-dialog modal-message modal-change-avatar\"\n } else {\n return \"modal-dialog modal-change-avatar\"\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"avatar modal title\", \"Change your avatar\")}\n

    \n
    \n\n {this.getBody()}\n
    \n
    \n )\n }\n}\n\nexport function select(state) {\n return {\n user: state.auth.user,\n }\n}\n","export default function logout() {\n document.getElementById(\"hidden-logout-form\").submit()\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { connect } from \"react-redux\"\nimport modal from \"../../services/modal\"\nimport ChangeAvatarModal, {\n select as selectAvatar,\n} from \"../change-avatar/root\"\nimport {\n DropdownDivider,\n DropdownFooter,\n DropdownMenuItem,\n DropdownSubheader,\n} from \"../Dropdown\"\nimport logout from \"./logout\"\n\nclass UserNavMenu extends React.Component {\n constructor(props) {\n super(props)\n\n if (props.dropdown) {\n // Collapse options on dropdown\n this.state = {\n options: props.options.slice(0, 2),\n optionsMore: props.options.length > 2,\n }\n } else {\n // Reveal all options on mobile overlay\n this.state = {\n options: props.options,\n optionsMore: false,\n }\n }\n }\n\n changeAvatar = () => {\n this.props.close()\n modal.show(connect(selectAvatar)(ChangeAvatarModal))\n }\n\n revealOptions = () => {\n this.setState({\n options: this.props.options,\n optionsMore: false,\n })\n }\n\n render() {\n const { user, close, dropdown, overlay } = this.props\n\n if (!user) {\n return null\n }\n\n const adminUrl = misago.get(\"ADMIN_URL\")\n\n return (\n \n
  • \n \n {user.username}\n {pgettext(\"user nav\", \"Go to your profile\")}\n \n
  • \n \n \n \n \n {user.unreadNotifications\n ? \"notifications_active\"\n : \"notifications_none\"}\n \n {pgettext(\"user nav\", \"Notifications\")}\n {!!user.unreadNotifications && (\n {user.unreadNotifications}\n )}\n \n \n {!!user.showPrivateThreads && (\n \n \n inbox\n {pgettext(\"user nav\", \"Private threads\")}\n {!!user.unreadPrivateThreads && (\n {user.unreadPrivateThreads}\n )}\n \n \n )}\n {!!adminUrl && (\n \n \n security\n {pgettext(\"user nav\", \"Admin control panel\")}\n \n \n )}\n \n \n {pgettext(\"user nav section\", \"Account settings\")}\n \n \n \n portrait\n {pgettext(\"user nav\", \"Change avatar\")}\n \n \n {this.state.options.map((item) => (\n \n \n {item.icon}\n {item.name}\n \n \n ))}\n \n \n more_vertical\n {pgettext(\"user nav\", \"See more\")}\n \n \n {!!dropdown && (\n \n {\n logout()\n close()\n }}\n type=\"button\"\n >\n {pgettext(\"user nav\", \"Log out\")}\n \n \n )}\n \n )\n }\n}\n\nfunction select(state) {\n const user = state.auth.user\n if (!user.id) {\n return { user: null }\n }\n\n return {\n user: {\n username: user.username,\n unreadNotifications: user.unreadNotifications,\n unreadPrivateThreads: user.unread_private_threads,\n showPrivateThreads: user.acl.can_use_private_threads,\n url: user.url,\n },\n options: [...misago.get(\"userOptions\")],\n }\n}\n\nconst UserNavMenuConnected = connect(select)(UserNavMenu)\n\nexport default UserNavMenuConnected\n","import React from \"react\"\nimport UserNavMenu from \"./UserNavMenu\"\n\nexport default function UserNavDropdown({ close }) {\n return \n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { close } from \"../../reducers/overlay\"\nimport { DropdownFooter } from \"../Dropdown\"\nimport { Overlay, OverlayHeader } from \"../Overlay\"\nimport UserNavMenu from \"./UserNavMenu\"\nimport logout from \"./logout\"\n\nexport function UserNavOverlay({ dispatch, isOpen }) {\n return (\n \n \n {pgettext(\"user nav title\", \"Your options\")}\n \n dispatch(close())} overlay />\n \n {\n logout()\n dispatch(close())\n }}\n type=\"button\"\n >\n {pgettext(\"user nav\", \"Log out\")}\n \n \n \n )\n}\n\nfunction select(state) {\n return {\n isOpen: state.overlay.userNav,\n }\n}\n\nconst UserNavOverlayConnected = connect(select)(UserNavOverlay)\n\nexport default UserNavOverlayConnected\n","import React from \"react\"\nimport misago from \"misago\"\n\nexport default function (props) {\n const size = props.size || 100\n const size2x = props.size2x || size * 2\n\n return (\n \n )\n}\n\nexport function getSrc(user, size) {\n if (user && user.id) {\n // just avatar hash, size and user id\n return resolveAvatarForSize(user.avatars, size).url\n } else {\n // just append avatar size to file to produce no-avatar placeholder\n return misago.get(\"BLANK_AVATAR_URL\")\n }\n}\n\nexport function resolveAvatarForSize(avatars, size) {\n let avatar = avatars[0]\n avatars.forEach((av) => {\n if (av.size >= size) {\n avatar = av\n }\n })\n return avatar\n}\n","import React from \"react\"\nimport Loader from \"./loader\"\n\nexport default class Button extends React.Component {\n render() {\n let className = \"btn \" + this.props.className\n let disabled = this.props.disabled\n\n if (this.props.loading) {\n className += \" btn-loading\"\n disabled = true\n }\n\n return (\n \n {this.props.children}\n {this.props.loading ? : null}\n \n )\n }\n}\n\nButton.defaultProps = {\n className: \"btn-default\",\n\n type: \"submit\",\n\n loading: false,\n disabled: false,\n\n onClick: null,\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n \n {props.choices.map((item) => {\n return (\n \n {\"- - \".repeat(item.level) + item.label}\n \n )\n })}\n \n )\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n isValidated() {\n return typeof this.props.validation !== \"undefined\"\n }\n\n getClassName() {\n let className = \"form-group\"\n if (this.isValidated()) {\n className += \" has-feedback\"\n if (this.props.validation === null) {\n className += \" has-success\"\n } else {\n className += \" has-error\"\n }\n }\n return className\n }\n\n getFeedback() {\n if (this.props.validation) {\n return (\n
    \n {this.props.validation.map((error, i) => {\n return

    {error}

    \n })}\n
    \n )\n } else {\n return null\n }\n }\n\n getFeedbackDescription() {\n if (this.isValidated()) {\n return (\n \n {this.props.validation\n ? pgettext(\"field validation status\", \"(error)\")\n : pgettext(\"field validation status\", \"(success)\")}\n \n )\n } else {\n return null\n }\n }\n\n getHelpText() {\n if (this.props.helpText) {\n return

    {this.props.helpText}

    \n } else {\n return null\n }\n }\n\n render() {\n return (\n
    \n \n {this.props.label + \":\"}\n \n
    \n {this.props.children}\n {this.getFeedbackDescription()}\n {this.getFeedback()}\n {this.getHelpText()}\n {this.props.extra || null}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport { required } from \"../utils/validators\"\nimport snackbar from \"../services/snackbar\"\n\nlet validateRequired = required()\n\nexport default class extends React.Component {\n validate() {\n let errors = {}\n if (!this.state.validators) {\n return errors\n }\n\n let validators = {\n required: this.state.validators.required || this.state.validators,\n optional: this.state.validators.optional || {},\n }\n\n let validatedFields = []\n\n // add required fields to validation\n for (let name in validators.required) {\n if (\n validators.required.hasOwnProperty(name) &&\n validators.required[name]\n ) {\n validatedFields.push(name)\n }\n }\n\n // add optional fields to validation\n for (let name in validators.optional) {\n if (\n validators.optional.hasOwnProperty(name) &&\n validators.optional[name]\n ) {\n validatedFields.push(name)\n }\n }\n\n // validate fields values\n for (let i in validatedFields) {\n let name = validatedFields[i]\n let fieldErrors = this.validateField(name, this.state[name])\n\n if (fieldErrors === null) {\n errors[name] = null\n } else if (fieldErrors) {\n errors[name] = fieldErrors\n }\n }\n\n return errors\n }\n\n isValid() {\n let errors = this.validate()\n for (let field in errors) {\n if (errors.hasOwnProperty(field)) {\n if (errors[field] !== null) {\n return false\n }\n }\n }\n\n return true\n }\n\n validateField(name, value) {\n let errors = []\n if (!this.state.validators) {\n return errors\n }\n\n let validators = {\n required: (this.state.validators.required || this.state.validators)[name],\n optional: (this.state.validators.optional || {})[name],\n }\n\n let requiredError = validateRequired(value) || false\n\n if (validators.required) {\n if (requiredError) {\n errors = [requiredError]\n } else {\n for (let i in validators.required) {\n let validationError = validators.required[i](value)\n if (validationError) {\n errors.push(validationError)\n }\n }\n }\n\n return errors.length ? errors : null\n } else if (requiredError === false && validators.optional) {\n for (let i in validators.optional) {\n let validationError = validators.optional[i](value)\n if (validationError) {\n errors.push(validationError)\n }\n }\n\n return errors.length ? errors : null\n }\n\n return false // false === field wasn't validated\n }\n\n bindInput = (name) => {\n return (event) => {\n this.changeValue(name, event.target.value)\n }\n }\n\n changeValue = (name, value) => {\n let newState = {\n [name]: value,\n }\n\n const formErrors = this.state.errors || {}\n formErrors[name] = this.validateField(name, newState[name])\n newState.errors = formErrors\n\n this.setState(newState)\n }\n\n clean() {\n return true\n }\n\n send() {\n return null\n }\n\n handleSuccess(success) {\n return\n }\n\n handleError(rejection) {\n snackbar.apiError(rejection)\n }\n\n handleSubmit = (event) => {\n // we don't reload page on submissions\n if (event) {\n event.preventDefault()\n }\n\n if (this.state.isLoading) {\n return\n }\n\n if (this.clean()) {\n this.setState({ isLoading: true })\n let promise = this.send()\n\n if (promise) {\n promise.then(\n (success) => {\n this.setState({ isLoading: false })\n this.handleSuccess(success)\n },\n (rejection) => {\n this.setState({ isLoading: false })\n this.handleError(rejection)\n }\n )\n } else {\n this.setState({ isLoading: false })\n }\n }\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n isActive() {\n if (this.props.isControlled) {\n return this.props.isActive\n } else {\n if (this.props.path) {\n return document.location.pathname.indexOf(this.props.path) === 0\n } else {\n return false\n }\n }\n }\n\n getClassName() {\n if (this.isActive()) {\n return (\n (this.props.className || \"\") +\n \" \" +\n (this.props.activeClassName || \"active\")\n )\n } else {\n return this.props.className || \"\"\n }\n }\n\n render() {\n return
  • {this.props.children}
  • \n }\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n
    \n
    \n
    \n )\n}\n","const ytRegExp = new RegExp(\n \"^.*(?:(?:youtu.be/|v/|vi/|u/w/|embed/)|(?:(?:watch)??v(?:i)?=|&v(?:i)?=))([^#&?]*).*\"\n)\n\nexport class OneBox {\n constructor() {\n this._youtube = {}\n }\n\n render = (element) => {\n if (!element) return\n this.highlightCode(element)\n this.embedYoutubePlayers(element)\n }\n\n highlightCode(element) {\n import(\"highlight\").then(({ default: hljs }) => {\n const codeblocks = element.querySelectorAll(\"pre>code\")\n for (let i = 0; i < codeblocks.length; i++) {\n hljs.highlightElement(codeblocks[i])\n }\n })\n }\n\n embedYoutubePlayers(element) {\n const anchors = element.querySelectorAll(\"p>a\")\n for (let i = 0; i < anchors.length; i++) {\n const a = anchors[i]\n const p = a.parentNode\n const onlyChild = p.childNodes.length === 1\n\n if (!this._youtube[a.href]) {\n this._youtube[a.href] = parseYoutubeUrl(a.href)\n }\n\n const youtubeMovie = this._youtube[a.href]\n if (onlyChild && !!youtubeMovie && youtubeMovie.data !== false) {\n this.swapYoutubePlayer(a, youtubeMovie)\n }\n }\n }\n\n swapYoutubePlayer(element, youtube) {\n let url = \"https://www.youtube.com/embed/\"\n url += youtube.video\n url += \"?feature=oembed\"\n if (youtube.start) {\n url += \"&start=\" + youtube.start\n }\n\n const player = $(\n '\"\n )\n $(element).replaceWith(player)\n player.wrap('
    ')\n }\n}\n\nexport default new OneBox()\n\nexport function parseYoutubeUrl(url) {\n const cleanedUrl = cleanUrl(url)\n const video = getVideoIdFromUrl(cleanedUrl)\n\n if (!video) return null\n\n let start = 0\n if (cleanedUrl.indexOf(\"?\") > 0) {\n const query = cleanedUrl.substr(cleanedUrl.indexOf(\"?\") + 1)\n const timebit = query.split(\"&\").filter((i) => {\n return i.substr(0, 2) === \"t=\"\n })[0]\n\n if (timebit) {\n const bits = timebit.substr(2).split(\"m\")\n if (bits[0].substr(-1) === \"s\") {\n start += parseInt(bits[0].substr(0, bits[0].length - 1))\n } else {\n start += parseInt(bits[0]) * 60\n if (!!bits[1] && bits[1].substr(-1) === \"s\") {\n start += parseInt(bits[1].substr(0, bits[1].length - 1))\n }\n }\n }\n }\n\n return {\n start,\n video,\n }\n}\n\nexport function cleanUrl(url) {\n let clean = url\n\n if (url.substr(0, 8) === \"https://\") {\n clean = clean.substr(8)\n } else if (url.substr(0, 7) === \"http://\") {\n clean = clean.substr(7)\n }\n\n if (clean.substr(0, 4) === \"www.\") {\n clean = clean.substr(4)\n }\n\n return clean\n}\n\nexport function getVideoIdFromUrl(url) {\n if (url.indexOf(\"youtu\") === -1) return null\n\n const video = url.match(ytRegExp)\n if (video) {\n return video[1]\n }\n return null\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport onebox from \"misago/services/one-box\"\n\nexport default class extends React.Component {\n componentDidMount() {\n onebox.render(this.documentNode)\n $(this.documentNode).find(\".spoiler-reveal\").click(revealSpoiler)\n }\n\n componentDidUpdate(prevProps, prevState) {\n onebox.render(this.documentNode)\n $(this.documentNode).find(\".spoiler-reveal\").click(revealSpoiler)\n }\n\n shouldComponentUpdate(nextProps, nextState) {\n return nextProps.markup !== this.props.markup\n }\n\n render() {\n return (\n {\n this.documentNode = node\n }}\n />\n )\n }\n}\n\nfunction revealSpoiler(event) {\n var btn = event.target\n $(btn).parent().parent().addClass(\"revealed\")\n}\n","import React from \"react\"\nimport Loader from \"misago/components/loader\"\n\nexport default class extends React.Component {\n render() {\n return (\n
    \n \n
    \n )\n }\n}\n","import React from \"react\"\nimport PanelMessage from \"misago/components/panel-message\"\n\nexport default class extends PanelMessage {\n getHelpText() {\n if (this.props.helpText) {\n return

    {this.props.helpText}

    \n } else {\n return null\n }\n }\n\n render() {\n return (\n
    \n
    \n \n {this.props.icon || \"info_outline\"}\n \n
    \n
    \n

    {this.props.message}

    \n {this.getHelpText()}\n \n {pgettext(\"modal message dismiss btn\", \"Ok\")}\n \n
    \n
    \n )\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getHelpText() {\n if (this.props.helpText) {\n return

    {this.props.helpText}

    \n } else {\n return null\n }\n }\n\n render() {\n return (\n
    \n
    \n \n {this.props.icon || \"info_outline\"}\n \n
    \n
    \n

    {this.props.message}

    \n {this.getHelpText()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport MisagoMarkup from \"misago/components/misago-markup\"\n\nexport default function (props) {\n if (props.post.content) {\n return \n } else {\n return \n }\n}\n\nexport function Default(props) {\n return (\n
    \n \n
    \n )\n}\n\nexport function Invalid(props) {\n return (\n
    \n

    \n {pgettext(\n \"post body invalid\",\n \"This post's contents cannot be displayed.\"\n )}\n

    \n

    \n {pgettext(\n \"post body invalid\",\n \"This error is caused by invalid post content manipulation.\"\n )}\n

    \n
    \n )\n}\n","import React from \"react\"\n\nexport default function ({ post }) {\n const { category, thread } = post\n\n const tooltip = interpolate(\n pgettext(\"posts feed item header\", \"posted %(posted_on)s\"),\n {\n posted_on: post.posted_on.format(\"LL, LT\"),\n },\n true\n )\n\n return (\n
    \n \n {thread.title}\n \n \n {category.name}\n \n \n {post.posted_on.fromNow()}\n \n
    \n )\n}\n","import React from \"react\"\n\nexport default function ({ post }) {\n return (\n \n \n {pgettext(\"go to post link\", \"See post\")}\n \n chevron_right\n \n )\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport GoToButton from \"./button\"\n\nexport default function ({ post }) {\n return (\n
    \n \n
    \n
    \n \n \n \n
    \n
    \n
    \n {post.poster_name}\n
    \n \n {pgettext(\"post removed poster username\", \"Removed user\")}\n \n
    \n
    \n
    \n )\n}\n","import React from \"react\"\n\nexport default function ({ rank, title }) {\n let userTitle = title || rank.title || rank.name\n\n let className = \"user-title\"\n if (rank.css_class) {\n className += \" user-title-\" + rank.css_class\n }\n\n if (rank.is_tab) {\n return (\n \n {userTitle}\n \n )\n }\n\n return {userTitle}\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport GoToButton from \"./button\"\nimport UserTitle from \"./user-title\"\n\nexport default function ({ post, poster }) {\n return (\n
    \n \n
    \n
    \n \n \n \n
    \n \n
    \n
    \n )\n}\n","import React from \"react\"\nimport Anonymous from \"./anonymous\"\nimport Registered from \"./registered\"\n\nexport default function ({ post, poster }) {\n if (poster && poster.id) {\n return \n }\n\n return \n}\n","import React from \"react\"\nimport Body from \"./body\"\nimport Header from \"./header\"\nimport PostSide from \"./post-side\"\n\nexport default function ({ post, poster }) {\n const user = poster || post.poster\n\n let className = \"post\"\n if (user && user.rank.css_class) {\n className += \" post-\" + user.rank.css_class\n }\n\n return (\n
  • \n
    \n
    \n
    \n \n
    \n \n
    \n
    \n
    \n
  • \n )\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport * as random from \"misago/utils/random\"\n\nexport default function () {\n return (\n
      \n
    • \n
      \n
      \n
      \n
      \n
      \n
      \n \n \n \n
      \n
      \n
      \n \n \n  \n \n \n
      \n \n \n  \n \n \n
      \n
      \n
      \n
      \n \n  \n \n
      \n
      \n
      \n

      \n \n  \n \n  \n \n  \n \n  \n \n  \n \n

      \n
      \n
      \n
      \n
      \n
      \n
    • \n
    \n )\n}\n","import React from \"react\"\nimport Post from \"./post\"\nimport Preview from \"./preview\"\n\nexport default function ({ isReady, posts, poster }) {\n if (!isReady) {\n return \n }\n\n return (\n
      \n {posts.map((post) => {\n return \n })}\n
    \n )\n}\n","import React from \"react\"\nimport posting from \"../../services/posting\"\nimport { getGlobalState, getQuoteMarkup } from \"../posting\"\n\nexport default class PostingQuoteSelection extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n range: null,\n rect: null,\n }\n\n this.element = null\n }\n\n selected = () => {\n if (this.element) {\n const range = getQuoteSelection(this.element) || null\n const rect = range ? range.getBoundingClientRect() : null\n\n this.setState({ range, rect })\n }\n }\n\n reply = () => {\n if (!posting.isOpen()) {\n const content = getQuoteMarkup(this.state.range)\n posting.open(Object.assign({}, this.props.posting, { default: content }))\n\n this.setState({ range: null, rect: null })\n\n window.setTimeout(focusEditor, 1000)\n } else {\n const globalState = getGlobalState()\n if (globalState && !globalState.disabled) {\n globalState.quote(getQuoteMarkup(this.state.range))\n this.setState({ range: null, rect: null })\n focusEditor()\n }\n }\n }\n\n render = () => (\n
    \n {\n if (element) {\n this.element = element\n }\n }}\n onMouseUp={this.selected}\n onTouchEnd={this.selected}\n >\n {this.props.children}\n
    \n {!!this.state.rect && (\n \n
    \n
    \n \n {pgettext(\"post reply\", \"Quote\")}\n \n
    \n
    \n )}\n
    \n )\n}\n\nfunction focusEditor() {\n const textarea = document.querySelector(\"#posting-mount textarea\")\n textarea.focus()\n textarea.selectionStart = textarea.selectionEnd = textarea.value.length\n}\n\nconst getQuoteSelection = (container) => {\n if (typeof window.getSelection === \"undefined\") return\n\n // Validate that selection is of valid type and has one range\n const selection = window.getSelection()\n if (!selection) return\n if (selection.type !== \"Range\") return\n if (selection.rangeCount !== 1) return\n\n // Validate that selection is within the container and post's article\n const range = selection.getRangeAt(0)\n if (!isRangeContained(range, container)) return\n if (!isPostContained(range)) return\n if (!isAnyTextSelected(range.cloneContents())) return\n\n return range\n}\n\nconst isRangeContained = (range, container) => {\n const node = range.commonAncestorContainer\n if (node === container) return true\n\n let p = node.parentNode\n while (p) {\n if (p === container) return true\n p = p.parentNode\n }\n\n return false\n}\n\nconst isPostContained = (range) => {\n const element = range.commonAncestorContainer\n if (element.nodeName === \"ARTICLE\") return true\n if (element.dataset && element.dataset.noquote === \"1\") return false\n let p = element.parentNode\n while (p) {\n if (p.dataset && p.dataset.noquote === \"1\") return false\n if (p.nodeName === \"ARTICLE\") return true\n p = p.parentNode\n }\n return false\n}\n\nconst isAnyTextSelected = (node) => {\n for (let i = 0; i < node.childNodes.length; i++) {\n const child = node.childNodes[i]\n if (child.nodeType === Node.TEXT_NODE) {\n if (child.textContent && child.textContent.trim().length > 0) return true\n }\n if (child.nodeName === \"IMG\") return true\n if (isAnyTextSelected(child)) return true\n }\n\n return false\n}\n","const getQuoteMarkup = (range) => {\n const metadata = getQuoteMetadata(range)\n let markup = convertNodesToMarkup(range.cloneContents().childNodes, [])\n let prefix = metadata ? `[quote=\"${metadata}\"]\\n` : \"[quote]\\n\"\n let suffix = \"\\n[/quote]\\n\\n\"\n\n const codeBlock = getQuoteCodeBlock(range)\n if (codeBlock) {\n prefix += codeBlock.syntax ? `[code=${codeBlock.syntax}]\\n` : \"[code]\\n\"\n suffix = \"\\n[/code]\" + suffix\n } else if (isNodeInlineCodeBlock(range)) {\n markup = markup.trim()\n prefix += \"`\"\n suffix = \"`\" + suffix\n } else {\n markup = markup.trim()\n }\n\n return prefix + markup + suffix\n}\n\nexport default getQuoteMarkup\n\nconst getQuoteMetadata = (range) => {\n const node = range.commonAncestorContainer\n if (isNodeElementWithQuoteMetadata(node)) {\n return getQuoteMetadataFromNode(node)\n }\n\n let p = node.parentNode\n while (p) {\n if (isNodeElementWithQuoteMetadata(p)) {\n return getQuoteMetadataFromNode(p)\n }\n p = p.parentNode\n }\n\n return \"\"\n}\n\nconst isNodeElementWithQuoteMetadata = (node) => {\n if (node.nodeType !== Node.ELEMENT_NODE) return false\n if (node.nodeName === \"ARTICLE\") return true\n if (node.nodeName === \"BLOCKQUOTE\") {\n return node.dataset && node.dataset.block === \"quote\"\n }\n\n return false\n}\n\nconst getQuoteMetadataFromNode = (element) => {\n if (element.dataset) {\n return element.dataset.author || null\n }\n return null\n}\n\nconst getQuoteCodeBlock = (range) => {\n const node = range.commonAncestorContainer\n if (isNodeCodeBlock(node)) {\n return getNodeCodeBlockMeta(node)\n }\n\n let p = node.parentNode\n while (p) {\n if (isNodeCodeBlock(p)) {\n return getNodeCodeBlockMeta(p)\n }\n p = p.parentNode\n }\n\n return null\n}\n\nconst isNodeCodeBlock = (node) => {\n return node.nodeName === \"PRE\"\n}\n\nconst isNodeInlineCodeBlock = (range) => {\n const node = range.commonAncestorContainer\n if (node.nodeName === \"CODE\") {\n return true\n }\n\n let p = node.parentNode\n while (p) {\n if (isNodeElementWithQuoteMetadata(p)) {\n return false\n }\n\n if (p.nodeName === \"CODE\") {\n return true\n }\n\n p = p.parentNode\n }\n\n return false\n}\n\nconst getNodeCodeBlockMeta = (node) => {\n if (!node.dataset) {\n return { syntax: null }\n }\n\n return { syntax: node.dataset.syntax || null }\n}\n\nconst convertNodesToMarkup = (nodes, stack) => {\n let markup = \"\"\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]\n markup += convertNodeToMarkup(node, stack)\n }\n return markup\n}\n\nconst SIMPLE_NODE_MAPPINGS = {\n H1: [\"\\n\\n# \", \"\"],\n H2: [\"\\n\\n## \", \"\"],\n H3: [\"\\n\\n### \", \"\"],\n H4: [\"\\n\\n#### \", \"\"],\n H5: [\"\\n\\n##### \", \"\"],\n H6: [\"\\n\\n###### \", \"\"],\n STRONG: [\"**\", \"**\"],\n EM: [\"*\", \"*\"],\n DEL: [\"~~\", \"~~\"],\n B: [\"[b]\", \"[/b]\"],\n U: [\"[u]\", \"[/u]\"],\n I: [\"[i]\", \"[/i]\"],\n SUB: [\"[sub]\", \"[/sub]\"],\n SUP: [\"[sup]\", \"[/sup]\"],\n}\n\nconst convertNodeToMarkup = (node, stack) => {\n const dataset = node.dataset || {}\n\n if (node.nodeType === Node.TEXT_NODE) {\n return node.textContent || \"\"\n }\n\n if (node.nodeType === Node.ELEMENT_NODE) {\n if (dataset.quote) {\n return dataset.quote || \"\"\n }\n if (dataset.noquote === \"1\") return \"\"\n }\n\n if (\n node.nodeType === Node.ELEMENT_NODE &&\n dataset.quote &&\n dataset.quote.trim()\n ) {\n return \"\"\n }\n\n if (node.nodeName === \"HR\") {\n return \"\\n\\n- - -\"\n }\n\n if (SIMPLE_NODE_MAPPINGS[node.nodeName]) {\n const [prefix, suffix] = SIMPLE_NODE_MAPPINGS[node.nodeName]\n return (\n prefix +\n convertNodesToMarkup(node.childNodes, [...stack, node.nodeName]) +\n suffix\n )\n }\n\n if (node.nodeName === \"A\") {\n const href = node.href\n const text = convertNodesToMarkup(node.childNodes, [\n ...stack,\n node.nodeName,\n ])\n if (text) {\n return `[${text}](${href})`\n } else {\n return `!(${href})`\n }\n }\n\n if (node.nodeName === \"IMG\") {\n const src = node.src\n const alt = node.alt\n if (alt) {\n return `![${alt}](${src})`\n } else {\n return `!(${src})`\n }\n }\n\n if (node.nodeName === \"DIV\" || node.nodeName === \"ASIDE\") {\n const block = dataset.block && dataset.block.toUpperCase()\n if (block && SIMPLE_NODE_MAPPINGS[block]) {\n const [prefix, suffix] = SIMPLE_NODE_MAPPINGS[block]\n return (\n prefix +\n convertNodesToMarkup(node.childNodes, [...stack, block]) +\n suffix\n )\n } else {\n return convertNodesToMarkup(node.childNodes, stack)\n }\n }\n\n if (node.nodeName === \"BLOCKQUOTE\") {\n if (dataset.block === \"spoiler\") {\n const content = convertNodesToMarkup(node.childNodes, [\n ...stack,\n \"SPOILER\",\n ]).trim()\n\n if (!content) return \"\"\n\n let markup = \"\\n[spoiler]\\n\"\n markup += content\n markup += \"\\n[/spoiler]\"\n return markup\n }\n\n const content = convertNodesToMarkup(node.childNodes, [\n ...stack,\n \"QUOTE\",\n ]).trim()\n\n if (!content) return \"\"\n\n const metadata = getQuoteMetadataFromNode(node)\n let markup = metadata ? `\\n[quote=${metadata}]\\n` : \"\\n\\n[quote]\\n\"\n markup += content\n markup += \"\\n[/quote]\"\n return markup\n }\n\n if (node.nodeName === \"PRE\") {\n const syntax = dataset.syntax || null\n const code = node.querySelector(\"code\")\n const content = code ? code.innerText || \"\" : \"\"\n\n if (!content.trim()) return \"\"\n\n return \"\\n[code\" + (syntax ? \"=\" + syntax : \"\") + \"]\" + content + \"[/code]\"\n }\n\n if (node.nodeName === \"CODE\") {\n return \"`\" + node.innerText + \"`\"\n }\n\n if (node.nodeName === \"P\") {\n return (\n \"\\n\" + convertNodesToMarkup(node.childNodes, [...stack, node.nodeName])\n )\n }\n\n if (node.nodeName === \"UL\" || node.nodeName === \"OL\") {\n const level = stack.filter((item) => item === \"OL\" || item === \"UL\").length\n const prefix = level === 0 ? \"\\n\" : \"\"\n return (\n prefix + convertNodesToMarkup(node.childNodes, [...stack, node.nodeName])\n )\n }\n\n if (node.nodeName === \"LI\") {\n let prefix = \"\"\n const level = stack.filter((item) => item === \"OL\" || item === \"UL\").length\n for (let i = 1; i < level; i++) {\n prefix += \" \"\n }\n\n const ordered = stack[stack.length - 1] === \"OL\"\n if (ordered) {\n prefix += dataset.index ? dataset.index + \". \" : \"1. \"\n } else {\n prefix += \"- \"\n }\n\n const content = convertNodesToMarkup(node.childNodes, [\n ...stack,\n node.nodeName,\n ])\n if (!content.trim()) return \"\"\n\n return \"\\n\" + prefix + content\n }\n\n if (node.nodeName === \"SPAN\") {\n return convertNodesToMarkup(node.childNodes, stack)\n }\n\n return \"\"\n}\n","export function getGlobalState() {\n return window.misagoReply\n}\n\nexport function setGlobalState(disabled, quote) {\n window.misagoReply = { disabled, quote }\n}\n\nexport function clearGlobalState() {\n window.misagoReply = null\n}\n","import moment from \"moment\"\n\nexport function clean(attachments) {\n return attachments\n .filter((attachment) => {\n return attachment.id && !attachment.isRemoved\n })\n .map((a) => {\n return a.id\n })\n}\n\nexport function hydrate(attachments) {\n return attachments.map((attachment) => {\n return Object.assign({}, attachment, {\n uploaded_on: moment(attachment.uploaded_on),\n })\n })\n}\n","import React from \"react\"\nimport formatFilesize from \"../../utils/file-size\"\n\nexport default function MarkupAttachmentModal({ attachment }) {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"markup editor\", \"Attachment details\")}\n

    \n
    \n
    \n {!!attachment.is_image && (\n
    \n \n \"\"\n \n
    \n )}\n
    \n {attachment.filename}\n
    \n
    \n
    \n \n {attachment.filetype + \", \" + formatFilesize(attachment.size)}\n \n
    \n {pgettext(\"markup editor\", \"Type and size\")}\n
    \n
    \n
    \n \n \n {attachment.uploaded_on.fromNow()}\n \n \n
    \n {pgettext(\"markup editor\", \"Uploaded at\")}\n
    \n
    \n
    \n {attachment.url.uploader ? (\n \n {attachment.uploader_name}\n \n ) : (\n {attachment.uploader_name}\n )}\n
    \n {pgettext(\"markup editor\", \"Uploader\")}\n
    \n
    \n
    \n
    \n
    \n \n {pgettext(\"modal\", \"Close\")}\n \n
    \n
    \n
    \n )\n}\n","const wrapSelection = (selection, update, prefix, suffix, def) => {\n const text = selection.text || def || \"\"\n let newValue = selection.prefix\n newValue += prefix + text + suffix\n newValue += selection.suffix\n update(newValue)\n\n window.setTimeout(() => {\n focus(selection.textarea)\n\n const caret = selection.start + prefix.length\n selection.textarea.setSelectionRange(caret, caret + text.length)\n }, 250)\n}\n\nconst replaceSelection = (selection, update, text) => {\n let newValue = selection.prefix\n newValue += text\n newValue += selection.suffix\n update(newValue)\n\n window.setTimeout(() => {\n focus(selection.textarea)\n\n const caret = selection.end + text.length\n selection.textarea.setSelectionRange(caret, caret)\n }, 250)\n}\n\nconst getSelection = (textarea) => {\n if (document.selection) {\n textarea.focus()\n const range = document.selection.createRange()\n const length = range.text.length\n range.moveStart(\"character\", -textarea.value.length)\n return createRange(textarea, range.text.length - length, range.text.length)\n }\n\n if (textarea.selectionStart || textarea.selectionStart == \"0\") {\n return createRange(textarea, textarea.selectionStart, textarea.selectionEnd)\n }\n}\n\nconst createRange = (textarea, start, end) => {\n return {\n textarea: textarea,\n start: start,\n end: end,\n text: textarea.value.substring(start, end),\n prefix: textarea.value.substring(0, start),\n suffix: textarea.value.substring(end),\n }\n}\n\nexport function focus(textarea) {\n const scroll = textarea.scrollTop\n textarea.focus()\n textarea.scrollTop = scroll\n}\n\nexport { getSelection, replaceSelection, wrapSelection }\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport snackbar from \"../../services/snackbar\"\nimport formatFilesize from \"../../utils/file-size\"\nimport MarkupAttachmentModal from \"./MarkupAttachmentModal\"\nimport { getSelection, replaceSelection } from \"./operations\"\n\nconst MarkupEditorAttachment = ({\n attachment,\n disabled,\n element,\n setState,\n update,\n}) => (\n
    \n
    \n
    \n {attachment.id ? (\n {\n event.preventDefault()\n modal.show()\n }}\n >\n {attachment.filename}\n \n ) : (\n {attachment.filename}\n )}\n
    \n
      \n {!attachment.id &&
    • {attachment.progress + \"%\"}
    • }\n {!!attachment.filetype &&
    • {attachment.filetype}
    • }\n {attachment.size > 0 &&
    • {formatFilesize(attachment.size)}
    • }\n
    \n
    \n
    \n {!!attachment.id && (\n
    \n {\n const markup = getAttachmentMarkup(attachment)\n const selection = getSelection(element)\n replaceSelection(selection, update, markup)\n }}\n >\n flip_to_front\n \n {\n setState(({ attachments }) => {\n const confirm = window.confirm(\n pgettext(\"markup editor\", \"Remove this attachment?\")\n )\n\n if (confirm) {\n return {\n attachments: attachments.filter(\n ({ id }) => id !== attachment.id\n ),\n }\n }\n })\n }}\n >\n close\n \n
    \n )}\n {!attachment.id && !!attachment.key && (\n
    \n {attachment.error && (\n {\n snackbar.error(\n interpolate(\n pgettext(\"markup editor\", \"%(filename)s: %(error)s\"),\n { filename: attachment.filename, error: attachment.error },\n true\n )\n )\n }}\n >\n warning\n \n )}\n {\n setState(({ attachments }) => {\n return {\n attachments: attachments.filter(\n ({ key }) => key !== attachment.key\n ),\n }\n })\n }}\n >\n close\n \n
    \n )}\n
    \n
    \n)\n\nexport default MarkupEditorAttachment\n\nfunction getAttachmentMarkup(attachment) {\n let markup = \"[\"\n\n if (attachment.is_image) {\n markup += \"![\" + attachment.filename + \"]\"\n markup += \"(\" + (attachment.url.thumb || attachment.url.index) + \"?shva=1)\"\n } else {\n markup += attachment.filename\n }\n\n markup += \"](\" + attachment.url.index + \"?shva=1)\"\n return markup\n}\n","import React from \"react\"\nimport MarkupEditorAttachment from \"./MarkupEditorAttachment\"\n\nconst MarkupEditorAttachments = ({\n attachments,\n disabled,\n element,\n setState,\n update,\n}) => (\n
    \n
    \n {attachments.map((attachment) => (\n \n ))}\n
    \n
    \n)\n\nexport default MarkupEditorAttachments\n","import React from \"react\"\nimport Button from \"../button\"\n\nconst MarkupEditorFooter = ({\n canProtect,\n disabled,\n empty,\n preview,\n isProtected,\n submitText,\n showPreview,\n closePreview,\n enableProtection,\n disableProtection,\n}) => (\n
    \n {!!canProtect && (\n {\n if (isProtected) {\n disableProtection()\n } else {\n enableProtection()\n }\n }}\n >\n \n {isProtected ? \"lock\" : \"lock_open\"}\n \n \n )}\n {!!canProtect && (\n
    \n {\n if (isProtected) {\n disableProtection()\n } else {\n enableProtection()\n }\n }}\n >\n \n {isProtected ? \"lock\" : \"lock_open\"}\n \n {isProtected\n ? pgettext(\"markup editor\", \"Protected\")\n : pgettext(\"markup editor\", \"Protect\")}\n \n
    \n )}\n
    \n {preview ? (\n \n {pgettext(\"markup editor\", \"Edit\")}\n \n ) : (\n \n {pgettext(\"markup editor\", \"Preview\")}\n \n )}\n \n
    \n)\n\nexport default MarkupEditorFooter\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport FormGroup from \"../form-group\"\nimport { replaceSelection } from \"./operations\"\n\nclass MarkupCodeModal extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n error: null,\n syntax: \"\",\n text: props.selection.text,\n }\n }\n\n handleSubmit = (ev) => {\n ev.preventDefault()\n\n const { selection, update } = this.props\n const syntax = this.state.syntax.trim()\n const text = this.state.text.trim()\n\n if (text.length === 0) {\n this.setState({ error: gettext(\"This field is required.\") })\n return false\n }\n\n const prefix = selection.prefix.trim().length ? \"\\n\\n\" : \"\"\n\n replaceSelection(\n Object.assign({}, selection, { text }),\n update,\n prefix + \"```\" + syntax + \"\\n\" + text + \"\\n```\\n\\n\"\n )\n\n modal.hide()\n\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    {pgettext(\"markup editor\", \"Code\")}

    \n
    \n
    \n
    \n \n \n this.setState({ syntax: event.target.value })\n }\n >\n \n {LANGUAGES.map(({ value, name }) => (\n \n ))}\n \n \n \n \n this.setState({ text: event.target.value })\n }\n />\n \n
    \n
    \n \n {pgettext(\"markup editor\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nconst LANGUAGES = [\n { value: \"bash\", name: \"Bash\" },\n { value: \"c\", name: \"C\" },\n { value: \"c#\", name: \"C#\" },\n { value: \"c++\", name: \"C++\" },\n { value: \"css\", name: \"CSS\" },\n { value: \"diff\", name: \"Diff\" },\n { value: \"go\", name: \"Go\" },\n { value: \"graphql\", name: \"GraphQL\" },\n { value: \"html,\", name: \"HTML\" },\n { value: \"xml\", name: \"XML\" },\n { value: \"json\", name: \"JSON\" },\n { value: \"java\", name: \"Java\" },\n { value: \"javascript\", name: \"JavaScript\" },\n { value: \"kotlin\", name: \"Kotlin\" },\n { value: \"less\", name: \"Less\" },\n { value: \"lua\", name: \"Lua\" },\n { value: \"makefile\", name: \"Makefile\" },\n { value: \"markdown\", name: \"Markdown\" },\n { value: \"objective-C\", name: \"Objective-C\" },\n { value: \"php\", name: \"PHP\" },\n { value: \"perl\", name: \"Perl\" },\n { value: \"plain\", name: \"Plain\" },\n { value: \"text\", name: \"text\" },\n { value: \"python\", name: \"Python\" },\n { value: \"repl\", name: \"REPL\" },\n { value: \"r\", name: \"R\" },\n { value: \"ruby\", name: \"Ruby\" },\n { value: \"rust\", name: \"Rust\" },\n { value: \"scss\", name: \"SCSS\" },\n { value: \"sql\", name: \"SQL\" },\n { value: \"shell\", name: \"Shell Session\" },\n { value: \"swift\", name: \"Swift\" },\n { value: \"toml\", name: \"TOML\" },\n { value: \"ini\", name: \"INI\" },\n { value: \"typescript\", name: \"TypeScript\" },\n { value: \"visualbasic\", name: \"Visual Basic .NET\" },\n { value: \"webassembly\", name: \"WebAssembly\" },\n { value: \"yaml\", name: \"YAML\" },\n]\n\nexport default MarkupCodeModal\n","import React from \"react\"\nimport formatFilesize from \"../../utils/file-size\"\n\nexport default function MarkupFormattingHelpModal() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"markup help\", \"Formatting help\")}\n

    \n
    \n
    \n

    {pgettext(\"markup help\", \"Emphasis text\")}

    \n \n \n {pgettext(\"markup help\", \"This text will have emphasis\")}\n \n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Bold text\")}

    \n \n \n {pgettext(\"markup help\", \"This text will be bold\")}\n \n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Removed text\")}

    \n \n \n {pgettext(\"markup help\", \"This text will be removed\")}\n \n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Bold text (BBCode)\")}

    \n \n {pgettext(\"markup help\", \"This text will be bold\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Underlined text (BBCode)\")}

    \n \n {pgettext(\"markup help\", \"This text will be underlined\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Italics text (BBCode)\")}

    \n \n {pgettext(\"markup help\", \"This text will be in italics\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Link\")}

    \n \"\n result={\n

    \n example.com\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Link with text\")}

    \n \n {pgettext(\"markup help\", \"Link text\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Link (BBCode)\")}

    \n \n example.com\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Link with text (BBCode)\")}

    \n \n {pgettext(\"markup help\", \"Link text\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Image\")}

    \n \n \"\"\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Image with alternate text\")}

    \n \n \n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Image (BBCode)\")}

    \n \n \"\"\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Mention user by their name\")}

    \n \n @username\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 1\")}

    \n {pgettext(\"markup help\", \"First level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 2\")}

    \n {pgettext(\"markup help\", \"Second level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 3\")}

    \n {pgettext(\"markup help\", \"Third level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 4\")}

    \n {pgettext(\"markup help\", \"Fourth level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Heading 5\")}

    \n {pgettext(\"markup help\", \"Fifth level heading\")}}\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Unordered list\")}

    \n \n
  • Lorem ipsum
  • \n
  • Dolor met
  • \n
  • Vulputate lectus
  • \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Ordered list\")}

    \n \n
  • Lorem ipsum
  • \n
  • Dolor met
  • \n
  • Vulputate lectus
  • \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Quote text\")}

    \n \" + pgettext(\"markup help\", \"Quoted text\")}\n result={\n
    \n

    {pgettext(\"markup help\", \"Quoted text\")}

    \n
    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Quote text (BBCode)\")}

    \n \n
    \n {gettext(\"Quoted message:\")}\n
    \n
    \n

    {pgettext(\"markup help\", \"Quoted text\")}

    \n
    \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Quote text with author (BBCode)\")}

    \n \n
    \n {pgettext(\"markup help\", \"Quote author has written:\")}\n
    \n
    \n

    {pgettext(\"markup help\", \"Quoted text\")}

    \n
    \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Spoiler\")}

    \n \n {pgettext(\"markup help\", \"Secret text\")}\n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Inline code\")}

    \n \n {pgettext(\"markup help\", \"Inline code\")}\n

    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Code block\")}

    \n \n alert(\"Hello world!\");\n \n }\n />\n\n
    \n\n

    \n {pgettext(\"markup help\", \"Code block with syntax highlighting\")}\n

    \n \n \n print(\"Hello world!\");\n \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Code block (BBCode)\")}

    \n \n alert(\"Hello world!\");\n \n }\n />\n\n
    \n\n

    \n {pgettext(\n \"markup help\",\n \"Code block with syntax highlighting (BBCode)\"\n )}\n

    \n \n \n print(\"Hello world!\");\n \n \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Horizontal rule\")}

    \n \n

    Lorem ipsum

    \n
    \n

    Dolor met

    \n
    \n }\n />\n\n
    \n\n

    {pgettext(\"markup help\", \"Horizontal rule (BBCode)\")}

    \n \n

    Lorem ipsum

    \n
    \n

    Dolor met

    \n
    \n }\n />\n
    \n
    \n \n {pgettext(\"modal\", \"Close\")}\n \n
    \n
    \n
    \n )\n}\n\nfunction ExampleFormatting({ markup, result }) {\n return (\n
    \n
    \n
    \n          {markup}\n        
    \n
    \n
    \n
    {result}
    \n
    \n
    \n )\n}\n\nclass ExampleFormattingSpoiler extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n reveal: false,\n }\n }\n\n render() {\n return (\n \n
    \n

    {this.props.children}

    \n
    \n {!this.state.reveal && (\n
    \n {\n this.setState({ reveal: true })\n }}\n >\n {gettext(\"Reveal spoiler\")}\n \n
    \n )}\n \n )\n }\n}\n","const URL_PATTERN = new RegExp(\"^(((ftps?)|(https?))://)\", \"i\")\n\nexport default function isUrl(str) {\n return URL_PATTERN.test(str.trim())\n}\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport FormGroup from \"../form-group\"\nimport isUrl from \"./isUrl\"\nimport { replaceSelection } from \"./operations\"\n\nclass MarkupImageModal extends React.Component {\n constructor(props) {\n super(props)\n\n const text = props.selection.text.trim()\n const textUrl = isUrl(text)\n\n this.state = {\n error: null,\n text: textUrl ? \"\" : text,\n url: textUrl ? text : \"\",\n }\n }\n\n handleSubmit = (ev) => {\n ev.preventDefault()\n\n const { selection, update } = this.props\n const text = this.state.text.trim()\n const url = this.state.url.trim()\n\n if (url.length === 0) {\n this.setState({ error: gettext(\"This field is required.\") })\n return false\n }\n\n if (text.length > 0) {\n replaceSelection(selection, update, \"![\" + text + \"](\" + url + \")\")\n } else {\n replaceSelection(selection, update, \"!(\" + url + \")\")\n }\n\n modal.hide()\n\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"markup editor\", \"Image\")}\n

    \n
    \n
    \n
    \n \n \n this.setState({ text: event.target.value })\n }\n />\n \n \n \n this.setState({ url: event.target.value })\n }\n />\n \n
    \n
    \n \n {pgettext(\"markup editor\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default MarkupImageModal\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport FormGroup from \"../form-group\"\nimport isUrl from \"./isUrl\"\nimport { replaceSelection } from \"./operations\"\n\nclass MarkupLinkModal extends React.Component {\n constructor(props) {\n super(props)\n\n const text = props.selection.text.trim()\n const textUrl = isUrl(text)\n\n this.state = {\n error: null,\n text: textUrl ? \"\" : text,\n url: textUrl ? text : \"\",\n }\n }\n\n handleSubmit = (ev) => {\n ev.preventDefault()\n\n const { selection, update } = this.props\n const text = this.state.text.trim()\n const url = this.state.url.trim()\n\n if (url.length === 0) {\n this.setState({ error: gettext(\"This field is required.\") })\n return false\n }\n\n if (text.length > 0) {\n replaceSelection(selection, update, \"[\" + text + \"](\" + url + \")\")\n } else {\n replaceSelection(selection, update, \"<\" + url + \">\")\n }\n\n modal.hide()\n\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    {pgettext(\"markup editor\", \"Link\")}

    \n
    \n
    \n
    \n \n \n this.setState({ text: event.target.value })\n }\n />\n \n \n \n this.setState({ url: event.target.value })\n }\n />\n \n
    \n
    \n \n {pgettext(\"markup editor\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default MarkupLinkModal\n","import React from \"react\"\nimport modal from \"../../services/modal\"\nimport FormGroup from \"../form-group\"\nimport { replaceSelection } from \"./operations\"\n\nclass MarkupQuoteModal extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n error: null,\n author: \"\",\n text: props.selection.text,\n }\n }\n\n handleSubmit = (ev) => {\n ev.preventDefault()\n\n const { selection, update } = this.props\n const author = this.state.author.trim()\n const text = this.state.text.trim()\n\n if (text.length === 0) {\n this.setState({ error: gettext(\"This field is required.\") })\n return false\n }\n\n const prefix = selection.prefix.trim().length ? \"\\n\\n\" : \"\"\n\n if (author) {\n replaceSelection(\n selection,\n update,\n prefix + '[quote=\"' + author + '\"]\\n' + text + \"\\n[/quote]\\n\\n\"\n )\n } else {\n replaceSelection(\n selection,\n update,\n prefix + \"[quote]\\n\" + text + \"\\n[/quote]\\n\\n\"\n )\n }\n\n modal.hide()\n\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"markup editor\", \"Quote\")}\n

    \n
    \n
    \n
    \n \n \n this.setState({ author: event.target.value })\n }\n />\n \n \n \n this.setState({ text: event.target.value })\n }\n />\n \n
    \n
    \n \n {pgettext(\"markup editor\", \"Cancel\")}\n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default MarkupQuoteModal\n","import React from \"react\"\n\nconst MarkupEditorButton = ({ disabled, icon, title, onClick }) => (\n \n {icon}\n \n)\n\nexport default MarkupEditorButton\n","import moment from \"moment\"\nimport misago from \"../../\"\nimport ajax from \"../../services/ajax\"\nimport snackbar from \"../../services/snackbar\"\nimport formatFilesize from \"../../utils/file-size\"\nimport getRandomString from \"../../utils/getRandomString\"\n\nconst ID_LEN = 32\n\nconst uploadFile = (file, setState) => {\n const maxSize = misago.get(\"user\").acl.max_attachment_size * 1024\n\n if (file.size > maxSize) {\n snackbar.error(\n interpolate(\n pgettext(\n \"markup editor\",\n \"File %(filename)s is bigger than %(limit)s.\"\n ),\n { filename: file.name, limit: formatFilesize(maxSize) },\n true\n )\n )\n\n return\n }\n\n let upload = {\n id: null,\n key: getRandomString(ID_LEN),\n error: null,\n uploaded_on: null,\n progress: 0,\n filename: file.name,\n filetype: null,\n is_image: false,\n size: file.size,\n url: null,\n uploader_name: null,\n }\n\n setState(({ attachments }) => {\n return { attachments: [upload].concat(attachments) }\n })\n\n const refreshState = () => {\n setState(({ attachments }) => {\n return { attachments: attachments.concat() }\n })\n }\n\n const data = new FormData()\n data.append(\"upload\", file)\n\n ajax\n .upload(misago.get(\"ATTACHMENTS_API\"), data, (progress) => {\n upload.progress = progress\n refreshState()\n })\n .then(\n (data) => {\n Object.assign(upload, data, { uploaded_on: moment(data.uploaded_on) })\n refreshState()\n },\n (rejection) => {\n if (rejection.status === 400 || rejection.status === 413) {\n upload.error = rejection.detail\n snackbar.error(rejection.detail)\n refreshState()\n } else {\n snackbar.apiError(rejection)\n }\n }\n )\n}\n\nexport default uploadFile\n","import React from \"react\"\nimport misago from \"../../\"\nimport modal from \"../../services/modal\"\nimport MarkupCodeModal from \"./MarkupCodeModal\"\nimport MarkupFormattingHelpModal from \"./MarkupFormattingHelpModal\"\nimport MarkupImageModal from \"./MarkupImageModal\"\nimport MarkupLinkModal from \"./MarkupLinkModal\"\nimport MarkupQuoteModal from \"./MarkupQuoteModal\"\nimport MarkupEditorButton from \"./MarkupEditorButton\"\nimport { getSelection, replaceSelection, wrapSelection } from \"./operations\"\nimport uploadFile from \"./uploadFile\"\n\nconst MarkupEditorToolbar = ({\n disabled,\n element,\n update,\n updateAttachments,\n}) => {\n const actions = [\n {\n name: pgettext(\"markup editor\", \"Strong\"),\n icon: \"format_bold\",\n onClick: () => {\n wrapSelection(\n getSelection(element),\n update,\n \"**\",\n \"**\",\n pgettext(\"example markup\", \"Strong text\")\n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Emphasis\"),\n icon: \"format_italic\",\n onClick: () => {\n wrapSelection(\n getSelection(element),\n update,\n \"*\",\n \"*\",\n pgettext(\"example markup\", \"Text with emphasis\")\n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Strikethrough\"),\n icon: \"format_strikethrough\",\n onClick: () => {\n wrapSelection(\n getSelection(element),\n update,\n \"~~\",\n \"~~\",\n pgettext(\"example markup\", \"Text with strikethrough\")\n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Horizontal ruler\"),\n icon: \"remove\",\n onClick: () => {\n replaceSelection(getSelection(element), update, \"\\n\\n- - -\\n\\n\")\n },\n },\n {\n name: pgettext(\"markup editor\", \"Link\"),\n icon: \"insert_link\",\n onClick: () => {\n const selection = getSelection(element)\n modal.show(\n \n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Image\"),\n icon: \"insert_photo\",\n onClick: () => {\n const selection = getSelection(element)\n modal.show(\n \n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Quote\"),\n icon: \"format_quote\",\n onClick: () => {\n const selection = getSelection(element)\n modal.show(\n \n )\n },\n },\n {\n name: pgettext(\"markup editor\", \"Spoiler\"),\n icon: \"visibility_off\",\n onClick: () => {\n insertSpoiler(element, update)\n },\n },\n {\n name: pgettext(\"markup editor\", \"Code\"),\n icon: \"code\",\n onClick: () => {\n const selection = getSelection(element)\n modal.show(\n \n )\n },\n },\n ]\n\n if (misago.get(\"user\").acl.max_attachment_size) {\n actions.push({\n name: pgettext(\"markup editor\", \"Upload file\"),\n icon: \"file_upload\",\n onClick: () => uploadFiles(updateAttachments),\n })\n }\n\n return (\n
    \n
    \n {actions.map(({ name, icon, onClick }) => (\n \n ))}\n
    \n
    \n
    \n \n more_vert\n \n
      \n {actions.map(({ name, icon, onClick }) => (\n
    • \n \n {icon}\n {name}\n \n
    • \n ))}\n
    \n
    \n {\n modal.show()\n }}\n />\n
    \n
    \n )\n}\n\nconst insertSpoiler = (element, update) => {\n const selection = getSelection(element)\n const prefix = selection.prefix.trim().length ? \"\\n\\n\" : \"\"\n\n wrapSelection(\n selection,\n update,\n prefix + \"[spoiler]\\n\",\n \"\\n[/spoiler]\\n\\n\",\n pgettext(\"markup editor\", \"Spoiler text\")\n )\n}\n\nconst uploadFiles = (setState) => {\n const input = document.createElement(\"input\")\n input.type = \"file\"\n input.multiple = \"multiple\"\n\n input.addEventListener(\"change\", function () {\n for (let i = 0; i < input.files.length; i++) {\n uploadFile(input.files[i], setState)\n }\n })\n\n input.click()\n}\n\nexport default MarkupEditorToolbar\n","import React from \"react\"\nimport classnames from \"classnames\"\n\nimport misago from \"../../\"\nimport ajax from \"../../services/ajax\"\nimport snackbar from \"../../services/snackbar\"\nimport MisagoMarkup from \"../misago-markup\"\nimport MarkupEditorAttachments from \"./MarkupEditorAttachments\"\nimport MarkupEditorFooter from \"./MarkupEditorFooter\"\nimport MarkupEditorToolbar from \"./MarkupEditorToolbar\"\nimport uploadFile from \"./uploadFile\"\n\nclass MarkupEditor extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n element: null,\n focused: false,\n loading: false,\n preview: false,\n parsed: null,\n }\n }\n\n showPreview = () => {\n if (this.state.loading) return\n\n this.setState({ loading: true, preview: true, element: null })\n\n ajax.post(misago.get(\"PARSE_MARKUP_API\"), { post: this.props.value }).then(\n (data) => {\n this.setState({ loading: false, parsed: data.parsed })\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n\n this.setState({ loading: false, preview: false })\n }\n )\n }\n\n closePreview = () => {\n this.setState({ loading: false, preview: false })\n }\n\n onDrop = (event) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!event.dataTransfer.files) return\n\n const { onAttachmentsChange: setState } = this.props\n\n if (misago.get(\"user\").acl.max_attachment_size) {\n for (let i = 0; i < event.dataTransfer.files.length; i++) {\n const file = event.dataTransfer.files[i]\n uploadFile(file, setState)\n }\n }\n }\n\n onPaste = (event) => {\n const { onAttachmentsChange: setState } = this.props\n\n const files = []\n for (let i = 0; i < event.clipboardData.items.length; i++) {\n const item = event.clipboardData.items[i]\n if (item.kind === \"file\") {\n files.push(item.getAsFile())\n }\n }\n\n if (files.length) {\n event.preventDefault()\n event.stopPropagation()\n\n if (misago.get(\"user\").acl.max_attachment_size) {\n for (let i = 0; i < files.length; i++) {\n uploadFile(files[i], setState)\n }\n }\n }\n }\n\n render = () => (\n \n this.props.onChange({ target: { value } })}\n updateAttachments={this.props.onAttachmentsChange}\n />\n {this.state.preview ? (\n
    \n {this.state.loading ? (\n
    \n
    \n \n
    \n
    \n ) : (\n \n )}\n
    \n ) : (\n {\n if (element && this.state.element !== element) {\n this.setState({ element })\n setMentions(this.props, element)\n }\n }}\n onChange={this.props.onChange}\n onDrop={this.onDrop}\n onFocus={() => this.setState({ focused: true })}\n onPaste={this.onPaste}\n onBlur={() => this.setState({ focused: false })}\n />\n )}\n {this.props.attachments.length > 0 && (\n this.props.onChange({ target: { value } })}\n />\n )}\n \n
    \n )\n}\n\nfunction setMentions(props, element) {\n $(element).atwho({\n at: \"@\",\n displayTpl: '
  • \"\"${username}
  • ',\n insertTpl: \"@${username}\",\n searchKey: \"username\",\n callbacks: {\n remoteFilter: function (query, callback) {\n $.getJSON(misago.get(\"MENTION_API\"), { q: query }, callback)\n },\n },\n })\n\n $(element).on(\"inserted.atwho\", (event, _storage, source, controller) => {\n const { query } = controller\n const username = source.target.innerText.trim()\n const prefix = event.target.value.substr(0, query.headPos)\n const suffix = event.target.value.substr(query.endPos)\n\n event.target.value = prefix + username + suffix\n props.onChange(event)\n\n const caret = query.headPos + username.length\n event.target.setSelectionRange(caret, caret)\n event.target.focus()\n })\n}\n\nexport default MarkupEditor\n","import MarkupEditor from \"./MarkupEditor\"\n\nexport default MarkupEditor\n","import React from \"react\"\nimport classnames from \"classnames\"\n\nconst CLASS_ACTIVE = \"posting-active\"\nconst CLASS_DEFAULT = \"posting-default\"\nconst CLASS_MINIMIZED = \"posting-minimized\"\nconst CLASS_FULLSCREEN = \"posting-fullscreen\"\n\nclass PostingDialog extends React.Component {\n componentDidMount() {\n document.body.classList.add(CLASS_ACTIVE, CLASS_DEFAULT)\n }\n\n componentWillUnmount() {\n document.body.classList.remove(\n CLASS_ACTIVE,\n CLASS_DEFAULT,\n CLASS_MINIMIZED,\n CLASS_FULLSCREEN\n )\n }\n\n componentWillReceiveProps({ fullscreen, minimized }) {\n if (minimized) {\n document.body.classList.remove(CLASS_DEFAULT, CLASS_FULLSCREEN)\n document.body.classList.add(CLASS_MINIMIZED)\n } else {\n if (fullscreen) {\n document.body.classList.remove(CLASS_DEFAULT, CLASS_MINIMIZED)\n document.body.classList.add(CLASS_FULLSCREEN)\n } else {\n document.body.classList.remove(CLASS_FULLSCREEN, CLASS_MINIMIZED)\n document.body.classList.add(CLASS_DEFAULT)\n }\n }\n }\n\n render() {\n const { children, fullscreen, minimized } = this.props\n\n return (\n \n
    {children}
    \n \n )\n }\n}\n\nexport default PostingDialog\n","import React from \"react\"\n\nconst PostingDialogBody = ({ children }) => (\n
    {children}
    \n)\n\nexport default PostingDialogBody\n","import React from \"react\"\n\nconst PostingDialogError = ({ close, message }) => (\n
    \n
    \n error_outlined\n
    \n
    \n

    {message}

    \n \n
    \n
    \n)\n\nexport default PostingDialogError\n","import React from \"react\"\n\nconst PostingDialogHeader = ({\n children,\n close,\n fullscreen,\n minimize,\n minimized,\n fullscreenEnter,\n fullscreenExit,\n open,\n}) => (\n
    \n
    {children}
    \n {minimized ? (\n \n expand_less\n \n ) : (\n \n expand_more\n \n )}\n {fullscreen ? (\n \n fullscreen_exit\n \n ) : (\n \n fullscreen\n \n )}\n \n close\n \n
    \n)\n\nexport default PostingDialogHeader\n","import React from \"react\"\n\nexport default function PostingThreadOptions({\n isClosed,\n isHidden,\n isPinned,\n disabled,\n options,\n close,\n open,\n hide,\n unhide,\n pinGlobally,\n pinLocally,\n unpin,\n}) {\n const icons = getIcons(isClosed, isHidden, isPinned)\n\n return (\n
    \n \n {icons.length > 0 ? (\n \n {icons.map((icon) => (\n \n {icon}\n \n ))}\n \n ) : (\n more_horiz\n )}\n \n
      \n {options.pin === 2 && isPinned !== 2 && (\n
    • \n \n bookmark\n {pgettext(\"post thread\", \"Pinned globally\")}\n \n
    • \n )}\n {options.pin >= isPinned && isPinned !== 1 && (\n
    • \n \n bookmark_outline\n {pgettext(\"post thread\", \"Pinned in category\")}\n \n
    • \n )}\n {options.pin >= isPinned && isPinned !== 0 && (\n
    • \n \n radio_button_unchecked\n {pgettext(\"post thread\", \"Not pinned\")}\n \n
    • \n )}\n {options.close && !!isClosed && (\n
    • \n \n lock_outline\n {pgettext(\"post thread\", \"Open\")}\n \n
    • \n )}\n {options.close && !isClosed && (\n
    • \n \n lock\n {pgettext(\"post thread\", \"Closed\")}\n \n
    • \n )}\n {options.hide && !!isHidden && (\n
    • \n \n visibility\n {pgettext(\"post thread\", \"Visible\")}\n \n
    • \n )}\n {options.hide && !isHidden && (\n
    • \n \n visibility_off\n {pgettext(\"post thread\", \"Hidden\")}\n \n
    • \n )}\n
    \n
    \n )\n}\n\nfunction getIcons(closed, hidden, pinned) {\n const icons = []\n if (pinned === 2) icons.push(\"bookmark\")\n if (pinned === 1) icons.push(\"bookmark_outline\")\n if (closed) icons.push(\"lock\")\n if (hidden) icons.push(\"visibility_off\")\n return icons\n}\n","import React from \"react\"\nimport CategorySelect from \"misago/components/category-select\"\nimport Form from \"misago/components/form\"\nimport * as attachments from \"./utils/attachments\"\nimport { getPostValidators, getTitleValidators } from \"./utils/validators\"\nimport ajax from \"misago/services/ajax\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport MarkupEditor from \"../MarkupEditor\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../Toolbar\"\nimport PostingDialog from \"./PostingDialog\"\nimport PostingDialogBody from \"./PostingDialogBody\"\nimport PostingDialogError from \"./PostingDialogError\"\nimport PostingDialogHeader from \"./PostingDialogHeader\"\nimport PostingThreadOptions from \"./PostingThreadOptions\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n isLoading: false,\n\n error: null,\n\n minimized: false,\n fullscreen: false,\n\n options: null,\n\n title: \"\",\n category: props.category || null,\n categories: [],\n post: \"\",\n attachments: [],\n close: false,\n hide: false,\n pin: 0,\n\n validators: {\n title: getTitleValidators(),\n post: getPostValidators(),\n },\n errors: {},\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.config).then(this.loadSuccess, this.loadError)\n }\n\n loadSuccess = (data) => {\n let category = null\n let options = null\n\n // hydrate categories, extract posting options\n const categories = data.map((item) => {\n // pick first category that allows posting and if it may, override it with initial one\n if (\n item.post !== false &&\n (!category || item.id == this.state.category)\n ) {\n category = item.id\n options = item.post\n }\n\n return Object.assign(item, {\n disabled: item.post === false,\n label: item.name,\n value: item.id,\n })\n })\n\n this.setState({\n isReady: true,\n options,\n\n categories,\n category,\n })\n }\n\n loadError = (rejection) => {\n this.setState({\n error: rejection.detail,\n })\n }\n\n onCancel = () => {\n const formEmpty = !!(\n this.state.post.length === 0 &&\n this.state.title.length === 0 &&\n this.state.attachments.length === 0\n )\n\n if (formEmpty) {\n this.minimize()\n return posting.close()\n }\n\n const cancel = window.confirm(\n pgettext(\"post thread\", \"Are you sure you want to discard thread?\")\n )\n if (cancel) {\n this.minimize()\n posting.close()\n }\n }\n\n onTitleChange = (event) => {\n this.changeValue(\"title\", event.target.value)\n }\n\n onCategoryChange = (event) => {\n const category = this.state.categories.find((item) => {\n return event.target.value == item.value\n })\n\n // if selected pin is greater than allowed, reduce it\n let pin = this.state.pin\n if (category.post.pin && category.post.pin < pin) {\n pin = category.post.pin\n }\n\n this.setState({\n category: category.id,\n categoryOptions: category.post,\n\n pin,\n })\n }\n\n onPostChange = (event) => {\n this.changeValue(\"post\", event.target.value)\n }\n\n onAttachmentsChange = (attachments) => {\n this.setState(attachments)\n }\n\n onClose = () => {\n this.changeValue(\"close\", true)\n }\n\n onOpen = () => {\n this.changeValue(\"close\", false)\n }\n\n onPinGlobally = () => {\n this.changeValue(\"pin\", 2)\n }\n\n onPinLocally = () => {\n this.changeValue(\"pin\", 1)\n }\n\n onUnpin = () => {\n this.changeValue(\"pin\", 0)\n }\n\n onHide = () => {\n this.changeValue(\"hide\", true)\n }\n\n onUnhide = () => {\n this.changeValue(\"hide\", false)\n }\n\n close = () => {\n this.minimize()\n posting.close()\n }\n\n minimize = () => {\n this.setState({ fullscreen: false, minimized: true })\n }\n\n open = () => {\n this.setState({ minimized: false })\n if (this.state.fullscreen) {\n }\n }\n\n fullscreenEnter = () => {\n this.setState({ fullscreen: true, minimized: false })\n }\n\n fullscreenExit = () => {\n this.setState({ fullscreen: false, minimized: false })\n }\n\n clean() {\n if (!this.state.title.trim().length) {\n snackbar.error(\n pgettext(\"posting form\", \"You have to enter thread title.\")\n )\n return false\n }\n\n if (!this.state.post.trim().length) {\n snackbar.error(pgettext(\"posting form\", \"You have to enter a message.\"))\n return false\n }\n\n const errors = this.validate()\n\n if (errors.title) {\n snackbar.error(errors.title[0])\n return false\n }\n\n if (errors.post) {\n snackbar.error(errors.post[0])\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.post(this.props.submit, {\n title: this.state.title,\n category: this.state.category,\n post: this.state.post,\n attachments: attachments.clean(this.state.attachments),\n close: this.state.close,\n hide: this.state.hide,\n pin: this.state.pin,\n })\n }\n\n handleSuccess(success) {\n this.setState({ isLoading: true })\n this.close()\n\n snackbar.success(pgettext(\"post thread\", \"Your thread has been posted.\"))\n window.location = success.url\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n const errors = [].concat(\n rejection.non_field_errors || [],\n rejection.category || [],\n rejection.title || [],\n rejection.post || [],\n rejection.attachments || []\n )\n\n snackbar.error(errors[0])\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n const dialogProps = {\n minimized: this.state.minimized,\n minimize: this.minimize,\n open: this.open,\n\n fullscreen: this.state.fullscreen,\n fullscreenEnter: this.fullscreenEnter,\n fullscreenExit: this.fullscreenExit,\n\n close: this.onCancel,\n }\n\n if (this.state.error) {\n return (\n \n \n \n )\n }\n\n if (!this.state.isReady) {\n return (\n \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n {}}\n onChange={() => {}}\n />\n
    \n
    \n )\n }\n\n const showOptions = !!(\n this.state.options.close ||\n this.state.options.hide ||\n this.state.options.pin\n )\n\n return (\n \n
    \n \n \n \n \n \n \n \n \n \n \n {showOptions && (\n \n \n \n )}\n \n \n \n \n
    \n )\n }\n}\n\nconst PostingDialogStart = ({\n children,\n close,\n minimized,\n minimize,\n open,\n fullscreen,\n fullscreenEnter,\n fullscreenExit,\n}) => (\n \n \n {pgettext(\"post thread\", \"Start new thread\")}\n \n {children}\n \n)\n","export default function (usernames) {\n const normalisedNames = usernames\n .split(\",\")\n .map((i) => i.trim().toLowerCase())\n const removedBlanks = normalisedNames.filter((i) => i.length > 0)\n const removedDuplicates = removedBlanks.filter((name, pos) => {\n return removedBlanks.indexOf(name) == pos\n })\n\n return removedDuplicates\n}\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport * as attachments from \"./utils/attachments\"\nimport cleanUsernames from \"./utils/usernames\"\nimport { getPostValidators, getTitleValidators } from \"./utils/validators\"\nimport ajax from \"misago/services/ajax\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport MarkupEditor from \"../MarkupEditor\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../Toolbar\"\nimport PostingDialog from \"./PostingDialog\"\nimport PostingDialogBody from \"./PostingDialogBody\"\nimport PostingDialogHeader from \"./PostingDialogHeader\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n const to = (props.to || []).map((user) => user.username).join(\", \")\n\n this.state = {\n isLoading: false,\n\n error: null,\n\n minimized: false,\n fullscreen: false,\n\n to: to,\n title: \"\",\n post: \"\",\n attachments: [],\n\n validators: {\n title: getTitleValidators(),\n post: getPostValidators(),\n },\n errors: {},\n }\n }\n\n onCancel = () => {\n const formEmpty = !!(\n this.state.post.length === 0 &&\n this.state.title.length === 0 &&\n this.state.to.length === 0 &&\n this.state.attachments.length === 0\n )\n\n if (formEmpty) {\n return this.close()\n }\n\n const cancel = window.confirm(\n pgettext(\n \"post thread\",\n \"Are you sure you want to discard private thread?\"\n )\n )\n if (cancel) {\n this.close()\n }\n }\n\n onToChange = (event) => {\n this.changeValue(\"to\", event.target.value)\n }\n\n onTitleChange = (event) => {\n this.changeValue(\"title\", event.target.value)\n }\n\n onPostChange = (event) => {\n this.changeValue(\"post\", event.target.value)\n }\n\n onAttachmentsChange = (attachments) => {\n this.setState(attachments)\n }\n\n clean() {\n if (!cleanUsernames(this.state.to).length) {\n snackbar.error(\n pgettext(\"posting form\", \"You have to enter at least one recipient.\")\n )\n return false\n }\n\n if (!this.state.title.trim().length) {\n snackbar.error(\n pgettext(\"posting form\", \"You have to enter thread title.\")\n )\n return false\n }\n\n if (!this.state.post.trim().length) {\n snackbar.error(pgettext(\"posting form\", \"You have to enter a message.\"))\n return false\n }\n\n const errors = this.validate()\n\n if (errors.title) {\n snackbar.error(errors.title[0])\n return false\n }\n\n if (errors.post) {\n snackbar.error(errors.post[0])\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.post(this.props.submit, {\n to: cleanUsernames(this.state.to),\n title: this.state.title,\n post: this.state.post,\n attachments: attachments.clean(this.state.attachments),\n })\n }\n\n handleSuccess(success) {\n this.setState({ isLoading: true })\n this.close()\n\n snackbar.success(pgettext(\"post thread\", \"Your thread has been posted.\"))\n window.location = success.url\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n const errors = [].concat(\n rejection.non_field_errors || [],\n rejection.to || [],\n rejection.title || [],\n rejection.post || [],\n rejection.attachments || []\n )\n\n snackbar.error(errors[0])\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n close = () => {\n this.minimize()\n posting.close()\n }\n\n minimize = () => {\n this.setState({ fullscreen: false, minimized: true })\n }\n\n open = () => {\n this.setState({ minimized: false })\n if (this.state.fullscreen) {\n }\n }\n\n fullscreenEnter = () => {\n this.setState({ fullscreen: true, minimized: false })\n }\n\n fullscreenExit = () => {\n this.setState({ fullscreen: false, minimized: false })\n }\n\n render() {\n const dialogProps = {\n minimized: this.state.minimized,\n minimize: this.minimize,\n open: this.open,\n\n fullscreen: this.state.fullscreen,\n fullscreenEnter: this.fullscreenEnter,\n fullscreenExit: this.fullscreenExit,\n\n close: this.onCancel,\n }\n\n return (\n \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n )\n }\n}\n\nconst PostingDialogStartPrivate = ({\n children,\n close,\n minimized,\n minimize,\n open,\n fullscreen,\n fullscreenEnter,\n fullscreenExit,\n}) => (\n \n \n {pgettext(\"post thread\", \"Start private thread\")}\n \n {children}\n \n)\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport * as attachments from \"./utils/attachments\"\nimport { getPostValidators } from \"./utils/validators\"\nimport ajax from \"misago/services/ajax\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport MarkupEditor from \"../MarkupEditor\"\nimport PostingDialog from \"./PostingDialog\"\nimport PostingDialogBody from \"./PostingDialogBody\"\nimport PostingDialogError from \"./PostingDialogError\"\nimport PostingDialogHeader from \"./PostingDialogHeader\"\nimport { clearGlobalState, setGlobalState } from \"./globalState\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n isLoading: false,\n\n error: null,\n\n minimized: false,\n fullscreen: false,\n\n post: this.props.default || \"\",\n attachments: [],\n\n validators: {\n post: getPostValidators(),\n },\n errors: {},\n }\n\n this.quoteText = \"\"\n }\n\n componentDidMount() {\n ajax\n .get(this.props.config, this.props.context || null)\n .then(this.loadSuccess, this.loadError)\n\n setGlobalState(false, this.onQuote)\n }\n\n componentWillUnmount() {\n clearGlobalState()\n }\n\n componentWillReceiveProps(nextProps) {\n const context = this.props.context\n const newContext = nextProps.context\n\n // User clicked \"reply\" instead of \"quote\"\n if (context && newContext && !newContext.reply) return\n\n ajax\n .get(nextProps.config, nextProps.context || null)\n .then(this.appendData, snackbar.apiError)\n }\n\n loadSuccess = (data) => {\n this.setState({\n isReady: true,\n\n post: data.post\n ? '[quote=\"@' + data.poster + '\"]\\n' + data.post + \"\\n[/quote]\"\n : this.state.post,\n })\n\n this.quoteText = data.post\n ? '[quote=\"@' + data.poster + '\"]\\n' + data.post + \"\\n[/quote]\"\n : this.state.post\n }\n\n loadError = (rejection) => {\n this.setState({\n error: rejection.detail,\n })\n }\n\n appendData = (data) => {\n const newPost = data.post\n ? '[quote=\"@' + data.poster + '\"]\\n' + data.post + \"\\n[/quote]\\n\\n\"\n : \"\"\n\n this.setState((prevState, props) => {\n if (prevState.post.length > 0) {\n return {\n post: prevState.post.trim() + \"\\n\\n\" + newPost,\n }\n }\n\n return {\n post: newPost,\n }\n })\n\n this.open()\n }\n\n onCancel = () => {\n // If only the quote text is on editor user didn't add anything\n // so no changes to discard\n const onlyQuoteTextInEditor = this.state.post === this.quoteText\n\n if (onlyQuoteTextInEditor && this.state.attachments.length === 0) {\n return this.close()\n }\n\n const cancel = window.confirm(\n pgettext(\"post reply\", \"Are you sure you want to discard your reply?\")\n )\n if (cancel) {\n this.close()\n }\n }\n\n onPostChange = (event) => {\n this.changeValue(\"post\", event.target.value)\n }\n\n onAttachmentsChange = (attachments) => {\n this.setState(attachments)\n }\n\n onQuote = (quote) => {\n this.setState(({ post }) => {\n if (post.length > 0) {\n return { post: post.trim() + \"\\n\\n\" + quote }\n }\n\n return { post: quote }\n })\n\n this.open()\n }\n\n clean() {\n if (!this.state.post.trim().length) {\n snackbar.error(pgettext(\"posting form\", \"You have to enter a message.\"))\n return false\n }\n\n const errors = this.validate()\n\n if (errors.post) {\n snackbar.error(errors.post[0])\n return false\n }\n\n return true\n }\n\n send() {\n setGlobalState(true, this.onQuote)\n\n return ajax.post(this.props.submit, {\n post: this.state.post,\n attachments: attachments.clean(this.state.attachments),\n })\n }\n\n handleSuccess(success) {\n this.setState({ isLoading: true })\n this.close()\n\n setGlobalState(false, this.onQuote)\n\n snackbar.success(pgettext(\"post reply\", \"Your reply has been posted.\"))\n window.location = success.url.index\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n const errors = [].concat(\n rejection.non_field_errors || [],\n rejection.post || [],\n rejection.attachments || []\n )\n\n snackbar.error(errors[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n setGlobalState(false, this.onQuote)\n }\n\n close = () => {\n this.minimize()\n posting.close()\n }\n\n minimize = () => {\n this.setState({ fullscreen: false, minimized: true })\n }\n\n open = () => {\n this.setState({ minimized: false })\n if (this.state.fullscreen) {\n }\n }\n\n fullscreenEnter = () => {\n this.setState({ fullscreen: true, minimized: false })\n }\n\n fullscreenExit = () => {\n this.setState({ fullscreen: false, minimized: false })\n }\n\n render() {\n const dialogProps = {\n thread: this.props.thread,\n\n minimized: this.state.minimized,\n minimize: this.minimize,\n open: this.open,\n\n fullscreen: this.state.fullscreen,\n fullscreenEnter: this.fullscreenEnter,\n fullscreenExit: this.fullscreenExit,\n\n close: this.onCancel,\n }\n\n if (this.state.error) {\n return (\n \n \n \n )\n }\n\n if (!this.state.isReady) {\n return (\n \n
    \n {}}\n onChange={() => {}}\n />\n
    \n
    \n )\n }\n\n return (\n \n \n \n \n \n )\n }\n}\n\nconst PostingDialogReply = ({\n children,\n close,\n minimized,\n minimize,\n open,\n fullscreen,\n fullscreenEnter,\n fullscreenExit,\n thread,\n}) => (\n \n \n {interpolate(\n pgettext(\"post reply\", \"Reply to: %(thread)s\"),\n { thread: thread.title },\n true\n )}\n \n {children}\n \n)\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport * as attachments from \"./utils/attachments\"\nimport { getPostValidators } from \"./utils/validators\"\nimport ajax from \"misago/services/ajax\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport MarkupEditor from \"../MarkupEditor\"\nimport PostingDialog from \"./PostingDialog\"\nimport PostingDialogBody from \"./PostingDialogBody\"\nimport PostingDialogError from \"./PostingDialogError\"\nimport PostingDialogHeader from \"./PostingDialogHeader\"\nimport { clearGlobalState, setGlobalState } from \"./globalState\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n isLoading: false,\n\n error: false,\n\n minimized: false,\n fullscreen: false,\n\n post: \"\",\n attachments: [],\n protect: false,\n\n canProtect: false,\n\n validators: {\n post: getPostValidators(),\n },\n errors: {},\n }\n\n this.originalPost = \"\"\n }\n\n componentDidMount() {\n ajax.get(this.props.config).then(this.loadSuccess, this.loadError)\n\n setGlobalState(false, this.onQuote)\n }\n\n componentWillUnmount() {\n clearGlobalState()\n }\n\n componentWillReceiveProps(nextProps) {\n const context = this.props.context\n const newContext = nextProps.context\n\n if (context && newContext && context.reply === newContext.reply) return\n\n ajax\n .get(nextProps.config, nextProps.context || null)\n .then(this.appendData, snackbar.apiError)\n }\n\n loadSuccess = (data) => {\n this.originalPost = data.post\n\n this.setState({\n isReady: true,\n\n post: data.post,\n attachments: attachments.hydrate(data.attachments),\n protect: data.is_protected,\n\n canProtect: data.can_protect,\n })\n }\n\n loadError = (rejection) => {\n this.setState({\n error: rejection.detail,\n })\n }\n\n appendData = (data) => {\n const newPost = data.post\n ? '[quote=\"@' + data.poster + '\"]\\n' + data.post + \"\\n[/quote]\\n\\n\"\n : \"\"\n\n this.setState((prevState, props) => {\n if (prevState.post.length > 0) {\n return {\n post: prevState.post.trim() + \"\\n\\n\" + newPost,\n }\n }\n\n return {\n post: newPost,\n }\n })\n\n this.open()\n }\n\n onCancel = () => {\n const originalPostSameAsCurrentPost =\n this.state.originalPost === this.state.post\n const noAttachementsAdded = this.state.attachments.length === 0\n\n if (originalPostSameAsCurrentPost && noAttachementsAdded) {\n return this.close()\n }\n\n const cancel = window.confirm(\n pgettext(\"edit reply\", \"Are you sure you want to discard changes?\")\n )\n if (cancel) {\n this.close()\n }\n }\n\n onProtect = () => {\n this.setState({\n protect: true,\n })\n }\n\n onUnprotect = () => {\n this.setState({\n protect: false,\n })\n }\n\n onPostChange = (event) => {\n this.changeValue(\"post\", event.target.value)\n }\n\n onAttachmentsChange = (attachments) => {\n this.setState(attachments)\n }\n\n onQuote = (quote) => {\n this.setState(({ post }) => {\n if (post.length > 0) {\n return { post: post.trim() + \"\\n\\n\" + quote }\n }\n\n return { post: quote }\n })\n\n this.open()\n }\n\n clean() {\n if (!this.state.post.trim().length) {\n snackbar.error(pgettext(\"posting form\", \"You have to enter a message.\"))\n return false\n }\n\n const errors = this.validate()\n\n if (errors.post) {\n snackbar.error(errors.post[0])\n return false\n }\n\n return true\n }\n\n send() {\n setGlobalState(true, this.onQuote)\n\n return ajax.put(this.props.submit, {\n post: this.state.post,\n attachments: attachments.clean(this.state.attachments),\n protect: this.state.protect,\n })\n }\n\n handleSuccess(success) {\n this.setState({ isLoading: true })\n this.close()\n\n setGlobalState(false, this.onQuote)\n\n snackbar.success(pgettext(\"edit reply\", \"Reply has been edited.\"))\n window.location = success.url.index\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n const errors = [].concat(\n rejection.non_field_errors || [],\n rejection.category || [],\n rejection.title || [],\n rejection.post || [],\n rejection.attachments || []\n )\n\n snackbar.error(errors[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n setGlobalState(false, this.onQuote)\n }\n\n close = () => {\n this.minimize()\n posting.close()\n }\n\n minimize = () => {\n this.setState({ fullscreen: false, minimized: true })\n }\n\n open = () => {\n this.setState({ minimized: false })\n if (this.state.fullscreen) {\n }\n }\n\n fullscreenEnter = () => {\n this.setState({ fullscreen: true, minimized: false })\n }\n\n fullscreenExit = () => {\n this.setState({ fullscreen: false, minimized: false })\n }\n\n render() {\n const dialogProps = {\n post: this.props.post,\n\n minimized: this.state.minimized,\n minimize: this.minimize,\n open: this.open,\n\n fullscreen: this.state.fullscreen,\n fullscreenEnter: this.fullscreenEnter,\n fullscreenExit: this.fullscreenExit,\n\n close: this.onCancel,\n }\n\n if (this.state.error) {\n return (\n \n \n \n )\n }\n\n if (!this.state.isReady) {\n return (\n \n
    \n {}}\n onChange={() => {}}\n />\n
    \n
    \n )\n }\n\n return (\n \n \n this.setState({ protect: true })}\n disableProtection={() => this.setState({ protect: false })}\n value={this.state.post}\n submitText={pgettext(\"edit reply submit\", \"Edit reply\")}\n disabled={this.state.isLoading}\n onAttachmentsChange={this.onAttachmentsChange}\n onChange={this.onPostChange}\n />\n \n \n )\n }\n}\n\nconst PostingDialogEditReply = ({\n children,\n close,\n minimized,\n minimize,\n open,\n fullscreen,\n fullscreenEnter,\n fullscreenExit,\n post,\n}) => (\n \n \n {interpolate(\n pgettext(\"edit reply\", \"Edit reply by %(poster)s from %(date)s\"),\n {\n poster: post.poster ? post.poster.username : post.poster_name,\n date: post.posted_on.fromNow(),\n },\n true\n )}\n \n {children}\n \n)\n","import React from \"react\"\nimport PostingQuoteSelection from \"./PostingQuoteSelection\"\nimport getQuoteMarkup from \"./getQuoteMarkup\"\nimport { clearGlobalState, getGlobalState, setGlobalState } from \"./globalState\"\nimport Start from \"./start\"\nimport StartPrivate from \"./start-private\"\nimport Reply from \"./reply\"\nimport Edit from \"./edit\"\n\nexport default function (props) {\n switch (props.mode) {\n case \"START\":\n return \n\n case \"START_PRIVATE\":\n return \n\n case \"REPLY\":\n return \n\n case \"EDIT\":\n return \n\n default:\n return null\n }\n}\n\nexport {\n PostingQuoteSelection,\n clearGlobalState,\n getGlobalState,\n getQuoteMarkup,\n setGlobalState,\n}\n","import { maxLength, minLength } from \"misago/utils/validators\"\nimport misago from \"misago\"\n\nexport function getTitleValidators() {\n return [getTitleLengthMin(), getTitleLengthMax()]\n}\n\nexport function getPostValidators() {\n if (misago.get(\"SETTINGS\").post_length_max) {\n return [validatePostLengthMin(), validatePostLengthMax()]\n } else {\n return [validatePostLengthMin()]\n }\n}\n\nexport function getTitleLengthMin() {\n return minLength(\n misago.get(\"SETTINGS\").thread_title_length_min,\n (limitValue, length) => {\n const message = npgettext(\n \"thread title length validator\",\n \"Thread title should be at least %(limit_value)s character long (it has %(show_value)s).\",\n \"Thread title should be at least %(limit_value)s characters long (it has %(show_value)s).\",\n limitValue\n )\n\n return interpolate(\n message,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n )\n}\n\nexport function getTitleLengthMax() {\n return maxLength(\n misago.get(\"SETTINGS\").thread_title_length_max,\n (limitValue, length) => {\n const message = npgettext(\n \"thread title length validator\",\n \"Thread title cannot be longer than %(limit_value)s character (it has %(show_value)s).\",\n \"Thread title cannot be longer than %(limit_value)s characters (it has %(show_value)s).\",\n limitValue\n )\n\n return interpolate(\n message,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n )\n}\n\nexport function validatePostLengthMin() {\n return minLength(\n misago.get(\"SETTINGS\").post_length_min,\n (limitValue, length) => {\n const message = npgettext(\n \"post length validator\",\n \"Posted message should be at least %(limit_value)s character long (it has %(show_value)s).\",\n \"Posted message should be at least %(limit_value)s characters long (it has %(show_value)s).\",\n limitValue\n )\n\n return interpolate(\n message,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n )\n}\n\nexport function validatePostLengthMax() {\n return maxLength(\n misago.get(\"SETTINGS\").post_length_max || 1000000,\n (limitValue, length) => {\n const message = npgettext(\n \"post length validator\",\n \"Posted message cannot be longer than %(limit_value)s character (it has %(show_value)s).\",\n \"Posted message cannot be longer than %(limit_value)s characters (it has %(show_value)s).\",\n limitValue\n )\n\n return interpolate(\n message,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n )\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getChoice() {\n let choice = null\n this.props.choices.map((item) => {\n if (item.value === this.props.value) {\n choice = item\n }\n })\n return choice\n }\n\n getIcon() {\n return this.getChoice().icon\n }\n\n getLabel() {\n return this.getChoice().label\n }\n\n change = (value) => {\n return () => {\n this.props.onChange({\n target: {\n value: value,\n },\n })\n }\n }\n\n render() {\n return (\n
    \n \n \n {this.getLabel()}\n \n
      \n {this.props.choices.map((item, i) => {\n return (\n
    • \n \n \n {item.label}\n \n
    • \n )\n })}\n
    \n
    \n )\n }\n}\n\nexport function Icon({ icon }) {\n if (!icon) return null\n\n return {icon}\n}\n","import React from \"react\"\nimport misago from \"misago/index\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport StartSocialAuth from \"misago/components/StartSocialAuth\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n showActivation: false,\n\n username: \"\",\n password: \"\",\n\n validators: {\n username: [],\n password: [],\n },\n }\n }\n\n clean() {\n if (!this.isValid()) {\n snackbar.error(pgettext(\"sign in modal\", \"Fill out both fields.\"))\n return false\n } else {\n return true\n }\n }\n\n send() {\n return ajax.post(misago.get(\"AUTH_API\"), {\n username: this.state.username,\n password: this.state.password,\n })\n }\n\n handleSuccess() {\n let form = $(\"#hidden-login-form\")\n\n form.append('')\n form.append('')\n\n // fill out form with user credentials and submit it, this will tell\n // Misago to redirect user back to right page, and will trigger browser's\n // key ring feature\n form.find('input[type=\"hidden\"]').val(ajax.getCsrfToken())\n form.find('input[name=\"redirect_to\"]').val(window.location.pathname)\n form.find('input[name=\"username\"]').val(this.state.username)\n form.find('input[name=\"password\"]').val(this.state.password)\n form.submit()\n\n // keep form loading\n this.setState({\n isLoading: true,\n })\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n if (rejection.code === \"inactive_admin\") {\n snackbar.info(rejection.detail)\n } else if (rejection.code === \"inactive_user\") {\n snackbar.info(rejection.detail)\n this.setState({\n showActivation: true,\n })\n } else if (rejection.code === \"banned\") {\n showBannedPage(rejection.detail)\n modal.hide()\n } else {\n snackbar.error(rejection.detail)\n }\n } else if (rejection.status === 403 && rejection.ban) {\n showBannedPage(rejection.ban)\n modal.hide()\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n getActivationButton() {\n if (!this.state.showActivation) return null\n\n return (\n \n {pgettext(\"sign in modal btn\", \"Activate account\")}\n \n )\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"sign in modal title\", \"Sign in\")}\n

    \n
    \n
    \n
    \n \n\n
    \n
    \n \n
    \n
    \n\n
    \n
    \n \n
    \n
    \n
    \n
    \n {this.getActivationButton()}\n \n {pgettext(\"sign in modal btn\", \"Sign in\")}\n \n \n {pgettext(\"sign in modal btn\", \"Forgot password?\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getClass() {\n return getStatusClassName(this.props.status)\n }\n\n render() {\n return {this.props.children}\n }\n}\n\nexport class StatusIcon extends React.Component {\n getIcon() {\n if (this.props.status.is_banned) {\n return \"remove_circle_outline\"\n } else if (this.props.status.is_hidden) {\n return \"help_outline\"\n } else if (this.props.status.is_online_hidden) {\n return \"label\"\n } else if (this.props.status.is_offline_hidden) {\n return \"label_outline\"\n } else if (this.props.status.is_online) {\n return \"lens\"\n } else if (this.props.status.is_offline) {\n return \"panorama_fish_eye\"\n }\n }\n\n render() {\n return {this.getIcon()}\n }\n}\n\nexport class StatusLabel extends React.Component {\n getHelp() {\n return getStatusDescription(this.props.user, this.props.status)\n }\n\n getLabel() {\n if (this.props.status.is_banned) {\n return pgettext(\"user status\", \"Banned\")\n } else if (this.props.status.is_hidden) {\n return pgettext(\"user status\", \"Hidden\")\n } else if (this.props.status.is_online_hidden) {\n return pgettext(\"user status\", \"Online (hidden)\")\n } else if (this.props.status.is_offline_hidden) {\n return pgettext(\"user status\", \"Offline (hidden)\")\n } else if (this.props.status.is_online) {\n return pgettext(\"user status\", \"Online\")\n } else if (this.props.status.is_offline) {\n return pgettext(\"user status\", \"Offline\")\n }\n }\n\n render() {\n return (\n \n {this.getLabel()}\n \n )\n }\n}\n\nexport function getStatusClassName(status) {\n let className = \"\"\n if (status.is_banned) {\n className = \"banned\"\n } else if (status.is_hidden) {\n className = \"offline\"\n } else if (status.is_online_hidden) {\n className = \"online\"\n } else if (status.is_offline_hidden) {\n className = \"offline\"\n } else if (status.is_online) {\n className = \"online\"\n } else if (status.is_offline) {\n className = \"offline\"\n }\n\n return \"user-status user-\" + className\n}\n\nexport function getStatusDescription(user, status) {\n if (status.is_banned) {\n if (status.banned_until) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is banned until %(ban_expires)s\"),\n {\n username: user.username,\n ban_expires: status.banned_until.format(\"LL, LT\"),\n },\n true\n )\n } else {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is banned\"),\n {\n username: user.username,\n },\n true\n )\n }\n } else if (status.is_hidden) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is hiding presence\"),\n {\n username: user.username,\n },\n true\n )\n } else if (status.is_online_hidden) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is online (hidden)\"),\n {\n username: user.username,\n },\n true\n )\n } else if (status.is_offline_hidden) {\n return interpolate(\n pgettext(\n \"user status\",\n \"%(username)s was last seen %(last_click)s (hidden)\"\n ),\n {\n username: user.username,\n last_click: status.last_click.fromNow(),\n },\n true\n )\n } else if (status.is_online) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s is online\"),\n {\n username: user.username,\n },\n true\n )\n } else if (status.is_offline) {\n return interpolate(\n pgettext(\"user status\", \"%(username)s was last seen %(last_click)s\"),\n {\n username: user.username,\n last_click: status.last_click.fromNow(),\n },\n true\n )\n }\n}\n","import React from \"react\"\nimport UserStatus, { StatusLabel } from \"misago/components/user-status\"\n\nexport default function ({ showStatus, user }) {\n return (\n
      \n \n \n
    • \n \n \n \n
    \n )\n}\n\nexport function Status({ showStatus, user }) {\n if (!showStatus) return null\n\n return (\n
  • \n \n \n \n
  • \n )\n}\n\nexport function JoinDate({ user }) {\n const { joined_on } = user\n\n let title = interpolate(\n pgettext(\"users list item\", \"Joined on %(joined_on)s\"),\n {\n joined_on: joined_on.format(\"LL, LT\"),\n },\n true\n )\n\n let message = interpolate(\n pgettext(\"users list item\", \"Joined %(joined_on)s\"),\n {\n joined_on: joined_on.fromNow(),\n },\n true\n )\n\n return (\n
  • \n {message}\n
  • \n )\n}\n\nexport function Posts({ user }) {\n const className = getStatClassName(\"user-stat-posts\", user.posts)\n const message = npgettext(\n \"users list item\",\n \"%(posts)s post\",\n \"%(posts)s posts\",\n user.posts\n )\n\n return (\n
  • \n {interpolate(\n message,\n {\n posts: user.posts,\n },\n true\n )}\n
  • \n )\n}\n\nexport function Threads({ user }) {\n const className = getStatClassName(\"user-stat-threads\", user.threads)\n const message = npgettext(\n \"users list item\",\n \"%(threads)s thread\",\n \"%(threads)s threads\",\n user.threads\n )\n\n return (\n
  • \n {interpolate(\n message,\n {\n threads: user.threads,\n },\n true\n )}\n
  • \n )\n}\n\nexport function Followers({ user }) {\n const className = getStatClassName(\"user-stat-followers\", user.followers)\n const message = npgettext(\n \"users list item\",\n \"%(followers)s follower\",\n \"%(followers)s followers\",\n user.followers\n )\n\n return (\n
  • \n {interpolate(\n message,\n {\n followers: user.followers,\n },\n true\n )}\n
  • \n )\n}\n\nexport function getStatClassName(className, stat) {\n if (stat === 0) {\n return className + \" user-stat-empty\"\n }\n return className\n}\n","import React from \"react\"\n\nexport default function ({ rank, title }) {\n let userTitle = title || rank.title || rank.name\n\n let className = \"user-title\"\n if (rank.css_class) {\n className += \" user-title-\" + rank.css_class\n }\n\n if (rank.is_tab) {\n return (\n \n {userTitle}\n \n )\n }\n\n return {userTitle}\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Stats from \"./stats\"\nimport UserTitle from \"./user-title\"\n\nexport default function ({ showStatus, user }) {\n const { rank } = user\n\n let className = \"panel user-card\"\n if (rank.css_class) {\n className += \" user-card-\" + rank.css_class\n }\n\n return (\n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n \n \n \n
    \n\n \n
    \n \n
    \n\n
    \n \n
    \n
    \n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport * as random from \"misago/utils/random\"\n\nexport default class extends React.Component {\n shouldComponentUpdate() {\n return false\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n \n \n \n
    \n\n
    \n \n  \n \n
    \n
    \n \n  \n \n
    \n\n
    \n
      \n
    • \n \n  \n \n
    • \n
    • \n \n  \n \n
    • \n
    • \n
    • \n \n  \n \n
    • \n
    • \n \n  \n \n
    • \n
    \n
    \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Card from \"./card\"\n\nexport default function ({ colClassName, cols }) {\n const list = Array.apply(null, { length: cols }).map(Number.call, Number)\n\n return (\n
    \n
    \n {list.map((i) => {\n let className = colClassName\n if (i !== 0) className += \" hidden-xs\"\n if (i === 3) className += \" hidden-sm\"\n\n return (\n
    \n \n
    \n )\n })}\n
    \n
    \n )\n}\n","import React from \"react\"\nimport Card from \"./card\"\nimport Preview from \"./preview\"\n\nexport default function ({ cols, isReady, showStatus, users }) {\n let colClassName = \"col-xs-12 col-sm-4\"\n if (cols === 4) {\n colClassName += \" col-md-3\"\n }\n\n if (!isReady) {\n return \n }\n\n return (\n
    \n
    \n {users.map((user) => {\n return (\n
    \n \n
    \n )\n })}\n
    \n
    \n )\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n dropdown: false,\n }\n }\n\n toggleNav = () => {\n this.setState({\n dropdown: !this.state.dropdown,\n })\n }\n\n hideNav = () => {\n this.setState({\n dropdown: false,\n })\n }\n\n getCompactNavClassName() {\n if (this.state.dropdown) {\n return \"compact-nav open\"\n } else {\n return \"compact-nav\"\n }\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getClassName() {\n if (this.props.value) {\n return \"btn btn-yes-no btn-yes-no-on\"\n } else {\n return \"btn btn-yes-no btn-yes-no-off\"\n }\n }\n\n getIcon() {\n if (!!this.props.value) {\n return this.props.iconOn || \"check_box\"\n } else {\n return this.props.iconOff || \"check_box_outline_blank\"\n }\n }\n\n getLabel() {\n if (!!this.props.value) {\n return this.props.labelOn || pgettext(\"yesno switch choice\", \"yes\")\n } else {\n return this.props.labelOff || pgettext(\"yesno switch choice\", \"no\")\n }\n }\n\n toggle = () => {\n this.props.onChange({\n target: {\n value: !this.props.value,\n },\n })\n }\n\n render() {\n return (\n \n {this.getIcon()}\n {this.getLabel()}\n \n )\n }\n}\n","export const locale = window.misago_locale || \"en-us\"\n\nexport const momentAgo = pgettext(\"time ago\", \"moment ago\")\nexport const momentAgoNarrow = pgettext(\"time ago\", \"now\")\nexport const dayAt = pgettext(\"day at time\", \"%(day)s at %(time)s\")\nexport const soonAt = pgettext(\"day at time\", \"at %(time)s\")\nexport const tomorrowAt = pgettext(\"day at time\", \"Tomorrow at %(time)s\")\nexport const yesterdayAt = pgettext(\"day at time\", \"Yesterday at %(time)s\")\n\nexport const minuteShort = pgettext(\"short minutes\", \"%(time)sm\")\nexport const hourShort = pgettext(\"short hours\", \"%(time)sh\")\nexport const dayShort = pgettext(\"short days\", \"%(time)sd\")\nexport const thisYearShort = pgettext(\"short month\", \"%(day)s %(month)s\")\nexport const otherYearShort = pgettext(\"short month\", \"%(month)s %(year)s\")\n\nexport const relativeNumeric = new Intl.RelativeTimeFormat(locale, {\n numeric: \"always\",\n style: \"long\",\n})\n\nexport const fullDateTime = new Intl.DateTimeFormat(locale, {\n dateStyle: \"full\",\n timeStyle: \"medium\",\n})\n\nexport const thisYearDate = new Intl.DateTimeFormat(locale, {\n month: \"long\",\n day: \"numeric\",\n})\n\nexport const otherYearDate = new Intl.DateTimeFormat(locale, {\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n})\n\nexport const short = new Intl.DateTimeFormat(locale, {\n year: \"2-digit\",\n month: \"short\",\n day: \"numeric\",\n})\n\nexport const weekday = new Intl.DateTimeFormat(locale, {\n weekday: \"long\",\n})\n\nexport const shortTime = new Intl.DateTimeFormat(locale, { timeStyle: \"short\" })\n\nexport function formatShort(date) {\n const now = new Date()\n const absDiff = Math.abs(Math.round((date - now) / 1000))\n\n if (absDiff < 60) {\n return momentAgoNarrow\n }\n\n if (absDiff < 60 * 55) {\n const minutes = Math.ceil(absDiff / 60)\n return minuteShort.replace(\"%(time)s\", minutes)\n }\n\n if (absDiff < 3600 * 24) {\n const hours = Math.ceil(absDiff / 3600)\n return hourShort.replace(\"%(time)s\", hours)\n }\n\n if (absDiff < 86400 * 7) {\n const days = Math.ceil(absDiff / 86400)\n return dayShort.replace(\"%(time)s\", days)\n }\n\n const parts = {}\n short.formatToParts(date).forEach(function ({ type, value }) {\n parts[type] = value\n })\n\n if (date.getFullYear() === now.getFullYear()) {\n return thisYearShort\n .replace(\"%(day)s\", parts.day)\n .replace(\"%(month)s\", parts.month)\n }\n\n return otherYearShort\n .replace(\"%(year)s\", parts.year)\n .replace(\"%(month)s\", parts.month)\n}\n\nexport function formatRelative(date) {\n const now = new Date()\n const diff = Math.round((date - now) / 1000)\n const absDiff = Math.abs(diff)\n const sign = diff < 1 ? -1 : 1\n\n if (absDiff < 90) {\n return momentAgo\n }\n\n if (absDiff < 60 * 47) {\n const minutes = Math.ceil(absDiff / 60) * sign\n return relativeNumeric.format(minutes, \"minute\")\n }\n\n if (absDiff < 3600 * 3) {\n const hours = Math.ceil(absDiff / 3600) * sign\n return relativeNumeric.format(hours, \"hour\")\n }\n\n if (isSameDay(now, date)) {\n if (diff > 0) {\n return soonAt.replace(\"%(time)s\", shortTime.format(date))\n }\n\n return shortTime.format(date)\n }\n\n if (isYesterday(date)) {\n return yesterdayAt.replace(\"%(time)s\", shortTime.format(date))\n }\n\n if (isTomorrow(date)) {\n return tomorrowAt.replace(\"%(time)s\", shortTime.format(date))\n }\n\n if (diff < 0 && absDiff < 3600 * 24 * 6) {\n const day = weekday.format(date)\n return formatDayAtTime(day, date)\n }\n\n if (now.getFullYear() == date.getFullYear()) {\n return thisYearDate.format(date)\n }\n\n return otherYearDate.format(date)\n}\n\nexport function isSameDay(now, date) {\n return (\n now.getFullYear() == date.getFullYear() &&\n now.getMonth() == date.getMonth() &&\n now.getDate() == date.getDate()\n )\n}\n\nexport function isYesterday(date) {\n const yesterday = new Date()\n yesterday.setDate(yesterday.getDate() - 1)\n return isSameDay(yesterday, date)\n}\n\nexport function isTomorrow(date) {\n const yesterday = new Date()\n yesterday.setDate(yesterday.getDate() + 1)\n return isSameDay(yesterday, date)\n}\n\nexport function formatDayAtTime(day, date) {\n return dayAt\n .replace(\"%(day)s\", day)\n .replace(\"%(time)s\", shortTime.format(date))\n}\n","class OrderedList {\n constructor(items) {\n this.isOrdered = false\n this._items = items || []\n }\n\n add(key, item, order) {\n this._items.push({\n key: key,\n item: item,\n\n after: order ? order.after || null : null,\n before: order ? order.before || null : null,\n })\n }\n\n get(key, value) {\n for (var i = 0; i < this._items.length; i++) {\n if (this._items[i].key === key) {\n return this._items[i].item\n }\n }\n\n return value\n }\n\n has(key) {\n return this.get(key) !== undefined\n }\n\n values() {\n var values = []\n for (var i = 0; i < this._items.length; i++) {\n values.push(this._items[i].item)\n }\n return values\n }\n\n order(values_only) {\n if (!this.isOrdered) {\n this._items = this._order(this._items)\n this.isOrdered = true\n }\n\n if (values_only || typeof values_only === \"undefined\") {\n return this.values()\n } else {\n return this._items\n }\n }\n\n orderedValues() {\n return this.order(true)\n }\n\n _order(unordered) {\n // Index of unordered items\n var index = []\n unordered.forEach(function (item) {\n index.push(item.key)\n })\n\n // Ordered items\n var ordered = []\n var ordering = []\n\n // First pass: register items that\n // don't specify their order\n unordered.forEach(function (item) {\n if (!item.after && !item.before) {\n ordered.push(item)\n ordering.push(item.key)\n }\n })\n\n // Second pass: register items that\n // specify their before to \"_end\"\n unordered.forEach(function (item) {\n if (item.before === \"_end\") {\n ordered.push(item)\n ordering.push(item.key)\n }\n })\n\n // Third pass: keep iterating items\n // until we hit iterations limit or finish\n // ordering list\n function insertItem(item) {\n var insertAt = -1\n if (ordering.indexOf(item.key) === -1) {\n if (item.after) {\n insertAt = ordering.indexOf(item.after)\n if (insertAt !== -1) {\n insertAt += 1\n }\n } else if (item.before) {\n insertAt = ordering.indexOf(item.before)\n }\n\n if (insertAt !== -1) {\n ordered.splice(insertAt, 0, item)\n ordering.splice(insertAt, 0, item.key)\n }\n }\n }\n\n var iterations = 200\n while (iterations > 0 && index.length !== ordering.length) {\n iterations -= 1\n unordered.forEach(insertItem)\n }\n\n return ordered\n }\n}\n\nexport default OrderedList\n","class AjaxLoader {\n constructor() {\n this.element = document.getElementById(\"misago-ajax-loader\")\n this.requests = 0\n this.timeout = null\n }\n\n show = () => {\n this.requests += 1\n this.update()\n }\n\n hide = () => {\n if (this.requests) {\n this.requests -= 1\n this.update()\n }\n }\n\n update = () => {\n if (this.timeout) {\n window.clearTimeout(this.timeout)\n }\n\n if (this.requests) {\n this.element.classList.add(\"busy\")\n this.element.classList.remove(\"complete\")\n } else {\n this.element.classList.remove(\"busy\")\n this.element.classList.add(\"complete\")\n\n this.timeout = setTimeout(() => {\n this.element.classList.remove(\"complete\")\n }, 1500)\n }\n }\n}\n\nexport function useLoader(target) {\n const silent = target.closest(\"[hx-silent]\")\n if (silent) {\n return silent.getAttribute(\"hx-silent\") !== \"true\"\n }\n\n return true\n}\n\nexport default AjaxLoader\n","import htmx from \"htmx.org\"\n\nclass BulkModeration {\n constructor(options) {\n this.menu = options.menu ? document.querySelector(options.menu) : null\n this.form = options.form\n this.modal = options.modal\n this.actions = document.querySelectorAll(options.actions)\n this.selection = options.selection\n this.control = document.querySelector(options.button.selector)\n this.text = options.button.text\n\n this.update()\n this.registerEvents()\n this.registerActions()\n }\n\n registerActions = () => {\n this.actions.forEach((element) => {\n if (element.getAttribute(\"moderation-action\") === \"remove-selection\") {\n element.addEventListener(\"click\", this.onRemoveSelection)\n } else {\n element.addEventListener(\"click\", this.onAction)\n }\n })\n }\n\n onAction = (event) => {\n const form = document.querySelector(this.form)\n const data = {}\n\n new FormData(form).forEach((value, key) => {\n if (typeof data[key] === \"undefined\") {\n data[key] = []\n }\n data[key].push(value)\n })\n\n const target = event.target\n data.moderation = target.getAttribute(\"moderation-action\")\n\n if (target.getAttribute(\"moderation-multistage\") === \"true\") {\n htmx\n .ajax(\"POST\", document.location.href, {\n target: this.modal,\n swap: \"innerHTML\",\n values: data,\n })\n .then(() => {\n $(this.modal).modal(\"show\")\n })\n } else {\n htmx.ajax(\"POST\", document.location.href, {\n target: \"#misago-htmx-root\",\n swap: \"outerHTML\",\n values: data,\n })\n }\n }\n\n onRemoveSelection = (event) => {\n document.querySelectorAll(this.selection).forEach((element) => {\n element.checked = false\n })\n this.update()\n }\n\n registerEvents = () => {\n document.body.addEventListener(\"click\", ({ target }) => {\n if (target.tagName === \"INPUT\" && target.type === \"checkbox\") {\n this.update()\n }\n })\n\n htmx.onLoad(() => this.update())\n }\n\n update = () => {\n const selection = document.querySelectorAll(this.selection).length\n\n this.control.innerText = this.text.replace(\"%(number)s\", selection)\n this.control.disabled = !selection\n\n if (this.menu) {\n if (selection) {\n this.menu.classList.add(\"visible\")\n } else {\n this.menu.classList.remove(\"visible\")\n }\n }\n }\n}\n\nexport default BulkModeration\n","import htmx from \"htmx.org\"\n\nconst DEBOUNCE = 1000\n\nconst cache = {}\n\nexport function registerElementValidator(element) {\n const active = element.getAttribute(\"misago-validate-active\")\n if (active) {\n return\n }\n\n const url = element.getAttribute(\"misago-validate\")\n const user = element.getAttribute(\"misago-validate-user\")\n const strip =\n element.getAttribute(\"misago-validate-strip\") == \"false\" ? false : true\n const input = element.querySelector(\"input\")\n const csrf = input.closest(\"form\").querySelector(\"input[type=hidden]\")\n\n if (!url || !input) {\n return\n }\n\n if (!cache[url]) {\n cache[url] = {}\n }\n\n element.setAttribute(\"misago-validate-active\", \"true\")\n\n let timeout = null\n\n input.addEventListener(\"keyup\", (event) => {\n let value = event.target.value\n if (strip) {\n value = value.trim()\n }\n\n if (value.trim().length === 0) {\n clearFormControlValidationState(element)\n return\n }\n\n if (cache[url][value]) {\n setFormControlValidationState(element, input, cache[url][value])\n } else {\n if (timeout) {\n window.clearTimeout(timeout)\n }\n\n timeout = window.setTimeout(async () => {\n const { errors } = await callValidationUrl(url, csrf, value, user)\n cache[url][value] = errors\n setFormControlValidationState(element, input, errors)\n }, DEBOUNCE)\n }\n })\n}\n\nfunction setFormControlValidationState(element, input, errors) {\n if (errors.length) {\n setFormControlErrorValidationState(element, input, errors)\n } else {\n setFormControlSuccessValidationState(element)\n }\n}\n\nfunction setFormControlErrorValidationState(element, input, errors) {\n element.classList.remove(\"has-success\")\n element.classList.add(\"has-error\")\n\n clearFormControlValidationMessages(element)\n\n errors.forEach((error) => {\n const message = document.createElement(\"p\")\n message.className = \"help-block\"\n message.setAttribute(\"misago-dynamic-message\", \"true\")\n message.innerText = error\n input.after(message)\n })\n}\n\nfunction setFormControlSuccessValidationState(element) {\n element.classList.remove(\"has-error\")\n element.classList.add(\"has-success\")\n\n clearFormControlValidationMessages(element)\n}\n\nfunction clearFormControlValidationState(element) {\n element.classList.remove(\"has-error\")\n element.classList.remove(\"has-success\")\n\n clearFormControlValidationMessages(element)\n}\n\nfunction clearFormControlValidationMessages(element) {\n element\n .querySelectorAll(\"[misago-dynamic-message]\")\n .forEach((i) => i.remove())\n}\n\nasync function callValidationUrl(url, csrf, value, user) {\n const data = new FormData()\n data.set(csrf.name, csrf.value)\n data.set(\"value\", value)\n if (user) {\n data.set(\"user\", user)\n }\n\n const response = await fetch(url, {\n method: \"POST\",\n mode: \"cors\",\n credentials: \"same-origin\",\n body: data,\n })\n return await response.json()\n}\n\nexport function registerValidators(element) {\n const target = element || document\n target.querySelectorAll(\"[misago-validate]\").forEach(registerElementValidator)\n}\n\nhtmx.onLoad(registerValidators)\n","import htmx from \"htmx.org\"\n\nconst SNACKBAR_TTL = 6\n\nconst container = document.getElementById(\"misago-snackbars\")\nlet timeout = null\n\nexport function removeSnackbars() {\n container.replaceChildren()\n}\n\nfunction renderSnackbars() {\n if (timeout) {\n window.clearTimeout(timeout)\n }\n\n container.querySelectorAll(\".snackbar\").forEach((element) => {\n element.classList.add(\"in\")\n })\n\n timeout = window.setTimeout(() => {\n container.querySelectorAll(\".snackbar\").forEach((element) => {\n element.classList.add(\"out\")\n timeout = window.setTimeout(removeSnackbars, 1000)\n })\n }, SNACKBAR_TTL * 1000)\n}\n\nexport function snackbar(type, message) {\n removeSnackbars()\n\n if (timeout) {\n window.clearTimeout(timeout)\n }\n\n const element = document.createElement(\"div\")\n element.classList.add(\"snackbar\")\n element.classList.add(\"snackbar-\" + type)\n element.innerText = message\n element.role = \"alert\"\n container.appendChild(element)\n\n timeout = window.setTimeout(renderSnackbars, 100)\n}\n\nexport function info(message) {\n snackbar(\"info\", message)\n}\n\nexport function success(message) {\n snackbar(\"success\", message)\n}\n\nexport function warning(message) {\n snackbar(\"warning\", message)\n}\n\nexport function error(message) {\n snackbar(\"danger\", message)\n}\n\nhtmx.onLoad(renderSnackbars)\n","import { error } from \"./snackbars\"\n\nfunction handleResponseError(event) {\n if (isEventVisible(event)) {\n const message = getResponseErrorMessage(event.detail.xhr)\n error(message)\n }\n}\n\nfunction getResponseErrorMessage(xhr) {\n if (xhr.getResponseHeader(\"content-type\") === \"application/json\") {\n const data = JSON.parse(xhr.response)\n if (data.error) {\n return data.error\n }\n }\n\n if (xhr.status === 404) {\n return pgettext(\"htmx response error\", \"Not found\")\n }\n\n if (xhr.status === 403) {\n return pgettext(\"htmx response error\", \"Permission denied\")\n }\n\n return pgettext(\"htmx response error\", \"Unexpected error\")\n}\n\nfunction handleSendError(event) {\n if (isEventVisible(event)) {\n const message = pgettext(\"htmx response error\", \"Site could not be reached\")\n error(message)\n }\n}\n\nfunction handleTimeoutError(event) {\n if (isEventVisible(event)) {\n const message = pgettext(\n \"htmx response error\",\n \"Site took too long to reply\"\n )\n error(message)\n }\n}\n\nfunction isEventVisible({ detail }) {\n const silent = getEventTargetSilentAttr(detail.target)\n return !(silent === \"true\" && detail.requestConfig.verb === \"get\")\n}\n\nfunction getEventTargetSilentAttr(target) {\n const element = target.closest(\"[hx-silent]\")\n if (element) {\n return element.getAttribute(\"hx-silent\")\n }\n return null\n}\n\nexport function setupHtmxErrors() {\n document.addEventListener(\"htmx:responseError\", handleResponseError)\n document.addEventListener(\"htmx:sendError\", handleSendError)\n document.addEventListener(\"htmx:timeout\", handleTimeoutError)\n}\n\nsetupHtmxErrors()\n","import htmx from \"htmx.org\"\n\nimport { formatRelative, formatShort, fullDateTime } from \"./datetimeFormats\"\n\nconst cache = {}\n\nexport function updateTimestamp(element) {\n const timestamp = element.getAttribute(\"misago-timestamp\")\n if (!cache[timestamp]) {\n cache[timestamp] = new Date(timestamp)\n }\n\n if (!element.hasAttribute(\"title\")) {\n element.setAttribute(\"title\", fullDateTime.format(cache[timestamp]))\n }\n\n const format = element.getAttribute(\"misago-timestamp-format\")\n\n if (format == \"short\") {\n element.textContent = formatShort(cache[timestamp])\n } else {\n element.textContent = formatRelative(cache[timestamp])\n }\n}\n\nexport function startLiveTimestamps() {\n document.querySelectorAll(\"[misago-timestamp]\").forEach(updateTimestamp)\n\n updateLiveTimestamps()\n window.setInterval(updateLiveTimestamps, 1000 * 55)\n}\n\nexport function updateLiveTimestamps(element) {\n const target = element || document\n target.querySelectorAll(\"[misago-timestamp]\").forEach(updateTimestamp)\n}\n\nstartLiveTimestamps()\nhtmx.onLoad(updateLiveTimestamps)\n","import \"bootstrap/js/transition\"\nimport \"bootstrap/js/affix\"\nimport \"bootstrap/js/modal\"\nimport \"bootstrap/js/dropdown\"\nimport \"at-js\"\nimport \"cropit\"\nimport \"jquery-caret\"\nimport htmx from \"htmx.org\"\nimport OrderedList from \"misago/utils/ordered-list\"\nimport \"misago/style/index.less\"\nimport AjaxLoader, { useLoader } from \"./AjaxLoader\"\nimport BulkModeration from \"./BulkModeration\"\nimport \"./formValidators\"\nimport \"./htmxErrors\"\nimport \"./liveTimestamps\"\nimport * as snackbars from \"./snackbars\"\n\nconst loader = new AjaxLoader()\n\nexport class Misago {\n constructor() {\n this._initializers = []\n this._context = {}\n\n this.loader = loader\n }\n\n addInitializer(initializer) {\n this._initializers.push({\n key: initializer.name,\n\n item: initializer.initializer,\n\n after: initializer.after,\n before: initializer.before,\n })\n }\n\n init(context) {\n this._context = context\n\n var initOrder = new OrderedList(this._initializers).orderedValues()\n initOrder.forEach((initializer) => {\n initializer(this)\n })\n }\n\n // context accessors\n has(key) {\n return !!this._context[key]\n }\n\n get(key, fallback) {\n if (this.has(key)) {\n return this._context[key]\n } else {\n return fallback || undefined\n }\n }\n\n pop(key) {\n if (this.has(key)) {\n let value = this._context[key]\n this._context[key] = null\n return value\n } else {\n return undefined\n }\n }\n\n snackbar(type, message) {\n snackbars.snackbar(type, message)\n }\n\n snackbarInfo(message) {\n snackbars.info(message)\n }\n\n snackbarSuccess(message) {\n snackbars.success(message)\n }\n\n snackbarWarning(message) {\n snackbars.warning(message)\n }\n\n snackbarError(message) {\n snackbars.error(message)\n }\n\n bulkModeration(options) {\n return new BulkModeration(options)\n }\n}\n\n// create the singleton\nconst misago = new Misago()\n\n// expose it globally\nwindow.misago = misago\n\n// and export it for tests and stuff\nexport default misago\n\n// Register ajax loader events\ndocument.addEventListener(\"htmx:beforeRequest\", ({ target }) => {\n if (useLoader(target)) {\n loader.show()\n }\n})\n\ndocument.addEventListener(\"htmx:afterRequest\", ({ target }) => {\n if (useLoader(target)) {\n loader.hide()\n }\n})\n\n// Hide moderation modal after moderation action completes\ndocument.addEventListener(\"misago:afterModeration\", () => {\n $(\"#threads-moderation-modal\").modal(\"hide\")\n})\n","import misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\n\nexport default function initializer() {\n ajax.init(misago.get(\"CSRF_COOKIE_NAME\"))\n}\n\nmisago.addInitializer({\n name: \"ajax\",\n initializer: initializer,\n})\n","import misago from \"misago/index\"\nimport { patch } from \"misago/reducers/auth\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nconst AUTH_SYNC_RATE = 45 // sync user with backend every 45 seconds\n\nexport default function initializer(context) {\n if (context.get(\"isAuthenticated\")) {\n window.setInterval(function () {\n ajax.get(context.get(\"AUTH_API\")).then(\n function (data) {\n store.dispatch(patch(data))\n },\n function (rejection) {\n snackbar.apiError(rejection)\n }\n )\n }, AUTH_SYNC_RATE * 1000)\n }\n}\n\nmisago.addInitializer({\n name: \"auth-sync\",\n initializer: initializer,\n after: \"auth\",\n})\n","import misago from \"misago/index\"\nimport auth from \"misago/services/auth\"\nimport modal from \"misago/services/modal\"\nimport store from \"misago/services/store\"\nimport storage from \"misago/services/local-storage\"\n\nexport default function initializer() {\n auth.init(store, storage, modal)\n}\n\nmisago.addInitializer({\n name: \"auth\",\n initializer: initializer,\n after: \"store\",\n})\n","import misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\nimport captcha from \"misago/services/captcha\"\nimport include from \"misago/services/include\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default function initializer(context) {\n captcha.init(context, ajax, include, snackbar)\n}\n\nmisago.addInitializer({\n name: \"captcha\",\n initializer: initializer,\n})\n","import React from \"react\"\nimport ajax from \"misago/services/ajax\"\n\nexport default class AcceptAgreement extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = { submiting: false }\n }\n\n handleDecline = () => {\n if (this.state.submiting) return\n\n const confirmation = window.confirm(\n pgettext(\n \"accept agreement prompt\",\n \"Declining will result in immediate deactivation and deletion of your account. This action is not reversible.\"\n )\n )\n if (!confirmation) return\n\n this.setState({ submiting: true })\n\n ajax.post(this.props.api, { accept: false }).then(() => {\n window.location.reload(true)\n })\n }\n\n handleAccept = () => {\n if (this.state.submiting) return\n\n this.setState({ submiting: true })\n\n ajax.post(this.props.api, { accept: true }).then(() => {\n window.location.reload(true)\n })\n }\n\n render() {\n return (\n
    \n \n {pgettext(\"accept agreement choice\", \"Decline\")}\n \n \n {pgettext(\"accept agreement choice\", \"Accept and continue\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport misago from \"misago/index\"\nimport AcceptAgreement from \"misago/components/accept-agreement\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer(context) {\n if (document.getElementById(\"required-agreement-mount\")) {\n mount(\n ,\n \"required-agreement-mount\",\n false\n )\n }\n}\n\nmisago.addInitializer({\n name: \"component:accept-agreement\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\n\nexport default class extends React.Component {\n refresh() {\n window.location.reload()\n }\n\n getMessage() {\n if (this.props.signedIn) {\n return interpolate(\n pgettext(\n \"auth message\",\n \"You have signed in as %(username)s. Please refresh the page before continuing.\"\n ),\n { username: this.props.signedIn.username },\n true\n )\n } else if (this.props.signedOut) {\n return interpolate(\n pgettext(\n \"auth message\",\n \"%(username)s, you have been signed out. Please refresh the page before continuing.\"\n ),\n { username: this.props.user.username },\n true\n )\n }\n }\n\n render() {\n let className = \"auth-message\"\n if (this.props.signedIn || this.props.signedOut) {\n className += \" show\"\n }\n\n return (\n
    \n
    \n

    {this.getMessage()}

    \n

    \n \n {pgettext(\"auth message\", \"Reload page\")}\n \n \n {\" \" + pgettext(\"auth message\", \"or press F5 key.\")}\n \n

    \n
    \n
    \n )\n }\n}\n\nexport function select(state) {\n return {\n user: state.auth.user,\n signedIn: state.auth.signedIn,\n signedOut: state.auth.signedOut,\n }\n}\n","import { connect } from \"react-redux\"\nimport misago from \"misago/index\"\nimport AuthMessage, { select } from \"misago/components/auth-message\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n mount(connect(select)(AuthMessage), \"auth-message-mount\")\n}\n\nmisago.addInitializer({\n name: \"component:auth-message\",\n initializer: initializer,\n after: \"store\",\n})\n","import misago from \"misago/index\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport default function initializer(context) {\n if (context.has(\"BAN_MESSAGE\")) {\n showBannedPage(context.get(\"BAN_MESSAGE\"), false)\n }\n}\n\nmisago.addInitializer({\n name: \"component:banmed-page\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport modal from \"../services/modal\"\nimport SignInModal from \"./sign-in\"\n\nclass SignInModalAutoOpen extends React.Component {\n componentDidMount() {\n const query = window.document.location.search\n if (query === \"?modal=login\") {\n window.setTimeout(() => modal.show(), 300)\n }\n }\n\n render() {\n return null\n }\n}\n\nexport default SignInModalAutoOpen\n","import React from \"react\"\n\nexport default function NavbarBranding({ logo, logoXs, text, url }) {\n if (logo) {\n return (\n
    \n \n {text}\n \n
    \n )\n }\n\n return (\n
    \n {!!logoXs && (\n \n {text}\n \n )}\n {!!text && (\n \n {text}\n \n )}\n
    \n )\n}\n","import React from \"react\"\n\nexport default function NavbarExtraMenu({ items }) {\n return (\n
      \n {items.map((item, index) => (\n
    • \n \n {item.title}\n \n
    • \n ))}\n
    \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { DropdownFooter, DropdownHeader, DropdownPills } from \"../Dropdown\"\n\nexport default function NotificationsDropdownBody({\n children,\n showAll,\n showUnread,\n unread,\n}) {\n return (\n
    \n \n {pgettext(\"notifications title\", \"Notifications\")}\n \n \n \n {pgettext(\"notifications dropdown\", \"All\")}\n \n \n {pgettext(\"notifications dropdown\", \"Unread\")}\n \n \n {children}\n \n \n {pgettext(\"notifications\", \"See all notifications\")}\n \n \n
    \n )\n}\n\nfunction NotificationsDropdownBodyPill({ active, children, onClick }) {\n return (\n \n {children}\n \n )\n}\n","import NotificationsDropdown from \"./NotificationsDropdown\"\n\nexport default NotificationsDropdown\n","import React from \"react\"\nimport NotificationsFetch from \"../NotificationsFetch\"\nimport {\n NotificationsList,\n NotificationsListError,\n NotificationsListLoading,\n} from \"../NotificationsList\"\nimport NotificationsDropdownBody from \"./NotificationsDropdownBody\"\n\nexport default class NotificationsDropdown extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n unread: false,\n url: \"\",\n }\n }\n\n getApiUrl() {\n let url = misago.get(\"NOTIFICATIONS_API\") + \"?limit=20\"\n url += this.state.unread ? \"&filter=unread\" : \"\"\n return url\n }\n\n render = () => (\n this.setState({ unread: false })}\n showUnread={() => this.setState({ unread: true })}\n >\n \n {({ data, loading, error }) => {\n if (loading) {\n return \n }\n\n if (error) {\n return \n }\n\n return (\n \n )\n }}\n \n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function NavbarNotificationsToggle({\n id,\n className,\n badge,\n url,\n active,\n onClick,\n}) {\n const title = !!badge\n ? pgettext(\"navbar\", \"You have unread notifications!\")\n : pgettext(\"navbar\", \"Open notifications\")\n\n return (\n \n {!!badge && {badge}}\n \n {!!badge ? \"notifications_active\" : \"notifications_none\"}\n \n \n )\n}\n","import React from \"react\"\nimport { Dropdown } from \"../Dropdown\"\nimport NotificationsDropdown from \"../NotificationsDropdown\"\nimport NavbarNotificationsToggle from \"./NavbarNotificationsToggle\"\n\nexport default function NavbarNotificationsDropdown({\n id,\n className,\n badge,\n url,\n}) {\n return (\n (\n {\n event.preventDefault()\n toggle()\n }}\n />\n )}\n menuClassName=\"notifications-dropdown\"\n menuAlignRight\n >\n {({ isOpen }) => }\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function NavbarPrivateThreads({\n id,\n className,\n badge,\n url,\n active,\n onClick,\n}) {\n const title = !!badge\n ? pgettext(\"navbar\", \"You have unread private threads!\")\n : pgettext(\"navbar\", \"Open private threads\")\n\n return (\n \n {!!badge && {badge}}\n inbox\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function NavbarSearchToggle({\n id,\n className,\n url,\n active,\n onClick,\n}) {\n return (\n \n search\n \n )\n}\n","import React from \"react\"\nimport { Dropdown } from \"../Dropdown\"\nimport { SearchDropdown } from \"../Search\"\nimport NavbarSearchToggle from \"./NavbarSearchToggle\"\n\nexport default function NavbarSearchDropdown({ id, className, url }) {\n return (\n (\n {\n event.preventDefault()\n toggle()\n\n window.setTimeout(() => {\n document\n .querySelector(\".search-dropdown .form-control-search\")\n .focus()\n }, 0)\n }}\n />\n )}\n menuClassName=\"search-dropdown\"\n menuAlignRight\n >\n {() => }\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nexport default function NavbarSiteNavToggle({\n id,\n className,\n active,\n onClick,\n}) {\n return (\n \n menu\n \n )\n}\n","import React from \"react\"\nimport { Dropdown } from \"../Dropdown\"\nimport NavbarSiteNavToggle from \"./NavbarSiteNavToggle\"\nimport { SiteNavDropdown } from \"../SiteNav\"\n\nexport default function NavbarSiteNavDropdown({ id, className }) {\n return (\n (\n \n )}\n menuClassName=\"site-nav-dropdown\"\n menuAlignRight\n >\n {({ isOpen, close }) => }\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport Avatar from \"../avatar\"\n\nexport default function NavbarUserNavToggle({\n id,\n className,\n user,\n active,\n onClick,\n}) {\n return (\n \n \n \n )\n}\n","import React from \"react\"\nimport { Dropdown } from \"../Dropdown\"\nimport NavbarUserNavToggle from \"./NavbarUserNavToggle\"\nimport { UserNavDropdown } from \"../UserNav\"\n\nexport default function NavbarUserNavDropdown({ id, className, user }) {\n return (\n (\n {\n event.preventDefault()\n toggle()\n }}\n />\n )}\n menuClassName=\"user-nav-dropdown\"\n menuAlignRight\n >\n {({ isOpen, close }) => }\n \n )\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport * as overlay from \"../../reducers/overlay\"\nimport RegisterButton from \"../RegisterButton\"\nimport SignInButton from \"../SignInButton\"\nimport SignInModalAutoOpen from \"../SignInModalAutoOpen\"\nimport NavbarBranding from \"./NavbarBranding\"\nimport NavbarExtraMenu from \"./NavbarExtraMenu\"\nimport NavbarNotificationsDropdown from \"./NavbarNotificationsDropdown\"\nimport NavbarNotificationsToggle from \"./NavbarNotificationsToggle\"\nimport NavbarPrivateThreads from \"./NavbarPrivateThreads\"\nimport NavbarSearchDropdown from \"./NavbarSearchDropdown\"\nimport NavbarSearchToggle from \"./NavbarSearchToggle\"\nimport NavbarSiteNavDropdown from \"./NavbarSiteNavDropdown\"\nimport NavbarSiteNavToggle from \"./NavbarSiteNavToggle\"\nimport NavbarUserNavDropdown from \"./NavbarUserNavDropdown\"\nimport NavbarUserNavToggle from \"./NavbarUserNavToggle\"\n\nexport function Navbar({\n dispatch,\n branding,\n extraMenuItems,\n authDelegated,\n user,\n searchUrl,\n notificationsUrl,\n privateThreadsUrl,\n showSearch,\n showPrivateThreads,\n}) {\n return (\n
    \n \n
    \n {extraMenuItems.length > 0 && (\n \n )}\n {!!showSearch && (\n \n )}\n {!!showSearch && (\n {\n dispatch(overlay.openSearch())\n event.preventDefault()\n }}\n />\n )}\n \n {\n dispatch(overlay.openSiteNav())\n }}\n />\n {!!showPrivateThreads && (\n \n )}\n {!!user && (\n \n )}\n {!!user && (\n {\n dispatch(overlay.openNotifications())\n event.preventDefault()\n }}\n />\n )}\n {!!user && (\n \n )}\n {!!user && (\n {\n dispatch(overlay.openUserNav())\n event.preventDefault()\n }}\n />\n )}\n {!user && }\n {!user && !authDelegated && (\n \n )}\n {!user && !authDelegated && }\n
    \n
    \n )\n}\n\nfunction select(state) {\n const settings = misago.get(\"SETTINGS\")\n const user = state.auth.user\n\n return {\n branding: {\n logo: settings.logo,\n logoXs: settings.logo_small,\n text: settings.logo_text,\n url: misago.get(\"MISAGO_PATH\"),\n },\n extraMenuItems: misago.get(\"extraMenuItems\"),\n\n user: !user.id\n ? null\n : {\n id: user.id,\n username: user.username,\n email: user.email,\n avatars: user.avatars,\n unreadNotifications: user.unreadNotifications,\n unreadPrivateThreads: user.unread_private_threads,\n url: user.url,\n },\n\n searchUrl: misago.get(\"SEARCH_URL\"),\n notificationsUrl: misago.get(\"NOTIFICATIONS_URL\"),\n privateThreadsUrl: misago.get(\"PRIVATE_THREADS_URL\"),\n\n authDelegated: settings.enable_oauth2_client,\n showSearch: !!user.acl.can_search,\n showPrivateThreads: !!user && !!user.acl.can_use_private_threads,\n }\n}\n\nconst NavbarConnected = connect(select)(Navbar)\n\nexport default NavbarConnected\n","import Navbar from \"./Navbar\"\n\nexport default Navbar\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport Navbar from \"../../components/Navbar\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n const root = document.getElementById(\"misago-navbar\")\n ReactDOM.render(\n \n \n ,\n root\n )\n}\n\nmisago.addInitializer({\n name: \"component:navbar\",\n initializer: initializer,\n after: \"store\",\n})\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { DropdownFooter, DropdownPills } from \"../Dropdown\"\nimport { Overlay, OverlayHeader } from \"../Overlay\"\n\nexport default function NotificationsOverlayBody({\n children,\n open,\n showAll,\n showUnread,\n unread,\n}) {\n return (\n \n \n {pgettext(\"notifications title\", \"Notifications\")}\n \n \n \n {pgettext(\"notifications dropdown\", \"All\")}\n \n \n {pgettext(\"notifications dropdown\", \"Unread\")}\n \n \n {children}\n \n \n {pgettext(\"notifications\", \"See all notifications\")}\n \n \n \n )\n}\n\nfunction NotificationsOverlayBodyPill({ active, children, onClick }) {\n return (\n \n {children}\n \n )\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport NotificationsFetch from \"../NotificationsFetch\"\nimport {\n NotificationsList,\n NotificationsListError,\n NotificationsListLoading,\n} from \"../NotificationsList\"\nimport NotificationsOverlayBody from \"./NotificationsOverlayBody\"\n\nclass NotificationsOverlay extends React.Component {\n constructor(props) {\n super(props)\n\n this.body = document.body\n\n this.state = {\n unread: false,\n url: \"\",\n }\n }\n\n getApiUrl() {\n let url = misago.get(\"NOTIFICATIONS_API\") + \"?limit=20\"\n url += this.state.unread ? \"&filter=unread\" : \"\"\n return url\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (prevProps.open !== this.props.open) {\n if (this.props.open) {\n this.body.classList.add(\"notifications-fullscreen\")\n } else {\n this.body.classList.remove(\"notifications-fullscreen\")\n }\n }\n }\n\n render = () => (\n this.setState({ unread: false })}\n showUnread={() => this.setState({ unread: true })}\n >\n \n {({ data, loading, error }) => {\n if (loading) {\n return \n }\n\n if (error) {\n return \n }\n\n return (\n \n )\n }}\n \n \n )\n}\n\nfunction select(state) {\n return { open: state.overlay.notifications }\n}\n\nconst NotificationsOverlayConnected = connect(select)(NotificationsOverlay)\n\nexport default NotificationsOverlayConnected\n","import NotificationsOverlay from \"./NotificationsOverlay\"\n\nexport default NotificationsOverlay\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport NotificationsOverlay from \"../../components/NotificationsOverlay\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n if (context.get(\"isAuthenticated\")) {\n const root = document.getElementById(\"notifications-mount\")\n ReactDOM.render(\n \n \n ,\n root\n )\n }\n}\n\nmisago.addInitializer({\n name: \"component:notifications-overlay\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport { PageHeaderPlain } from \"../PageHeader\"\n\nexport default function NotificationsHeader() {\n return (\n \n )\n}\n","import PageTitle from \"./PageTitle\"\n\nexport default PageTitle\n","export default function PageTitle({ title, subtitle }) {\n const parts = []\n if (subtitle) {\n parts.push(subtitle)\n }\n if (title) {\n parts.push(title)\n }\n parts.push(misago.get(\"SETTINGS\").forum_name)\n\n document.title = parts.join(\" | \")\n return null\n}\n","import React from \"react\"\n\nexport default function PillsNav({ children }) {\n return
      {children}
    \n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { Link } from \"react-router\"\n\nexport default function PillsNavLink({ active, link, icon, children }) {\n return (\n
  • \n \n {!!icon && {icon}}\n {children}\n \n
  • \n )\n}\n","import React from \"react\"\nimport { PillsNav, PillsNavLink } from \"../PillsNav\"\nimport { Toolbar, ToolbarSection, ToolbarItem } from \"../Toolbar\"\n\nexport default function NotificationsPills({ filter }) {\n const basename = misago.get(\"NOTIFICATIONS_URL\")\n\n return (\n \n \n \n \n \n {pgettext(\"notifications nav\", \"All\")}\n \n \n {pgettext(\"notifications nav\", \"Unread\")}\n \n \n {pgettext(\"notifications nav\", \"Read\")}\n \n \n \n \n \n )\n}\n","import React from \"react\"\nimport { Link } from \"react-router\"\n\nexport default function NotificationsPagination({ baseUrl, data, disabled }) {\n return (\n
    \n \n {pgettext(\"notifications pagination\", \"Latest\")}\n \n \n {pgettext(\"notifications pagination\", \"Newer\")}\n \n \n {pgettext(\"notifications pagination\", \"Older\")}\n \n
    \n )\n}\n\nfunction NotificationsPaginationLink({ disabled, children, url }) {\n if (disabled) {\n return (\n \n )\n }\n\n return (\n \n {children}\n \n )\n}\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport Button from \"../button\"\nimport { Toolbar, ToolbarSection, ToolbarItem, ToolbarSpacer } from \"../Toolbar\"\nimport NotificationsPagination from \"./NotificationsPagination\"\n\nexport default function NotificationsToolbar({\n baseUrl,\n data,\n disabled,\n bottom,\n markAllAsRead,\n}) {\n return (\n \n \n \n \n \n \n \n \n \n \n done_all\n {pgettext(\"notifications\", \"Mark all as read\")}\n \n \n \n \n )\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport { updateAuthenticatedUser } from \"../../reducers/auth\"\nimport snackbar from \"../../services/snackbar\"\nimport { ApiMutation } from \"../Api\"\nimport NotificationsFetch from \"../NotificationsFetch\"\nimport PageTitle from \"../PageTitle\"\nimport PageContainer from \"../PageContainer\"\nimport {\n NotificationsList,\n NotificationsListError,\n NotificationsListLoading,\n} from \"../NotificationsList\"\nimport NotificationsPills from \"./NotificationsPills\"\nimport NotificationsToolbar from \"./NotificationsToolbar\"\n\nfunction NotificationsRoute({ dispatch, location, route }) {\n const { query } = location\n const { filter } = route.props\n\n const baseUrl = getBaseUrl(filter)\n\n return (\n \n \n\n \n\n \n {({ data, loading, error, refetch }) => (\n \n {(readAll, { loading: mutating }) => {\n const toolbarProps = {\n baseUrl,\n data,\n disabled:\n loading || mutating || !data || data.results.length === 0,\n markAllAsRead: async () => {\n const confirmed = window.confirm(\n pgettext(\"notifications\", \"Mark all notifications as read?\")\n )\n\n if (confirmed) {\n readAll({\n onSuccess: async () => {\n refetch()\n dispatch(\n updateAuthenticatedUser({ unreadNotifications: null })\n )\n snackbar.success(\n pgettext(\n \"notifications\",\n \"All notifications have been marked as read.\"\n )\n )\n },\n onError: snackbar.apiError,\n })\n }\n },\n }\n\n if (loading || mutating) {\n return (\n
    \n \n \n \n
    \n )\n }\n\n if (error) {\n return (\n
    \n \n \n \n
    \n )\n }\n\n if (data) {\n if (!data.hasPrevious && query) {\n window.history.replaceState({}, \"\", baseUrl)\n }\n\n return (\n
    \n \n \n \n
    \n )\n }\n\n return null\n }}\n
    \n )}\n
    \n
    \n )\n}\n\nfunction getSubtitle(filter) {\n if (filter === \"unread\") {\n return pgettext(\"notifications title\", \"Unread notifications\")\n } else if (filter === \"read\") {\n return pgettext(\"notifications title\", \"Read notifications\")\n } else {\n return null\n }\n}\n\nfunction getBaseUrl(filter) {\n let url = misago.get(\"NOTIFICATIONS_URL\")\n if (filter !== \"all\") {\n url += filter + \"/\"\n }\n return url\n}\n\nconst NotificationsRouteConnected = connect()(NotificationsRoute)\n\nexport default NotificationsRouteConnected\n","import Notifications from \"./Notifications\"\nimport NotificationsFetch from \"../NotificationsFetch/NotificationsFetch\"\n\nexport default Notifications\n\nexport { NotificationsFetch }\n","import React from \"react\"\nimport { Router, browserHistory } from \"react-router\"\nimport NotificationsHeader from \"./NotificationsHeader\"\nimport NotificationsRoute from \"./NotificationsRoute\"\n\nexport default function Notifications() {\n const basename = misago.get(\"NOTIFICATIONS_URL\")\n\n return (\n
    \n \n \n
    \n )\n}\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport Notifications from \"../../components/Notifications\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n const basename = misago.get(\"NOTIFICATIONS_URL\")\n if (\n document.location.pathname.startsWith(basename) &&\n !document.location.pathname.startsWith(basename + \"disable-email/\") &&\n context.get(\"isAuthenticated\")\n ) {\n const root = document.getElementById(\"page-mount\")\n ReactDOM.render(\n \n \n ,\n root\n )\n }\n}\n\nmisago.addInitializer({\n name: \"component:notifications\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport Loader from \"misago/components/loader\"\n\nexport default class extends React.Component {\n render() {\n return (\n
    \n \n
    \n )\n }\n}\n","import moment from \"moment\"\nimport React from \"react\"\nimport PanelLoader from \"misago/components/panel-loader\"\nimport PanelMessage from \"misago/components/panel-message\"\nimport misago from \"misago/index\"\nimport polls from \"misago/services/polls\"\nimport title from \"misago/services/page-title\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n if (misago.has(\"PROFILE_BAN\")) {\n this.initWithPreloadedData(misago.pop(\"PROFILE_BAN\"))\n } else {\n this.initWithoutPreloadedData()\n }\n\n this.startPolling(props.profile.api.ban)\n }\n\n initWithPreloadedData(ban) {\n if (ban.expires_on) {\n ban.expires_on = moment(ban.expires_on)\n }\n\n this.state = {\n isLoaded: true,\n ban,\n }\n }\n\n initWithoutPreloadedData() {\n this.state = {\n isLoaded: false,\n }\n }\n\n startPolling(api) {\n polls.start({\n poll: \"ban-details\",\n url: api,\n frequency: 90 * 1000,\n update: this.update,\n error: this.error,\n })\n }\n\n update = (ban) => {\n if (ban.expires_on) {\n ban.expires_on = moment(ban.expires_on)\n }\n\n this.setState({\n isLoaded: true,\n error: null,\n\n ban,\n })\n }\n\n error = (error) => {\n this.setState({\n isLoaded: true,\n error: error.detail,\n ban: null,\n })\n }\n\n componentDidMount() {\n title.set({\n title: pgettext(\"profile ban details title\", \"Ban details\"),\n parent: this.props.profile.username,\n })\n }\n\n componentWillUnmount() {\n polls.stop(\"ban-details\")\n }\n\n getUserMessage() {\n if (this.state.ban.user_message) {\n return (\n
    \n

    {pgettext(\"profile ban details\", \"User-shown ban message\")}

    \n \n
    \n )\n } else {\n return null\n }\n }\n\n getStaffMessage() {\n if (this.state.ban.staff_message) {\n return (\n
    \n

    {pgettext(\"profile ban details\", \"Team-shown ban message\")}

    \n \n
    \n )\n } else {\n return null\n }\n }\n\n getExpirationMessage() {\n if (this.state.ban.expires_on) {\n if (this.state.ban.expires_on.isAfter(moment())) {\n let title = interpolate(\n pgettext(\n \"profile ban details\",\n \"This ban expires on %(expires_on)s.\"\n ),\n {\n expires_on: this.state.ban.expires_on.format(\"LL, LT\"),\n },\n true\n )\n\n let message = interpolate(\n pgettext(\"profile ban details\", \"This ban expires %(expires_on)s.\"),\n {\n expires_on: this.state.ban.expires_on.fromNow(),\n },\n true\n )\n\n return {message}\n } else {\n return pgettext(\"profile ban details\", \"This ban has expired.\")\n }\n } else {\n return interpolate(\n pgettext(\"profile ban details\", \"%(username)s's ban is permanent.\"),\n {\n username: this.props.profile.username,\n },\n true\n )\n }\n }\n\n getPanelBody() {\n if (this.state.ban) {\n if (Object.keys(this.state.ban).length) {\n return (\n
    \n {this.getUserMessage()}\n {this.getStaffMessage()}\n\n
    \n

    {pgettext(\"profile ban details\", \"Ban expiration\")}

    \n

    {this.getExpirationMessage()}

    \n
    \n
    \n )\n } else {\n return (\n
    \n \n
    \n )\n }\n } else if (this.state.error) {\n return (\n
    \n \n
    \n )\n } else {\n return (\n
    \n \n
    \n )\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n

    \n {pgettext(\"profile ban details title\", \"Ban details\")}\n

    \n
    \n\n {this.getPanelBody()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport PanelMessage from \"misago/components/panel-message\"\n\nexport default function ({ display }) {\n if (!display) return null\n\n return (\n \n )\n}\n","import React from \"react\"\nimport Loader from \"misago/components/loader\"\n\nexport default function ({ display }) {\n if (!display) return null\n\n return (\n
    \n \n
    \n )\n}\n","import React from \"react\"\nimport Select from \"misago/components/select\"\n\nexport default class extends React.Component {\n onChange = (ev) => {\n const { field, onChange } = this.props\n onChange(field.fieldname, ev.target.value)\n }\n\n render() {\n const { disabled, field, value } = this.props\n const { input } = field\n\n if (input.type === \"select\") {\n return (\n \n )\n }\n\n if (input.type === \"textarea\") {\n return (\n \n )\n }\n\n if (input.type === \"text\") {\n return (\n \n )\n }\n\n return null\n }\n}\n","import React from \"react\"\nimport FieldInput from \"./field-input\"\nimport FormGroup from \"misago/components/form-group\"\n\nexport default function ({ disabled, errors, fields, name, onChange, value }) {\n return (\n
    \n {name}\n {fields.map((field) => {\n return (\n \n \n \n )\n })}\n
    \n )\n}\n","import React from \"react\"\nimport Fieldset from \"./fieldset\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n errors: {},\n }\n\n const groups = props.groups.length\n for (let i = 0; i < groups; i++) {\n const group = props.groups[i]\n const fields = group.fields.length\n for (let f = 0; f < fields; f++) {\n const fieldname = group.fields[f].fieldname\n const initial = group.fields[f].initial\n this.state[fieldname] = initial\n }\n }\n }\n\n send() {\n const data = Object.assign({}, this.state, {\n errors: null,\n isLoading: null,\n })\n\n return ajax.post(this.props.api, data)\n }\n\n handleSuccess(data) {\n this.props.onSuccess(data)\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n snackbar.error(gettext(\"Form contains errors.\"))\n this.setState({ errors: rejection })\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onChange = (name, value) => {\n this.setState({\n [name]: value,\n })\n }\n\n render() {\n return (\n
    \n
    \n {this.props.groups.map((group, i) => {\n return (\n \n )\n })}\n
    \n
    \n {\" \"}\n \n
    \n
    \n )\n }\n}\n\nexport function CancelButton({ onCancel, disabled }) {\n if (!onCancel) return null\n\n return (\n \n {pgettext(\"user profile details form btn\", \"Cancel\")}\n \n )\n}\n","import React from \"react\"\nimport Blankslate from \"./blankslate\"\nimport Loader from \"./loader\"\nimport Form from \"./form\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n loading: true,\n groups: null,\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.api).then(\n (groups) => {\n this.setState({\n loading: false,\n\n groups,\n })\n },\n (rejection) => {\n snackbar.apiError(rejection)\n if (this.props.cancel) {\n this.props.cancel()\n }\n }\n )\n }\n\n render() {\n const { groups, loading } = this.state\n\n return (\n
    \n
    \n

    \n {pgettext(\"user profile details form title\", \"Edit details\")}\n

    \n
    \n \n \n \n
    \n )\n }\n}\n\nexport function FormDisplay({ api, display, groups, onCancel, onSuccess }) {\n if (!display) return null\n\n return (\n
    \n )\n}\n","import React from \"react\"\nimport Form from \"misago/components/edit-details\"\n\nexport default function ({ api, display, onCancel, onSuccess }) {\n if (!display) return null\n\n return \n}\n","import React from \"react\"\n\nexport default function ({ isAuthenticated, profile }) {\n let message = null\n if (isAuthenticated) {\n message = pgettext(\n \"profile details empty\",\n \"You are not sharing any details with others.\"\n )\n } else {\n message = interpolate(\n pgettext(\n \"profile details empty\",\n \"%(username)s is not sharing any details with others.\"\n ),\n {\n username: profile.username,\n },\n true\n )\n }\n\n return (\n
    \n
    {message}
    \n
    \n )\n}\n","import React from \"react\"\n\nexport default function ({ html, text, url }) {\n if (html) {\n return (\n \n )\n }\n\n return (\n
    \n \n
    \n )\n}\n\nexport function SafeValue({ text, url }) {\n if (url) {\n return (\n

    \n \n {text || url}\n \n

    \n )\n }\n\n if (text) {\n return

    {text}

    \n }\n\n return null\n}\n","import React from \"react\"\nimport FieldValue from \"./field-value\"\n\nexport default function (props) {\n return (\n
    \n {props.name}:\n \n
    \n )\n}\n","import React from \"react\"\nimport Field from \"./field\"\n\nexport default function ({ fields, name }) {\n return (\n
    \n
    \n

    {name}

    \n
    \n
    \n
    \n {fields.map(({ fieldname, html, name, text, url }) => {\n return (\n \n )\n })}\n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport EmptyMessage from \"./empty-message\"\nimport Group from \"./group\"\nimport Loader from \"misago/components/loader\"\n\nexport default function ({\n display,\n groups,\n isAuthenticated,\n loading,\n profile,\n}) {\n if (!display) return null\n\n if (loading) {\n return \n }\n\n if (!groups.length) {\n return \n }\n\n return (\n
    \n {groups.map((group, i) => {\n return \n })}\n
    \n )\n}\n","import React from \"react\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../../Toolbar\"\n\nconst ProfileDetailsHeader = ({ onEdit, showEditButton }) => (\n \n \n \n

    {pgettext(\"profile details title\", \"Details\")}

    \n
    \n
    \n {showEditButton && (\n \n \n \n {pgettext(\"profile details edit btn\", \"Edit\")}\n \n \n \n )}\n
    \n)\n\nexport default ProfileDetailsHeader\n","import React from \"react\"\nimport { load } from \"misago/reducers/profile-details\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n componentDidMount() {\n const { data, dispatch, user } = this.props\n if (data && data.id === user.id) return\n\n ajax.get(this.props.user.api.details).then(\n (data) => {\n dispatch(load(data))\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n }\n\n render() {\n return this.props.children\n }\n}\n","import React from \"react\"\nimport Form from \"./form\"\nimport GroupsList from \"./groups-list\"\nimport Header from \"./header\"\nimport ProfileDetailsData from \"misago/data/profile-details\"\nimport { load as loadDetails } from \"misago/reducers/profile-details\"\nimport title from \"misago/services/page-title\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n editing: false,\n }\n }\n\n componentDidMount() {\n title.set({\n title: pgettext(\"profile details title\", \"Details\"),\n parent: this.props.profile.username,\n })\n }\n\n onCancel = () => {\n this.setState({ editing: false })\n }\n\n onEdit = () => {\n this.setState({ editing: true })\n }\n\n onSuccess = (newDetails) => {\n const { dispatch, isAuthenticated, profile } = this.props\n\n let message = null\n if (isAuthenticated) {\n message = pgettext(\n \"profile details form\",\n \"Your details have been changed.\"\n )\n } else {\n message = interpolate(\n pgettext(\n \"profile details form\",\n \"%(username)s's details have been changed.\"\n ),\n {\n username: profile.username,\n },\n true\n )\n }\n\n snackbar.info(message)\n dispatch(loadDetails(newDetails))\n this.setState({ editing: false })\n }\n\n render() {\n const { dispatch, isAuthenticated, profile, profileDetails } = this.props\n const loading = profileDetails.id !== profile.id\n\n return (\n \n
    \n \n \n \n
    \n \n )\n }\n}\n","import React from \"react\"\nimport PostFeed from \"misago/components/post-feed\"\nimport Button from \"misago/components/button\"\nimport * as posts from \"misago/reducers/posts\"\nimport title from \"misago/services/page-title\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../../Toolbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n }\n }\n\n loadItems(start = 0) {\n ajax\n .get(this.props.api, {\n start: start || 0,\n })\n .then(\n (data) => {\n if (start === 0) {\n store.dispatch(posts.load(data))\n } else {\n store.dispatch(posts.append(data))\n }\n\n this.setState({\n isLoading: false,\n })\n },\n (rejection) => {\n this.setState({\n isLoading: false,\n })\n\n snackbar.apiError(rejection)\n }\n )\n }\n\n loadMore = () => {\n this.setState({\n isLoading: true,\n })\n\n this.loadItems(this.props.posts.next)\n }\n\n componentDidMount() {\n title.set({\n title: this.props.title,\n parent: this.props.profile.username,\n })\n\n this.loadItems()\n }\n\n render() {\n return (\n
    \n \n \n \n

    {this.props.header}

    \n
    \n
    \n
    \n \n
    \n )\n }\n}\n\nexport function Feed(props) {\n if (props.posts.isLoaded && !props.posts.results.length) {\n return

    {props.emptyMessage}

    \n }\n\n return (\n
    \n \n \n
    \n )\n}\n\nexport function LoadMoreButton(props) {\n if (!props.next) return null\n\n return (\n
    \n \n {pgettext(\"profile load more btn\", \"Show older activity\")}\n \n
    \n )\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getClassName() {\n if (this.props.className) {\n return \"form-search \" + this.props.className\n } else {\n return \"form-search\"\n }\n }\n\n render() {\n return (\n
    \n \n search\n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Search from \"misago/components/quick-search\"\nimport UsersList from \"misago/components/users-list\"\nimport misago from \"misago/index\"\nimport { hydrate, append } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport title from \"misago/services/page-title\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../Toolbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.setSpecialProps()\n\n if (misago.has(this.PRELOADED_DATA_KEY)) {\n this.initWithPreloadedData(misago.pop(this.PRELOADED_DATA_KEY))\n } else {\n this.initWithoutPreloadedData()\n }\n }\n\n setSpecialProps() {\n this.PRELOADED_DATA_KEY = \"PROFILE_FOLLOWERS\"\n this.TITLE = pgettext(\"profile followers title\", \"Followers\")\n this.API_FILTER = \"followers\"\n }\n\n initWithPreloadedData(data) {\n this.state = {\n isLoaded: true,\n isBusy: false,\n\n search: \"\",\n\n count: data.count,\n more: data.more,\n\n page: data.page,\n pages: data.pages,\n }\n\n store.dispatch(hydrate(data.results))\n }\n\n initWithoutPreloadedData() {\n this.state = {\n isLoaded: false,\n isBusy: false,\n\n search: \"\",\n\n count: 0,\n more: 0,\n\n page: 1,\n pages: 1,\n }\n\n this.loadUsers()\n }\n\n loadUsers(page = 1, search = null) {\n const apiUrl = this.props.profile.api[this.API_FILTER]\n\n ajax\n .get(\n apiUrl,\n {\n search: search,\n page: page || 1,\n },\n \"user-\" + this.API_FILTER\n )\n .then(\n (data) => {\n if (page === 1) {\n store.dispatch(hydrate(data.results))\n } else {\n store.dispatch(append(data.results))\n }\n\n this.setState({\n isLoaded: true,\n isBusy: false,\n\n count: data.count,\n more: data.more,\n\n page: data.page,\n pages: data.pages,\n })\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n }\n\n componentDidMount() {\n title.set({\n title: this.TITLE,\n parent: this.props.profile.username,\n })\n }\n\n loadMore = () => {\n this.setState({\n isBusy: true,\n })\n\n this.loadUsers(this.state.page + 1, this.state.search)\n }\n\n search = (ev) => {\n this.setState({\n isLoaded: false,\n isBusy: true,\n\n search: ev.target.value,\n\n count: 0,\n more: 0,\n\n page: 1,\n pages: 1,\n })\n\n this.loadUsers(1, ev.target.value)\n }\n\n getLabel() {\n if (!this.state.isLoaded) {\n return pgettext(\"Loading...\")\n } else if (this.state.search) {\n let message = npgettext(\n \"profile followers\",\n \"Found %(users)s user.\",\n \"Found %(users)s users.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n users: this.state.count,\n },\n true\n )\n } else if (this.props.profile.id === this.props.user.id) {\n let message = npgettext(\n \"profile followers\",\n \"You have %(users)s follower.\",\n \"You have %(users)s followers.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n users: this.state.count,\n },\n true\n )\n } else {\n let message = npgettext(\n \"profile followers\",\n \"%(username)s has %(users)s follower.\",\n \"%(username)s has %(users)s followers.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n username: this.props.profile.username,\n users: this.state.count,\n },\n true\n )\n }\n }\n\n getEmptyMessage() {\n if (this.state.search) {\n return pgettext(\n \"profile followers\",\n \"Search returned no users matching specified criteria.\"\n )\n } else if (this.props.user.id === this.props.profile.id) {\n return pgettext(\"profile followers\", \"You have no followers.\")\n } else {\n return interpolate(\n pgettext(\"profile followers\", \"%(username)s has no followers.\"),\n {\n username: this.props.profile.username,\n },\n true\n )\n }\n }\n\n getMoreButton() {\n if (!this.state.more) return null\n\n return (\n
    \n \n {interpolate(\n pgettext(\"profile followers\", \"Show more (%(more)s)\"),\n {\n more: this.state.more,\n },\n true\n )}\n \n
    \n )\n }\n\n getListBody() {\n if (this.state.isLoaded && this.state.count === 0) {\n return

    {this.getEmptyMessage()}

    \n }\n\n return (\n
    \n \n\n {this.getMoreButton()}\n
    \n )\n }\n\n getClassName() {\n return \"profile-\" + this.API_FILTER\n }\n\n render() {\n return (\n
    \n \n \n \n

    {this.getLabel()}

    \n
    \n
    \n \n \n \n \n \n
    \n\n {this.getListBody()}\n
    \n )\n }\n}\n","import React from \"react\"\nimport Followers from \"misago/components/profile/followers\"\n\nexport default class extends Followers {\n setSpecialProps() {\n this.PRELOADED_DATA_KEY = \"PROFILE_FOLLOWS\"\n this.TITLE = pgettext(\"profile follows title\", \"Follows\")\n this.API_FILTER = \"follows\"\n }\n\n getLabel() {\n if (!this.state.isLoaded) {\n return pgettext(\"profile follows\", \"Loading...\")\n } else if (this.state.search) {\n let message = npgettext(\n \"profile follows\",\n \"Found %(users)s user.\",\n \"Found %(users)s users.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n users: this.state.count,\n },\n true\n )\n } else if (this.props.profile.id === this.props.user.id) {\n let message = npgettext(\n \"profile follows\",\n \"You are following %(users)s user.\",\n \"You are following %(users)s users.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n users: this.state.count,\n },\n true\n )\n } else {\n let message = npgettext(\n \"profile follows\",\n \"%(username)s is following %(users)s user.\",\n \"%(username)s is following %(users)s users.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n username: this.props.profile.username,\n users: this.state.count,\n },\n true\n )\n }\n }\n\n getEmptyMessage() {\n if (this.state.search) {\n return pgettext(\n \"profile follows\",\n \"Search returned no users matching specified criteria.\"\n )\n } else if (this.props.user.id === this.props.profile.id) {\n return pgettext(\"profile follows\", \"You are not following any users.\")\n } else {\n return interpolate(\n pgettext(\"profile follows\", \"%(username)s is not following any users.\"),\n {\n username: this.props.profile.username,\n },\n true\n )\n }\n }\n}\n","import React from \"react\"\n\nexport default class extends React.Component {\n getEmptyMessage() {\n if (this.props.emptyMessage) {\n return this.props.emptyMessage\n } else {\n return pgettext(\n \"username history empty\",\n \"Your account has no history of name changes.\"\n )\n }\n }\n\n render() {\n return (\n
    \n
      \n
    • \n {this.getEmptyMessage()}\n
    • \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\n\nexport default class extends React.Component {\n renderUserAvatar() {\n if (this.props.change.changed_by) {\n return (\n \n \n \n )\n } else {\n return (\n \n \n \n )\n }\n }\n\n renderUsername() {\n if (this.props.change.changed_by) {\n return (\n \n {this.props.change.changed_by.username}\n \n )\n } else {\n return (\n \n {this.props.change.changed_by_username}\n \n )\n }\n }\n\n render() {\n return (\n
  • \n
    {this.renderUserAvatar()}
    \n
    {this.renderUsername()}
    \n
    \n {this.props.change.old_username}\n arrow_forward\n {this.props.change.new_username}\n
    \n
    \n \n {this.props.change.changed_on.fromNow()}\n \n
    \n
  • \n )\n }\n}\n","import React from \"react\"\nimport Change from \"misago/components/username-history/change\"\n\nexport default class extends React.Component {\n render() {\n return (\n
    \n
      \n {this.props.changes.map((change) => {\n return \n })}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport * as random from \"misago/utils/random\"\n\nexport default class extends React.Component {\n shouldComponentUpdate() {\n return false\n }\n\n getClassName() {\n if (this.props.hiddenOnMobile) {\n return \"list-group-item hidden-xs hidden-sm\"\n } else {\n return \"list-group-item\"\n }\n }\n\n render() {\n return (\n
  • \n
    \n \n \n \n
    \n
    \n \n  \n \n
    \n
    \n \n  \n \n arrow_forward\n \n  \n \n
    \n
    \n \n  \n \n
    \n
  • \n )\n }\n}\n","import React from \"react\"\nimport ChangePreview from \"misago/components/username-history/change-preview\"\n\nexport default class extends React.Component {\n shouldComponentUpdate() {\n return false\n }\n\n render() {\n return (\n
    \n
      \n {[0, 1, 2].map((i) => {\n return 0} key={i} />\n })}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport ListEmpty from \"misago/components/username-history/list-empty\"\nimport ListReady from \"misago/components/username-history/list-ready\"\nimport ListPreview from \"misago/components/username-history/list-preview\"\n\nexport default class extends React.Component {\n render() {\n if (this.props.isLoaded) {\n if (this.props.changes.length) {\n return \n } else {\n return \n }\n } else {\n return \n }\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Search from \"misago/components/quick-search\"\nimport UsernameHistory from \"misago/components/username-history/root\"\nimport misago from \"misago/index\"\nimport { hydrate, append } from \"misago/reducers/username-history\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport title from \"misago/services/page-title\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../Toolbar\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n if (misago.has(\"PROFILE_NAME_HISTORY\")) {\n this.initWithPreloadedData(misago.pop(\"PROFILE_NAME_HISTORY\"))\n } else {\n this.initWithoutPreloadedData()\n }\n }\n\n initWithPreloadedData(data) {\n this.state = {\n isLoaded: true,\n isBusy: false,\n\n search: \"\",\n\n count: data.count,\n more: data.more,\n\n page: data.page,\n pages: data.pages,\n }\n\n store.dispatch(hydrate(data.results))\n }\n\n initWithoutPreloadedData() {\n this.state = {\n isLoaded: false,\n isBusy: false,\n\n search: \"\",\n\n count: 0,\n more: 0,\n\n page: 1,\n pages: 1,\n }\n\n this.loadChanges()\n }\n\n loadChanges(page = 1, search = null) {\n ajax\n .get(\n misago.get(\"USERNAME_CHANGES_API\"),\n {\n user: this.props.profile.id,\n search: search,\n page: page || 1,\n },\n \"search-username-history\"\n )\n .then(\n (data) => {\n if (page === 1) {\n store.dispatch(hydrate(data.results))\n } else {\n store.dispatch(append(data.results))\n }\n\n this.setState({\n isLoaded: true,\n isBusy: false,\n\n count: data.count,\n more: data.more,\n\n page: data.page,\n pages: data.pages,\n })\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n }\n\n componentDidMount() {\n title.set({\n title: pgettext(\"profile username history title\", \"Username history\"),\n parent: this.props.profile.username,\n })\n }\n\n loadMore = () => {\n this.setState({\n isBusy: true,\n })\n\n this.loadChanges(this.state.page + 1, this.state.search)\n }\n\n search = (ev) => {\n this.setState({\n isLoaded: false,\n isBusy: true,\n\n search: ev.target.value,\n\n count: 0,\n more: 0,\n\n page: 1,\n pages: 1,\n })\n\n this.loadChanges(1, ev.target.value)\n }\n\n getLabel() {\n if (!this.state.isLoaded) {\n return pgettext(\"profile username history\", \"Loading...\")\n } else if (this.state.search) {\n let message = npgettext(\n \"profile username history\",\n \"Found %(changes)s username change.\",\n \"Found %(changes)s username changes.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n changes: this.state.count,\n },\n true\n )\n } else if (this.props.profile.id === this.props.user.id) {\n let message = npgettext(\n \"profile username history\",\n \"Your username was changed %(changes)s time.\",\n \"Your username was changed %(changes)s times.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n changes: this.state.count,\n },\n true\n )\n } else {\n let message = npgettext(\n \"profile username history\",\n \"%(username)s's username was changed %(changes)s time.\",\n \"%(username)s's username was changed %(changes)s times.\",\n this.state.count\n )\n\n return interpolate(\n message,\n {\n username: this.props.profile.username,\n changes: this.state.count,\n },\n true\n )\n }\n }\n\n getEmptyMessage() {\n if (this.state.search) {\n return pgettext(\n \"profile username history\",\n \"Search returned no username changes matching specified criteria.\"\n )\n } else if (this.props.user.id === this.props.profile.id) {\n return pgettext(\n \"username history empty\",\n \"Your account has no history of name changes.\"\n )\n } else {\n return interpolate(\n pgettext(\n \"profile username history\",\n \"%(username)s's username was never changed.\"\n ),\n {\n username: this.props.profile.username,\n },\n true\n )\n }\n }\n\n getMoreButton() {\n if (!this.state.more) return null\n\n return (\n
    \n \n {interpolate(\n pgettext(\"profile username history\", \"Show older (%(more)s)\"),\n {\n more: this.state.more,\n },\n true\n )}\n \n
    \n )\n }\n\n render() {\n return (\n
    \n \n \n \n

    {this.getLabel()}

    \n
    \n
    \n \n \n \n \n \n
    \n\n \n\n {this.getMoreButton()}\n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport { patch } from \"misago/reducers/profile\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n }\n }\n\n getClassName() {\n if (this.props.profile.is_followed) {\n return this.props.className + \" btn-default btn-following\"\n } else {\n return this.props.className + \" btn-default btn-follow\"\n }\n }\n\n getIcon() {\n if (this.props.profile.is_followed) {\n return \"favorite\"\n } else {\n return \"favorite_border\"\n }\n }\n\n getLabel() {\n if (this.props.profile.is_followed) {\n return pgettext(\"user profile follow btn\", \"Following\")\n } else {\n return pgettext(\"user profile follow btn\", \"Follow\")\n }\n }\n\n action = () => {\n this.setState({\n isLoading: true,\n })\n\n if (this.props.profile.is_followed) {\n store.dispatch(\n patch({\n is_followed: false,\n followers: this.props.profile.followers - 1,\n })\n )\n } else {\n store.dispatch(\n patch({\n is_followed: true,\n followers: this.props.profile.followers + 1,\n })\n )\n }\n\n ajax.post(this.props.profile.api.follow).then(\n (data) => {\n this.setState({\n isLoading: false,\n })\n\n store.dispatch(patch(data))\n },\n (rejection) => {\n this.setState({\n isLoading: false,\n })\n snackbar.apiError(rejection)\n }\n )\n }\n\n render() {\n return (\n \n {this.getIcon()}\n {this.getLabel()}\n \n )\n }\n}\n","import React from \"react\"\nimport posting from \"misago/services/posting\"\nimport misago from \"misago\"\n\nexport default class extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"START_PRIVATE\",\n submit: misago.get(\"PRIVATE_THREADS_API\"),\n\n to: [this.props.profile],\n })\n }\n\n render() {\n const canMessage = this.props.user.acl.can_start_private_threads\n const isProfileOwner = this.props.user.id === this.props.profile.id\n\n if (!canMessage || isProfileOwner) return null\n\n return (\n \n comment\n {pgettext(\"profile message btn\", \"Message\")}\n \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport Loader from \"misago/components/modal-loader\"\nimport YesNoSwitch from \"misago/components/yes-no-switch\"\nimport ModalMessage from \"misago/components/modal-message\"\nimport { updateAvatar } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoaded: false,\n isLoading: false,\n error: null,\n\n is_avatar_locked: \"\",\n avatar_lock_user_message: \"\",\n avatar_lock_staff_message: \"\",\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.profile.api.moderate_avatar).then(\n (options) => {\n this.setState({\n isLoaded: true,\n\n is_avatar_locked: options.is_avatar_locked,\n avatar_lock_user_message: options.avatar_lock_user_message || \"\",\n avatar_lock_staff_message: options.avatar_lock_staff_message || \"\",\n })\n },\n (rejection) => {\n this.setState({\n isLoaded: true,\n error: rejection.detail,\n })\n }\n )\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(this.validate().username[0])\n return false\n }\n }\n\n send() {\n return ajax.post(this.props.profile.api.moderate_avatar, {\n is_avatar_locked: this.state.is_avatar_locked,\n avatar_lock_user_message: this.state.avatar_lock_user_message,\n avatar_lock_staff_message: this.state.avatar_lock_staff_message,\n })\n }\n\n handleSuccess(apiResponse) {\n store.dispatch(updateAvatar(this.props.profile, apiResponse.avatar_hash))\n snackbar.success(\n pgettext(\n \"profile avatar moderation\",\n \"Avatar controls have been changed.\"\n )\n )\n }\n\n getFormBody() {\n return (\n \n
    \n \n \n \n\n \n \n \n\n \n \n \n
    \n
    \n \n {pgettext(\"profile avatar moderation btn\", \"Close\")}\n \n \n
    \n \n )\n }\n\n getModalBody() {\n if (this.state.error) {\n return (\n \n )\n } else if (this.state.isLoaded) {\n return this.getFormBody()\n } else {\n return \n }\n }\n\n getClassName() {\n if (this.state.error) {\n return \"modal-dialog modal-message modal-avatar-controls\"\n } else {\n return \"modal-dialog modal-avatar-controls\"\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"profile avatar moderation title\", \"Avatar controls\")}\n

    \n
    \n {this.getModalBody()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport Loader from \"misago/components/modal-loader\"\nimport ModalMessage from \"misago/components/modal-message\"\nimport { addNameChange } from \"misago/reducers/username-history\"\nimport { updateUsername } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport * as validators from \"misago/utils/validators\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoaded: false,\n isLoading: false,\n error: null,\n\n username: \"\",\n validators: {\n username: [validators.usernameContent()],\n },\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.profile.api.moderate_username).then(\n () => {\n this.setState({\n isLoaded: true,\n })\n },\n (rejection) => {\n this.setState({\n isLoaded: true,\n error: rejection.detail,\n })\n }\n )\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(this.validate().username[0])\n return false\n }\n }\n\n send() {\n return ajax.post(this.props.profile.api.moderate_username, {\n username: this.state.username,\n })\n }\n\n handleSuccess(apiResponse) {\n this.setState({\n username: \"\",\n })\n\n store.dispatch(\n addNameChange(apiResponse, this.props.profile, this.props.user)\n )\n store.dispatch(\n updateUsername(this.props.profile, apiResponse.username, apiResponse.slug)\n )\n\n snackbar.success(\n pgettext(\"profile username moderation\", \"Username has been changed.\")\n )\n }\n\n getFormBody() {\n return (\n
    \n
    \n \n \n \n
    \n
    \n \n {pgettext(\"profile username moderation btn\", \"Cancel\")}\n \n \n
    \n
    \n )\n }\n\n getModalBody() {\n if (this.state.error) {\n return (\n \n )\n } else if (this.state.isLoaded) {\n return this.getFormBody()\n } else {\n return \n }\n }\n\n getClassName() {\n if (this.state.error) {\n return \"modal-dialog modal-message modal-rename-user\"\n } else {\n return \"modal-dialog modal-rename-user\"\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"profile username moderation title\", \"Change username\")}\n

    \n
    \n {this.getModalBody()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport Loader from \"misago/components/modal-loader\"\nimport ModalMessage from \"misago/components/modal-message\"\nimport YesNoSwitch from \"misago/components/yes-no-switch\"\nimport misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\nimport polls from \"misago/services/polls\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoaded: false,\n isLoading: false,\n isDeleted: false,\n error: null,\n\n countdown: 5,\n confirm: false,\n\n with_content: false,\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.profile.api.delete).then(\n () => {\n this.setState({\n isLoaded: true,\n })\n\n this.countdown()\n },\n (rejection) => {\n this.setState({\n isLoaded: true,\n error: rejection.detail,\n })\n }\n )\n }\n\n countdown = () => {\n window.setTimeout(() => {\n if (this.state.countdown > 1) {\n this.setState({\n countdown: this.state.countdown - 1,\n })\n this.countdown()\n } else if (!this.state.confirm) {\n this.setState({\n confirm: true,\n })\n }\n }, 1000)\n }\n\n send() {\n return ajax.post(this.props.profile.api.delete, {\n with_content: this.state.with_content,\n })\n }\n\n handleSuccess() {\n polls.stop(\"user-profile\")\n\n if (this.state.with_content) {\n this.setState({\n isDeleted: interpolate(\n pgettext(\n \"profile delete\",\n \"%(username)s's account, threads, posts and other content has been deleted.\"\n ),\n {\n username: this.props.profile.username,\n },\n true\n ),\n })\n } else {\n this.setState({\n isDeleted: interpolate(\n pgettext(\n \"profile delete\",\n \"%(username)s's account has been deleted and other content has been hidden.\"\n ),\n {\n username: this.props.profile.username,\n },\n true\n ),\n })\n }\n }\n\n getButtonLabel() {\n if (this.state.confirm) {\n return interpolate(\n pgettext(\"profile delete btn\", \"Delete %(username)s\"),\n {\n username: this.props.profile.username,\n },\n true\n )\n } else {\n return interpolate(\n pgettext(\"profile delete btn\", \"Please wait... (%(countdown)ss)\"),\n {\n countdown: this.state.countdown,\n },\n true\n )\n }\n }\n\n getForm() {\n return (\n
    \n
    \n \n \n \n
    \n
    \n \n {pgettext(\"profile delete btn\", \"Cancel\")}\n \n\n \n {this.getButtonLabel()}\n \n
    \n
    \n )\n }\n\n getDeletedBody() {\n return (\n
    \n
    \n info_outline\n
    \n \n
    \n )\n }\n\n getModalBody() {\n if (this.state.error) {\n return (\n \n )\n } else if (this.state.isLoaded) {\n if (this.state.isDeleted) {\n return this.getDeletedBody()\n } else {\n return this.getForm()\n }\n } else {\n return \n }\n }\n\n getClassName() {\n if (this.state.error || this.state.isDeleted) {\n return \"modal-dialog modal-message modal-delete-account\"\n } else {\n return \"modal-dialog modal-delete-account\"\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"profile delete title\", \"Delete user account\")}\n

    \n
    \n {this.getModalBody()}\n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport AvatarControls from \"misago/components/profile/moderation/avatar-controls\"\nimport ChangeUsername from \"misago/components/profile/moderation/change-username\"\nimport DeleteAccount from \"misago/components/profile/moderation/delete-account\"\nimport modal from \"misago/services/modal\"\n\nlet select = function (store) {\n return {\n tick: store.tick,\n user: store.auth,\n profile: store.profile,\n }\n}\n\nexport default class extends React.Component {\n showAvatarDialog = () => {\n modal.show(connect(select)(AvatarControls))\n }\n\n showRenameDialog = () => {\n modal.show(connect(select)(ChangeUsername))\n }\n\n showDeleteDialog = () => {\n modal.show(connect(select)(DeleteAccount))\n }\n\n render() {\n const { moderation } = this.props\n\n return (\n
      \n {!!moderation.avatar && (\n
    • \n \n portrait\n {pgettext(\"profile moderation menu\", \"Avatar controls\")}\n \n
    • \n )}\n {!!moderation.rename && (\n
    • \n \n credit_card\n {pgettext(\"profile moderation menu\", \"Change username\")}\n \n
    • \n )}\n {!!moderation.delete && (\n
    • \n \n clear\n {pgettext(\"profile moderation menu\", \"Delete account\")}\n \n
    • \n )}\n
    \n )\n }\n}\n","import React from \"react\"\nimport Status, { StatusIcon, StatusLabel } from \"../user-status\"\n\nconst ProfileDataList = ({ profile }) => (\n
      \n {profile.is_active === false && (\n
    • \n \n {pgettext(\"profile data list\", \"Account disabled\")}\n \n
    • \n )}\n
    • \n \n \n \n \n
    • \n {profile.rank.is_tab ? (\n
    • \n \n {profile.rank.name}\n \n
    • \n ) : (\n
    • \n {profile.rank.name}\n
    • \n )}\n {(profile.title || profile.rank.title) && (\n
    • {profile.title || profile.rank.title}
    • \n )}\n
    • \n \n {interpolate(\n pgettext(\"profile data list\", \"Joined %(joined_on)s\"),\n {\n joined_on: profile.joined_on.fromNow(),\n },\n true\n )}\n \n
    • \n {profile.email && (\n
    • \n \n {profile.email}\n \n
    • \n )}\n
    \n)\n\nexport default ProfileDataList\n","import React from \"react\"\nimport Avatar from \"../avatar\"\nimport { FlexRow, FlexRowCol, FlexRowSection } from \"../FlexRow\"\nimport {\n PageHeader,\n PageHeaderBanner,\n PageHeaderContainer,\n PageHeaderDetails,\n} from \"../PageHeader\"\nimport FollowButton from \"./follow-button\"\nimport MessageButton from \"./message-button\"\nimport ModerationOptions from \"./moderation/nav\"\nimport ProfileDataList from \"./ProfileDataList\"\n\nconst ProfileHeader = ({ profile, user, moderation, message, follow }) => (\n \n \n \n
    \n
    \n \n \n \n
    \n

    {profile.username}

    \n
    \n \n \n \n \n \n \n \n \n {message && (\n \n \n \n \n {moderation.available && !follow && (\n \n
    \n \n \n
    \n
    \n )}\n
    \n )}\n {follow && (\n \n \n \n \n {moderation.available && (\n \n
    \n \n \n
    \n
    \n )}\n
    \n )}\n {moderation.available && !follow && !message && (\n \n \n
    \n \n \n
    \n
    \n \n
    \n \n settings\n {pgettext(\"profile options btn\", \"Options\")}\n \n \n
    \n
    \n
    \n )}\n
    \n
    \n \n
    \n)\n\nconst ProfileModerationButton = () => (\n \n settings\n \n)\n\nexport default ProfileHeader\n","import React from \"react\"\nimport { Link } from \"react-router\"\nimport Li from \"misago/components/li\"\n\nconst ProfileNav = ({ baseUrl, page, pages }) => (\n
    \n
    \n \n {page.icon}\n {page.name}\n \n
      \n {pages.map((page) => (\n
    • \n \n {page.icon}\n {page.name}\n \n
    • \n ))}\n
    \n
    \n
      \n {pages.map((page) => (\n
    • \n \n {page.icon}\n {page.name}\n \n
    • \n ))}\n
    \n
    \n)\n\nexport default ProfileNav\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport BanDetails from \"./ban-details\"\nimport Details from \"./details\"\nimport { Posts, Threads } from \"./feed\"\nimport Followers from \"./followers\"\nimport Follows from \"./follows\"\nimport UsernameHistory from \"./username-history\"\nimport WithDropdown from \"misago/components/with-dropdown\"\nimport misago from \"misago\"\nimport { hydrate } from \"misago/reducers/profile\"\nimport polls from \"misago/services/polls\"\nimport store from \"misago/services/store\"\nimport PageContainer from \"../PageContainer\"\nimport ProfileHeader from \"./ProfileHeader\"\nimport ProfileNav from \"./ProfileNav\"\n\nexport default class extends WithDropdown {\n constructor(props) {\n super(props)\n\n this.startPolling(props.profile.api.index)\n }\n\n startPolling(api) {\n polls.start({\n poll: \"user-profile\",\n url: api,\n frequency: 90 * 1000,\n update: this.update,\n })\n }\n\n update = (data) => {\n store.dispatch(hydrate(data))\n }\n\n render() {\n const baseUrl = misago.get(\"PROFILE\").url\n const pages = misago.get(\"PROFILE_PAGES\")\n const page = pages.filter((page) => {\n const url = baseUrl + page.component + \"/\"\n return this.props.location.pathname === url\n })[0]\n const { profile, user } = this.props\n const moderation = getModeration(profile, user)\n const message =\n !!user.acl.can_start_private_threads && profile.id !== user.id\n const follow = !!profile.acl.can_follow && profile.id !== user.id\n\n return (\n
    \n \n \n \n\n {this.props.children}\n \n
    \n )\n }\n}\n\nconst getModeration = (profile, user) => {\n const moderation = {\n available: false,\n rename: false,\n avatar: false,\n delete: false,\n }\n\n if (user.is_anonymous) return moderation\n\n moderation.rename = profile.acl.can_rename\n moderation.avatar = profile.acl.can_moderate_avatar\n moderation.delete = profile.acl.can_delete\n moderation.available = !!(\n moderation.rename ||\n moderation.avatar ||\n moderation.delete\n )\n\n return moderation\n}\n\nexport function select(store) {\n return {\n isAuthenticated: store.auth.user.id === store.profile.id,\n\n tick: store.tick.tick,\n user: store.auth.user,\n users: store.users,\n posts: store.posts,\n profile: store.profile,\n profileDetails: store[\"profile-details\"],\n \"username-history\": store[\"username-history\"],\n }\n}\n\nconst COMPONENTS = {\n posts: Posts,\n threads: Threads,\n followers: Followers,\n follows: Follows,\n details: Details,\n \"username-history\": UsernameHistory,\n \"ban-details\": BanDetails,\n}\n\nexport function paths() {\n let paths = []\n misago.get(\"PROFILE_PAGES\").forEach(function (item) {\n paths.push(\n Object.assign({}, item, {\n path: misago.get(\"PROFILE\").url + item.component + \"/\",\n component: connect(select)(COMPONENTS[item.component]),\n })\n )\n })\n\n return paths\n}\n","import React from \"react\"\nimport Route from \"./route\"\n\nexport function Threads(props) {\n let emptyMessage = null\n if (props.user.id === props.profile.id) {\n emptyMessage = pgettext(\n \"profile threads\",\n \"You haven't started any threads.\"\n )\n } else {\n emptyMessage = interpolate(\n pgettext(\"profile threads\", \"%(username)s hasn't started any threads\"),\n {\n username: props.profile.username,\n },\n true\n )\n }\n\n let header = null\n if (!props.posts.isLoaded) {\n header = pgettext(\"profile threads\", \"Loading...\")\n } else if (props.profile.id === props.user.id) {\n const message = npgettext(\n \"profile threads\",\n \"You have started %(threads)s thread.\",\n \"You have started %(threads)s threads.\",\n props.profile.threads\n )\n\n header = interpolate(\n message,\n {\n threads: props.profile.threads,\n },\n true\n )\n } else {\n const message = npgettext(\n \"profile threads\",\n \"%(username)s has started %(threads)s thread.\",\n \"%(username)s has started %(threads)s threads.\",\n props.profile.threads\n )\n\n header = interpolate(\n message,\n {\n username: props.profile.username,\n threads: props.profile.threads,\n },\n true\n )\n }\n\n return (\n \n )\n}\n\nexport function Posts(props) {\n let emptyMessage = null\n if (props.user.id === props.profile.id) {\n emptyMessage = pgettext(\"profile posts\", \"You have posted no messages.\")\n } else {\n emptyMessage = interpolate(\n pgettext(\"profile posts\", \"%(username)s posted no messages.\"),\n {\n username: props.profile.username,\n },\n true\n )\n }\n\n let header = null\n if (!props.posts.isLoaded) {\n header = pgettext(\"profile posts\", \"Loading...\")\n } else if (props.profile.id === props.user.id) {\n const message = npgettext(\n \"profile posts\",\n \"You have posted %(posts)s message.\",\n \"You have posted %(posts)s messages.\",\n props.profile.posts\n )\n\n header = interpolate(\n message,\n {\n posts: props.profile.posts,\n },\n true\n )\n } else {\n const message = npgettext(\n \"profile posts\",\n \"%(username)s has posted %(posts)s message.\",\n \"%(username)s has posted %(posts)s messages.\",\n props.profile.posts\n )\n\n header = interpolate(\n message,\n {\n username: props.profile.username,\n posts: props.profile.posts,\n },\n true\n )\n }\n\n return (\n \n )\n}\n","import { connect } from \"react-redux\"\nimport Profile, { paths, select } from \"misago/components/profile/root\"\nimport misago from \"misago/index\"\nimport mount from \"misago/utils/routed-component\"\n\nexport default function initializer(context) {\n if (context.has(\"PROFILE\") && context.has(\"PROFILE_PAGES\")) {\n mount({\n root: misago.get(\"PROFILE\").url,\n component: connect(select)(Profile),\n paths: paths(),\n })\n }\n}\n\nmisago.addInitializer({\n name: \"component:profile\",\n initializer: initializer,\n after: \"reducer:profile-hydrate\",\n})\n","import React from \"react\"\nimport misago from \"misago/index\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport * as validators from \"misago/utils/validators\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport class RequestLinkForm extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n email: \"\",\n\n validators: {\n email: [validators.email()],\n },\n }\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(\n pgettext(\n \"request activation link form\",\n \"Enter a valid e-mail address.\"\n )\n )\n return false\n }\n }\n\n send() {\n return ajax.post(misago.get(\"SEND_ACTIVATION_API\"), {\n email: this.state.email,\n })\n }\n\n handleSuccess(apiResponse) {\n this.props.callback(apiResponse)\n }\n\n handleError(rejection) {\n if ([\"already_active\", \"inactive_admin\"].indexOf(rejection.code) > -1) {\n snackbar.info(rejection.detail)\n } else if (rejection.status === 403 && rejection.ban) {\n showBannedPage(rejection.ban)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n \n
    \n
    \n\n \n {pgettext(\"request activation link form btn\", \"Send link\")}\n \n \n
    \n )\n }\n}\n\nexport class LinkSent extends React.Component {\n getMessage() {\n return interpolate(\n pgettext(\n \"request activation link form\",\n \"Activation link was sent to %(email)s\"\n ),\n {\n email: this.props.user.email,\n },\n true\n )\n }\n\n render() {\n return (\n
    \n
    \n
    \n check\n
    \n
    \n

    {this.getMessage()}

    \n
    \n \n {pgettext(\n \"request activation link form btn\",\n \"Request another link\"\n )}\n \n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n complete: false,\n }\n }\n\n complete = (apiResponse) => {\n this.setState({\n complete: apiResponse,\n })\n }\n\n reset = () => {\n this.setState({\n complete: false,\n })\n }\n\n render() {\n if (this.state.complete) {\n return \n } else {\n return \n }\n }\n}\n","import misago from \"misago/index\"\nimport RequestActivationLink from \"misago/components/request-activation-link\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n if (document.getElementById(\"request-activation-link-mount\")) {\n mount(RequestActivationLink, \"request-activation-link-mount\", false)\n }\n}\n\nmisago.addInitializer({\n name: \"component:request-activation-link\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport misago from \"misago/index\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport * as validators from \"misago/utils/validators\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport class RequestResetForm extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n email: \"\",\n\n validators: {\n email: [validators.email()],\n },\n }\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(\n pgettext(\"request password reset form\", \"Enter a valid e-mail address.\")\n )\n return false\n }\n }\n\n send() {\n return ajax.post(misago.get(\"SEND_PASSWORD_RESET_API\"), {\n email: this.state.email,\n })\n }\n\n handleSuccess(apiResponse) {\n this.props.callback(apiResponse)\n }\n\n handleError(rejection) {\n if ([\"inactive_user\", \"inactive_admin\"].indexOf(rejection.code) > -1) {\n this.props.showInactivePage(rejection)\n } else if (rejection.status === 403 && rejection.ban) {\n showBannedPage(rejection.ban)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n \n
    \n
    \n\n \n {pgettext(\"request password reset form btn\", \"Send link\")}\n \n \n
    \n )\n }\n}\n\nexport class LinkSent extends React.Component {\n getMessage() {\n return interpolate(\n pgettext(\n \"request password reset form\",\n \"Reset password link was sent to %(email)s\"\n ),\n {\n email: this.props.user.email,\n },\n true\n )\n }\n\n render() {\n return (\n
    \n
    \n
    \n check\n
    \n
    \n

    {this.getMessage()}

    \n
    \n \n {pgettext(\n \"request password reset form btn\",\n \"Request another link\"\n )}\n \n
    \n
    \n )\n }\n}\n\nexport class AccountInactivePage extends React.Component {\n getActivateButton() {\n if (this.props.activation === \"inactive_user\") {\n return (\n

    \n \n {pgettext(\n \"request password reset form error\",\n \"Activate your account.\"\n )}\n \n

    \n )\n } else {\n return null\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n info_outline\n
    \n\n
    \n

    \n {pgettext(\n \"request password reset form error\",\n \"Your account is inactive.\"\n )}\n

    \n

    {this.props.message}

    \n {this.getActivateButton()}\n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n complete: false,\n }\n }\n\n complete = (apiResponse) => {\n this.setState({\n complete: apiResponse,\n })\n }\n\n reset = () => {\n this.setState({\n complete: false,\n })\n }\n\n showInactivePage(apiResponse) {\n ReactDOM.render(\n ,\n document.getElementById(\"page-mount\")\n )\n }\n\n render() {\n if (this.state.complete) {\n return \n }\n\n return (\n \n )\n }\n}\n","import misago from \"misago/index\"\nimport RequestPasswordReset from \"misago/components/request-password-reset\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n if (document.getElementById(\"request-password-reset-mount\")) {\n mount(RequestPasswordReset, \"request-password-reset-mount\", false)\n }\n}\n\nmisago.addInitializer({\n name: \"component:request-password-reset\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport misago from \"misago/index\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport SignInModal from \"misago/components/sign-in.js\"\nimport ajax from \"misago/services/ajax\"\nimport auth from \"misago/services/auth\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport showBannedPage from \"misago/utils/banned-page\"\n\nexport class ResetPasswordForm extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n password: \"\",\n }\n }\n\n clean() {\n if (this.state.password.trim().length) {\n return true\n } else {\n snackbar.error(pgettext(\"password reset form\", \"Enter new password.\"))\n return false\n }\n }\n\n send() {\n return ajax.post(misago.get(\"CHANGE_PASSWORD_API\"), {\n password: this.state.password,\n })\n }\n\n handleSuccess(apiResponse) {\n this.props.callback(apiResponse)\n }\n\n handleError(rejection) {\n if (rejection.status === 403 && rejection.ban) {\n showBannedPage(rejection.ban)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n \n
    \n
    \n\n \n {pgettext(\"password reset form btn\", \"Change password\")}\n \n \n
    \n )\n }\n}\n\nexport class PasswordChangedPage extends React.Component {\n getMessage() {\n return interpolate(\n pgettext(\n \"password reset form\",\n \"%(username)s, your password has been changed.\"\n ),\n {\n username: this.props.user.username,\n },\n true\n )\n }\n\n showSignIn() {\n modal.show(SignInModal)\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n check\n
    \n\n
    \n

    {this.getMessage()}

    \n

    \n {pgettext(\n \"password reset form\",\n \"Sign in using new password to continue.\"\n )}\n

    \n

    \n \n {pgettext(\"password reset form btn\", \"Sign in\")}\n \n

    \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport default class extends React.Component {\n complete = (apiResponse) => {\n auth.softSignOut()\n\n // nuke \"redirect_to\" field so we don't end\n // coming back to error page after sign in\n $('#hidden-login-form input[name=\"redirect_to\"]').remove()\n\n ReactDOM.render(\n ,\n document.getElementById(\"page-mount\")\n )\n }\n\n render() {\n return \n }\n}\n","import misago from \"misago\"\nimport ResetPasswordForm from \"misago/components/reset-password-form\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n if (document.getElementById(\"reset-password-form-mount\")) {\n mount(ResetPasswordForm, \"reset-password-form-mount\", false)\n }\n}\n\nmisago.addInitializer({\n name: \"component:reset-password-form\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport { SearchOverlay } from \"../../components/Search\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n const root = document.getElementById(\"search-mount\")\n ReactDOM.render(\n \n \n ,\n root\n )\n}\n\nmisago.addInitializer({\n name: \"component:search-overlay\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport misago from \"misago\"\nimport Form from \"misago/components/form\"\nimport { load as updatePosts } from \"misago/reducers/posts\"\nimport { update as updateSearch } from \"misago/reducers/search\"\nimport { hydrate as updateUsers } from \"misago/reducers/users\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport { FlexRow, FlexRowCol, FlexRowSection } from \"../FlexRow\"\nimport {\n PageHeader,\n PageHeaderContainer,\n PageHeaderBanner,\n PageHeaderDetails,\n} from \"../PageHeader\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n query: props.search.query,\n }\n }\n\n componentDidMount() {\n if (this.state.query.length) {\n this.handleSubmit()\n }\n }\n\n onQueryChange = (event) => {\n this.changeValue(\"query\", event.target.value)\n }\n\n clean() {\n if (!this.state.query.trim().length) {\n snackbar.error(pgettext(\"search form\", \"You have to enter search query.\"))\n return false\n }\n\n return true\n }\n\n send() {\n store.dispatch(\n updateSearch({\n isLoading: true,\n })\n )\n\n const query = this.state.query.trim()\n\n let url = window.location.href\n const urlQuery = url.indexOf(\"?q=\")\n if (urlQuery > 0) {\n url = url.substring(0, urlQuery + 3)\n }\n window.history.pushState({}, \"\", url + encodeURIComponent(query))\n\n return ajax.get(misago.get(\"SEARCH_API\"), { q: query })\n }\n\n handleSuccess(providers) {\n store.dispatch(\n updateSearch({\n query: this.state.query.trim(),\n isLoading: false,\n providers,\n })\n )\n\n providers.forEach((provider) => {\n if (provider.id === \"users\") {\n store.dispatch(updateUsers(provider.results.results))\n } else if (provider.id === \"threads\") {\n store.dispatch(updatePosts(provider.results))\n }\n })\n }\n\n handleError(rejection) {\n snackbar.apiError(rejection)\n\n store.dispatch(\n updateSearch({\n isLoading: false,\n })\n )\n }\n\n render() {\n return (\n
    \n \n \n \n

    {pgettext(\"search form title\", \"Search\")}

    \n
    \n \n \n \n \n \n \n \n \n search\n \n \n \n \n \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport { Link } from \"react-router\"\n\nexport default function (props) {\n return (\n
    \n {props.providers.map((provider) => {\n return (\n \n {provider.icon}\n {provider.name}\n \n \n )\n })}\n
    \n )\n}\n\nexport function Badge(props) {\n if (!props.results) return null\n\n let count = props.results.count\n if (count > 1000000) {\n count = Math.ceil(count / 1000000) + \"KK\"\n } else if (count > 1000) {\n count = Math.ceil(count / 1000) + \"K\"\n }\n\n return {count}\n}\n","import React from \"react\"\nimport PageContainer from \"../PageContainer\"\nimport SearchForm from \"./form\"\nimport SideNav from \"./sidenav\"\n\nexport default function (props) {\n return (\n
    \n \n \n
    \n
    \n \n
    \n
    \n {props.children}\n \n
    \n
    \n
    \n
    \n )\n}\n\nexport function SearchTime(props) {\n let time = null\n props.search.providers.forEach((p) => {\n if (p.id === props.provider.id) {\n time = p.time\n }\n })\n\n if (time === null) return null\n\n const copy = pgettext(\"search time\", \"Search took %(time)s s\")\n\n return (\n
    \n

    {interpolate(copy, { time }, true)}

    \n
    \n )\n}\n","import React from \"react\"\nimport PostFeed from \"misago/components/post-feed\"\nimport Button from \"misago/components/button\"\nimport MisagoMarkup from \"misago/components/misago-markup\"\nimport {\n update as updatePosts,\n append as appendPosts,\n} from \"misago/reducers/posts\"\nimport { updateProvider } from \"misago/reducers/search\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default function (props) {\n return (\n
    \n \n \n
    \n )\n}\n\nexport class LoadMore extends React.Component {\n onClick = () => {\n store.dispatch(\n updatePosts({\n isBusy: true,\n })\n )\n\n ajax\n .get(this.props.provider.api, {\n q: this.props.query,\n page: this.props.next,\n })\n .then(\n (providers) => {\n providers.forEach((provider) => {\n if (provider.id !== \"threads\") return\n store.dispatch(appendPosts(provider.results))\n store.dispatch(updateProvider(provider))\n })\n\n store.dispatch(\n updatePosts({\n isBusy: false,\n })\n )\n },\n (rejection) => {\n snackbar.apiError(rejection)\n\n store.dispatch(\n updatePosts({\n isBusy: false,\n })\n )\n }\n )\n }\n\n render() {\n if (!this.props.more) return null\n\n return (\n
    \n \n {pgettext(\"search threads btn\", \"Show more\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport SearchPage from \"../page\"\nimport Results from \"./results\"\n\nexport default function (props) {\n return (\n \n \n \n \n \n )\n}\n\nexport function Blankslate({ children, loading, posts, query }) {\n if (posts && posts.count) return children\n\n if (query.length) {\n return (\n

    \n {loading\n ? pgettext(\"search threads\", \"Loading results...\")\n : pgettext(\n \"search threads\",\n \"No threads matching search query have been found.\"\n )}\n

    \n )\n }\n\n return (\n

    \n {pgettext(\n \"search threads\",\n \"Enter at least two characters to search threads.\"\n )}\n

    \n )\n}\n","import React from \"react\"\nimport SearchPage from \"../page\"\nimport UsersList from \"misago/components/users-list\"\n\nexport default function (props) {\n return (\n \n \n \n \n \n )\n}\n\nexport function Blankslate({ children, loading, query, users }) {\n if (users.length) return children\n\n if (query.length) {\n return (\n

    \n {loading\n ? pgettext(\"search users\", \"Loading results...\")\n : pgettext(\n \"search users\",\n \"No users matching search query have been found.\"\n )}\n

    \n )\n }\n\n return (\n

    \n {pgettext(\n \"search users\",\n \"Enter at least two characters to search users.\"\n )}\n

    \n )\n}\n","import { connect } from \"react-redux\"\nimport SearchThreads from \"./threads\"\nimport SearchUsers from \"./users\"\n\nconst components = {\n threads: SearchThreads,\n users: SearchUsers,\n}\n\nexport function select(store) {\n return {\n posts: store.posts,\n search: store.search,\n tick: store.tick.tick,\n user: store.auth.user,\n users: store.users,\n }\n}\n\nexport default function (providers) {\n return providers.map((provider) => {\n return {\n path: provider.url,\n component: connect(select)(components[provider.id]),\n provider: provider,\n }\n })\n}\n","import paths from \"misago/components/search-route\"\nimport misago from \"misago\"\nimport mount from \"misago/utils/routed-component\"\n\nexport default function initializer(context) {\n if (context.get(\"CURRENT_LINK\") === \"misago:search\") {\n mount({\n paths: paths(misago.get(\"SEARCH_PROVIDERS\")),\n })\n }\n}\n\nmisago.addInitializer({\n name: \"component:search\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport { SiteNavOverlay } from \"../../components/SiteNav\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n const root = document.getElementById(\"site-nav-mount\")\n ReactDOM.render(\n \n \n ,\n root\n )\n}\n\nmisago.addInitializer({\n name: \"component:site-nav-overlay\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\n\nconst TYPES_CLASSES = {\n info: \"alert-info\",\n success: \"alert-success\",\n warning: \"alert-warning\",\n error: \"alert-danger\",\n}\n\nexport class Snackbar extends React.Component {\n getSnackbarClass() {\n let snackbarClass = \"alerts-snackbar\"\n if (this.props.isVisible) {\n snackbarClass += \" in\"\n } else {\n snackbarClass += \" out\"\n }\n return snackbarClass\n }\n\n render() {\n return (\n
    \n

    \n {this.props.message}\n

    \n
    \n )\n }\n}\n\nexport function select(state) {\n return state.snackbar\n}\n","import { connect } from \"react-redux\"\nimport misago from \"misago/index\"\nimport { Snackbar, select } from \"misago/components/snackbar\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer() {\n mount(connect(select)(Snackbar), \"snackbar-mount\")\n}\n\nmisago.addInitializer({\n name: \"component:snackbar\",\n initializer: initializer,\n after: \"snackbar\",\n})\n","import React from \"react\"\nimport {\n PageHeader,\n PageHeaderBanner,\n PageHeaderContainer,\n} from \"../PageHeader\"\n\nconst Header = ({ backendName }) => {\n const pageTitleTpl = pgettext(\"social auth title\", \"Sign in with %(backend)s\")\n const pageTitle = interpolate(pageTitleTpl, { backend: backendName }, true)\n\n return (\n \n \n \n

    {pageTitle}

    \n
    \n
    \n
    \n )\n}\n\nexport default Header\n","import React from \"react\"\nimport misago from \"misago\"\nimport RegisterLegalFootnote from \"misago/components/RegisterLegalFootnote\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport * as validators from \"misago/utils/validators\"\nimport PageContainer from \"../PageContainer\"\nimport Header from \"./header\"\n\nexport default class Register extends Form {\n constructor(props) {\n super(props)\n\n const formValidators = {\n email: [validators.email()],\n username: [validators.usernameContent()],\n }\n\n if (!!misago.get(\"TERMS_OF_SERVICE_ID\")) {\n formValidators.termsOfService = [validators.requiredTermsOfService()]\n }\n\n if (!!misago.get(\"PRIVACY_POLICY_ID\")) {\n formValidators.privacyPolicy = [validators.requiredPrivacyPolicy()]\n }\n\n this.state = {\n email: props.email || \"\",\n emailProtected: !!props.email,\n username: props.username || \"\",\n\n termsOfService: null,\n privacyPolicy: null,\n\n validators: formValidators,\n errors: {},\n\n isLoading: false,\n }\n }\n\n clean() {\n let errors = this.validate()\n let lengths = [\n this.state.email.trim().length,\n this.state.username.trim().length,\n ]\n\n if (lengths.indexOf(0) !== -1) {\n snackbar.error(pgettext(\"social auth form\", \"Fill out all fields.\"))\n return false\n }\n\n const { validators } = this.state\n\n const checkTermsOfService = !!misago.get(\"TERMS_OF_SERVICE_ID\")\n if (checkTermsOfService && this.state.termsOfService === null) {\n snackbar.error(validators.termsOfService[0](null))\n return false\n }\n\n const checkPrivacyPolicy = !!misago.get(\"PRIVACY_POLICY_ID\")\n if (checkPrivacyPolicy && this.state.privacyPolicy === null) {\n snackbar.error(validators.privacyPolicy[0](null))\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.post(this.props.url, {\n email: this.state.email,\n username: this.state.username,\n terms_of_service: this.state.termsOfService,\n privacy_policy: this.state.privacyPolicy,\n })\n }\n\n handleSuccess(response) {\n const { onRegistrationComplete } = this.props\n onRegistrationComplete(response)\n }\n\n handleError(rejection) {\n if (rejection.status === 200) {\n // We've entered \"errored\" state because response is HTML instead of exptected JSON\n const { onRegistrationComplete } = this.props\n const { username } = this.state\n onRegistrationComplete({ activation: \"active\", step: \"done\", username })\n } else if (rejection.status === 400) {\n const stateUpdate = { errors: rejection }\n if (rejection.email) {\n stateUpdate.emailProtected = false\n }\n this.setState(stateUpdate)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n handlePrivacyPolicyChange = (event) => {\n const value = event.target.value\n this.handleToggleAgreement(\"privacyPolicy\", value)\n }\n\n handleTermsOfServiceChange = (event) => {\n const value = event.target.value\n this.handleToggleAgreement(\"termsOfService\", value)\n }\n\n handleToggleAgreement = (agreement, value) => {\n this.setState((prevState, props) => {\n if (prevState[agreement] === null) {\n const errors = { ...prevState.errors, [agreement]: null }\n return { errors, [agreement]: value }\n }\n\n const validator = this.state.validators[agreement][0]\n const errors = { ...prevState.errors, [agreement]: [validator(null)] }\n return { errors, [agreement]: null }\n })\n }\n\n render() {\n const { backend_name } = this.props\n const { email, emailProtected, username, isLoading } = this.state\n\n let emailHelpText = null\n if (emailProtected) {\n const emailHelpTextTpl = pgettext(\n \"social auth form\",\n \"Your e-mail address has been verified by %(backend)s.\"\n )\n emailHelpText = interpolate(\n emailHelpTextTpl,\n { backend: backend_name },\n true\n )\n }\n\n return (\n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n

    \n {pgettext(\n \"social auth form title\",\n \"Complete your account\"\n )}\n

    \n
    \n
    \n \n \n \n \n \n \n \n
    \n
    \n \n {pgettext(\"social auth form btn\", \"Sign in\")}\n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport misago from \"misago\"\nimport PageContainer from \"../PageContainer\"\nimport Header from \"./header\"\n\nconst Complete = ({ activation, backend_name, username }) => {\n let icon = \"\"\n let message = \"\"\n if (activation === \"user\") {\n message = pgettext(\n \"account activation required\",\n \"%(username)s, your account has been created but you need to activate it before you will be able to sign in.\"\n )\n } else if (activation === \"admin\") {\n message = pgettext(\n \"account activation required\",\n \"%(username)s, your account has been created but the site administrator will have to activate it before you will be able to sign in.\"\n )\n } else {\n message = pgettext(\n \"social auth complete\",\n \"%(username)s, your account has been created and you have been signed in to it.\"\n )\n }\n\n if (activation === \"active\") {\n icon = \"check\"\n } else {\n icon = \"info_outline\"\n }\n\n return (\n
    \n
    \n \n
    \n
    \n
    \n
    \n

    \n {pgettext(\n \"social auth complete title\",\n \"Registration completed!\"\n )}\n

    \n
    \n
    \n
    \n {icon}\n
    \n
    \n

    \n {interpolate(message, { username }, true)}\n

    \n

    \n \n {pgettext(\n \"social auth complete link\",\n \"Return to forum index\"\n )}\n \n

    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n )\n}\n\nexport default Complete\n","import React from \"react\"\nimport Register from \"./register\"\nimport Complete from \"./complete\"\n\nexport default class SocialAuth extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n step: props.step,\n\n activation: props.activation || \"\",\n email: props.email || \"\",\n username: props.username || \"\",\n }\n }\n\n handleRegistrationComplete = ({ activation, email, step, username }) => {\n this.setState({ activation, email, step, username })\n }\n\n render() {\n const { backend_name, url } = this.props\n const { activation, email, step, username } = this.state\n\n if (step === \"register\") {\n return (\n \n )\n }\n\n return (\n \n )\n }\n}\n","import React from \"react\"\nimport SocialAuth from \"misago/components/social-auth\"\nimport misago from \"misago\"\nimport mount from \"misago/utils/mount-component\"\n\nexport default function initializer(context) {\n if (context.get(\"CURRENT_LINK\") === \"misago:social-complete\") {\n const props = context.get(\"SOCIAL_AUTH_FORM\")\n mount(, \"page-mount\")\n }\n}\n\nmisago.addInitializer({\n name: \"component:social-auth\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport Form from \"./form\"\nimport FormGroup from \"misago/components/form-group\"\nimport * as participants from \"misago/reducers/participants\"\nimport { updateAcl } from \"misago/reducers/thread\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n username: \"\",\n }\n }\n\n onUsernameChange = (event) => {\n this.changeValue(\"username\", event.target.value)\n }\n\n clean() {\n if (!this.state.username.trim().length) {\n snackbar.error(\n pgettext(\n \"add private thread participant\",\n \"You have to enter user name.\"\n )\n )\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.patch(this.props.thread.api.index, [\n { op: \"add\", path: \"participants\", value: this.state.username },\n { op: \"add\", path: \"acl\", value: 1 },\n ])\n }\n\n handleSuccess(data) {\n store.dispatch(updateAcl(data))\n store.dispatch(participants.replace(data.participants))\n\n snackbar.success(\n pgettext(\n \"add private thread participant\",\n \"New participant has been added to thread.\"\n )\n )\n\n modal.hide()\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n
    \n \n \n \n
    \n
    \n \n {pgettext(\n \"add private thread participant btn\",\n \"Add participant\"\n )}\n \n \n {pgettext(\"add private thread participant btn\", \"Cancel\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport function ModalHeader(props) {\n return (\n
    \n \n ×\n \n

    \n {pgettext(\n \"add private thread participant modal title\",\n \"Add participant\"\n )}\n

    \n
    \n )\n}\n","import React from \"react\"\nimport AddParticipantModal from \"misago/components/add-participant\"\nimport modal from \"misago/services/modal\"\n\nexport default class extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n if (!this.props.thread.acl.can_add_participants) return null\n\n return (\n
    \n \n person_add\n {pgettext(\"add participant btn\", \"Add participant\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport { changeOwner } from \"./actions\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.isUser = props.participant.id === props.user.id\n }\n\n onClick = () => {\n let confirmed = false\n if (this.isUser) {\n confirmed = window.confirm(\n pgettext(\n \"private thread owner change\",\n \"Are you sure you want to take over this thread?\"\n )\n )\n } else {\n const message = pgettext(\n \"private thread owner change\",\n \"Are you sure you want to change thread owner to %(user)s?\"\n )\n confirmed = window.confirm(\n interpolate(\n message,\n {\n user: this.props.participant.username,\n },\n true\n )\n )\n }\n\n if (!confirmed) return\n\n changeOwner(this.props.thread, this.props.participant)\n }\n\n render() {\n if (this.props.participant.is_owner) return null\n if (!this.props.thread.acl.can_change_owner) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n","import * as participants from \"misago/reducers/participants\"\nimport { updateAcl } from \"misago/reducers/thread\"\nimport misago from \"misago\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport function leave(thread, participant) {\n ajax\n .patch(thread.api.index, [\n { op: \"remove\", path: \"participants\", value: participant.id },\n ])\n .then(\n () => {\n snackbar.success(\n pgettext(\"thread participants actions\", \"You have left this thread.\")\n )\n window.setTimeout(() => {\n window.location = misago.get(\"PRIVATE_THREADS_URL\")\n }, 3 * 1000)\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n}\n\nexport function remove(thread, participant) {\n ajax\n .patch(thread.api.index, [\n { op: \"remove\", path: \"participants\", value: participant.id },\n { op: \"add\", path: \"acl\", value: 1 },\n ])\n .then(\n (data) => {\n store.dispatch(updateAcl(data))\n store.dispatch(participants.replace(data.participants))\n\n const message = pgettext(\n \"thread participants actions\",\n \"%(user)s has been removed from this thread.\"\n )\n snackbar.success(\n interpolate(\n message,\n {\n user: participant.username,\n },\n true\n )\n )\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n}\n\nexport function changeOwner(thread, participant) {\n ajax\n .patch(thread.api.index, [\n { op: \"replace\", path: \"owner\", value: participant.id },\n { op: \"add\", path: \"acl\", value: 1 },\n ])\n .then(\n (data) => {\n store.dispatch(updateAcl(data))\n store.dispatch(participants.replace(data.participants))\n\n const message = pgettext(\n \"thread participants actions\",\n \"%(user)s has been made new thread owner.\"\n )\n snackbar.success(\n interpolate(\n message,\n {\n user: participant.username,\n },\n true\n )\n )\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n}\n","import React from \"react\"\nimport { remove, leave } from \"./actions\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.isUser = props.participant.id === props.user.id\n }\n\n onClick = () => {\n let confirmed = false\n if (this.isUser) {\n confirmed = window.confirm(\n pgettext(\n \"private thread leave\",\n \"Are you sure you want to leave this thread?\"\n )\n )\n } else {\n const message = pgettext(\n \"private thread leave\",\n \"Are you sure you want to remove %(user)s from this thread?\"\n )\n confirmed = window.confirm(\n interpolate(\n message,\n {\n user: this.props.participant.username,\n },\n true\n )\n )\n }\n\n if (!confirmed) return\n\n if (this.isUser) {\n leave(this.props.thread, this.props.participant)\n } else {\n remove(this.props.thread, this.props.participant)\n }\n }\n\n render() {\n const isModerator = this.props.user.acl.can_moderate_private_threads\n\n if (!(this.props.userIsOwner || this.isUser || isModerator)) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n","import React from \"react\"\nimport MakeOwner from \"./make-owner\"\nimport Remove from \"./remove\"\nimport Avatar from \"misago/components/avatar\"\n\nexport default function (props) {\n const participant = props.participant\n\n let className = \"btn btn-default\"\n if (participant.is_owner) {\n className = \"btn btn-primary\"\n }\n className += \" btn-user btn-block\"\n\n return (\n
    \n
    \n \n \n {participant.username}\n \n \n
    \n
    \n )\n}\n\nexport function UserStatus({ isOwner }) {\n if (!isOwner) return null\n\n return (\n
  • \n start\n \n {pgettext(\"thread participants owner status\", \"Thread owner\")}\n \n
  • \n )\n}\n","import React from \"react\"\nimport Card from \"./card\"\n\nexport default function ({ participants, thread, user, userIsOwner }) {\n return (\n
    \n
    \n {participants.map((participant) => {\n return (\n \n )\n })}\n
    \n
    \n )\n}\n","import React from \"react\"\nimport AddParticipant from \"./add-participant\"\nimport CardsList from \"./cards-list\"\nimport * as utils from \"./utils\"\n\nexport default function (props) {\n if (!props.participants.length) return null\n\n return (\n
    \n
    \n \n
    \n \n
    \n

    {utils.getParticipantsCopy(props.participants)}

    \n
    \n
    \n
    \n
    \n )\n}\n\nexport function getUserIsOwner(user, participants) {\n return participants[0].id === user.id\n}\n","export function getParticipantsCopy(participants) {\n const count = participants.length\n const message = npgettext(\n \"thread participants stat\",\n \"This thread has %(users)s participant.\",\n \"This thread has %(users)s participants.\",\n count\n )\n\n return interpolate(\n message,\n {\n users: count,\n },\n true\n )\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n
    \n {props.poll.choices.map((choice) => {\n return (\n \n )\n })}\n
    \n )\n}\n\nexport function PollChoice(props) {\n let proc = 0\n if (props.choice.votes && props.poll.votes) {\n proc = Math.ceil((props.choice.votes * 100) / props.poll.votes)\n }\n\n return (\n
    \n
    {props.choice.label}
    \n
    \n
    \n \n \n {getVotesLabel(props.votes, props.proc)}\n \n
    \n \n
      \n \n \n
    \n
    \n
    \n )\n}\n\nexport function ChoiceVotes(props) {\n return (\n
  • \n {getVotesLabel(props.votes, props.proc)}\n
  • \n )\n}\n\nexport function getVotesLabel(votes, proc) {\n const message = npgettext(\n \"thread poll\",\n \"%(votes)s vote, %(proc)s% of total.\",\n \"%(votes)s votes, %(proc)s% of total.\",\n votes\n )\n\n return interpolate(\n message,\n {\n votes: votes,\n proc: proc,\n },\n true\n )\n}\n\nexport function UserChoice(props) {\n if (!props.selected) return null\n\n return (\n
  • \n check_box\n {pgettext(\"thread poll\", \"You've voted on this choice.\")}\n
  • \n )\n}\n","import React from \"react\"\nimport moment from \"moment\"\nimport Message from \"misago/components/modal-message\"\nimport Loader from \"misago/components/modal-loader\"\nimport ajax from \"misago/services/ajax\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: true,\n error: null,\n data: [],\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.poll.api.votes).then(\n (data) => {\n const hydratedData = data.map((choice) => {\n return Object.assign({}, choice, {\n voters: choice.voters.map((voter) => {\n return Object.assign({}, voter, {\n voted_on: moment(voter.voted_on),\n })\n }),\n })\n })\n\n this.setState({\n isLoading: false,\n data: hydratedData,\n })\n },\n (rejection) => {\n this.setState({\n isLoading: false,\n error: rejection.detail,\n })\n }\n )\n }\n\n render() {\n return (\n \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"thread poll\", \"Poll votes\")}\n

    \n
    \n\n \n
    \n \n )\n }\n}\n\nexport function ModalBody(props) {\n if (props.isLoading) {\n return \n } else if (props.error) {\n return \n }\n\n return \n}\n\nexport function ChoicesList(props) {\n return (\n
    \n
      \n {props.data.map((choice) => {\n return \n })}\n
    \n
    \n )\n}\n\nexport function ChoiceDetails(props) {\n return (\n
  • \n

    {props.label}

    \n \n \n
    \n
  • \n )\n}\n\nexport function VotesCount(props) {\n const message = npgettext(\n \"thread poll\",\n \"%(votes)s user has voted for this choice.\",\n \"%(votes)s users have voted for this choice.\",\n props.votes\n )\n\n const label = interpolate(\n message,\n {\n votes: props.votes,\n },\n true\n )\n\n return

    {label}

    \n}\n\nexport function VotesList(props) {\n if (!props.voters.length) return null\n\n return (\n
      \n {props.voters.map((user) => {\n return \n })}\n
    \n )\n}\n\nexport function Voter(props) {\n if (props.url) {\n return (\n
  • \n \n {props.username}\n {\" \"}\n \n
  • \n )\n }\n\n return (\n
  • \n {props.username} \n
  • \n )\n}\n\nexport function VoteDate(props) {\n return (\n \n {props.voted_on.fromNow()}\n \n )\n}\n","import React from \"react\"\nimport Modal from \"./modal\"\nimport * as poll from \"misago/reducers/poll\"\nimport * as thread from \"misago/reducers/thread\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default function (props) {\n const { isPollOver, poll, showVoting, thread } = props\n\n if (!isVisible(isPollOver, poll.acl, poll)) return null\n\n const controls = []\n\n const canVote = poll.acl.can_vote\n const canChangeVote = !poll.hasSelectedChoices || poll.allow_revotes\n\n if (canVote && canChangeVote) controls.push(0)\n if (poll.is_public || poll.acl.can_see_votes) controls.push(1)\n if (poll.acl.can_edit) controls.push(2)\n if (poll.acl.can_delete) controls.push(3)\n\n return (\n
    \n \n \n \n \n
    \n )\n}\n\nexport function isVisible(isPollOver, acl, poll) {\n return (\n poll.is_public ||\n acl.can_delete ||\n acl.can_edit ||\n acl.can_see_votes ||\n (acl.can_vote &&\n !isPollOver &&\n (!poll.hasSelectedChoices || poll.allow_revotes))\n )\n}\n\nexport function getClassName(controls, control) {\n let className = \"col-xs-6\"\n\n if (controls.length === 1) {\n className = \"col-xs-12\"\n }\n\n if (controls.length === 3 && controls[0] === control) {\n className = \"col-xs-12\"\n }\n\n return className + \" col-sm-3 col-md-2\"\n}\n\nexport function ChangeVote(props) {\n const canVote = props.poll.acl.can_vote\n const canChangeVote =\n !props.poll.hasSelectedChoices || props.poll.allow_revotes\n\n if (!(canVote && canChangeVote)) return null\n\n return (\n
    \n \n {pgettext(\"thread poll\", \"Vote\")}\n \n
    \n )\n}\n\nexport class SeeVotes extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n const seeVotes =\n this.props.poll.is_public || this.props.poll.acl.can_see_votes\n if (!seeVotes) return null\n\n return (\n
    \n \n {pgettext(\"thread poll\", \"See votes\")}\n \n
    \n )\n }\n}\n\nexport function Edit(props) {\n if (!props.poll.acl.can_edit) return null\n\n return (\n
    \n \n {pgettext(\"thread poll\", \"Edit\")}\n \n
    \n )\n}\n\nexport class Delete extends React.Component {\n onClick = () => {\n const deletePoll = window.confirm(\n pgettext(\n \"thread poll\",\n \"Are you sure you want to delete this poll? This action is not reversible.\"\n )\n )\n if (!deletePoll) return false\n\n store.dispatch(poll.busy())\n\n ajax\n .delete(this.props.poll.api.index)\n .then(this.handleSuccess, this.handleError)\n }\n\n handleSuccess = (newThreadAcl) => {\n snackbar.success(pgettext(\"thread poll\", \"Poll has been deleted\"))\n store.dispatch(poll.remove())\n store.dispatch(thread.updateAcl(newThreadAcl))\n }\n\n handleError = (rejection) => {\n snackbar.apiError(rejection)\n store.dispatch(poll.release())\n }\n\n render() {\n if (!this.props.poll.acl.can_delete) return null\n\n return (\n
    \n \n {pgettext(\"thread poll\", \"Delete\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst DATE_ABBR = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default function (props) {\n return (\n
      \n \n \n \n \n
    \n )\n}\n\nexport function PollCreation(props) {\n const message = interpolate(\n escapeHtml(pgettext(\"thread poll\", \"Started by %(poster)s %(posted_on)s.\")),\n {\n poster: getPoster(props.poll),\n posted_on: getPostedOn(props.poll),\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function getPoster(poll) {\n if (poll.url.poster) {\n return interpolate(\n USER_URL,\n {\n url: escapeHtml(poll.url.poster),\n user: escapeHtml(poll.poster_name),\n },\n true\n )\n }\n\n return interpolate(\n USER_SPAN,\n {\n user: escapeHtml(poll.poster_name),\n },\n true\n )\n}\n\nexport function getPostedOn(poll) {\n return interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(poll.posted_on.format(\"LLL\")),\n relative: escapeHtml(poll.posted_on.fromNow()),\n },\n true\n )\n}\n\nexport function PollLength(props) {\n if (!props.poll.length) {\n return null\n }\n\n const message = interpolate(\n escapeHtml(pgettext(\"thread poll\", \"Voting ends %(ends_on)s.\")),\n {\n ends_on: getEndsOn(props.poll),\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function getEndsOn(poll) {\n return interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(poll.endsOn.format(\"LLL\")),\n relative: escapeHtml(poll.endsOn.fromNow()),\n },\n true\n )\n}\n\nexport function PollVotes(props) {\n const message = npgettext(\n \"thread poll\",\n \"%(votes)s vote.\",\n \"%(votes)s votes.\",\n props.votes\n )\n const label = interpolate(\n message,\n {\n votes: props.votes,\n },\n true\n )\n\n return
  • {label}
  • \n}\n\nexport function PollIsPublic(props) {\n if (!props.poll.is_public) {\n return null\n }\n\n return (\n
  • \n {pgettext(\"thread poll\", \"Voting is public.\")}\n
  • \n )\n}\n","import React from \"react\"\nimport Chart from \"./chart\"\nimport Options from \"./options\"\nimport PollInfo from \"../info\"\n\nexport default function (props) {\n return (\n
    \n
    \n

    {props.poll.question}

    \n \n \n \n
    \n
    \n )\n}\n","import React from \"react\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst DATE_ABBR = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default function (props) {\n return (\n
      \n \n \n
    \n )\n}\n\nexport function PollChoicesLeft({ choicesLeft }) {\n if (choicesLeft === 0) {\n return (\n
  • \n {pgettext(\"thread poll\", \"You can't select any more choices.\")}\n
  • \n )\n }\n\n const message = npgettext(\n \"thread poll\",\n \"You can select %(choices)s more choice.\",\n \"You can select %(choices)s more choices.\",\n choicesLeft\n )\n\n const label = interpolate(\n message,\n {\n choices: choicesLeft,\n },\n true\n )\n\n return
  • {label}
  • \n}\n\nexport function PollAllowRevote(props) {\n if (props.poll.allow_revotes) {\n return (\n
  • \n {pgettext(\"thread poll\", \"You can change your vote later.\")}\n
  • \n )\n }\n\n return (\n
  • \n {pgettext(\"thread poll\", \"Votes are final.\")}\n
  • \n )\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n
      \n {props.choices.map((choice) => {\n return (\n \n )\n })}\n
    \n )\n}\n\nexport class ChoiceSelect extends React.Component {\n onClick = () => {\n this.props.toggleChoice(this.props.choice.hash)\n }\n\n render() {\n return (\n
  • \n \n \n {this.props.choice.selected\n ? \"check_box\"\n : \"check_box_outline_blank\"}\n \n {this.props.choice.label}\n \n
  • \n )\n }\n}\n","export function getChoiceFromHash(choices, hash) {\n for (const i in choices) {\n const choice = choices[i]\n if (choice.hash === hash) {\n return choice\n }\n }\n\n return null\n}\n\nexport function getChoicesLeft(poll, choices) {\n let selection = []\n for (const i in choices) {\n const choice = choices[i]\n if (choice.selected) {\n selection.push(choice)\n }\n }\n\n return poll.allowed_choices - selection.length\n}\n","import React from \"react\"\nimport ChoicesHelp from \"./help\"\nimport ChoicesSelect from \"./select\"\nimport { getChoicesLeft, getChoiceFromHash } from \"./utils\"\nimport PollInfo from \"../info\"\nimport { Delete, Edit, getClassName } from \"../results/options\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport * as poll from \"misago/reducers/poll\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n choices: props.poll.choices,\n choicesLeft: getChoicesLeft(props.poll, props.poll.choices),\n }\n }\n\n toggleChoice = (hash) => {\n const choice = getChoiceFromHash(this.state.choices, hash)\n\n let choices = null\n if (!choice.selected) {\n choices = this.selectChoice(choice, hash)\n } else {\n choices = this.deselectChoice(choice, hash)\n }\n\n this.setState({\n choices,\n choicesLeft: getChoicesLeft(this.props.poll, choices),\n })\n }\n\n selectChoice = (choice, hash) => {\n const choicesLeft = getChoicesLeft(this.props.poll, this.state.choices)\n\n if (!choicesLeft) {\n for (const i in this.state.choices.slice()) {\n const item = this.state.choices[i]\n if (item.selected && item.hash != hash) {\n item.selected = false\n break\n }\n }\n }\n\n return this.state.choices.map((choice) => {\n return Object.assign({}, choice, {\n selected: choice.hash == hash ? true : choice.selected,\n })\n })\n }\n\n deselectChoice = (choice, hash) => {\n return this.state.choices.map((choice) => {\n return Object.assign({}, choice, {\n selected: choice.hash == hash ? false : choice.selected,\n })\n })\n }\n\n clean() {\n if (this.state.choicesLeft === this.props.poll.allowed_choices) {\n snackbar.error(\n pgettext(\"thread poll vote\", \"You need to select at least one choice.\")\n )\n return false\n }\n\n return true\n }\n\n send() {\n let data = []\n for (const i in this.state.choices.slice()) {\n const item = this.state.choices[i]\n if (item.selected) {\n data.push(item.hash)\n }\n }\n\n return ajax.post(this.props.poll.api.votes, data)\n }\n\n handleSuccess(data) {\n store.dispatch(poll.replace(data))\n snackbar.success(pgettext(\"thread poll vote\", \"Your vote has been saved.\"))\n\n this.props.showResults()\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n const controls = []\n\n if (this.props.poll.acl.can_vote) controls.push(0)\n if (this.props.poll.is_public || this.props.poll.acl.can_see_votes)\n controls.push(1)\n if (this.props.poll.acl.can_edit) controls.push(2)\n if (this.props.poll.acl.can_delete) controls.push(3)\n\n return (\n
    \n
    \n
    \n

    {this.props.poll.question}

    \n \n \n \n
    \n
    \n
    \n
    \n \n {pgettext(\"thread poll vote btn\", \"Save your vote\")}\n \n
    \n
    \n \n {pgettext(\"thread poll vote btn\", \"See results\")}\n \n
    \n \n \n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport moment from \"moment\"\nimport Results from \"./results\"\nimport Voting from \"./voting\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n let showResults = true\n if (props.user.id && !props.poll.hasSelectedChoices) {\n showResults = false\n }\n\n this.state = {\n showResults,\n }\n }\n\n showResults = () => {\n this.setState({\n showResults: true,\n })\n }\n\n showVoting = () => {\n this.setState({\n showResults: false,\n })\n }\n\n render() {\n if (!this.props.thread.poll) return null\n\n const isPollOver = getIsPollOver(this.props.poll)\n\n if (\n !isPollOver &&\n this.props.poll.acl.can_vote &&\n !this.state.showResults\n ) {\n return \n } else {\n return (\n \n )\n }\n }\n}\n\nexport function getIsPollOver(poll) {\n if (poll.length) {\n return moment().isAfter(poll.endsOn)\n }\n return false\n}\n","import React from \"react\"\nimport getRandomString from \"../../../utils/getRandomString\"\n\nconst HASH_LENGTH = 12\n\nexport default class extends React.Component {\n onAdd = () => {\n let choices = this.props.choices.slice()\n choices.push({\n hash: getRandomString(HASH_LENGTH),\n label: \"\",\n })\n\n this.props.setChoices(choices)\n }\n\n onChange = (hash, label) => {\n const choices = this.props.choices.map((choice) => {\n if (choice.hash === hash) {\n choice.label = label\n }\n\n return choice\n })\n this.props.setChoices(choices)\n }\n\n onDelete = (hash) => {\n const choices = this.props.choices.filter((choice) => {\n return choice.hash !== hash\n })\n this.props.setChoices(choices)\n }\n\n render() {\n return (\n
    \n
      \n {this.props.choices.map((choice) => {\n return (\n 2}\n choice={choice}\n disabled={this.props.disabled}\n key={choice.hash}\n onChange={this.onChange}\n onDelete={this.onDelete}\n />\n )\n })}\n
    \n \n {pgettext(\"thread poll\", \"Add choice\")}\n \n
    \n )\n }\n}\n\nexport class PollChoice extends React.Component {\n onChange = (event) => {\n this.props.onChange(this.props.choice.hash, event.target.value)\n }\n\n onDelete = () => {\n const deleteItem =\n this.props.choice.label.length === 0\n ? true\n : window.confirm(\n pgettext(\n \"thread poll\",\n \"Are you sure you want to remove this choice?\"\n )\n )\n if (deleteItem) {\n this.props.onDelete(this.props.choice.hash)\n }\n }\n\n render() {\n return (\n
  • \n \n close\n \n \n
  • \n )\n }\n}\n","import React from \"react\"\nimport ChoicesControl from \"./choices-control\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport YesNoSwitch from \"misago/components/yes-no-switch\"\nimport * as poll from \"misago/reducers/poll\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n const poll = props.poll.id\n ? props.poll\n : {\n question: \"\",\n choices: [\n {\n hash: \"choice-10000\",\n label: \"\",\n },\n {\n hash: \"choice-20000\",\n label: \"\",\n },\n ],\n length: 0,\n allowed_choices: 1,\n allow_revotes: 0,\n is_public: 0,\n }\n\n this.state = {\n isLoading: false,\n isEdit: !!poll.id,\n\n question: poll.question,\n choices: poll.choices,\n length: poll.length,\n allowed_choices: poll.allowed_choices,\n allow_revotes: poll.allow_revotes,\n is_public: poll.is_public,\n\n validators: {\n question: [],\n choices: [],\n length: [],\n allowed_choices: [],\n },\n\n errors: {},\n }\n }\n\n setChoices = (choices) => {\n this.setState((state) => {\n return {\n choices,\n errors: Object.assign({}, state.errors, { choices: null }),\n }\n })\n }\n\n onCancel = () => {\n let cancel = false\n\n // Nothing added to the poll so no changes to discard\n const formEmpty = !!(\n this.state.question === \"\" &&\n this.state.choices &&\n this.state.choices.every((choice) => choice.label === \"\") &&\n this.state.length === 0 &&\n this.state.allowed_choices === 1\n )\n\n if (formEmpty) {\n return this.props.close()\n }\n\n if (!!this.props.poll) {\n cancel = window.confirm(\n pgettext(\"thread poll\", \"Are you sure you want to discard changes?\")\n )\n } else {\n cancel = window.confirm(\n pgettext(\"thread poll\", \"Are you sure you want to discard new poll?\")\n )\n }\n\n if (cancel) {\n this.props.close()\n }\n }\n\n send() {\n const data = {\n question: this.state.question,\n choices: this.state.choices,\n length: this.state.length,\n allowed_choices: this.state.allowed_choices,\n allow_revotes: this.state.allow_revotes,\n is_public: this.state.is_public,\n }\n\n if (this.state.isEdit) {\n return ajax.put(this.props.poll.api.index, data)\n }\n\n return ajax.post(this.props.thread.api.poll, data)\n }\n\n handleSuccess(data) {\n store.dispatch(poll.replace(data))\n\n if (this.state.isEdit) {\n snackbar.success(pgettext(\"thread poll\", \"Poll has been edited.\"))\n } else {\n snackbar.success(pgettext(\"thread poll\", \"Poll has been posted.\"))\n }\n\n this.props.close()\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n if (rejection.non_field_errors) {\n rejection.allowed_choices = rejection.non_field_errors\n }\n\n this.setState({\n errors: Object.assign({}, rejection),\n })\n\n snackbar.error(gettext(\"Form contains errors.\"))\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n

    \n {this.state.isEdit\n ? pgettext(\"thread poll\", \"Edit poll\")\n : pgettext(\"thread poll\", \"Add poll\")}\n

    \n
    \n
    \n
    \n \n {pgettext(\"thread poll\", \"Question and choices\")}\n \n\n \n \n \n\n \n \n \n
    \n\n
    \n {pgettext(\"thread poll\", \"Voting\")}\n\n
    \n
    \n \n \n \n
    \n
    \n \n \n \n
    \n
    \n\n
    \n \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n {pgettext(\"thread poll\", \"Cancel\")}\n {\" \"}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport function PollPublicSwitch(props) {\n if (props.isEdit) return null\n\n return (\n
    \n \n \n \n
    \n )\n}\n","import React from \"react\"\n\nconst ICON = {\n changed_title: \"edit\",\n\n pinned_globally: \"bookmark\",\n pinned_locally: \"bookmark_border\",\n unpinned: \"panorama_fish_eye\",\n\n moved: \"arrow_forward\",\n merged: \"call_merge\",\n\n approved: \"done\",\n\n opened: \"lock_open\",\n closed: \"lock_outline\",\n\n unhid: \"visibility\",\n hid: \"visibility_off\",\n\n changed_owner: \"grade\",\n tookover: \"grade\",\n\n added_participant: \"person_add\",\n\n owner_left: \"person_outline\",\n participant_left: \"person_outline\",\n removed_participant: \"remove_circle_outline\",\n}\n\nconst EventIcon = (props) => (\n \n {ICON[props.post.event_type]}\n \n)\n\nexport default EventIcon\n","import React from \"react\"\nimport moment from \"moment\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default function (props) {\n if (isVisible(props.post.acl)) {\n return (\n
  • \n \n \n \n
  • \n )\n } else {\n return null\n }\n}\n\nexport function isVisible(acl) {\n return acl.can_hide\n}\n\nexport class Hide extends React.Component {\n onClick = () => {\n store.dispatch(\n post.patch(this.props.post, {\n is_hidden: true,\n hidden_on: moment(),\n hidden_by_name: this.props.user.username,\n url: Object.assign(this.props.post.url, {\n hidden_by: this.props.user.url,\n }),\n })\n )\n\n const op = { op: \"replace\", path: \"is-hidden\", value: true }\n\n ajax.patch(this.props.post.api.index, [op]).then(\n (patch) => {\n store.dispatch(post.patch(this.props.post, patch))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(\n post.patch(this.props.post, {\n is_hidden: false,\n })\n )\n }\n )\n }\n\n render() {\n if (!this.props.post.is_hidden) {\n return (\n \n )\n } else {\n return null\n }\n }\n}\n\nexport class Unhide extends React.Component {\n onClick = () => {\n store.dispatch(\n post.patch(this.props.post, {\n is_hidden: false,\n })\n )\n\n const op = { op: \"replace\", path: \"is-hidden\", value: false }\n\n ajax.patch(this.props.post.api.index, [op]).then(\n (patch) => {\n store.dispatch(post.patch(this.props.post, patch))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(\n post.patch(this.props.post, {\n is_hidden: true,\n })\n )\n }\n )\n }\n\n render() {\n if (this.props.post.is_hidden) {\n return (\n \n )\n } else {\n return null\n }\n }\n}\n\nexport class Delete extends React.Component {\n onClick = () => {\n const decision = window.confirm(\n pgettext(\n \"event delete\",\n \"Are you sure you wish to delete this event? This action is not reversible!\"\n )\n )\n if (decision) {\n this.delete()\n }\n }\n\n delete = () => {\n store.dispatch(\n post.patch(this.props.post, {\n isDeleted: true,\n })\n )\n\n ajax.delete(this.props.post.api.index).then(\n () => {\n snackbar.success(pgettext(\"event delete\", \"Event has been deleted.\"))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(\n post.patch(this.props.post, {\n isDeleted: false,\n })\n )\n }\n )\n }\n\n render() {\n return (\n \n )\n }\n}\n","import React from \"react\"\nimport escapeHtml from \"misago/utils/escape-html\"\nimport Controls from \"./controls\"\n\nconst DATE_ABBR = '%(relative)s'\nconst DATE_URL = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default function (props) {\n return (\n
      \n \n \n \n
    \n )\n}\n\nexport function Hidden(props) {\n if (props.post.is_hidden) {\n let user = null\n if (props.post.url.hidden_by) {\n user = interpolate(\n USER_URL,\n {\n url: escapeHtml(props.post.url.hidden_by),\n user: escapeHtml(props.post.hidden_by_name),\n },\n true\n )\n } else {\n user = interpolate(\n USER_SPAN,\n {\n user: escapeHtml(props.post.hidden_by_name),\n },\n true\n )\n }\n\n const date = interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(props.post.hidden_on.format(\"LLL\")),\n relative: escapeHtml(props.post.hidden_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(\n pgettext(\"event info\", \"Hidden by %(event_by)s %(event_on)s.\")\n ),\n {\n event_by: user,\n event_on: date,\n },\n true\n )\n\n return (\n \n )\n } else {\n return null\n }\n}\n\nexport function Poster(props) {\n let user = null\n if (props.post.poster) {\n user = interpolate(\n USER_URL,\n {\n url: escapeHtml(props.post.poster.url),\n user: escapeHtml(props.post.poster_name),\n },\n true\n )\n } else {\n user = interpolate(\n USER_SPAN,\n {\n user: escapeHtml(props.post.poster_name),\n },\n true\n )\n }\n\n const date = interpolate(\n DATE_URL,\n {\n url: escapeHtml(props.post.url.index),\n absolute: escapeHtml(props.post.posted_on.format(\"LLL\")),\n relative: escapeHtml(props.post.posted_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(pgettext(\"event info\", \"By %(event_by)s %(event_on)s.\")),\n {\n event_by: user,\n event_on: date,\n },\n true\n )\n\n return (\n \n )\n}\n","import React from \"react\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst MESSAGE = {\n pinned_globally: pgettext(\n \"event message\",\n \"Thread has been pinned globally.\"\n ),\n pinned_locally: pgettext(\n \"event message\",\n \"Thread has been pinned in category.\"\n ),\n unpinned: pgettext(\"event message\", \"Thread has been unpinned.\"),\n\n approved: pgettext(\"event message\", \"Thread has been approved.\"),\n\n opened: pgettext(\"event message\", \"Thread has been opened.\"),\n closed: pgettext(\"event message\", \"Thread has been closed.\"),\n\n unhid: pgettext(\"event message\", \"Thread has been revealed.\"),\n hid: pgettext(\"event message\", \"Thread has been made hidden.\"),\n\n tookover: pgettext(\"event message\", \"Took thread over.\"),\n\n owner_left: pgettext(\n \"event message\",\n \"Owner has left thread. This thread is now closed.\"\n ),\n participant_left: pgettext(\"event message\", \"Participant has left thread.\"),\n}\n\nconst ITEM_LINK = '%(name)s'\nconst ITEM_SPAN = '%(name)s'\n\nexport default function (props) {\n if (MESSAGE[props.post.event_type]) {\n return

    {MESSAGE[props.post.event_type]}

    \n } else if (props.post.event_type === \"changed_title\") {\n return \n } else if (props.post.event_type === \"moved\") {\n return \n } else if (props.post.event_type === \"merged\") {\n return \n } else if (props.post.event_type === \"changed_owner\") {\n return \n } else if (props.post.event_type === \"added_participant\") {\n return \n } else if (props.post.event_type === \"removed_participant\") {\n return \n } else {\n return null\n }\n}\n\nexport function ChangedTitle(props) {\n const msgstring = escapeHtml(\n pgettext(\n \"event message\",\n \"Thread title has been changed from %(old_title)s.\"\n )\n )\n const oldTitle = interpolate(\n ITEM_SPAN,\n {\n name: escapeHtml(props.post.event_context.old_title),\n },\n true\n )\n const message = interpolate(\n msgstring,\n {\n old_title: oldTitle,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function Moved(props) {\n const msgstring = escapeHtml(\n pgettext(\"event message\", \"Thread has been moved from %(from_category)s.\")\n )\n const fromCategory = interpolate(\n ITEM_LINK,\n {\n url: escapeHtml(props.post.event_context.from_category.url),\n name: escapeHtml(props.post.event_context.from_category.name),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n from_category: fromCategory,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function Merged(props) {\n const msgstring = escapeHtml(\n pgettext(\n \"event message\",\n \"The %(merged_thread)s thread has been merged into this thread.\"\n )\n )\n const mergedThread = interpolate(\n ITEM_SPAN,\n {\n name: escapeHtml(props.post.event_context.merged_thread),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n merged_thread: mergedThread,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function ChangedOwner(props) {\n const msgstring = escapeHtml(\n pgettext(\"event message\", \"Changed thread owner to %(user)s.\")\n )\n const newOwner = interpolate(\n ITEM_LINK,\n {\n url: escapeHtml(props.post.event_context.user.url),\n name: escapeHtml(props.post.event_context.user.username),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n user: newOwner,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function AddedParticipant(props) {\n const msgstring = escapeHtml(\n pgettext(\"event message\", \"Added %(user)s to thread.\")\n )\n const newOwner = interpolate(\n ITEM_LINK,\n {\n url: escapeHtml(props.post.event_context.user.url),\n name: escapeHtml(props.post.event_context.user.username),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n user: newOwner,\n },\n true\n )\n\n return (\n \n )\n}\n\nexport function RemovedParticipant(props) {\n const msgstring = escapeHtml(\n pgettext(\"event message\", \"Removed %(user)s from thread.\")\n )\n const newOwner = interpolate(\n ITEM_LINK,\n {\n url: escapeHtml(props.post.event_context.user.url),\n name: escapeHtml(props.post.event_context.user.username),\n },\n true\n )\n\n const message = interpolate(\n msgstring,\n {\n user: newOwner,\n },\n true\n )\n\n return (\n \n )\n}\n","import React from \"react\"\n\nexport default function ({ post }) {\n if (post.is_read) return null\n\n return (\n
    \n \n {pgettext(\"event unread label\", \"New event\")}\n \n
    \n )\n}\n","import React from \"react\"\nimport ajax from \"misago/services/ajax\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.initialized = false\n this.primed = false\n this.observer = null\n }\n\n initialize = (element) => {\n this.initialized = true\n\n this.observer = new IntersectionObserver((entries) =>\n entries.forEach(this.callback)\n )\n this.observer.observe(element)\n }\n\n callback = (entry) => {\n if (!entry.isIntersecting || this.props.post.is_read || this.primed) {\n return\n }\n\n window.setTimeout(() => {\n ajax.post(this.props.post.api.read)\n }, 0)\n\n this.primed = true\n this.destroy()\n }\n\n destroy() {\n if (this.observer) {\n this.observer.disconnect()\n this.observer = null\n }\n }\n\n componentWillUnmount() {\n this.destroy()\n }\n\n render() {\n const ready = !this.initialized && !this.primed && !this.props.post.is_read\n\n return (\n {\n if (node && ready) {\n this.initialize(node)\n }\n }}\n >\n {this.props.children}\n \n )\n }\n}\n","import React from \"react\"\nimport Icon from \"./icon\"\nimport Info from \"./info\"\nimport Message from \"./message\"\nimport UnreadLabel from \"./unread-label\"\nimport Waypoint from \"../waypoint\"\n\nexport default function (props) {\n let className = \"event\"\n if (props.post.isDeleted) {\n className = \"hide\"\n } else if (props.post.is_hidden) {\n className = \"event post-hidden\"\n }\n\n return (\n
  • \n \n
    \n
    \n \n
    \n \n \n \n \n
    \n
  • \n )\n}\n","import React from \"react\"\nimport misago from \"misago\"\nimport escapeHtml from \"misago/utils/escape-html\"\nimport formatFilesize from \"misago/utils/file-size\"\n\nconst DATE_ABBR = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default function (props) {\n return (\n
    \n \n
    \n \n {props.attachment.filename}\n \n \n
    \n
    \n )\n}\n\nexport function AttachmentPreview(props) {\n if (props.attachment.is_image) {\n return (\n
    \n \n
    \n )\n } else {\n return (\n
    \n \n
    \n )\n }\n}\n\nexport function AttachmentIcon(props) {\n return (\n \n insert_drive_file\n \n )\n}\n\nexport function AttachmentThumbnail(props) {\n const url = props.attachment.url.thumb || props.attachment.url.index\n return (\n \n )\n}\n\nexport function AttachmentDetails(props) {\n let user = null\n if (props.attachment.url.uploader) {\n user = interpolate(\n USER_URL,\n {\n url: escapeHtml(props.attachment.url.uploader),\n user: escapeHtml(props.attachment.uploader_name),\n },\n true\n )\n } else {\n user = interpolate(\n USER_SPAN,\n {\n user: escapeHtml(props.attachment.uploader_name),\n },\n true\n )\n }\n\n const date = interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(props.attachment.uploaded_on.format(\"LLL\")),\n relative: escapeHtml(props.attachment.uploaded_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(\n pgettext(\n \"post attachment\",\n \"%(filetype)s, %(size)s, uploaded by %(uploader)s %(uploaded_on)s.\"\n )\n ),\n {\n filetype: props.attachment.filetype,\n size: formatFilesize(props.attachment.size),\n uploader: user,\n uploaded_on: date,\n },\n true\n )\n\n return (\n \n )\n}\n","import React from \"react\"\nimport batch from \"misago/utils/batch\"\nimport Attachment from \"./attachment\"\n\nexport default function (props) {\n if (!isVisible(props.post)) {\n return null\n }\n\n return (\n
    \n {batch(props.post.attachments, 2).map((row) => {\n const key = row\n .map((a) => {\n return a ? a.id : 0\n })\n .join(\"_\")\n return \n })}\n
    \n )\n}\n\nexport function isVisible(post) {\n return (!post.is_hidden || post.acl.can_see_hidden) && post.attachments\n}\n\nexport function Row(props) {\n return (\n
    \n {props.row.map((attachment) => {\n return (\n \n )\n })}\n
    \n )\n}\n","import React from \"react\"\nimport Waypoint from \"../waypoint\"\nimport MisagoMarkup from \"misago/components/misago-markup\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst HIDDEN_BY_URL = '%(user)s'\nconst HIDDEN_BY_SPAN = '%(user)s'\nconst HIDDEN_ON =\n '%(relative)s'\n\nexport default function (props) {\n if (props.post.is_hidden && !props.post.acl.can_see_hidden) {\n return \n } else if (props.post.content) {\n return \n } else {\n return \n }\n}\n\nexport function Default({ post }) {\n const poster = \"@\" + (post.poster ? post.poster.username : post.poster_name)\n\n return (\n \n \n \n )\n}\n\nexport function Hidden(props) {\n let user = null\n if (props.post.hidden_by) {\n user = interpolate(\n HIDDEN_BY_URL,\n {\n url: escapeHtml(props.post.url.hidden_by),\n user: escapeHtml(props.post.hidden_by_name),\n },\n true\n )\n } else {\n user = interpolate(\n HIDDEN_BY_SPAN,\n {\n user: escapeHtml(props.post.hidden_by_name),\n },\n true\n )\n }\n\n const date = interpolate(\n HIDDEN_ON,\n {\n absolute: escapeHtml(props.post.hidden_on.format(\"LLL\")),\n relative: escapeHtml(props.post.hidden_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(\n pgettext(\"post body hidden\", \"Hidden by %(hidden_by)s %(hidden_on)s.\")\n ),\n {\n hidden_by: user,\n hidden_on: date,\n },\n true\n )\n\n return (\n \n

    \n {pgettext(\n \"post body hidden\",\n \"This post is hidden. You cannot see its contents.\"\n )}\n

    \n

    \n \n )\n}\n\nexport function Invalid(props) {\n return (\n \n

    \n {pgettext(\n \"post body invalid\",\n \"This post's contents cannot be displayed.\"\n )}\n

    \n

    \n {pgettext(\n \"post body invalid\",\n \"This error is caused by invalid post content manipulation.\"\n )}\n

    \n
    \n )\n}\n","import React from \"react\"\n\nexport function FlagBestAnswer({ post, thread, user }) {\n if (!(isVisible(post) && post.id === thread.best_answer)) {\n return null\n }\n\n let message = null\n if (user.id && thread.best_answer_marked_by === user.id) {\n message = interpolate(\n pgettext(\n \"post best answer flag\",\n \"Marked as best answer by you %(marked_on)s.\"\n ),\n {\n marked_on: thread.best_answer_marked_on.fromNow(),\n },\n true\n )\n } else {\n message = interpolate(\n pgettext(\n \"post best answer flag\",\n \"Marked as best answer by %(marked_by)s %(marked_on)s.\"\n ),\n {\n marked_by: thread.best_answer_marked_by_name,\n marked_on: thread.best_answer_marked_on.fromNow(),\n },\n true\n )\n }\n\n return (\n
    \n check_box\n

    {message}

    \n
    \n )\n}\n\nexport function FlagHidden(props) {\n if (!(isVisible(props.post) && props.post.is_hidden)) {\n return null\n }\n\n return (\n
    \n visibility_off\n

    \n {pgettext(\n \"post hidden flag\",\n \"This post is hidden. Only users with permission may see its contents.\"\n )}\n

    \n
    \n )\n}\n\nexport function FlagUnapproved(props) {\n if (!(isVisible(props.post) && props.post.is_unapproved)) {\n return null\n }\n\n return (\n
    \n remove_circle_outline\n

    \n {pgettext(\n \"post unapproved flag\",\n \"This post is unapproved. Only users with permission to approve posts and its author may see its contents.\"\n )}\n

    \n
    \n )\n}\n\nexport function FlagProtected(props) {\n if (!(isVisible(props.post) && props.post.is_protected)) {\n return null\n }\n\n return (\n
    \n lock_outline\n

    \n {pgettext(\n \"post protected flag\",\n \"This post is protected. Only moderators may change it.\"\n )}\n

    \n
    \n )\n}\n\nexport function isVisible(post) {\n return !post.is_hidden || post.acl.can_see_hidden\n}\n","import moment from \"moment\"\nimport * as thread from \"misago/reducers/thread\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport function approve(props) {\n store.dispatch(\n post.patch(props.post, {\n is_unapproved: false,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-unapproved\", value: false }]\n\n const previousState = {\n is_unapproved: props.post.is_unapproved,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function protect(props) {\n store.dispatch(\n post.patch(props.post, {\n is_protected: true,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-protected\", value: true }]\n\n const previousState = {\n is_protected: props.post.is_protected,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function unprotect(props) {\n store.dispatch(\n post.patch(props.post, {\n is_protected: false,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-protected\", value: false }]\n\n const previousState = {\n is_protected: props.post.is_protected,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function hide(props) {\n store.dispatch(\n post.patch(props.post, {\n is_hidden: true,\n hidden_on: moment(),\n hidden_by_name: props.user.username,\n url: Object.assign(props.post.url, {\n hidden_by: props.user.url,\n }),\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-hidden\", value: true }]\n\n const previousState = {\n is_hidden: props.post.is_hidden,\n hidden_on: props.post.hidden_on,\n hidden_by_name: props.post.hidden_by_name,\n url: props.post.url,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function unhide(props) {\n store.dispatch(\n post.patch(props.post, {\n is_hidden: false,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-hidden\", value: false }]\n\n const previousState = {\n is_hidden: props.post.is_hidden,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function like(props) {\n const lastLikes = props.post.last_likes || []\n const concatedLikes = [props.user].concat(lastLikes)\n const finalLikes =\n concatedLikes.length > 3 ? concatedLikes.slice(0, -1) : concatedLikes\n\n store.dispatch(\n post.patch(props.post, {\n is_liked: true,\n likes: props.post.likes + 1,\n last_likes: finalLikes,\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-liked\", value: true }]\n\n const previousState = {\n is_liked: props.post.is_liked,\n likes: props.post.likes,\n last_likes: props.post.last_likes,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function unlike(props) {\n store.dispatch(\n post.patch(props.post, {\n is_liked: false,\n likes: props.post.likes - 1,\n last_likes: props.post.last_likes.filter((user) => {\n return !user.id || user.id !== props.user.id\n }),\n })\n )\n\n const ops = [{ op: \"replace\", path: \"is-liked\", value: false }]\n\n const previousState = {\n is_liked: props.post.is_liked,\n likes: props.post.likes,\n last_likes: props.post.last_likes,\n }\n\n patch(props, ops, previousState)\n}\n\nexport function patch(props, ops, previousState) {\n ajax.patch(props.post.api.index, ops).then(\n (newState) => {\n store.dispatch(post.patch(props.post, newState))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(post.patch(props.post, previousState))\n }\n )\n}\n\nexport function remove(props) {\n let confirmed = window.confirm(\n pgettext(\n \"post delete\",\n \"Are you sure you want to delete this post? This action is not reversible!\"\n )\n )\n if (!confirmed) {\n return\n }\n\n store.dispatch(\n post.patch(props.post, {\n isDeleted: true,\n })\n )\n\n ajax.delete(props.post.api.index).then(\n () => {\n snackbar.success(pgettext(\"post delete\", \"Post has been deleted.\"))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(\n post.patch(props.post, {\n isDeleted: false,\n })\n )\n }\n )\n}\n\nexport function markAsBestAnswer(props) {\n const { post, user } = props\n\n store.dispatch(\n thread.update({\n best_answer: post.id,\n best_answer_is_protected: post.is_protected,\n best_answer_marked_on: moment(),\n best_answer_marked_by: user.id,\n best_answer_marked_by_name: user.username,\n best_answer_marked_by_slug: user.slug,\n })\n )\n\n const ops = [\n { op: \"replace\", path: \"best-answer\", value: post.id },\n { op: \"add\", path: \"acl\", value: true },\n ]\n\n const previousState = {\n best_answer: props.thread.best_answer,\n best_answer_is_protected: props.thread.best_answer_is_protected,\n best_answer_marked_on: props.thread.best_answer_marked_on,\n best_answer_marked_by: props.thread.best_answer_marked_by,\n best_answer_marked_by_name: props.thread.best_answer_marked_by_name,\n best_answer_marked_by_slug: props.thread.best_answer_marked_by_slug,\n }\n\n patchThread(props, ops, previousState)\n}\n\nexport function unmarkBestAnswer(props) {\n const { post } = props\n\n store.dispatch(\n thread.update({\n best_answer: null,\n best_answer_is_protected: false,\n best_answer_marked_on: null,\n best_answer_marked_by: null,\n best_answer_marked_by_name: null,\n best_answer_marked_by_slug: null,\n })\n )\n\n const ops = [\n { op: \"remove\", path: \"best-answer\", value: post.id },\n { op: \"add\", path: \"acl\", value: true },\n ]\n\n const previousState = {\n best_answer: props.thread.best_answer,\n best_answer_is_protected: props.thread.best_answer_is_protected,\n best_answer_marked_on: props.thread.best_answer_marked_on,\n best_answer_marked_by: props.thread.best_answer_marked_by,\n best_answer_marked_by_name: props.thread.best_answer_marked_by_name,\n best_answer_marked_by_slug: props.thread.best_answer_marked_by_slug,\n }\n\n patchThread(props, ops, previousState)\n}\n\nexport function patchThread(props, ops, previousState) {\n ajax.patch(props.thread.api.index, ops).then(\n (newState) => {\n if (newState.best_answer_marked_on) {\n newState.best_answer_marked_on = moment(newState.best_answer_marked_on)\n }\n store.dispatch(thread.update(newState))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n\n store.dispatch(thread.update(previousState))\n }\n )\n}\n","import React from \"react\"\nimport moment from \"moment\"\nimport Avatar from \"misago/components/avatar\"\nimport Message from \"misago/components/modal-message\"\nimport Loader from \"misago/components/modal-loader\"\nimport ajax from \"misago/services/ajax\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n\n error: null,\n likes: [],\n }\n }\n\n componentDidMount() {\n ajax.get(this.props.post.api.likes).then(\n (data) => {\n this.setState({\n isReady: true,\n likes: data.map(hydrateLike),\n })\n },\n (rejection) => {\n this.setState({\n isReady: true,\n error: rejection.detail,\n })\n }\n )\n }\n\n render() {\n if (this.state.error) {\n return (\n \n \n \n )\n } else if (this.state.isReady) {\n if (this.state.likes.length) {\n return (\n \n \n \n )\n }\n\n return (\n \n \n \n )\n }\n\n return (\n \n \n \n )\n }\n}\n\nexport function hydrateLike(data) {\n return Object.assign({}, data, {\n liked_on: moment(data.liked_on),\n })\n}\n\nexport function ModalDialog({ className, children, likes }) {\n let title = pgettext(\"post likes modal title\", \"Post Likes\")\n if (likes) {\n const likesCount = likes.length\n const message = npgettext(\n \"post likes modal\",\n \"%(likes)s like\",\n \"%(likes)s likes\",\n likesCount\n )\n\n title = interpolate(message, { likes: likesCount }, true)\n }\n\n return (\n
    \n
    \n
    \n \n ×\n \n

    {title}

    \n
    \n {children}\n
    \n
    \n )\n}\n\nexport function LikesList(props) {\n return (\n
    \n
      \n {props.likes.map((like) => {\n return \n })}\n
    \n
    \n )\n}\n\nexport function LikeDetails(props) {\n if (props.url) {\n const user = {\n id: props.liker_id,\n avatars: props.avatars,\n }\n\n return (\n
  • \n
    \n \n \n \n
    \n
    \n \n {props.username}\n {\" \"}\n \n
    \n
  • \n )\n }\n\n return (\n
  • \n
    \n \n \n \n
    \n
    \n {props.username} \n
    \n
  • \n )\n}\n\nexport function LikeDate(props) {\n return (\n \n {props.likedOn.fromNow()}\n \n )\n}\n","import React from \"react\"\nimport * as actions from \"./controls/actions\"\nimport LikesModal from \"misago/components/post-likes\"\nimport modal from \"misago/services/modal\"\nimport posting from \"misago/services/posting\"\n\nexport default function (props) {\n if (!isVisible(props.post)) return null\n\n return (\n
    \n \n \n \n \n \n \n \n \n
    \n )\n}\n\nexport function isVisible(post) {\n return (\n (!post.is_hidden || post.acl.can_see_hidden) &&\n (post.acl.can_reply ||\n post.acl.can_edit ||\n (post.acl.can_see_likes && (post.last_likes || []).length) ||\n post.acl.can_like)\n )\n}\n\nexport class MarkAsBestAnswer extends React.Component {\n onClick = () => {\n actions.markAsBestAnswer(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (!thread.acl.can_mark_best_answer) return null\n if (!post.acl.can_mark_as_best_answer) return null\n if (thread.best_answer && !thread.acl.can_change_best_answer) return null\n\n return (\n \n check_box\n {pgettext(\"post footer btn\", \"Best answer\")}\n \n )\n }\n}\n\nexport class MarkAsBestAnswerCompact extends React.Component {\n onClick = () => {\n actions.markAsBestAnswer(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (!thread.acl.can_mark_best_answer) return null\n if (!post.acl.can_mark_as_best_answer) return null\n if (thread.best_answer && !thread.acl.can_change_best_answer) return null\n\n return (\n \n check_box\n \n )\n }\n}\n\nexport class Like extends React.Component {\n onClick = () => {\n if (this.props.post.is_liked) {\n actions.unlike(this.props)\n } else {\n actions.like(this.props)\n }\n }\n\n render() {\n if (!this.props.post.acl.can_like) return null\n\n let className = \"btn btn-default btn-sm pull-left\"\n if (this.props.post.is_liked) {\n className = \"btn btn-success btn-sm pull-left\"\n }\n\n return (\n \n {this.props.post.is_liked\n ? pgettext(\"post footer btn\", \"Liked\")\n : pgettext(\"post footer btn\", \"Like\")}\n \n )\n }\n}\n\nexport class Likes extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n const hasLikes = (this.props.post.last_likes || []).length > 0\n if (!this.props.post.acl.can_see_likes || !hasLikes) return null\n\n if (this.props.post.acl.can_see_likes === 2) {\n return (\n \n {getLikesMessage(this.props.likes, this.props.lastLikes)}\n \n )\n }\n\n return (\n

    \n {getLikesMessage(this.props.likes, this.props.lastLikes)}\n

    \n )\n }\n}\n\nexport class LikesCompact extends Likes {\n render() {\n const hasLikes = (this.props.post.last_likes || []).length > 0\n if (!this.props.post.acl.can_see_likes || !hasLikes) return null\n\n if (this.props.post.acl.can_see_likes === 2) {\n return (\n \n favorite\n {this.props.likes}\n \n )\n }\n\n return (\n

    \n favorite\n {this.props.likes}\n

    \n )\n }\n}\n\nexport function getLikesMessage(likes, users) {\n const usernames = users.slice(0, 3).map((u) => u.username)\n\n if (usernames.length == 1) {\n return interpolate(\n pgettext(\"post likes\", \"%(user)s likes this.\"),\n {\n user: usernames[0],\n },\n true\n )\n }\n\n const hiddenLikes = likes - usernames.length\n\n const otherUsers = usernames.slice(0, -1).join(\", \")\n const lastUser = usernames.slice(-1)[0]\n\n const usernamesList = interpolate(\n pgettext(\"post likes\", \"%(users)s and %(last_user)s\"),\n {\n users: otherUsers,\n last_user: lastUser,\n },\n true\n )\n\n if (hiddenLikes === 0) {\n return interpolate(\n pgettext(\"post likes\", \"%(users)s like this.\"),\n {\n users: usernamesList,\n },\n true\n )\n }\n\n const message = npgettext(\n \"post likes\",\n \"%(users)s and %(likes)s other user like this.\",\n \"%(users)s and %(likes)s other users like this.\",\n hiddenLikes\n )\n\n return interpolate(\n message,\n {\n users: usernames.join(\", \"),\n likes: hiddenLikes,\n },\n true\n )\n}\n\nexport class Reply extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"REPLY\",\n\n thread: this.props.thread,\n config: this.props.thread.api.editor,\n submit: this.props.thread.api.posts.index,\n })\n }\n\n render() {\n if (this.props.post.acl.can_reply) {\n return (\n \n {pgettext(\"post footer btn\", \"Reply\")}\n \n )\n } else {\n return null\n }\n }\n}\n\nexport class Quote extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"QUOTE\",\n\n thread: this.props.thread,\n config: this.props.thread.api.editor,\n submit: this.props.thread.api.posts.index,\n\n context: {\n reply: this.props.post.id,\n },\n })\n }\n\n render() {\n if (this.props.post.acl.can_reply) {\n return (\n \n {pgettext(\"post footer btn\", \"Quote\")}\n \n )\n } else {\n return null\n }\n }\n}\n\nexport class Edit extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"EDIT\",\n\n thread: this.props.thread,\n post: this.props.post,\n config: this.props.post.api.editor,\n submit: this.props.post.api.index,\n })\n }\n\n render() {\n if (this.props.post.acl.can_edit) {\n return (\n \n {pgettext(\"post footer btn\", \"Edit\")}\n \n )\n } else {\n return null\n }\n }\n}\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n url: \"\",\n\n validators: {\n url: [],\n },\n errors: {},\n }\n }\n\n clean() {\n if (!this.state.url.trim().length) {\n snackbar.error(\n pgettext(\n \"post move modal\",\n \"You have to enter link to the other thread.\"\n )\n )\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.post(this.props.thread.api.posts.move, {\n new_thread: this.state.url,\n posts: [this.props.post.id],\n })\n }\n\n handleSuccess(success) {\n store.dispatch(\n post.patch(this.props.post, {\n isDeleted: true,\n })\n )\n\n modal.hide()\n\n snackbar.success(\n pgettext(\n \"post move modal\",\n \"Selected post was moved to the other thread.\"\n )\n )\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onUrlChange = (event) => {\n this.changeValue(\"url\", event.target.value)\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n
    \n \n \n \n
    \n
    \n \n {pgettext(\"post move modal btn\", \"Move post\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport function ModalHeader(props) {\n return (\n
    \n \n ×\n \n

    \n {pgettext(\"post move modal title\", \"Move post\")}\n

    \n
    \n )\n}\n","import React from \"react\"\n\nexport default function (props) {\n return (\n
    \n
      \n {props.diff.map((item, i) => {\n return \n })}\n
    \n
    \n )\n}\n\nexport function DiffItem(props) {\n if (props.item[0] === \"?\") return null\n\n return (\n
  • {cleanItem(props.item)}
  • \n )\n}\n\nexport function getItemClassName(item) {\n let className = \"diff-item\"\n if (item[0] === \"-\") {\n className += \" diff-item-sub\"\n } else if (item[0] === \"+\") {\n className += \" diff-item-add\"\n }\n return className\n}\n\nexport function cleanItem(item) {\n return item.substr(2)\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\n\nexport default class extends React.Component {\n onClick = () => {\n this.props.revertEdit(this.props.edit.id)\n }\n\n render() {\n if (!this.props.canRevert) return null\n\n return (\n
    \n \n {pgettext(\"post revert btn\", \"Revert\")}\n \n
    \n )\n }\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport escapeHtml from \"misago/utils/escape-html\"\n\nconst DATE_ABBR = '%(relative)s'\nconst USER_SPAN = '%(user)s'\nconst USER_URL = '%(user)s'\n\nexport default class extends React.Component {\n goLast = () => {\n this.props.goToEdit()\n }\n\n goForward = () => {\n this.props.goToEdit(this.props.edit.next)\n }\n\n goBack = () => {\n this.props.goToEdit(this.props.edit.previous)\n }\n\n revertEdit = () => {\n this.props.revertEdit(this.props.edit.id)\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n )\n }\n}\n\nexport function GoBackBtn(props) {\n return (\n \n chevron_left\n \n )\n}\n\nexport function GoForwardBtn(props) {\n return (\n \n chevron_right\n \n )\n}\n\nexport function GoLastBtn(props) {\n return (\n \n last_page\n \n )\n}\n\nexport function RevertBtn(props) {\n if (!props.canRevert) return null\n\n return (\n
    \n \n {pgettext(\"post revert btn\", \"Revert\")}\n \n
    \n )\n}\n\nexport function Label(props) {\n let user = null\n if (props.edit.url.editor) {\n user = interpolate(\n USER_URL,\n {\n url: escapeHtml(props.edit.url.editor),\n user: escapeHtml(props.edit.editor_name),\n },\n true\n )\n } else {\n user = interpolate(\n USER_SPAN,\n {\n user: escapeHtml(props.edit.editor_name),\n },\n true\n )\n }\n\n const date = interpolate(\n DATE_ABBR,\n {\n absolute: escapeHtml(props.edit.edited_on.format(\"LLL\")),\n relative: escapeHtml(props.edit.edited_on.fromNow()),\n },\n true\n )\n\n const message = interpolate(\n escapeHtml(\n pgettext(\"post history modal\", \"By %(edited_by)s %(edited_on)s.\")\n ),\n {\n edited_by: user,\n edited_on: date,\n },\n true\n )\n\n return

    \n}\n","import moment from \"moment\"\n\nexport function hydrateEdit(json) {\n return Object.assign({}, json, {\n edited_on: moment(json.edited_on),\n })\n}\n","import React from \"react\"\nimport Diff from \"./diff\"\nimport Footer from \"./footer\"\nimport Toolbar from \"./toolbar\"\nimport { hydrateEdit } from \"./utils\"\nimport Message from \"misago/components/modal-message\"\nimport Loader from \"misago/components/modal-loader\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n isBusy: true,\n\n canRevert: props.post.acl.can_edit,\n\n error: null,\n edit: null,\n }\n }\n\n componentDidMount() {\n this.goToEdit()\n }\n\n goToEdit = (edit = null) => {\n this.setState({\n isBusy: true,\n })\n\n let url = this.props.post.api.edits\n if (edit !== null) {\n url += \"?edit=\" + edit\n }\n\n ajax.get(url).then(\n (data) => {\n this.setState({\n isReady: true,\n isBusy: false,\n edit: hydrateEdit(data),\n })\n },\n (rejection) => {\n this.setState({\n isReady: true,\n isBusy: false,\n error: rejection.detail,\n })\n }\n )\n }\n\n revertEdit = (edit) => {\n if (this.state.isBusy) return\n\n const confirmation = window.confirm(\n pgettext(\n \"post revert\",\n \"Are you sure you with to revert this post to the state from before this edit?\"\n )\n )\n if (!confirmation) return\n\n this.setState({\n isBusy: true,\n })\n\n const url = this.props.post.api.edits + \"?edit=\" + edit\n ajax.post(url).then(\n (data) => {\n const hydratedPost = post.hydrate(data)\n store.dispatch(post.patch(data, hydratedPost))\n\n snackbar.success(\n pgettext(\"post revert\", \"Post has been reverted to previous state.\")\n )\n modal.hide()\n },\n (rejection) => {\n snackbar.apiError(rejection)\n\n this.setState({\n isBusy: false,\n })\n }\n )\n }\n\n render() {\n if (this.state.error) {\n return (\n \n \n \n )\n } else if (this.state.isReady) {\n return (\n \n \n \n \n \n )\n }\n\n return (\n \n \n \n )\n }\n}\n\nexport function ModalDialog(props) {\n return (\n

    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"post history modal title\", \"Post edits history\")}\n

    \n
    \n {props.children}\n
    \n
    \n )\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport CategorySelect from \"misago/components/category-select\"\nimport ModalLoader from \"misago/components/modal-loader\"\nimport Select from \"misago/components/select\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport * as validators from \"misago/utils/validators\"\n\nexport default function (props) {\n return \n}\n\nexport class PostingConfig extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoaded: false,\n isError: false,\n\n categories: [],\n }\n }\n\n componentDidMount() {\n ajax.get(misago.get(\"THREAD_EDITOR_API\")).then(\n (data) => {\n // hydrate categories, extract posting options\n const categories = data.map((item) => {\n return Object.assign(item, {\n disabled: item.post === false,\n label: item.name,\n value: item.id,\n post: item.post,\n })\n })\n\n this.setState({\n isLoaded: true,\n categories,\n })\n },\n (rejection) => {\n this.setState({\n isError: rejection.detail,\n })\n }\n )\n }\n\n render() {\n if (this.state.isError) {\n return \n } else if (this.state.isLoaded) {\n return (\n \n )\n } else {\n return \n }\n }\n}\n\nexport class ModerationForm extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n title: \"\",\n category: null,\n categories: props.categories,\n weight: 0,\n is_hidden: 0,\n is_closed: false,\n\n validators: {\n title: [validators.required()],\n },\n\n errors: {},\n }\n\n this.isHiddenChoices = [\n {\n value: 0,\n icon: \"visibility\",\n label: pgettext(\"thread hidden switch choice\", \"No\"),\n },\n {\n value: 1,\n icon: \"visibility_off\",\n label: pgettext(\"thread hidden switch choice\", \"Yes\"),\n },\n ]\n\n this.isClosedChoices = [\n {\n value: false,\n icon: \"lock_outline\",\n label: pgettext(\"thread closed switch choice\", \"No\"),\n },\n {\n value: true,\n icon: \"lock\",\n label: pgettext(\"thread closed switch choice\", \"Yes\"),\n },\n ]\n\n this.acl = {}\n this.props.categories.forEach((category) => {\n if (category.post) {\n if (!this.state.category) {\n this.state.category = category.id\n }\n\n this.acl[category.id] = {\n can_pin_threads: category.post.pin,\n can_close_threads: category.post.close,\n can_hide_threads: category.post.hide,\n }\n }\n })\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(gettext(\"Form contains errors.\"))\n this.setState({\n errors: this.validate(),\n })\n return false\n }\n }\n\n send() {\n return ajax.post(this.props.thread.api.posts.split, {\n title: this.state.title,\n category: this.state.category,\n weight: this.state.weight,\n is_hidden: this.state.is_hidden,\n is_closed: this.state.is_closed,\n posts: [this.props.post.id],\n })\n }\n\n handleSuccess(apiResponse) {\n store.dispatch(\n post.patch(this.props.post, {\n isDeleted: true,\n })\n )\n\n modal.hide()\n\n snackbar.success(\n pgettext(\"post split modal\", \"Selected post was split into new thread.\")\n )\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n this.setState({\n errors: Object.assign({}, this.state.errors, rejection),\n })\n snackbar.error(gettext(\"Form contains errors.\"))\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onCategoryChange = (ev) => {\n const categoryId = ev.target.value\n const newState = {\n category: categoryId,\n }\n\n if (this.acl[categoryId].can_pin_threads < newState.weight) {\n newState.weight = 0\n }\n\n if (!this.acl[categoryId].can_hide_threads) {\n newState.is_hidden = 0\n }\n\n if (!this.acl[categoryId].can_close_threads) {\n newState.is_closed = false\n }\n\n this.setState(newState)\n }\n\n getWeightChoices() {\n const choices = [\n {\n value: 0,\n icon: \"remove\",\n label: pgettext(\"thread weight choice\", \"Not pinned\"),\n },\n {\n value: 1,\n icon: \"bookmark_border\",\n label: pgettext(\"thread weight choice\", \"Pinned in category\"),\n },\n ]\n\n if (this.acl[this.state.category].can_pin_threads == 2) {\n choices.push({\n value: 2,\n icon: \"bookmark\",\n label: pgettext(\"thread weight choice\", \"Pinned globally\"),\n })\n }\n\n return choices\n }\n\n renderWeightField() {\n if (this.acl[this.state.category].can_pin_threads) {\n return (\n \n \n \n )\n } else {\n return null\n }\n }\n\n renderHiddenField() {\n if (this.acl[this.state.category].can_hide_threads) {\n return (\n \n \n \n )\n } else {\n return null\n }\n }\n\n renderClosedField() {\n if (this.acl[this.state.category].can_close_threads) {\n return (\n \n \n \n )\n } else {\n return null\n }\n }\n\n render() {\n return (\n \n
    \n
    \n \n \n \n
    \n\n \n \n \n
    \n\n {this.renderWeightField()}\n {this.renderHiddenField()}\n {this.renderClosedField()}\n
    \n
    \n \n
    \n \n \n )\n }\n}\n\nexport function Loader() {\n return (\n \n \n \n )\n}\n\nexport function Error(props) {\n return (\n \n
    \n info_outline\n
    \n
    \n

    \n {pgettext(\n \"post split modal\",\n \"You can't move this post at the moment.\"\n )}\n

    \n

    {props.message}

    \n
    \n
    \n )\n}\n\nexport function Modal(props) {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"posts split modal title\", \"Split post into new thread\")}\n

    \n
    \n {props.children}\n
    \n
    \n )\n}\n","import React from \"react\"\nimport modal from \"misago/services/modal\"\nimport posting from \"misago/services/posting\"\nimport * as moderation from \"./actions\"\nimport MoveModal from \"./move\"\nimport PostChangelog from \"misago/components/post-changelog\"\nimport SplitModal from \"./split\"\n\nexport default function (props) {\n return (\n
      \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n )\n}\n\nexport class Permalink extends React.Component {\n onClick = () => {\n let permaUrl = window.location.protocol + \"//\"\n permaUrl += window.location.host\n permaUrl += this.props.post.url.index\n\n prompt(pgettext(\"post permalink\", \"Permament link to this post:\"), permaUrl)\n }\n\n render() {\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Edit extends React.Component {\n onClick = () => {\n posting.open({\n mode: \"EDIT\",\n\n thread: this.props.thread,\n post: this.props.post,\n config: this.props.post.api.editor,\n submit: this.props.post.api.index,\n })\n }\n\n render() {\n if (!this.props.post.acl.can_edit) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class MarkAsBestAnswer extends React.Component {\n onClick = () => {\n moderation.markAsBestAnswer(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (!thread.acl.can_mark_best_answer) return null\n if (!post.acl.can_mark_as_best_answer) return null\n if (post.id === thread.best_answer) return null\n if (thread.best_answer && !thread.acl.can_change_best_answer) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class UnmarkMarkBestAnswer extends React.Component {\n onClick = () => {\n moderation.unmarkBestAnswer(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (post.id !== thread.best_answer) return null\n if (!thread.acl.can_unmark_best_answer) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class PostEdits extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n const isHidden =\n this.props.post.is_hidden && !this.props.post.acl.can_see_hidden\n const isUnedited = this.props.post.edits === 0\n if (isHidden || isUnedited) return null\n\n const message = npgettext(\n \"post edits\",\n \"This post was edited %(edits)s time.\",\n \"This post was edited %(edits)s times.\",\n this.props.post.edits\n )\n\n const title = interpolate(\n message,\n {\n edits: this.props.post.edits,\n },\n true\n )\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Approve extends React.Component {\n onClick = () => {\n moderation.approve(this.props)\n }\n\n render() {\n if (!this.props.post.acl.can_approve) return null\n if (!this.props.post.is_unapproved) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Move extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n if (!this.props.post.acl.can_move) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Split extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n if (!this.props.post.acl.can_move) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Protect extends React.Component {\n onClick = () => {\n moderation.protect(this.props)\n }\n\n render() {\n if (!this.props.post.acl.can_protect) return null\n if (this.props.post.is_protected) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Unprotect extends React.Component {\n onClick = () => {\n moderation.unprotect(this.props)\n }\n\n render() {\n if (!this.props.post.acl.can_protect) return null\n if (!this.props.post.is_protected) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Hide extends React.Component {\n onClick = () => {\n moderation.hide(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (post.id === thread.best_answer) return null\n if (!post.acl.can_hide) return null\n if (post.is_hidden) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Unhide extends React.Component {\n onClick = () => {\n moderation.unhide(this.props)\n }\n\n render() {\n if (!this.props.post.acl.can_unhide) return null\n if (!this.props.post.is_hidden) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Delete extends React.Component {\n onClick = () => {\n moderation.remove(this.props)\n }\n\n render() {\n const { post, thread } = this.props\n\n if (post.id === thread.best_answer) return null\n if (!post.acl.can_delete) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n","import React from \"react\"\nimport Dropdown from \"./dropdown\"\n\nexport default function (props) {\n return (\n
    \n \n expand_more\n \n \n
    \n )\n}\n","import React from \"react\"\nimport * as posts from \"misago/reducers/posts\"\nimport store from \"misago/services/store\"\n\nexport default class extends React.Component {\n onClick = () => {\n if (this.props.post.isSelected) {\n store.dispatch(posts.deselect(this.props.post))\n } else {\n store.dispatch(posts.select(this.props.post))\n }\n }\n\n render() {\n if (\n !(this.props.thread.acl.can_merge_posts || isVisible(this.props.post.acl))\n ) {\n return null\n }\n\n return (\n
    \n \n \n {this.props.post.isSelected\n ? \"check_box\"\n : \"check_box_outline_blank\"}\n \n \n
    \n )\n }\n}\n\nexport function isVisible(acl) {\n return (\n acl.can_approve ||\n acl.can_hide ||\n acl.can_protect ||\n acl.can_unhide ||\n acl.can_delete ||\n acl.can_move\n )\n}\n","import React from \"react\"\nimport Controls from \"./controls\"\nimport Select from \"./select\"\nimport {\n StatusIcon,\n getStatusClassName,\n getStatusDescription,\n} from \"misago/components/user-status\"\nimport PostChangelog from \"misago/components/post-changelog\"\nimport modal from \"misago/services/modal\"\n\nexport default function (props) {\n return (\n
    \n \n \n \n \n \n \n \n \n \n
    \n
    \n \n \n \n
    \n
    \n {post.poster_name}\n\n \n {pgettext(\"post removed poster username\", \"Removed user\")}\n \n
    \n
    \n
    \n )\n}\n","export default function ({ title, rank }) {\n return rank.is_tab || !!title || !!rank.title\n}\n","import React from \"react\"\nimport hasVisibleTitle from \"./has-visible-title\"\n\nexport default function ({ poster }) {\n const message = npgettext(\n \"poster stats\",\n \"%(posts)s post\",\n \"%(posts)s posts\",\n poster.posts\n )\n\n let className = \"user-postcount\"\n if (hasVisibleTitle(poster)) {\n className += \" hidden-xs hidden-sm\"\n }\n\n return (\n \n {interpolate(\n message,\n {\n posts: poster.posts,\n },\n true\n )}\n \n )\n}\n","import React from \"react\"\nimport UserStatus, { StatusLabel } from \"misago/components/user-status\"\nimport hasVisibleTitle from \"./has-visible-title\"\n\nexport default function ({ poster }) {\n let className = \"hidden-xs\"\n if (hasVisibleTitle(poster)) {\n className += \" hidden-sm\"\n }\n\n return (\n \n \n \n \n \n )\n}\n","import React from \"react\"\n\nexport default function ({ rank, title }) {\n let userTitle = title || rank.title\n if (!userTitle && rank.is_tab) {\n userTitle = rank.name\n }\n\n if (!userTitle) return null\n\n let className = \"user-title\"\n if (rank.css_class) {\n className += \" user-title-\" + rank.css_class\n }\n\n if (rank.is_tab) {\n return (\n \n )\n }\n\n return
    {userTitle}
    \n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport Controls from \"misago/components/posts-list/post/controls\"\nimport Select from \"misago/components/posts-list/post/select\"\nimport UserStatus, { StatusIcon } from \"misago/components/user-status\"\nimport UserPostcount from \"./user-postcount\"\nimport UserStatusLabel from \"./user-status\"\nimport UserTitle from \"./user-title\"\n\nexport default function ({ post, thread }) {\n const { poster } = post\n\n return (\n
    \n \n \n )\n}\n\nexport function PollSelect({ choices, onChange, value }) {\n if (!choices) return null\n\n return (\n \n \n {choices.map((choice) => {\n return (\n \n )\n })}\n \n \n )\n}\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport MergeConflict from \"misago/components/merge-conflict\"\nimport * as thread from \"misago/reducers/thread\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n url: \"\",\n\n validators: {\n url: [],\n },\n errors: {},\n }\n }\n\n clean() {\n if (!this.state.url.trim().length) {\n snackbar.error(\n pgettext(\n \"thread merge form\",\n \"You have to enter link to the other thread.\"\n )\n )\n return false\n }\n\n return true\n }\n\n send() {\n // freeze thread\n store.dispatch(thread.busy())\n\n return ajax.post(this.props.thread.api.merge, {\n other_thread: this.state.url,\n })\n }\n\n handleSuccess = (success) => {\n this.handleSuccessUnmounted(success)\n\n // keep form loading\n this.setState({\n isLoading: true,\n })\n }\n\n handleSuccessUnmounted = (success) => {\n snackbar.success(\n pgettext(\"thread merge form\", \"Thread has been merged with other one.\")\n )\n window.location = success.url\n }\n\n handleError = (rejection) => {\n store.dispatch(thread.release())\n\n if (rejection.status === 400) {\n if (rejection.best_answers || rejection.polls) {\n modal.show(\n \n )\n } else if (rejection.best_answer) {\n snackbar.error(rejection.best_answer[0])\n } else if (rejection.poll) {\n snackbar.error(rejection.poll[0])\n } else {\n snackbar.error(rejection.detail)\n }\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onUrlChange = (event) => {\n this.changeValue(\"url\", event.target.value)\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n
    \n \n \n \n
    \n
    \n \n {pgettext(\"thread merge form btn\", \"Cancel\")}\n \n \n {pgettext(\"thread merge form btn\", \"Merge thread\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport function ModalHeader(props) {\n return (\n
    \n \n ×\n \n

    \n {pgettext(\"thread merge form title\", \"Merge thread\")}\n

    \n
    \n )\n}\n","import React from \"react\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport CategorySelect from \"misago/components/category-select\"\nimport ModalLoader from \"misago/components/modal-loader\"\nimport * as posts from \"misago/reducers/posts\"\nimport * as thread from \"misago/reducers/thread\"\nimport misago from \"misago\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isReady: false,\n isLoading: false,\n isError: false,\n\n category: null,\n categories: [],\n }\n }\n\n componentDidMount() {\n ajax.get(misago.get(\"THREAD_EDITOR_API\")).then(\n (data) => {\n let category = null\n\n // hydrate categories, extract posting options\n const categories = data.map((item) => {\n // pick first category that allows posting and if it may, override it with initial one\n if (item.post !== false && !category) {\n category = item.id\n }\n\n return Object.assign(item, {\n disabled: item.post === false,\n label: item.name,\n value: item.id,\n })\n })\n\n this.setState({\n isReady: true,\n\n category,\n categories,\n })\n },\n (rejection) => {\n this.setState({\n isError: rejection.detail,\n })\n }\n )\n }\n\n send() {\n // freeze thread\n store.dispatch(thread.busy())\n\n return ajax.patch(this.props.thread.api.index, [\n { op: \"replace\", path: \"category\", value: this.state.category },\n ])\n }\n\n handleSuccess() {\n // refresh thread and displayed posts\n ajax\n .get(this.props.thread.api.posts.index, { page: this.props.posts.page })\n .then(\n (data) => {\n store.dispatch(thread.replace(data))\n store.dispatch(posts.load(data.post_set))\n store.dispatch(thread.release())\n\n snackbar.success(\n pgettext(\"thread move form\", \"Thread has been moved.\")\n )\n modal.hide()\n },\n (rejection) => {\n store.dispatch(thread.release())\n snackbar.apiError(rejection)\n }\n )\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onCategoryChange = (event) => {\n this.changeValue(\"category\", event.target.value)\n }\n\n render() {\n if (this.state.isReady) {\n return (\n
    \n
    \n
    \n \n
    \n \n \n \n
    \n
    \n \n {pgettext(\"thread move form btn\", \"Cancel\")}\n \n \n {pgettext(\"thread move form btn\", \"Move thread\")}\n \n
    \n
    \n
    \n
    \n )\n } else if (this.state.isError) {\n return \n } else {\n return \n }\n }\n}\n\nexport function ModalHeader(props) {\n return (\n
    \n \n ×\n \n

    \n {pgettext(\"thread move form title\", \"Move thread\")}\n

    \n
    \n )\n}\n\nexport function ModalLoading(props) {\n return (\n
    \n
    \n \n \n
    \n
    \n )\n}\n\nexport function ModalMessage(props) {\n return (\n
    \n
    \n \n
    \n info_outline\n
    \n
    \n

    \n {pgettext(\n \"thread move form\",\n \"You can't move this thread at the moment.\"\n )}\n

    \n

    {props.message}

    \n \n {pgettext(\"thread move form dismiss btn\", \"Ok\")}\n \n
    \n
    \n
    \n )\n}\n","import React from \"react\"\nimport * as thread from \"misago/reducers/thread\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport ThreadChangeTitleModal from \"./ThreadChangeTitleModal\"\nimport MergeModal from \"./merge\"\nimport MoveModal from \"./move\"\n\nexport default class extends React.Component {\n callApi = (ops, successMessage) => {\n store.dispatch(thread.busy())\n\n // by the chance update thread acl too\n ops.push({ op: \"add\", path: \"acl\", value: true })\n\n ajax.patch(this.props.thread.api.index, ops).then(\n (data) => {\n store.dispatch(thread.update(data))\n store.dispatch(thread.release())\n snackbar.success(successMessage)\n },\n (rejection) => {\n store.dispatch(thread.release())\n if (rejection.status === 400) {\n snackbar.error(rejection.detail[0])\n } else {\n snackbar.apiError(rejection)\n }\n }\n )\n }\n\n changeTitle = () => {\n modal.show()\n }\n\n pinGlobally = () => {\n this.callApi(\n [\n {\n op: \"replace\",\n path: \"weight\",\n value: 2,\n },\n ],\n pgettext(\"thread moderation\", \"Thread has been pinned globally.\")\n )\n }\n\n pinLocally = () => {\n this.callApi(\n [\n {\n op: \"replace\",\n path: \"weight\",\n value: 1,\n },\n ],\n pgettext(\"thread moderation\", \"Thread has been pinned in category.\")\n )\n }\n\n unpin = () => {\n this.callApi(\n [\n {\n op: \"replace\",\n path: \"weight\",\n value: 0,\n },\n ],\n pgettext(\"thread moderation\", \"Thread has been unpinned.\")\n )\n }\n\n approve = () => {\n this.callApi(\n [\n {\n op: \"replace\",\n path: \"is-unapproved\",\n value: false,\n },\n ],\n pgettext(\"thread moderation\", \"Thread has been approved.\")\n )\n }\n\n open = () => {\n this.callApi(\n [\n {\n op: \"replace\",\n path: \"is-closed\",\n value: false,\n },\n ],\n gettext(\"Thread has been opened.\")\n )\n }\n\n close = () => {\n this.callApi(\n [\n {\n op: \"replace\",\n path: \"is-closed\",\n value: true,\n },\n ],\n pgettext(\"thread moderation\", \"Thread has been closed.\")\n )\n }\n\n unhide = () => {\n this.callApi(\n [\n {\n op: \"replace\",\n path: \"is-hidden\",\n value: false,\n },\n ],\n pgettext(\"thread moderation\", \"Thread has been made visible.\")\n )\n }\n\n hide = () => {\n this.callApi(\n [\n {\n op: \"replace\",\n path: \"is-hidden\",\n value: true,\n },\n ],\n pgettext(\"thread moderation\", \"Thread has been made hidden.\")\n )\n }\n\n move = () => {\n modal.show(\n \n )\n }\n\n merge = () => {\n modal.show()\n }\n\n delete = () => {\n if (\n !window.confirm(\n pgettext(\n \"thread moderation\",\n \"Are you sure you want to delete this thread?\"\n )\n )\n ) {\n return\n }\n\n store.dispatch(thread.busy())\n\n ajax.delete(this.props.thread.api.index).then(\n (data) => {\n snackbar.success(\n pgettext(\"thread moderation\", \"Thread has been deleted.\")\n )\n window.location = this.props.thread.category.url.index\n },\n (rejection) => {\n store.dispatch(thread.release())\n snackbar.apiError(rejection)\n }\n )\n }\n\n render() {\n const { moderation } = this.props\n\n return (\n
      \n {!!moderation.edit && (\n
    • \n \n edit\n {pgettext(\"thread moderation btn\", \"Change title\")}\n \n
    • \n )}\n {!!moderation.pinGlobally && (\n
    • \n \n bookmark\n {pgettext(\"thread moderation btn\", \"Pin globally\")}\n \n
    • \n )}\n {!!moderation.pinLocally && (\n
    • \n \n bookmark_border\n {pgettext(\"thread moderation btn\", \"Pin in category\")}\n \n
    • \n )}\n {!!moderation.unpin && (\n
    • \n \n
    • \n )}\n {!!moderation.move && (\n
    • \n \n
    • \n )}\n {!!moderation.merge && (\n
    • \n \n
    • \n )}\n {!!moderation.approve && (\n
    • \n \n done\n {pgettext(\"thread moderation btn\", \"Approve\")}\n \n
    • \n )}\n {!!moderation.open && (\n
    • \n \n
    • \n )}\n {!!moderation.close && (\n
    • \n \n
    • \n )}\n {!!moderation.unhide && (\n
    • \n \n visibility\n {pgettext(\"thread moderation btn\", \"Unhide\")}\n \n
    • \n )}\n {!!moderation.hide && (\n
    • \n \n
    • \n )}\n {!!moderation.delete && (\n
    • \n \n clear\n {pgettext(\"thread moderation btn\", \"Delete\")}\n \n
    • \n )}\n
    \n )\n }\n}\n","import ThreadModerationOptions from \"./controls\"\n\nexport default ThreadModerationOptions\n","import React from \"react\"\nimport ThreadModerationOptions from \"./moderation/thread\"\n\nconst ThreadModeration = ({ thread, posts, moderation }) => (\n
    \n \n settings\n \n \n
    \n)\n\nexport default ThreadModeration\n","import classnames from \"classnames\"\nimport React from \"react\"\nimport { connect } from \"react-redux\"\nimport { update } from \"../../reducers/thread\"\nimport snackbar from \"../../services/snackbar\"\nimport { ApiMutation } from \"../Api\"\nimport { DropdownSubheader } from \"../Dropdown\"\n\nconst ThreadWatchButton = ({ dispatch, dropup, stickToBottom, thread }) => (\n \n {(mutate, { loading }) => {\n function setNotifications(notifications) {\n if (thread.notifications !== notifications) {\n dispatch(update({ notifications }))\n mutate({\n json: { notifications },\n onError: (error) => {\n snackbar.apiError(error)\n dispatch(update({ notifications: thread.notifications }))\n },\n })\n }\n }\n\n return (\n
    \n \n \n {getIcon(thread.notifications)}\n \n {getLabel(thread.notifications)}\n \n \n \n {pgettext(\"watch thread\", \"Notify about new replies\")}\n \n
  • \n setNotifications(2)}\n >\n mail\n {pgettext(\"watch thread\", \"On site and with e-mail\")}\n \n
  • \n
  • \n setNotifications(1)}\n >\n notifications_active\n {pgettext(\"watch thread\", \"On site only\")}\n \n
  • \n
  • \n setNotifications(0)}\n >\n notifications_none\n {pgettext(\"watch thread\", \"Don't notify\")}\n \n
  • \n \n
    \n )\n }}\n
    \n)\n\nfunction getIcon(notifications) {\n if (notifications === 2) return \"mail\"\n if (notifications === 1) return \"notifications_active\"\n\n return \"notifications_none\"\n}\n\nfunction getLabel(notifications) {\n if (notifications) {\n return pgettext(\"watch thread\", \"Watching\")\n }\n\n return pgettext(\"watch thread\", \"Watch\")\n}\n\nconst ThreadWatchButtonConnected = connect()(ThreadWatchButton)\n\nexport default ThreadWatchButtonConnected\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst Breadcrumbs = ({ children, className }) => (\n
      {children}
    \n)\n\nexport default Breadcrumbs\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst BreadcrumbsCategory = ({ category, className }) => (\n
  • \n \n \n label\n \n {!!category.short_name && (\n \n {category.short_name}\n \n )}\n {!!category.short_name && (\n {category.name}\n )}\n {!category.short_name && (\n {category.name}\n )}\n \n
  • \n)\n\nexport default BreadcrumbsCategory\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst BreadcrumbsRootCategory = ({ category, className }) => (\n
  • \n \n chevron_right\n \n {category.special_role === \"root_category\"\n ? pgettext(\"breadcrumb\", \"Threads\")\n : pgettext(\"breadcrumb\", \"Private threads\")}\n \n \n
  • \n)\n\nexport default BreadcrumbsRootCategory\n","import React from \"react\"\nimport {\n Breadcrumbs,\n BreadcrumbsCategory,\n BreadcrumbsRootCategory,\n} from \"../../Breadcrumbs\"\n\nconst ThreadHeaderBreadcrumbs = ({ breadcrumbs }) => (\n \n {breadcrumbs.map((category) =>\n category.special_role ? (\n \n ) : (\n \n )\n )}\n \n)\n\nexport default ThreadHeaderBreadcrumbs\n","import React from \"react\"\nimport { FlexRow, FlexRowCol, FlexRowSection } from \"../../FlexRow\"\nimport ThreadFlags from \"../../ThreadFlags\"\nimport ThreadReplies from \"../../ThreadReplies\"\nimport ThreadStarterCard from \"../../ThreadStarterCard\"\nimport {\n PageHeader,\n PageHeaderBanner,\n PageHeaderContainer,\n PageHeaderDetails,\n} from \"../../PageHeader\"\nimport ThreadModeration from \"../ThreadModeration\"\nimport ThreadWatchButton from \"../ThreadWatchButton\"\nimport ThreadHeaderBreadcrumbs from \"./ThreadHeaderBreadcrumbs\"\n\nconst ThreadHeader = ({ styleName, thread, posts, user, moderation }) => (\n \n \n \n \n

    {thread.title}

    \n
    \n \n \n \n \n \n \n \n {thread.replies > 0 && (\n \n \n \n )}\n {hasFlags(thread) && (\n \n \n \n )}\n \n {user.is_authenticated && (\n \n \n \n \n {moderation.enabled && (\n \n \n \n )}\n \n )}\n \n \n
    \n
    \n)\n\nconst hasFlags = (thread) => {\n return (\n thread.is_closed ||\n thread.is_hidden ||\n thread.is_unapproved ||\n thread.weight > 0 ||\n thread.best_answer ||\n thread.has_poll ||\n thread.has_unapproved_posts\n )\n}\n\nexport default ThreadHeader\n","import ThreadHeader from \"./ThreadHeader\"\n\nexport default ThreadHeader\n","import React from \"react\"\nimport { Link, withRouter } from \"react-router\"\nimport { Dropdown } from \"../Dropdown\"\n\nconst ThreadPaginator = ({ router, baseUrl, posts, scrollToTop }) => (\n
    \n {posts.isLoaded && posts.first ? (\n \n first_page\n \n ) : (\n \n first_page\n \n )}\n {posts.isLoaded && posts.previous ? (\n 1 ? posts.previous + \"/\" : \"\")}\n title={pgettext(\"paginator\", \"Go to previous page\")}\n onClick={scrollToTop ? resetScroll : null}\n >\n chevron_left\n \n ) : (\n \n chevron_left\n \n )}\n (\n \n {getLabel(posts.page, posts.pages)}\n \n )}\n onOpen={(dropdown) => {\n dropdown.querySelector(\"input\").focus()\n }}\n >\n {({ close }) => (\n {\n if (posts.isLoaded) {\n const formData = new FormData(event.target)\n const page = parseInt(formData.get(\"page\"))\n\n if (\n page &&\n page != posts.page &&\n page >= 1 &&\n page <= posts.pages\n ) {\n const url = page > 1 ? baseUrl + page + \"/\" : baseUrl\n router.push({ pathname: url })\n }\n }\n\n event.preventDefault()\n close()\n\n if (scrollToTop) {\n resetScroll()\n }\n }}\n >\n \n \n {pgettext(\"paginator\", \"Go\")}\n \n \n )}\n \n {posts.isLoaded && posts.next ? (\n \n chevron_right\n \n ) : (\n \n chevron_right\n \n )}\n {posts.isLoaded && posts.last ? (\n \n last_page\n \n ) : (\n \n last_page\n \n )}\n
    \n)\n\nfunction getLabel(page, pages) {\n return pgettext(\"paginator\", \"Page %(page)s of %(pages)s\")\n .replace(\"%(page)s\", page)\n .replace(\"%(pages)s\", pages)\n}\n\nfunction resetScroll() {\n window.scrollTo(0, 0)\n}\n\nconst ThreadPaginatorConnected = withRouter(ThreadPaginator)\n\nexport default ThreadPaginatorConnected\n","import React from \"react\"\n\nexport default function ({ errors, posts }) {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\"thread posts moderation modal title\", \"Moderation\")}\n

    \n
    \n
    \n

    \n {pgettext(\n \"thread posts moderation modal\",\n \"One or more posts could not be changed:\"\n )}\n

    \n\n
      \n {errors.map((post) => {\n return (\n \n )\n })}\n
    \n
    \n
    \n
    \n )\n}\n\nexport function PostErrors({ errors, post }) {\n const heading = interpolate(\n pgettext(\"thread posts moderation modal\", \"%(username)s on %(posted_on)s\"),\n {\n posted_on: post.posted_on.format(\"LL, LT\"),\n username: post.poster_name,\n },\n true\n )\n\n return (\n
  • \n
    {heading}:
    \n {errors.map((error, i) => {\n return

    {error}

    \n })}\n
  • \n )\n}\n","import moment from \"moment\"\nimport React from \"react\"\nimport * as post from \"misago/reducers/post\"\nimport * as posts from \"misago/reducers/posts\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport ErrorsList from \"./errors-list\"\n\nexport function approve(props) {\n const { selection } = props\n\n const ops = [{ op: \"replace\", path: \"is-unapproved\", value: false }]\n\n const newState = selection.map((post) => {\n return {\n id: post.id,\n is_unapproved: false,\n }\n })\n\n const previousState = selection.map((post) => {\n return {\n id: post.id,\n is_unapproved: post.is_unapproved,\n }\n })\n\n patch(props, ops, newState, previousState)\n}\n\nexport function protect(props) {\n const { selection } = props\n\n const ops = [{ op: \"replace\", path: \"is-protected\", value: true }]\n\n const newState = selection.map((post) => {\n return {\n id: post.id,\n is_protected: true,\n }\n })\n\n const previousState = selection.map((post) => {\n return {\n id: post.id,\n is_protected: post.is_protected,\n }\n })\n\n patch(props, ops, newState, previousState)\n}\n\nexport function unprotect(props) {\n const { selection } = props\n\n const ops = [{ op: \"replace\", path: \"is-protected\", value: false }]\n\n const newState = selection.map((post) => {\n return {\n id: post.id,\n is_protected: false,\n }\n })\n\n const previousState = selection.map((post) => {\n return {\n id: post.id,\n is_protected: post.is_protected,\n }\n })\n\n patch(props, ops, newState, previousState)\n}\n\nexport function hide(props) {\n const { selection } = props\n\n const ops = [{ op: \"replace\", path: \"is-hidden\", value: true }]\n\n const newState = selection.map((post) => {\n return {\n id: post.id,\n is_hidden: true,\n hidden_on: moment(),\n hidden_by_name: props.user.username,\n url: Object.assign(post.url, {\n hidden_by: props.user.url,\n }),\n }\n })\n\n const previousState = selection.map((post) => {\n return {\n id: post.id,\n is_hidden: post.is_hidden,\n hidden_on: post.hidden_on,\n hidden_by_name: post.hidden_by_name,\n url: post.url,\n }\n })\n\n patch(props, ops, newState, previousState)\n}\n\nexport function unhide(props) {\n const { selection } = props\n\n const ops = [{ op: \"replace\", path: \"is-hidden\", value: false }]\n\n const newState = selection.map((post) => {\n return {\n id: post.id,\n is_hidden: false,\n hidden_on: moment(),\n hidden_by_name: props.user.username,\n url: Object.assign(post.url, {\n hidden_by: props.user.url,\n }),\n }\n })\n\n const previousState = selection.map((post) => {\n return {\n id: post.id,\n is_hidden: post.is_hidden,\n hidden_on: post.hidden_on,\n hidden_by_name: post.hidden_by_name,\n url: post.url,\n }\n })\n\n patch(props, ops, newState, previousState)\n}\n\nexport function patch(props, ops, newState, previousState) {\n const { selection, thread } = props\n\n // patch selected items\n newState.forEach((item) => {\n post.patch(item, item)\n })\n\n // deselect all the things\n store.dispatch(posts.deselectAll())\n\n // call ajax\n const data = {\n ops,\n\n ids: selection.map((post) => {\n return post.id\n }),\n }\n\n ajax.patch(thread.api.posts.index, data).then(\n (data) => {\n data.forEach((item) => {\n store.dispatch(post.patch(item, item))\n })\n },\n (rejection) => {\n if (rejection.status !== 400) {\n // rollback all\n previousState.forEach((item) => {\n store.dispatch(post.patch(item, item))\n })\n return snackbar.apiError(rejection)\n }\n\n let errors = []\n let rollback = []\n\n rejection.forEach((item) => {\n if (item.detail) {\n errors.push(item)\n rollback.push(item.id)\n } else {\n store.dispatch(post.patch(item, item))\n }\n\n previousState.forEach((item) => {\n if (rollback.indexOf(item) !== -1) {\n store.dispatch(post.patch(item, item))\n }\n })\n })\n\n let posts = {}\n selection.forEach((item) => {\n posts[item.id] = item\n })\n\n modal.show()\n }\n )\n}\n\nexport function merge(props) {\n let confirmed = window.confirm(\n pgettext(\n \"merge posts\",\n \"Are you sure you want to merge selected posts? This action is not reversible!\"\n )\n )\n if (!confirmed) {\n return\n }\n\n props.selection.slice(1).map((selection) => {\n store.dispatch(\n post.patch(selection, {\n isDeleted: true,\n })\n )\n })\n\n ajax\n .post(props.thread.api.posts.merge, {\n posts: props.selection.map((post) => post.id),\n })\n .then(\n (data) => {\n store.dispatch(post.patch(data, post.hydrate(data)))\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n\n props.selection.slice(1).map((selection) => {\n store.dispatch(\n post.patch(selection, {\n isDeleted: false,\n })\n )\n })\n }\n )\n\n store.dispatch(posts.deselectAll())\n}\n\nexport function remove(props) {\n let confirmed = window.confirm(\n pgettext(\n \"delete posts\",\n \"Are you sure you want to delete selected posts? This action is not reversible!\"\n )\n )\n if (!confirmed) {\n return\n }\n\n props.selection.map((selection) => {\n store.dispatch(\n post.patch(selection, {\n isDeleted: true,\n })\n )\n })\n\n const ids = props.selection.map((post) => {\n return post.id\n })\n\n ajax.delete(props.thread.api.posts.index, ids).then(\n () => {\n return\n },\n (rejection) => {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n\n props.selection.map((selection) => {\n store.dispatch(\n post.patch(selection, {\n isDeleted: false,\n })\n )\n })\n }\n )\n\n store.dispatch(posts.deselectAll())\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default class extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n url: \"\",\n\n validators: {\n url: [],\n },\n errors: {},\n }\n }\n\n clean() {\n if (!this.state.url.trim().length) {\n snackbar.error(\n pgettext(\n \"thread posts moderation move\",\n \"You have to enter link to the other thread.\"\n )\n )\n return false\n }\n\n return true\n }\n\n send() {\n return ajax.post(this.props.thread.api.posts.move, {\n new_thread: this.state.url,\n posts: this.props.selection.map((post) => post.id),\n })\n }\n\n handleSuccess(success) {\n this.props.selection.forEach((selection) => {\n store.dispatch(\n post.patch(selection, {\n isDeleted: true,\n })\n )\n })\n\n modal.hide()\n\n snackbar.success(\n pgettext(\n \"thread posts moderation move\",\n \"Selected posts were moved to the other thread.\"\n )\n )\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n snackbar.error(rejection.detail)\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onUrlChange = (event) => {\n this.changeValue(\"url\", event.target.value)\n }\n\n render() {\n return (\n
    \n
    \n
    \n \n
    \n \n \n \n
    \n
    \n \n {pgettext(\"thread posts moderation move btn\", \"Cancel\")}\n \n \n {pgettext(\"thread posts moderation move btn\", \"Move posts\")}\n \n
    \n
    \n
    \n
    \n )\n }\n}\n\nexport function ModalHeader(props) {\n return (\n
    \n \n ×\n \n

    \n {pgettext(\"thread posts moderation move title\", \"Move posts\")}\n

    \n
    \n )\n}\n","import React from \"react\"\nimport Button from \"misago/components/button\"\nimport Form from \"misago/components/form\"\nimport FormGroup from \"misago/components/form-group\"\nimport CategorySelect from \"misago/components/category-select\"\nimport ModalLoader from \"misago/components/modal-loader\"\nimport Select from \"misago/components/select\"\nimport * as post from \"misago/reducers/post\"\nimport ajax from \"misago/services/ajax\"\nimport modal from \"misago/services/modal\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\nimport * as validators from \"misago/utils/validators\"\nimport ErrorsModal from \"./errors-list\"\n\nexport default function (props) {\n return \n}\n\nexport class PostingConfig extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoaded: false,\n isError: false,\n\n categories: [],\n }\n }\n\n componentDidMount() {\n ajax.get(misago.get(\"THREAD_EDITOR_API\")).then(\n (data) => {\n // hydrate categories, extract posting options\n const categories = data.map((item) => {\n return Object.assign(item, {\n disabled: item.post === false,\n label: item.name,\n value: item.id,\n post: item.post,\n })\n })\n\n this.setState({\n isLoaded: true,\n categories,\n })\n },\n (rejection) => {\n this.setState({\n isError: rejection.detail,\n })\n }\n )\n }\n\n render() {\n if (this.state.isError) {\n return \n } else if (this.state.isLoaded) {\n return (\n \n )\n } else {\n return \n }\n }\n}\n\nexport class ModerationForm extends Form {\n constructor(props) {\n super(props)\n\n this.state = {\n isLoading: false,\n\n title: \"\",\n category: null,\n categories: props.categories,\n weight: 0,\n is_hidden: 0,\n is_closed: false,\n\n validators: {\n title: [validators.required()],\n },\n\n errors: {},\n }\n\n this.isHiddenChoices = [\n {\n value: 0,\n icon: \"visibility\",\n label: pgettext(\"thread hidden switch choice\", \"No\"),\n },\n {\n value: 1,\n icon: \"visibility_off\",\n label: pgettext(\"thread hidden switch choice\", \"Yes\"),\n },\n ]\n\n this.isClosedChoices = [\n {\n value: false,\n icon: \"lock_outline\",\n label: pgettext(\"thread closed switch choice\", \"No\"),\n },\n {\n value: true,\n icon: \"lock\",\n label: pgettext(\"thread closed switch choice\", \"Yes\"),\n },\n ]\n\n this.acl = {}\n this.props.categories.forEach((category) => {\n if (category.post) {\n if (!this.state.category) {\n this.state.category = category.id\n }\n\n this.acl[category.id] = {\n can_pin_threads: category.post.pin,\n can_close_threads: category.post.close,\n can_hide_threads: category.post.hide,\n }\n }\n })\n }\n\n clean() {\n if (this.isValid()) {\n return true\n } else {\n snackbar.error(gettext(\"Form contains errors.\"))\n this.setState({\n errors: this.validate(),\n })\n return false\n }\n }\n\n send() {\n return ajax.post(this.props.thread.api.posts.split, {\n title: this.state.title,\n category: this.state.category,\n weight: this.state.weight,\n is_hidden: this.state.is_hidden,\n is_closed: this.state.is_closed,\n posts: this.props.selection.map((post) => post.id),\n })\n }\n\n handleSuccess(apiResponse) {\n this.props.selection.forEach((selection) => {\n store.dispatch(\n post.patch(selection, {\n isDeleted: true,\n })\n )\n })\n\n modal.hide()\n\n snackbar.success(\n pgettext(\n \"posts moderation split\",\n \"Selected posts were split into new thread.\"\n )\n )\n }\n\n handleError(rejection) {\n if (rejection.status === 400) {\n this.setState({\n errors: Object.assign({}, this.state.errors, rejection),\n })\n snackbar.error(gettext(\"Form contains errors.\"))\n } else if (rejection.status === 403 && Array.isArray(rejection)) {\n modal.show()\n } else {\n snackbar.apiError(rejection)\n }\n }\n\n onCategoryChange = (ev) => {\n const categoryId = ev.target.value\n const newState = {\n category: categoryId,\n }\n\n if (this.acl[categoryId].can_pin_threads < newState.weight) {\n newState.weight = 0\n }\n\n if (!this.acl[categoryId].can_hide_threads) {\n newState.is_hidden = 0\n }\n\n if (!this.acl[categoryId].can_close_threads) {\n newState.is_closed = false\n }\n\n this.setState(newState)\n }\n\n getWeightChoices() {\n const choices = [\n {\n value: 0,\n icon: \"remove\",\n label: pgettext(\"thread weight choice\", \"Not pinned\"),\n },\n {\n value: 1,\n icon: \"bookmark_border\",\n label: pgettext(\"thread weight choice\", \"Pinned in category\"),\n },\n ]\n\n if (this.acl[this.state.category].can_pin_threads == 2) {\n choices.push({\n value: 2,\n icon: \"bookmark\",\n label: pgettext(\"thread weight choice\", \"Pinned globally\"),\n })\n }\n\n return choices\n }\n\n renderWeightField() {\n if (this.acl[this.state.category].can_pin_threads) {\n return (\n \n \n \n )\n } else {\n return null\n }\n }\n\n renderHiddenField() {\n if (this.acl[this.state.category].can_hide_threads) {\n return (\n \n \n \n )\n } else {\n return null\n }\n }\n\n renderClosedField() {\n if (this.acl[this.state.category].can_close_threads) {\n return (\n \n \n \n )\n } else {\n return null\n }\n }\n\n render() {\n return (\n \n
    \n
    \n \n \n \n
    \n\n \n \n \n
    \n\n {this.renderWeightField()}\n {this.renderHiddenField()}\n {this.renderClosedField()}\n
    \n
    \n \n {pgettext(\"posts moderation split btn\", \"Cancel\")}\n \n \n
    \n \n \n )\n }\n}\n\nexport function Loader() {\n return (\n \n \n \n )\n}\n\nexport function Error(props) {\n return (\n \n
    \n info_outline\n
    \n
    \n

    \n {pgettext(\n \"posts moderation split\",\n \"You can't move selected posts at the moment.\"\n )}\n

    \n

    {props.message}

    \n \n
    \n
    \n )\n}\n\nexport function Modal(props) {\n return (\n
    \n
    \n
    \n \n ×\n \n

    \n {pgettext(\n \"posts moderation split title\",\n \"Split posts into new thread\"\n )}\n

    \n
    \n {props.children}\n
    \n
    \n )\n}\n","import React from \"react\"\nimport modal from \"misago/services/modal\"\nimport * as moderation from \"./actions\"\nimport MoveModal from \"./move\"\nimport SplitModal from \"./split\"\n\nexport default function (props) {\n return (\n
      \n \n \n \n \n \n \n \n \n \n
    \n )\n}\n\nexport class Approve extends React.Component {\n onClick = () => {\n moderation.approve(this.props)\n }\n\n render() {\n const isVisible = this.props.selection.find((post) => {\n return post.acl.can_approve && post.is_unapproved\n })\n\n if (!isVisible) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Merge extends React.Component {\n onClick = () => {\n moderation.merge(this.props)\n }\n\n render() {\n const isVisible =\n this.props.selection.length > 1 &&\n this.props.selection.find((post) => {\n return post.acl.can_merge\n })\n\n if (!isVisible) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Move extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n const isVisible = this.props.selection.find((post) => {\n return post.acl.can_move\n })\n\n if (!isVisible) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Split extends React.Component {\n onClick = () => {\n modal.show()\n }\n\n render() {\n const isVisible = this.props.selection.find((post) => {\n return post.acl.can_move\n })\n\n if (!isVisible) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Protect extends React.Component {\n onClick = () => {\n moderation.protect(this.props)\n }\n\n render() {\n const isVisible = this.props.selection.find((post) => {\n return !post.is_protected && post.acl.can_protect\n })\n\n if (!isVisible) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Unprotect extends React.Component {\n onClick = () => {\n moderation.unprotect(this.props)\n }\n\n render() {\n const isVisible = this.props.selection.find((post) => {\n return post.is_protected && post.acl.can_protect\n })\n\n if (!isVisible) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Hide extends React.Component {\n onClick = () => {\n moderation.hide(this.props)\n }\n\n render() {\n const isVisible = this.props.selection.find((post) => {\n return post.acl.can_hide && !post.is_hidden\n })\n\n if (!isVisible) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Unhide extends React.Component {\n onClick = () => {\n moderation.unhide(this.props)\n }\n\n render() {\n const isVisible = this.props.selection.find((post) => {\n return post.acl.can_unhide && post.is_hidden\n })\n\n if (!isVisible) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n\nexport class Delete extends React.Component {\n onClick = () => {\n moderation.remove(this.props)\n }\n\n render() {\n const isVisible = this.props.selection.find((post) => {\n return post.acl.can_delete\n })\n\n if (!isVisible) return null\n\n return (\n
  • \n \n
  • \n )\n }\n}\n","import React from \"react\"\nimport { ThreadPostsModerationOptions } from \"./moderation/posts\"\n\nconst ThreadPostsModeration = ({ thread, user, selection, dropup }) => (\n
    \n \n settings\n \n \n
    \n)\n\nexport default ThreadPostsModeration\n","import React from \"react\"\n\nconst ThreadReplyButton = ({ onClick }) => (\n \n chat\n {pgettext(\"thread reply btn\", \"Reply\")}\n \n)\n\nexport default ThreadReplyButton\n","import React from \"react\"\nimport { Toolbar, ToolbarItem, ToolbarSection, ToolbarSpacer } from \"../Toolbar\"\nimport ThreadPaginator from \"./ThreadPaginator\"\nimport ThreadPostsModeration from \"./ThreadPostsModeration\"\nimport ThreadReplyButton from \"./ThreadReplyButton\"\nimport ThreadWatchButton from \"./ThreadWatchButton\"\n\nconst ThreadToolbarBottom = ({\n thread,\n posts,\n user,\n selection,\n moderation,\n onReply,\n}) => (\n \n {posts.pages > 1 && (\n \n \n \n \n \n )}\n \n {user.is_authenticated && (\n \n \n \n \n {thread.acl.can_reply && (\n \n \n \n )}\n {moderation.enabled && (\n \n \n \n )}\n \n )}\n {user.is_authenticated && (\n \n \n \n \n \n )}\n \n)\n\nexport default ThreadToolbarBottom\n","import React from \"react\"\nimport { Toolbar, ToolbarItem, ToolbarSection, ToolbarSpacer } from \"../Toolbar\"\n\nconst ThreadToolbarThird = () => (\n \n \n \n \n window.scrollTo(0, 0)}\n >\n arrow_upward\n {pgettext(\"go up\", \"Go to top\")}\n \n \n \n \n)\n\nexport default ThreadToolbarThird\n","import classnames from \"classnames\"\nimport React from \"react\"\n\nconst ThreadPollButton = ({ compact, disabled, onClick }) => (\n \n poll\n {!compact && pgettext(\"thread poll btn\", \"Add poll\")}\n \n)\n\nexport default ThreadPollButton\n","import React from \"react\"\nimport { Link } from \"react-router\"\n\nconst ThreadShortcutsButton = ({ user, thread, posts }) => (\n
    \n \n bookmark\n \n \n
    \n)\n\nexport default ThreadShortcutsButton\n","import React from \"react\"\nimport { Toolbar, ToolbarItem, ToolbarSection, ToolbarSpacer } from \"../Toolbar\"\nimport ThreadPaginator from \"./ThreadPaginator\"\nimport ThreadPollButton from \"./ThreadPollButton\"\nimport ThreadPostsModeration from \"./ThreadPostsModeration\"\nimport ThreadReplyButton from \"./ThreadReplyButton\"\nimport ThreadShortcutsButton from \"./ThreadShortcutsButton\"\n\nconst ThreadToolbarTop = ({\n thread,\n posts,\n user,\n pollDisabled,\n selection,\n moderation,\n onPoll,\n onReply,\n}) => (\n \n \n \n \n \n {posts.pages > 1 && (\n \n \n \n )}\n \n \n {thread.acl.can_start_poll && !thread.poll && (\n \n \n \n \n \n )}\n {thread.acl.can_reply ? (\n \n \n \n \n \n \n \n {thread.acl.can_start_poll && !thread.poll && (\n \n \n \n )}\n {moderation.enabled && (\n \n \n \n )}\n \n ) : (\n \n \n \n \n {thread.acl.can_start_poll && !thread.poll && (\n \n \n \n )}\n {moderation.enabled && (\n \n \n \n )}\n \n )}\n {posts.pages > 1 && (\n \n \n \n \n \n )}\n \n)\n\nexport default ThreadToolbarTop\n","import React from \"react\"\nimport Participants from \"misago/components/participants\"\nimport { Poll, PollForm } from \"misago/components/poll\"\nimport PostsList from \"misago/components/posts-list\"\nimport * as participants from \"misago/reducers/participants\"\nimport * as poll from \"misago/reducers/poll\"\nimport * as posts from \"misago/reducers/posts\"\nimport * as thread from \"misago/reducers/thread\"\nimport ajax from \"misago/services/ajax\"\nimport polls from \"misago/services/polls\"\nimport snackbar from \"misago/services/snackbar\"\nimport posting from \"misago/services/posting\"\nimport store from \"misago/services/store\"\nimport title from \"misago/services/page-title\"\nimport { PostingQuoteSelection } from \"../posting\"\nimport PageContainer from \"../PageContainer\"\nimport ThreadHeader from \"./ThreadHeader\"\nimport ThreadToolbarBottom from \"./ThreadToolbarBottom\"\nimport ThreadToolbarThird from \"./ThreadToolbarThird\"\nimport ThreadToolbarTop from \"./ThreadToolbarTop\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n editPoll: false,\n }\n }\n\n componentDidMount() {\n if (this.shouldFetchData()) {\n this.fetchData()\n this.setPageTitle()\n }\n\n this.startPollingApi()\n }\n\n componentDidUpdate() {\n if (this.shouldFetchData()) {\n this.fetchData()\n this.startPollingApi()\n this.setPageTitle()\n }\n }\n\n componentWillUnmount() {\n this.stopPollingApi()\n }\n\n shouldFetchData() {\n if (this.props.posts.isLoaded) {\n const page = (this.props.params.page || 1) * 1\n return page != this.props.posts.page\n } else {\n return false\n }\n }\n\n fetchData() {\n store.dispatch(posts.unload())\n\n ajax\n .get(\n this.props.thread.api.posts.index,\n {\n page: this.props.params.page || 1,\n },\n \"posts\"\n )\n .then(\n (data) => {\n this.update(data)\n },\n (rejection) => {\n snackbar.apiError(rejection)\n }\n )\n }\n\n startPollingApi() {\n polls.start({\n poll: \"thread-posts\",\n\n url: this.props.thread.api.posts.index,\n data: {\n page: this.props.params.page || 1,\n },\n update: this.update,\n\n frequency: 120 * 1000,\n delayed: true,\n })\n }\n\n stopPollingApi() {\n polls.stop(\"thread-posts\")\n }\n\n setPageTitle() {\n title.set({\n title: this.props.thread.title,\n parent: this.props.thread.category.name,\n page: (this.props.params.page || 1) * 1,\n })\n }\n\n update = (data) => {\n store.dispatch(thread.replace(data))\n store.dispatch(posts.load(data.post_set))\n\n if (data.participants) {\n store.dispatch(participants.replace(data.participants))\n }\n\n if (data.poll) {\n store.dispatch(poll.replace(data.poll))\n }\n\n this.setPageTitle()\n }\n\n openPollForm = () => {\n this.setState({ editPoll: true })\n }\n\n closePollForm = () => {\n this.setState({ editPoll: false })\n }\n\n openReplyForm = () => {\n posting.open({\n mode: \"REPLY\",\n\n thread: this.props.thread,\n config: this.props.thread.api.editor,\n submit: this.props.thread.api.posts.index,\n })\n }\n\n render() {\n const category = this.props.thread.category\n\n let className = \"page page-thread\"\n if (category.css_class) {\n className += \" page-thread-\" + category.css_class\n }\n\n const styleName =\n category.special_role === \"private_threads\"\n ? \"private-threads\"\n : category.css_class || \"category-threads\"\n\n const threadModeration = getThreadModeration(\n this.props.thread,\n this.props.user\n )\n\n const postsModeration = getPostsModeration(\n this.props.posts.results,\n this.props.user\n )\n const selection = this.props.posts.results.filter((post) => post.isSelected)\n\n return (\n
    \n \n \n \n \n {this.state.editPoll ? (\n \n ) : (\n \n )}\n {this.props.thread.acl.can_reply ? (\n \n \n \n ) : (\n \n )}\n \n \n \n
    \n )\n }\n}\n\nconst getThreadModeration = (thread, user) => {\n const moderation = {\n enabled: false,\n edit: false,\n approve: false,\n close: false,\n open: false,\n hide: false,\n unhide: false,\n move: false,\n merge: false,\n pinGlobally: false,\n pinLocally: false,\n unpin: false,\n delete: false,\n }\n\n if (!user.is_authenticated) return moderation\n\n moderation.edit = thread.acl.can_edit\n moderation.approve = thread.acl.can_approve && thread.is_unapproved\n moderation.close = thread.acl.can_close && !thread.is_closed\n moderation.open = thread.acl.can_close && thread.is_closed\n moderation.hide = thread.acl.can_hide && !thread.is_hidden\n moderation.unhide = thread.acl.can_unhide && thread.is_hidden\n moderation.move = thread.acl.can_move\n moderation.merge = thread.acl.can_merge\n moderation.pinGlobally = thread.acl.can_pin_globally && thread.weight < 2\n moderation.pinLocally = thread.acl.can_pin && thread.weight !== 1\n moderation.unpin =\n (thread.acl.can_pin && thread.weight === 1) ||\n (thread.acl.can_pin_globally && thread.weight === 2)\n moderation.delete = thread.acl.can_delete\n\n moderation.enabled =\n moderation.edit ||\n moderation.approve ||\n moderation.close ||\n moderation.open ||\n moderation.hide ||\n moderation.unhide ||\n moderation.move ||\n moderation.merge ||\n moderation.pinGlobally ||\n moderation.pinLocally ||\n moderation.unpin ||\n moderation.delete\n\n return moderation\n}\n\nconst getPostsModeration = (posts, user) => {\n const moderation = {\n enabled: false,\n approve: false,\n move: false,\n merge: false,\n protect: false,\n hide: false,\n delete: false,\n }\n\n if (!user.is_authenticated) return moderation\n\n posts.forEach((post) => {\n if (!post.is_event) {\n if (post.acl.can_approve && post.is_unapproved) {\n moderation.approve = true\n }\n if (post.acl.can_move) moderation.move = true\n if (post.acl.can_merge) moderation.merge = true\n if (post.acl.can_protect || post.acl.can_unprotect) {\n moderation.protect = true\n }\n if (post.acl.can_hide || post.acl.can_unhide) {\n moderation.hide = true\n }\n if (post.acl.can_delete) moderation.delete = true\n\n if (\n moderation.approve ||\n moderation.move ||\n moderation.merge ||\n moderation.protect ||\n moderation.hide ||\n moderation.delete\n ) {\n moderation.enabled = true\n }\n }\n })\n\n return moderation\n}\n","import { connect } from \"react-redux\"\nimport Route from \"misago/components/thread/route\"\nimport misago from \"misago/index\"\n\nexport function select(store) {\n return {\n participants: store.participants,\n poll: store.poll,\n posts: store.posts,\n thread: store.thread,\n tick: store.tick.tick,\n user: store.auth.user,\n }\n}\n\nexport function paths() {\n const thread = misago.get(\"THREAD\")\n const basePath = thread.url.index.replace(\n thread.slug + \"-\" + thread.pk,\n \":slug\"\n )\n return [\n {\n path: basePath,\n component: connect(select)(Route),\n },\n {\n path: basePath + \":page/\",\n component: connect(select)(Route),\n },\n ]\n}\n","import { paths } from \"misago/components/thread/root\"\nimport misago from \"misago/index\"\nimport mount from \"misago/utils/routed-component\"\n\nexport default function initializer(context) {\n if (context.has(\"THREAD\") && context.has(\"POSTS\")) {\n mount({\n paths: paths(),\n })\n }\n}\n\nmisago.addInitializer({\n name: \"component:thread\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport { UserNavOverlay } from \"../../components/UserNav\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n const root = document.getElementById(\"user-nav-mount\")\n ReactDOM.render(\n \n \n ,\n root\n )\n}\n\nmisago.addInitializer({\n name: \"component:user-nav-overlay\",\n initializer: initializer,\n after: \"store\",\n})\n","import React from \"react\"\nimport { Link } from \"react-router\"\nimport Li from \"misago/components/li\"\n\nconst UsersNav = ({ baseUrl, page, pages }) => (\n
    \n
    \n \n menu\n {page.name}\n \n
      \n {pages.map((page) => {\n const url = getPageUrl(baseUrl, page)\n return (\n
    • \n {page.name}\n
    • \n )\n })}\n
    \n
    \n
      \n {pages.map((page) => {\n const url = getPageUrl(baseUrl, page)\n return (\n
    • \n {page.name}\n
    • \n )\n })}\n
    \n
    \n)\n\nconst getPageUrl = (baseUrl, page) => {\n let url = baseUrl\n if (page.component === \"rank\") {\n url += page.slug\n } else {\n url += page.component\n }\n return url + \"/\"\n}\n\nexport default UsersNav\n","import React from \"react\"\nimport PageContainer from \"../../PageContainer\"\nimport UsersNav from \"../UsersNav\"\n\nexport default class extends React.Component {\n getEmptyMessage() {\n return interpolate(\n npgettext(\n \"top posters empty\",\n \"No users have posted any new messages during last %(days)s day.\",\n \"No users have posted any new messages during last %(days)s days.\",\n this.props.trackedPeriod\n ),\n { days: this.props.trackedPeriod },\n true\n )\n }\n\n render() {\n return (\n
    \n \n \n

    {this.getEmptyMessage()}

    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport Avatar from \"misago/components/avatar\"\nimport * as random from \"misago/utils/random\"\n\nexport default class extends React.Component {\n shouldComponentUpdate() {\n return false\n }\n\n getClassName() {\n if (this.props.hiddenOnMobile) {\n return \"list-group-item hidden-xs hidden-sm\"\n } else {\n return \"list-group-item\"\n }\n }\n\n render() {\n return (\n
  • \n
    \n \n \n \n
    \n\n
    \n
    \n \n \n  \n \n \n
    \n\n
    \n \n  \n \n  \n \n \n \n \n  \n \n \n \n \n  \n \n \n
    \n
    \n \n \n \n  \n \n \n {pgettext(\"top posters list item\", \"Rank\")}\n \n \n \n \n  \n \n \n {pgettext(\"top posters list item\", \"Ranked posts\")}\n \n
    \n
    \n\n
    \n \n \n  \n \n \n {pgettext(\"top posters list item\", \"Rank\")}\n
    \n\n
    \n \n \n  \n \n \n {pgettext(\"top posters list item\", \"Ranked posts\")}\n
    \n\n
    \n \n \n  \n \n \n {pgettext(\"top posters list item\", \"Total posts\")}\n
    \n
  • \n )\n }\n}\n","import React from \"react\"\nimport ItemPreview from \"misago/components/users/active-posters/list-item-preview\"\nimport * as random from \"misago/utils/random\"\nimport PageContainer from \"../../PageContainer\"\nimport UsersNav from \"../UsersNav\"\n\nexport default class extends React.Component {\n shouldComponentUpdate() {\n return false\n }\n\n render() {\n return (\n
    \n \n \n

    \n \n  \n \n

    \n\n
    \n
      \n {[0, 1, 2].map((i) => {\n return 0} key={i} />\n })}\n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport { Link } from \"react-router\"\nimport Avatar from \"misago/components/avatar\"\nimport Status, { StatusIcon, StatusLabel } from \"misago/components/user-status\"\nimport misago from \"misago/index\"\nimport * as random from \"misago/utils/random\"\n\nexport default class extends React.Component {\n getClassName() {\n if (this.props.rank.css_class) {\n return \"list-group-item list-group-rank-\" + this.props.rank.css_class\n } else {\n return \"list-group-item\"\n }\n }\n\n getUserStatus() {\n if (this.props.user.status) {\n return (\n \n \n \n \n )\n }\n\n return (\n \n  \n \n  \n \n \n )\n }\n\n getRankName() {\n if (!this.props.rank.is_tab) {\n return (\n {this.props.rank.name}\n )\n }\n\n let rankUrl = misago.get(\"USERS_LIST_URL\") + this.props.rank.slug + \"/\"\n return (\n \n {this.props.rank.name}\n \n )\n }\n\n getUserTitle() {\n if (!this.props.user.title) return null\n\n return (\n \n {this.props.user.title}\n \n )\n }\n\n render() {\n return (\n
  • \n
    \n \n \n \n
    \n\n
    \n \n
    \n {this.getUserStatus()}\n {this.getRankName()}\n {this.getUserTitle()}\n
    \n
    \n \n #{this.props.counter}\n {pgettext(\"top posters list item\", \"Rank\")}\n \n\n \n {this.props.user.meta.score}\n {pgettext(\"top posters list item\", \"Ranked posts\")}\n \n
    \n
    \n\n
    \n #{this.props.counter}\n {pgettext(\"top posters list item\", \"Rank\")}\n
    \n\n
    \n {this.props.user.meta.score}\n {pgettext(\"top posters list item\", \"Ranked posts\")}\n
    \n\n
    \n {this.props.user.posts}\n {pgettext(\"top posters list item\", \"Total posts\")}\n
    \n
  • \n )\n }\n}\n","import React from \"react\"\nimport ListItem from \"misago/components/users/active-posters/list-item\"\nimport PageContainer from \"../../PageContainer\"\nimport UsersNav from \"../UsersNav\"\n\nexport default class extends React.Component {\n getLeadMessage() {\n let message = npgettext(\n \"top posters list\",\n \"%(posters)s top poster from last %(days)s days.\",\n \"%(posters)s top posters from last %(days)s days.\",\n this.props.count\n )\n\n return interpolate(\n message,\n {\n posters: this.props.count,\n days: this.props.trackedPeriod,\n },\n true\n )\n }\n\n render() {\n return (\n
    \n \n \n

    {this.getLeadMessage()}

    \n\n
    \n
      \n {this.props.users.map((user, i) => {\n return (\n \n )\n })}\n
    \n
    \n
    \n
    \n )\n }\n}\n","import React from \"react\"\nimport ListEmpty from \"misago/components/users/active-posters/list-empty\"\nimport ListPreview from \"misago/components/users/active-posters/list-preview\"\nimport ListReady from \"misago/components/users/active-posters/list-ready\"\nimport misago from \"misago/index\"\nimport { hydrate } from \"misago/reducers/users\"\nimport polls from \"misago/services/polls\"\nimport store from \"misago/services/store\"\nimport title from \"misago/services/page-title\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n if (misago.has(\"USERS\")) {\n this.initWithPreloadedData(misago.pop(\"USERS\"))\n } else {\n this.initWithoutPreloadedData()\n }\n\n this.startPolling()\n }\n\n initWithPreloadedData(data) {\n this.state = {\n isLoaded: true,\n\n trackedPeriod: data.tracked_period,\n count: data.count,\n }\n\n store.dispatch(hydrate(data.results))\n }\n\n initWithoutPreloadedData() {\n this.state = {\n isLoaded: false,\n }\n }\n\n startPolling() {\n polls.start({\n poll: \"active-posters\",\n url: misago.get(\"USERS_API\"),\n data: {\n list: \"active\",\n },\n frequency: 90 * 1000,\n update: this.update,\n })\n }\n\n update = (data) => {\n store.dispatch(hydrate(data.results))\n\n this.setState({\n isLoaded: true,\n\n trackedPeriod: data.tracked_period,\n count: data.count,\n })\n }\n\n componentDidMount() {\n title.set({\n title: this.props.route.extra.name,\n parent: pgettext(\"users page title\", \"Users\"),\n })\n }\n\n componentWillUnmount() {\n polls.stop(\"active-posters\")\n }\n\n render() {\n const page = { name: this.props.route.extra.name }\n\n if (this.state.isLoaded) {\n if (this.state.count > 0) {\n return (\n \n )\n } else {\n return (\n \n )\n }\n } else {\n return \n }\n }\n}\n","import React from \"react\"\nimport stringCount from \"misago/utils/string-count\"\n\nexport default class extends React.Component {\n getClassName() {\n if (this.props.copy && this.props.copy.length) {\n if (\n stringCount(this.props.copy, \"\n )\n } else {\n return null\n }\n }\n}\n","export default function (string, subString) {\n string = (string + \"\").toLowerCase()\n subString = (subString + \"\").toLowerCase()\n\n if (subString.length <= 0) return 0\n\n let n = 0\n let pos = 0\n let step = subString.length\n\n while (true) {\n pos = string.indexOf(subString, pos)\n if (pos >= 0) {\n n += 1\n pos += step\n } else {\n break\n }\n }\n\n return n\n}\n","import React from \"react\"\nimport UsersList from \"../../users-list\"\n\nconst RankUsersList = ({ users }) => (\n \n)\n\nexport default RankUsersList\n","import React from \"react\"\nimport UsersList from \"misago/components/users-list\"\n\nclass RankUsersListLoader extends React.Component {\n shouldComponentUpdate() {\n return false\n }\n\n render = () => \n}\n\nexport default RankUsersListLoader\n","import React from \"react\"\n\nconst RankUsersLeft = ({ users }) => {\n if (users.more) {\n return (\n

    \n {interpolate(\n npgettext(\n \"rank users list\",\n \"There is %(more)s more user with this rank.\",\n \"There are %(more)s more users with this rank.\",\n users.more\n ),\n { more: users.more },\n true\n )}\n

    \n )\n }\n\n return (\n

    \n {pgettext(\n \"rank users list empty\",\n \"There are no more users with this rank.\"\n )}\n

    \n )\n}\n\nexport default RankUsersLeft\n","import React from \"react\"\nimport { Link } from \"react-router\"\n\nconst RankUsersPagination = ({ baseUrl, users }) => (\n
    \n {users.isLoaded && users.first ? (\n \n first_page\n \n ) : (\n \n first_page\n \n )}\n {users.isLoaded && users.previous ? (\n 1 ? users.previous + \"/\" : \"\")}\n title={pgettext(\"rank users list paginator\", \"Go to previous page\")}\n >\n chevron_left\n \n ) : (\n \n chevron_left\n \n )}\n {users.isLoaded && users.next ? (\n \n chevron_right\n \n ) : (\n \n chevron_right\n \n )}\n {users.isLoaded && users.last ? (\n \n last_page\n \n ) : (\n \n last_page\n \n )}\n
    \n)\n\nexport default RankUsersPagination\n","import React from \"react\"\nimport { Toolbar, ToolbarItem, ToolbarSection } from \"../../Toolbar\"\nimport RankUsersLeft from \"./RankUsersLeft\"\nimport RankUsersPagination from \"./RankUsersPagination\"\n\nconst RankUsersToolbar = ({ baseUrl, users }) => (\n \n \n \n \n \n \n \n \n \n \n \n \n)\n\nexport default RankUsersToolbar\n","import React from \"react\"\nimport PageLead from \"misago/components/page-lead\"\nimport misago from \"misago/index\"\nimport { hydrate } from \"misago/reducers/users\"\nimport polls from \"misago/services/polls\"\nimport store from \"misago/services/store\"\nimport title from \"misago/services/page-title\"\nimport PageContainer from \"../../PageContainer\"\nimport RankUsersList from \"./RankUsersList\"\nimport RankUsersListLoader from \"./RankUsersListLoader\"\nimport RankUsersToolbar from \"./RankUsersToolbar\"\nimport UsersNav from \"../UsersNav\"\n\nexport default class extends React.Component {\n constructor(props) {\n super(props)\n\n if (misago.has(\"USERS\")) {\n this.initWithPreloadedData(misago.pop(\"USERS\"))\n } else {\n this.initWithoutPreloadedData()\n }\n\n this.startPolling(props.params.page || 1)\n }\n\n initWithPreloadedData(data) {\n this.state = Object.assign(data, {\n isLoaded: true,\n })\n store.dispatch(hydrate(data.results))\n }\n\n initWithoutPreloadedData() {\n this.state = {\n isLoaded: false,\n }\n }\n\n startPolling(page) {\n polls.start({\n poll: \"rank-users\",\n url: misago.get(\"USERS_API\"),\n data: {\n rank: this.props.route.rank.id,\n page: page,\n },\n frequency: 90 * 1000,\n update: this.update,\n })\n }\n\n update = (data) => {\n store.dispatch(hydrate(data.results))\n\n data.isLoaded = true\n this.setState(data)\n }\n\n componentDidMount() {\n title.set({\n title: this.props.route.rank.name,\n page: this.props.params.page || null,\n parent: pgettext(\"users page title\", \"Users\"),\n })\n }\n\n componentWillUnmount() {\n polls.stop(\"rank-users\")\n }\n\n componentWillReceiveProps(nextProps) {\n if (this.props.params.page !== nextProps.params.page) {\n title.set({\n title: this.props.route.rank.name,\n page: nextProps.params.page || null,\n parent: pgettext(\"users page title\", \"Users\"),\n })\n\n this.setState({\n isLoaded: false,\n })\n\n polls.stop(\"rank-users\")\n this.startPolling(nextProps.params.page)\n }\n }\n\n getClassName() {\n if (this.props.route.rank.css_class) {\n return \"rank-users-list rank-users-\" + this.props.route.rank.css_class\n } else {\n return \"rank-users-list\"\n }\n }\n\n getRankDescription() {\n if (this.props.route.rank.description) {\n return (\n
    \n \n
    \n )\n } else {\n return null\n }\n }\n\n getComponent() {\n if (this.state.isLoaded) {\n if (this.state.count > 0) {\n return \n } else {\n return (\n

    \n {pgettext(\n \"rank users list\",\n \"There are no users with this rank at the moment.\"\n )}\n

    \n )\n }\n } else {\n return \n }\n }\n\n render() {\n return (\n
    \n \n \n {this.getRankDescription()}\n {this.getComponent()}\n \n \n
    \n )\n }\n}\n","import React from \"react\"\nimport { connect } from \"react-redux\"\nimport ActivePosters from \"misago/components/users/active-posters/root\"\nimport Rank from \"misago/components/users/rank/root\"\nimport WithDropdown from \"misago/components/with-dropdown\"\nimport misago from \"misago/index\"\nimport {\n PageHeader,\n PageHeaderBanner,\n PageHeaderContainer,\n} from \"../PageHeader\"\n\nexport default class extends WithDropdown {\n render() {\n return (\n
    \n \n \n \n

    {pgettext(\"users page title\", \"Users\")}

    \n
    \n
    \n
    \n {this.props.children}\n
    \n )\n }\n}\n\nexport function select(store) {\n return {\n tick: store.tick.tick,\n user: store.auth.user,\n users: store.users,\n }\n}\n\nexport function paths() {\n let paths = []\n\n misago.get(\"USERS_LISTS\").forEach(function (item) {\n if (item.component === \"rank\") {\n paths.push({\n path: misago.get(\"USERS_LIST_URL\") + item.slug + \"/:page/\",\n component: connect(select)(Rank),\n rank: item,\n })\n paths.push({\n path: misago.get(\"USERS_LIST_URL\") + item.slug + \"/\",\n component: connect(select)(Rank),\n rank: item,\n })\n } else if (item.component === \"active-posters\") {\n paths.push({\n path: misago.get(\"USERS_LIST_URL\") + item.component + \"/\",\n component: connect(select)(ActivePosters),\n extra: {\n name: item.name,\n },\n })\n }\n })\n\n return paths\n}\n","import Users, { paths } from \"misago/components/users/root\"\nimport misago from \"misago/index\"\nimport mount from \"misago/utils/routed-component\"\n\nexport default function initializer(context) {\n if (context.has(\"USERS_LISTS\")) {\n mount({\n root: misago.get(\"USERS_LIST_URL\"),\n component: Users,\n paths: paths(),\n })\n }\n}\n\nmisago.addInitializer({\n name: \"component:users\",\n initializer: initializer,\n after: \"store\",\n})\n","import misago from \"misago/index\"\nimport include from \"misago/services/include\"\n\nexport default function initializer(context) {\n include.init(context.get(\"STATIC_URL\"))\n}\n\nmisago.addInitializer({\n name: \"include\",\n initializer: initializer,\n})\n","import misago from \"misago/index\"\nimport storage from \"misago/services/local-storage\"\n\nexport default function initializer() {\n storage.init(\"misago_\")\n}\n\nmisago.addInitializer({\n name: \"local-storage\",\n initializer: initializer,\n})\n","import mount from \"misago/utils/mount-component\"\n\nexport class MobileNavbarDropdown {\n init(element) {\n this._element = element\n this._component = null\n }\n\n show(component) {\n if (this._component === component) {\n this.hide()\n } else {\n this._component = component\n mount(component, this._element.id)\n $(this._element).addClass(\"open\")\n }\n }\n\n showConnected(name, component) {\n if (this._component === name) {\n this.hide()\n } else {\n this._component = name\n mount(component, this._element.id, true)\n $(this._element).addClass(\"open\")\n }\n }\n\n hide() {\n $(this._element).removeClass(\"open\")\n this._component = null\n }\n}\n\nexport default new MobileNavbarDropdown()\n","import misago from \"misago/index\"\nimport dropdown from \"misago/services/mobile-navbar-dropdown\"\n\nexport default function initializer() {\n let element = document.getElementById(\"mobile-navbar-dropdown-mount\")\n if (element) {\n dropdown.init(element)\n }\n}\n\nmisago.addInitializer({\n name: \"dropdown\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport modal from \"misago/services/modal\"\n\nexport default function initializer() {\n let element = document.getElementById(\"modal-mount\")\n if (element) {\n modal.init(element)\n }\n}\n\nmisago.addInitializer({\n name: \"modal\",\n initializer: initializer,\n before: \"store\",\n})\n","import moment from \"moment\"\nimport misago from \"misago/index\"\n\nexport default function initializer() {\n moment.locale($(\"html\").attr(\"lang\"))\n}\n\nmisago.addInitializer({\n name: \"moment\",\n initializer: initializer,\n})\n","import misago from \"misago/index\"\nimport title from \"misago/services/page-title\"\n\nexport default function initializer(context) {\n title.init(\n context.get(\"SETTINGS\").forum_index_title,\n context.get(\"SETTINGS\").forum_name\n )\n}\n\nmisago.addInitializer({\n name: \"page-title\",\n initializer: initializer,\n})\n","import misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\nimport snackbar from \"misago/services/snackbar\"\nimport polls from \"misago/services/polls\"\n\nexport default function initializer() {\n polls.init(ajax, snackbar)\n}\n\nmisago.addInitializer({\n name: \"polls\",\n initializer: initializer,\n})\n","import misago from \"misago/index\"\nimport ajax from \"misago/services/ajax\"\nimport posting from \"misago/services/posting\"\nimport snackbar from \"misago/services/snackbar\"\n\nexport default function initializer() {\n posting.init(ajax, snackbar, document.getElementById(\"posting-mount\"))\n}\n\nmisago.addInitializer({\n name: \"posting\",\n initializer: initializer,\n})\n","import misago from \"misago/index\"\nimport reducer, { initialState } from \"misago/reducers/auth\"\nimport store from \"misago/services/store\"\n\nexport default function initializer(context) {\n store.addReducer(\n \"auth\",\n reducer,\n Object.assign(\n {\n isAuthenticated: context.get(\"isAuthenticated\"),\n isAnonymous: !context.get(\"isAuthenticated\"),\n\n user: context.get(\"user\"),\n },\n initialState\n )\n )\n}\n\nmisago.addInitializer({\n name: \"reducer:auth\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer, { initialState } from \"../../reducers/overlay\"\nimport store from \"../../services/store\"\n\nexport default function initializer(context) {\n store.addReducer(\"overlay\", reducer, initialState)\n}\n\nmisago.addInitializer({\n name: \"reducer:overlay\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer from \"misago/reducers/participants\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n let initialState = null\n if (misago.has(\"THREAD\")) {\n initialState = misago.get(\"THREAD\").participants\n }\n\n store.addReducer(\"participants\", reducer, initialState || [])\n}\n\nmisago.addInitializer({\n name: \"reducer:participants\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer, { hydrate } from \"misago/reducers/poll\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n let initialState = null\n if (misago.has(\"THREAD\") && misago.get(\"THREAD\").poll) {\n initialState = hydrate(misago.get(\"THREAD\").poll)\n } else {\n initialState = {}\n }\n\n store.addReducer(\"poll\", reducer, initialState)\n}\n\nmisago.addInitializer({\n name: \"reducer:poll\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer, { hydrate } from \"misago/reducers/posts\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n let initialState = null\n if (misago.has(\"POSTS\")) {\n initialState = hydrate(misago.get(\"POSTS\"))\n } else {\n initialState = {\n isLoaded: false,\n isBusy: false,\n }\n }\n\n store.addReducer(\"posts\", reducer, initialState)\n}\n\nmisago.addInitializer({\n name: \"reducer:posts\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer from \"misago/reducers/profile-details\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n let initialState = null\n if (misago.has(\"PROFILE_DETAILS\")) {\n initialState = misago.get(\"PROFILE_DETAILS\")\n }\n\n store.addReducer(\"profile-details\", reducer, initialState || {})\n}\n\nmisago.addInitializer({\n name: \"reducer:profile-details\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport { hydrate } from \"misago/reducers/profile\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n if (misago.has(\"PROFILE\")) {\n store.dispatch(hydrate(misago.get(\"PROFILE\")))\n }\n}\n\nmisago.addInitializer({\n name: \"reducer:profile-hydrate\",\n initializer: initializer,\n after: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer from \"misago/reducers/profile\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n store.addReducer(\"profile\", reducer, {})\n}\n\nmisago.addInitializer({\n name: \"reducer:profile\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago\"\nimport reducer, { initialState } from \"misago/reducers/search\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n store.addReducer(\n \"search\",\n reducer,\n Object.assign({}, initialState, {\n providers: misago.get(\"SEARCH_PROVIDERS\") || [],\n query: misago.get(\"SEARCH_QUERY\") || \"\",\n })\n )\n}\n\nmisago.addInitializer({\n name: \"reducer:search\",\n initializer: initializer,\n before: \"store\",\n})\n","export function push(array, value) {\n if (array.indexOf(value) === -1) {\n let copy = array.slice()\n copy.push(value)\n return copy\n } else {\n return array\n }\n}\n\nexport function remove(array, value) {\n if (array.indexOf(value) >= 0) {\n return array.filter(function (i) {\n return i !== value\n })\n } else {\n return array\n }\n}\n\nexport function toggle(array, value) {\n if (array.indexOf(value) === -1) {\n let copy = array.slice()\n copy.push(value)\n return copy\n } else {\n return array.filter(function (i) {\n return i !== value\n })\n }\n}\n","import { toggle } from \"misago/utils/sets\"\n\nexport const SELECT_ALL = \"SELECT_ALL\"\nexport const SELECT_NONE = \"SELECT_NONE\"\nexport const SELECT_ITEM = \"SELECT_ITEM\"\n\nexport function all(itemsIds) {\n return {\n type: SELECT_ALL,\n items: itemsIds,\n }\n}\n\nexport function none() {\n return {\n type: SELECT_NONE,\n }\n}\n\nexport function item(itemId) {\n return {\n type: SELECT_ITEM,\n item: itemId,\n }\n}\n\nexport default function selection(state = [], action = null) {\n switch (action.type) {\n case SELECT_ALL:\n return action.items\n\n case SELECT_NONE:\n return []\n\n case SELECT_ITEM:\n return toggle(state, action.item)\n\n default:\n return state\n }\n}\n","import misago from \"misago/index\"\nimport reducer from \"misago/reducers/selection\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n store.addReducer(\"selection\", reducer, [])\n}\n\nmisago.addInitializer({\n name: \"reducer:selection\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer, { initialState } from \"misago/reducers/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n store.addReducer(\"snackbar\", reducer, initialState)\n}\n\nmisago.addInitializer({\n name: \"reducer:snackbar\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer, { hydrate } from \"misago/reducers/thread\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n let initialState = null\n if (misago.has(\"THREAD\")) {\n initialState = hydrate(misago.get(\"THREAD\"))\n } else {\n initialState = {\n isBusy: false,\n }\n }\n\n store.addReducer(\"thread\", reducer, initialState)\n}\n\nmisago.addInitializer({\n name: \"reducer:thread\",\n initializer: initializer,\n before: \"store\",\n})\n","import moment from \"moment\"\nimport concatUnique from \"misago/utils/concat-unique\"\n\nexport const APPEND_THREADS = \"APPEND_THREADS\"\nexport const DELETE_THREAD = \"DELETE_THREAD\"\nexport const FILTER_THREADS = \"FILTER_THREADS\"\nexport const HYDRATE_THREADS = \"HYDRATE_THREADS\"\nexport const PATCH_THREAD = \"PATCH_THREAD\"\nexport const SORT_THREADS = \"SORT_THREADS\"\n\nexport const MODERATION_PERMISSIONS = [\n \"can_announce\",\n \"can_approve\",\n \"can_close\",\n \"can_hide\",\n \"can_move\",\n \"can_merge\",\n \"can_pin\",\n \"can_review\",\n]\n\nexport function append(items, sorting) {\n return {\n type: APPEND_THREADS,\n items,\n sorting,\n }\n}\n\nexport function deleteThread(thread) {\n return {\n type: DELETE_THREAD,\n thread,\n }\n}\n\nexport function filterThreads(category, categoriesMap) {\n return {\n type: FILTER_THREADS,\n category,\n categoriesMap,\n }\n}\n\nexport function hydrate(items) {\n return {\n type: HYDRATE_THREADS,\n items,\n }\n}\n\nexport function patch(thread, patch, sorting = null) {\n return {\n type: PATCH_THREAD,\n thread,\n patch,\n sorting,\n }\n}\n\nexport function sort(sorting) {\n return {\n type: SORT_THREADS,\n sorting,\n }\n}\n\nexport function getThreadModerationOptions(thread_acl) {\n let options = []\n MODERATION_PERMISSIONS.forEach(function (perm) {\n if (thread_acl[perm]) {\n options.push(perm)\n }\n })\n return options\n}\n\nexport function hydrateThread(thread) {\n return Object.assign({}, thread, {\n moderation: getThreadModerationOptions(thread.acl),\n })\n}\n\nexport default function thread(state = [], action = null) {\n switch (action.type) {\n case APPEND_THREADS:\n const mergedState = concatUnique(action.items.map(hydrateThread), state)\n return mergedState.sort(action.sorting)\n\n case DELETE_THREAD:\n return state.filter(function (item) {\n return item.id !== action.thread.id\n })\n\n case FILTER_THREADS:\n return state.filter(function (item) {\n const itemCategory = action.categoriesMap[item.category]\n if (\n itemCategory.lft >= action.category.lft &&\n itemCategory.rght <= action.category.rght\n ) {\n // same or sub category\n return true\n } else if (item.weight == 2) {\n // globally pinned\n return true\n } else {\n // thread moved outside displayed scope, hide it\n return false\n }\n })\n\n case HYDRATE_THREADS:\n return action.items.map(hydrateThread)\n\n case PATCH_THREAD:\n const patchedState = state.map(function (item) {\n if (item.id === action.thread.id) {\n return Object.assign({}, item, action.patch)\n } else {\n return item\n }\n })\n\n if (action.sorting) {\n return patchedState.sort(action.sorting)\n }\n return patchedState\n\n case SORT_THREADS:\n return state.sort(action.sorting)\n\n default:\n return state\n }\n}\n","import misago from \"misago/index\"\nimport reducer from \"misago/reducers/threads\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n store.addReducer(\"threads\", reducer, [])\n}\n\nmisago.addInitializer({\n name: \"reducer:threads\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer, { initialState } from \"misago/reducers/tick\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n store.addReducer(\"tick\", reducer, initialState)\n}\n\nmisago.addInitializer({\n name: \"reducer:tick\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer from \"misago/reducers/username-history\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n store.addReducer(\"username-history\", reducer, [])\n}\n\nmisago.addInitializer({\n name: \"reducer:username-history\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport reducer from \"misago/reducers/users\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n store.addReducer(\"users\", reducer, [])\n}\n\nmisago.addInitializer({\n name: \"reducer:users\",\n initializer: initializer,\n before: \"store\",\n})\n","import misago from \"misago/index\"\nimport snackbar from \"misago/services/snackbar\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n snackbar.init(store)\n}\n\nmisago.addInitializer({\n name: \"snackbar\",\n initializer: initializer,\n after: \"store\",\n})\n","import misago from \"misago/index\"\nimport store from \"misago/services/store\"\n\nexport default function initializer() {\n store.init()\n}\n\nmisago.addInitializer({\n name: \"store\",\n initializer: initializer,\n before: \"_end\",\n})\n","import misago from \"misago/index\"\nimport { doTick } from \"misago/reducers/tick\"\nimport store from \"misago/services/store\"\n\nconst TICK_PERIOD = 50 * 1000 //do the tick every 50s\n\nexport default function initializer() {\n window.setInterval(function () {\n store.dispatch(doTick())\n }, TICK_PERIOD)\n}\n\nmisago.addInitializer({\n name: \"tick-start\",\n initializer: initializer,\n after: \"store\",\n})\n","import misago from \"misago/index\"\nimport include from \"misago/services/include\"\nimport zxcvbn from \"misago/services/zxcvbn\"\n\nexport default function initializer() {\n zxcvbn.init(include)\n}\n\nmisago.addInitializer({\n name: \"zxcvbn\",\n initializer: initializer,\n})\n","import { UPDATE_AVATAR, UPDATE_USERNAME } from \"misago/reducers/users\"\n\nexport var initialState = {\n signedIn: false,\n signedOut: false,\n}\n\nexport const UPDATE_AUTHENTICATED_USER = \"UPDATE_AUTHENTICATED_USER\"\nexport const PATCH_USER = \"PATCH_USER\"\nexport const SIGN_IN = \"SIGN_IN\"\nexport const SIGN_OUT = \"SIGN_OUT\"\n\nexport function updateAuthenticatedUser(data) {\n return {\n type: UPDATE_AUTHENTICATED_USER,\n data,\n }\n}\n\nexport function patch(patch) {\n return {\n type: PATCH_USER,\n patch,\n }\n}\n\nexport function signIn(user) {\n return {\n type: SIGN_IN,\n user,\n }\n}\n\nexport function signOut(soft = false) {\n return {\n type: SIGN_OUT,\n soft,\n }\n}\n\nexport default function auth(state = initialState, action = null) {\n switch (action.type) {\n case PATCH_USER:\n let newState = Object.assign({}, state)\n newState.user = Object.assign({}, state.user, action.patch)\n return newState\n\n case UPDATE_AUTHENTICATED_USER:\n let updatedState = Object.assign({}, state)\n updatedState.user = Object.assign({}, state.user, action.data)\n return updatedState\n\n case SIGN_IN:\n return Object.assign({}, state, {\n signedIn: action.user,\n })\n\n case SIGN_OUT:\n return Object.assign({}, state, {\n isAuthenticated: false,\n isAnonymous: true,\n signedOut: !action.soft,\n })\n\n case UPDATE_AVATAR:\n if (state.isAuthenticated && state.user.id === action.userId) {\n let newState = Object.assign({}, state)\n newState.user = Object.assign({}, state.user, {\n avatars: action.avatars,\n })\n return newState\n }\n return state\n\n case UPDATE_USERNAME:\n if (state.isAuthenticated && state.user.id === action.userId) {\n let newState = Object.assign({}, state)\n newState.user = Object.assign({}, state.user, {\n username: action.username,\n slug: action.slug,\n })\n return newState\n }\n return state\n\n default:\n return state\n }\n}\n","export const OPEN_SITE_NAV = \"OPEN_SITE_NAV\"\nexport const OPEN_SEARCH = \"OPEN_SEARCH\"\nexport const OPEN_NOTIFICATIONS = \"OPEN_NOTIFICATIONS\"\nexport const OPEN_PRIVATE_THREADS = \"OPEN_PRIVATE_THREADS\"\nexport const OPEN_USER_NAV = \"OPEN_USER_NAV\"\nexport const CLOSE = \"CLOSE_OVERLAYS\"\n\nexport function openSiteNav() {\n return { type: OPEN_SITE_NAV }\n}\n\nexport function openSearch() {\n return { type: OPEN_SEARCH }\n}\n\nexport function openNotifications() {\n return { type: OPEN_NOTIFICATIONS }\n}\n\nexport function openPrivateThreads() {\n return { type: OPEN_PRIVATE_THREADS }\n}\n\nexport function openUserNav() {\n return { type: OPEN_USER_NAV }\n}\n\nexport function close() {\n return { type: CLOSE }\n}\n\nexport const initialState = {\n siteNav: false,\n search: false,\n notifications: false,\n privateThreads: false,\n userNav: false,\n}\n\nexport default function notifications(state = initialState, action = null) {\n switch (action.type) {\n case OPEN_SITE_NAV:\n return Object.assign({}, state, initialState, { siteNav: true })\n\n case OPEN_SEARCH:\n return Object.assign({}, state, initialState, { search: true })\n\n case OPEN_NOTIFICATIONS:\n return Object.assign({}, state, initialState, { notifications: true })\n\n case OPEN_PRIVATE_THREADS:\n return Object.assign({}, state, initialState, { privateThreads: true })\n\n case OPEN_USER_NAV:\n return Object.assign({}, state, initialState, { userNav: true })\n\n case CLOSE:\n return Object.assign({}, state, initialState)\n\n default:\n return state\n }\n}\n","export const REPLACE_PARTICIPANTS = \"REPLACE_PARTICIPANTS\"\n\nexport function replace(newState) {\n return {\n type: REPLACE_PARTICIPANTS,\n state: newState,\n }\n}\n\nexport default function participants(state = [], action = null) {\n switch (action.type) {\n case REPLACE_PARTICIPANTS:\n return action.state\n\n default:\n return state\n }\n}\n","import moment from \"moment\"\n\nexport const BUSY_POLL = \"BUSY_POLL\"\nexport const RELEASE_POLL = \"RELEASE_POLL\"\nexport const REMOVE_POLL = \"REMOVE_POLL\"\nexport const REPLACE_POLL = \"REPLACE_POLL\"\nexport const UPDATE_POLL = \"UPDATE_POLL\"\n\nexport function hydrate(json) {\n let hasSelectedChoices = false\n for (const i in json.choices) {\n const choice = json.choices[i]\n if (choice.selected) {\n hasSelectedChoices = true\n break\n }\n }\n\n return Object.assign({}, json, {\n posted_on: moment(json.posted_on),\n\n hasSelectedChoices,\n endsOn: json.length\n ? moment(json.posted_on).add(json.length, \"days\")\n : null,\n\n isBusy: false,\n })\n}\n\nexport function busy() {\n return {\n type: BUSY_POLL,\n }\n}\n\nexport function release() {\n return {\n type: RELEASE_POLL,\n }\n}\n\nexport function replace(newState, hydrated = false) {\n return {\n type: REPLACE_POLL,\n state: hydrated ? newState : hydrate(newState),\n }\n}\n\nexport function update(data) {\n return {\n type: UPDATE_POLL,\n data,\n }\n}\n\nexport function remove() {\n return {\n type: REMOVE_POLL,\n }\n}\n\nexport default function poll(state = {}, action = null) {\n switch (action.type) {\n case BUSY_POLL:\n return Object.assign({}, state, { isBusy: true })\n\n case RELEASE_POLL:\n return Object.assign({}, state, { isBusy: false })\n\n case REMOVE_POLL:\n return {\n isBusy: false,\n }\n\n case REPLACE_POLL:\n return action.state\n\n case UPDATE_POLL:\n return Object.assign({}, state, action.data)\n\n default:\n return state\n }\n}\n","import moment from \"moment\"\nimport { hydrateUser } from \"./users\"\n\nexport const PATCH_POST = \"PATCH_POST\"\n\nexport function hydrate(json) {\n return Object.assign({}, json, {\n posted_on: moment(json.posted_on),\n updated_on: moment(json.updated_on),\n hidden_on: moment(json.hidden_on),\n\n attachments: json.attachments\n ? json.attachments.map(hydrateAttachment)\n : null,\n poster: json.poster ? hydrateUser(json.poster) : null,\n\n isSelected: false,\n isBusy: false,\n isDeleted: false,\n })\n}\n\nexport function hydrateAttachment(json) {\n return Object.assign({}, json, {\n uploaded_on: moment(json.uploaded_on),\n })\n}\n\nexport function patch(post, patch) {\n return {\n type: PATCH_POST,\n post,\n patch,\n }\n}\n\nexport default function post(state = {}, action = null) {\n switch (action.type) {\n case PATCH_POST:\n if (state.id == action.post.id) {\n return Object.assign({}, state, action.patch)\n }\n return state\n\n default:\n return state\n }\n}\n","import postReducer, {\n PATCH_POST,\n hydrate as hydratePost,\n} from \"misago/reducers/post\"\n\nexport const APPEND_POSTS = \"APPEND_POSTS\"\nexport const SELECT_POST = \"SELECT_POST\"\nexport const DESELECT_POST = \"DESELECT_POST\"\nexport const DESELECT_POSTS = \"DESELECT_POSTS\"\nexport const LOAD_POSTS = \"LOAD_POSTS\"\nexport const UNLOAD_POSTS = \"UNLOAD_POSTS\"\nexport const UPDATE_POSTS = \"UPDATE_POSTS\"\n\nexport function select(post) {\n return {\n type: SELECT_POST,\n post,\n }\n}\n\nexport function deselect(post) {\n return {\n type: DESELECT_POST,\n post,\n }\n}\n\nexport function deselectAll() {\n return {\n type: DESELECT_POSTS,\n }\n}\n\nexport function hydrate(json) {\n return Object.assign({}, json, {\n results: json.results.map(hydratePost),\n isLoaded: true,\n isBusy: false,\n isSelected: false,\n })\n}\n\nexport function load(newState, hydrated = false) {\n return {\n type: LOAD_POSTS,\n state: hydrated ? newState : hydrate(newState),\n }\n}\n\nexport function append(newState, hydrated = false) {\n return {\n type: APPEND_POSTS,\n state: hydrated ? newState : hydrate(newState),\n }\n}\n\nexport function unload() {\n return {\n type: UNLOAD_POSTS,\n }\n}\n\nexport function update(newState) {\n return {\n type: UPDATE_POSTS,\n update: newState,\n }\n}\n\nexport default function posts(state = {}, action = null) {\n switch (action.type) {\n case SELECT_POST:\n const selectedPosts = state.results.map((post) => {\n if (post.id == action.post.id) {\n return Object.assign({}, post, {\n isSelected: true,\n })\n } else {\n return post\n }\n })\n\n return Object.assign({}, state, {\n results: selectedPosts,\n })\n\n case DESELECT_POST:\n const deseletedPosts = state.results.map((post) => {\n if (post.id == action.post.id) {\n return Object.assign({}, post, {\n isSelected: false,\n })\n } else {\n return post\n }\n })\n\n return Object.assign({}, state, {\n results: deseletedPosts,\n })\n\n case DESELECT_POSTS:\n const deseletedAllPosts = state.results.map((post) => {\n return Object.assign({}, post, {\n isSelected: false,\n })\n })\n\n return Object.assign({}, state, {\n results: deseletedAllPosts,\n })\n\n case APPEND_POSTS:\n let results = state.results.slice()\n const resultsIds = state.results.map((post) => {\n return post.id\n })\n\n action.state.results.map((post) => {\n if (resultsIds.indexOf(post.id) === -1) {\n results.push(post)\n }\n })\n\n return Object.assign({}, action.state, {\n results,\n })\n\n case LOAD_POSTS:\n return action.state\n\n case UNLOAD_POSTS:\n return Object.assign({}, state, {\n isLoaded: false,\n })\n\n case UPDATE_POSTS:\n return Object.assign({}, state, action.update)\n\n case PATCH_POST:\n const reducedPosts = state.results.map((post) => {\n return postReducer(post, action)\n })\n\n return Object.assign({}, state, {\n results: reducedPosts,\n })\n\n default:\n return state\n }\n}\n","export const LOAD_DETAILS = \"LOAD_DETAILS\"\n\nexport function load(newState) {\n return {\n type: LOAD_DETAILS,\n\n newState,\n }\n}\n\nexport default function details(state = {}, action = null) {\n switch (action.type) {\n case LOAD_DETAILS:\n return action.newState\n\n default:\n return state\n }\n}\n","import moment from \"moment\"\nimport {\n UPDATE_AVATAR,\n UPDATE_USERNAME,\n hydrateStatus,\n} from \"misago/reducers/users\"\n\nexport const HYDRATE_PROFILE = \"HYDRATE_PROFILE\"\nexport const PATCH_PROFILE = \"PATCH_PROFILE\"\n\nexport function hydrate(profile) {\n return {\n type: HYDRATE_PROFILE,\n profile,\n }\n}\n\nexport function patch(patch) {\n return {\n type: PATCH_PROFILE,\n patch,\n }\n}\n\nexport default function auth(state = {}, action = null) {\n switch (action.type) {\n case HYDRATE_PROFILE:\n return Object.assign({}, action.profile, {\n joined_on: moment(action.profile.joined_on),\n status: hydrateStatus(action.profile.status),\n })\n\n case PATCH_PROFILE:\n return Object.assign({}, state, action.patch)\n\n case UPDATE_AVATAR:\n if (state.id === action.userId) {\n return Object.assign({}, state, {\n avatars: action.avatars,\n })\n }\n return state\n\n case UPDATE_USERNAME:\n if (state.id === action.userId) {\n return Object.assign({}, state, {\n username: action.username,\n slug: action.slug,\n })\n }\n return state\n\n default:\n return state\n }\n}\n","export const REPLACE_SEARCH = \"REPLACE_SEARCH\"\nexport const UPDATE_SEARCH = \"UPDATE_SEARCH\"\nexport const UPDATE_SEARCH_PROVIDER = \"UPDATE_SEARCH_PROVIDER\"\n\nexport const initialState = {\n isLoading: false,\n query: \"\",\n providers: [],\n}\n\nexport function replace(newState) {\n return {\n type: REPLACE_SEARCH,\n state: {\n isLoading: false,\n providers: newState,\n },\n }\n}\n\nexport function update(newState) {\n return {\n type: UPDATE_SEARCH,\n update: newState,\n }\n}\n\nexport function updateProvider(provider) {\n return {\n type: UPDATE_SEARCH_PROVIDER,\n provider: provider,\n }\n}\n\nexport default function participants(state = {}, action = null) {\n switch (action.type) {\n case REPLACE_SEARCH:\n return action.state\n\n case UPDATE_SEARCH:\n return Object.assign({}, state, action.update)\n\n case UPDATE_SEARCH_PROVIDER:\n return Object.assign({}, state, {\n providers: state.providers.map((provider) => {\n if (provider.id === action.provider.id) {\n return action.provider\n } else {\n return provider\n }\n }),\n })\n\n default:\n return state\n }\n}\n","export var initialState = {\n type: \"info\",\n message: \"\",\n isVisible: false,\n}\n\nexport const SHOW_SNACKBAR = \"SHOW_SNACKBAR\"\nexport const HIDE_SNACKBAR = \"HIDE_SNACKBAR\"\n\nexport function showSnackbar(message, type) {\n return {\n type: SHOW_SNACKBAR,\n message,\n messageType: type,\n }\n}\n\nexport function hideSnackbar() {\n return {\n type: HIDE_SNACKBAR,\n }\n}\n\nexport default function snackbar(state = initialState, action = null) {\n if (action.type === SHOW_SNACKBAR) {\n return {\n type: action.messageType,\n message: action.message,\n isVisible: true,\n }\n } else if (action.type === HIDE_SNACKBAR) {\n return Object.assign({}, state, {\n isVisible: false,\n })\n } else {\n return state\n }\n}\n","import moment from \"moment\"\nimport { REMOVE_POLL, REPLACE_POLL } from \"./poll\"\n\nexport const BUSY_THREAD = \"BUSY_THREAD\"\nexport const RELEASE_THREAD = \"RELEASE_THREAD\"\nexport const REPLACE_THREAD = \"REPLACE_THREAD\"\nexport const UPDATE_THREAD = \"UPDATE_THREAD\"\nexport const UPDATE_THREAD_ACL = \"UPDATE_THREAD_ACL\"\n\nexport function hydrate(json) {\n return Object.assign({}, json, {\n started_on: moment(json.started_on),\n last_post_on: moment(json.last_post_on),\n best_answer_marked_on: json.best_answer_marked_on\n ? moment(json.best_answer_marked_on)\n : null,\n\n isBusy: false,\n })\n}\n\nexport function busy() {\n return {\n type: BUSY_THREAD,\n }\n}\n\nexport function release() {\n return {\n type: RELEASE_THREAD,\n }\n}\n\nexport function replace(newState, hydrated = false) {\n return {\n type: REPLACE_THREAD,\n state: hydrated ? newState : hydrate(newState),\n }\n}\n\nexport function update(data) {\n return {\n type: UPDATE_THREAD,\n data,\n }\n}\n\nexport function updateAcl(data) {\n return {\n type: UPDATE_THREAD_ACL,\n data,\n }\n}\n\nexport default function thread(state = {}, action = null) {\n switch (action.type) {\n case BUSY_THREAD:\n return Object.assign({}, state, { isBusy: true })\n\n case RELEASE_THREAD:\n return Object.assign({}, state, { isBusy: false })\n\n case REMOVE_POLL:\n return Object.assign({}, state, { poll: null })\n\n case REPLACE_POLL:\n return Object.assign({}, state, { poll: action.state })\n\n case REPLACE_THREAD:\n return action.state\n\n case UPDATE_THREAD:\n return Object.assign({}, state, action.data)\n\n case UPDATE_THREAD_ACL:\n const acl = Object.assign({}, state.acl, action.data)\n return Object.assign({}, state, { acl })\n\n default:\n return state\n }\n}\n","export var initialState = {\n tick: 0,\n}\n\nexport const TICK = \"TICK\"\n\nexport function doTick() {\n return {\n type: TICK,\n }\n}\n\nexport default function tick(state = initialState, action = null) {\n if (action.type === TICK) {\n return Object.assign({}, state, {\n tick: state.tick + 1,\n })\n } else {\n return state\n }\n}\n","import moment from \"moment\"\nimport { UPDATE_AVATAR, UPDATE_USERNAME } from \"misago/reducers/users\"\nimport concatUnique from \"misago/utils/concat-unique\"\n\nexport const ADD_NAME_CHANGE = \"ADD_NAME_CHANGE\"\nexport const APPEND_HISTORY = \"APPEND_HISTORY\"\nexport const HYDRATE_HISTORY = \"HYDRATE_HISTORY\"\n\nexport function addNameChange(change, user, changedBy) {\n return {\n type: ADD_NAME_CHANGE,\n change,\n user,\n changedBy,\n }\n}\n\nexport function append(items) {\n return {\n type: APPEND_HISTORY,\n items: items,\n }\n}\n\nexport function hydrate(items) {\n return {\n type: HYDRATE_HISTORY,\n items: items,\n }\n}\n\nexport function hydrateNamechange(namechange) {\n return Object.assign({}, namechange, {\n changed_on: moment(namechange.changed_on),\n })\n}\n\nexport default function username(state = [], action = null) {\n switch (action.type) {\n case ADD_NAME_CHANGE:\n let newState = state.slice()\n newState.unshift({\n id: Math.floor(Date.now() / 1000), // just small hax for getting id\n changed_by: action.changedBy,\n changed_by_username: action.changedBy.username,\n changed_on: moment(),\n new_username: action.change.username,\n old_username: action.user.username,\n })\n return newState\n\n case APPEND_HISTORY:\n return concatUnique(state, action.items.map(hydrateNamechange))\n\n case HYDRATE_HISTORY:\n return action.items.map(hydrateNamechange)\n\n case UPDATE_AVATAR:\n return state.map(function (item) {\n item = Object.assign({}, item)\n if (item.changed_by && item.changed_by.id === action.userId) {\n item.changed_by = Object.assign({}, item.changed_by, {\n avatars: action.avatars,\n })\n }\n\n return item\n })\n\n case UPDATE_USERNAME:\n return state.map(function (item) {\n item = Object.assign({}, item)\n if (item.changed_by && item.changed_by.id === action.userId) {\n item.changed_by = Object.assign({}, item.changed_by, {\n username: action.username,\n slug: action.slug,\n })\n }\n\n return Object.assign({}, item)\n })\n\n default:\n return state\n }\n}\n","import moment from \"moment\"\nimport concatUnique from \"misago/utils/concat-unique\"\n\nexport const APPEND_USERS = \"APPEND_USERS\"\nexport const HYDRATE_USERS = \"HYDRATE_USERS\"\nexport const UPDATE_AVATAR = \"UPDATE_AVATAR\"\nexport const UPDATE_USERNAME = \"UPDATE_USERNAME\"\n\nexport function append(items) {\n return {\n type: APPEND_USERS,\n items,\n }\n}\n\nexport function hydrate(items) {\n return {\n type: HYDRATE_USERS,\n items,\n }\n}\n\nexport function hydrateStatus(status) {\n if (status) {\n return Object.assign({}, status, {\n last_click: status.last_click ? moment(status.last_click) : null,\n banned_until: status.banned_until ? moment(status.banned_until) : null,\n })\n } else {\n return null\n }\n}\n\nexport function hydrateUser(user) {\n return Object.assign({}, user, {\n joined_on: moment(user.joined_on),\n status: hydrateStatus(user.status),\n })\n}\n\nexport function updateAvatar(user, avatars) {\n return {\n type: UPDATE_AVATAR,\n userId: user.id,\n avatars,\n }\n}\n\nexport function updateUsername(user, username, slug) {\n return {\n type: UPDATE_USERNAME,\n userId: user.id,\n username,\n slug,\n }\n}\n\nexport default function user(state = [], action = null) {\n switch (action.type) {\n case APPEND_USERS:\n return concatUnique(state, action.items.map(hydrateUser))\n\n case HYDRATE_USERS:\n return action.items.map(hydrateUser)\n\n case UPDATE_AVATAR:\n return state.map(function (item) {\n item = Object.assign({}, item)\n if (item.id === action.userId) {\n item.avatars = action.avatars\n }\n\n return item\n })\n\n default:\n return state\n }\n}\n","export class Ajax {\n constructor() {\n this._cookieName = null\n this._csrfToken = null\n this._locks = {}\n }\n\n init(cookieName) {\n this._cookieName = cookieName\n }\n\n getCsrfToken() {\n if (document.cookie.indexOf(this._cookieName) !== -1) {\n let cookieRegex = new RegExp(this._cookieName + \"=([^;]*)\")\n let cookie = document.cookie.match(cookieRegex)[0]\n return cookie ? cookie.split(\"=\")[1] : null\n } else {\n return null\n }\n }\n\n request(method, url, data) {\n let self = this\n return new Promise(function (resolve, reject) {\n let xhr = {\n url: url,\n method: method,\n headers: {\n \"X-CSRFToken\": self.getCsrfToken(),\n },\n\n data: data ? JSON.stringify(data) : null,\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n\n success: function (data) {\n resolve(data)\n },\n\n error: function (jqXHR) {\n let rejection = jqXHR.responseJSON || {}\n\n rejection.status = jqXHR.status\n\n if (rejection.status === 0) {\n rejection.detail = pgettext(\n \"ajax client error\",\n \"Could not connect to the site.\"\n )\n }\n\n if (rejection.status === 404) {\n if (!rejection.detail || rejection.detail === \"NOT FOUND\") {\n rejection.detail = pgettext(\n \"ajax client error\",\n \"Action link is invalid.\"\n )\n }\n }\n\n if (rejection.status === 500 && !rejection.detail) {\n rejection.detail = pgettext(\n \"ajax client error\",\n \"Unknown error has occurred.\"\n )\n }\n\n rejection.statusText = jqXHR.statusText\n\n reject(rejection)\n },\n }\n\n $.ajax(xhr)\n })\n }\n\n get(url, params, lock) {\n if (params) {\n url += \"?\" + $.param(params)\n }\n\n if (lock) {\n let self = this\n\n // update url in existing lock?\n if (this._locks[lock]) {\n this._locks[lock].url = url\n }\n\n // immediately dereference promise handlers without doing anything\n // we are already waiting for existing response to resolve\n if (this._locks[lock] && this._locks[lock].waiter) {\n return {\n then: function () {\n return\n },\n }\n\n // return promise that will begin when original one resolves\n } else if (this._locks[lock] && this._locks[lock].wait) {\n this._locks[lock].waiter = true\n\n return new Promise(function (resolve, reject) {\n let wait = function (url) {\n // keep waiting on promise\n if (self._locks[lock].wait) {\n window.setTimeout(function () {\n wait(url)\n }, 300)\n\n // poll for new url\n } else if (self._locks[lock].url !== url) {\n wait(self._locks[lock].url)\n\n // ajax backend for response\n } else {\n self._locks[lock].waiter = false\n self.request(\"GET\", self._locks[lock].url).then(\n function (data) {\n if (self._locks[lock].url === url) {\n resolve(data)\n } else {\n self._locks[lock].waiter = true\n wait(self._locks[lock].url)\n }\n },\n function (rejection) {\n if (self._locks[lock].url === url) {\n reject(rejection)\n } else {\n self._locks[lock].waiter = true\n wait(self._locks[lock].url)\n }\n }\n )\n }\n }\n\n window.setTimeout(function () {\n wait(url)\n }, 300)\n })\n\n // setup new lock without waiter\n } else {\n this._locks[lock] = {\n url,\n wait: true,\n waiter: false,\n }\n\n return new Promise(function (resolve, reject) {\n self.request(\"GET\", url).then(\n function (data) {\n self._locks[lock].wait = false\n if (self._locks[lock].url === url) {\n resolve(data)\n }\n },\n function (rejection) {\n self._locks[lock].wait = false\n if (self._locks[lock].url === url) {\n reject(rejection)\n }\n }\n )\n })\n }\n } else {\n return this.request(\"GET\", url)\n }\n }\n\n post(url, data) {\n return this.request(\"POST\", url, data)\n }\n\n patch(url, data) {\n return this.request(\"PATCH\", url, data)\n }\n\n put(url, data) {\n return this.request(\"PUT\", url, data)\n }\n\n delete(url, data) {\n return this.request(\"DELETE\", url, data)\n }\n\n upload(url, data, progress) {\n let self = this\n return new Promise(function (resolve, reject) {\n let xhr = {\n url: url,\n method: \"POST\",\n headers: {\n \"X-CSRFToken\": self.getCsrfToken(),\n },\n\n data: data,\n contentType: false,\n processData: false,\n\n xhr: function () {\n let xhr = new window.XMLHttpRequest()\n xhr.upload.addEventListener(\n \"progress\",\n function (evt) {\n if (evt.lengthComputable) {\n progress(Math.round((evt.loaded / evt.total) * 100))\n }\n },\n false\n )\n return xhr\n },\n\n success: function (response) {\n resolve(response)\n },\n\n error: function (jqXHR) {\n let rejection = jqXHR.responseJSON || {}\n\n rejection.status = jqXHR.status\n\n if (rejection.status === 0) {\n rejection.detail = pgettext(\n \"api error\",\n \"Could not connect to the site.\"\n )\n }\n\n if (rejection.status === 413 && !rejection.detail) {\n rejection.detail = pgettext(\n \"api error\",\n \"Upload was rejected by the site as too large.\"\n )\n }\n\n if (rejection.status === 404) {\n if (!rejection.detail || rejection.detail === \"NOT FOUND\") {\n rejection.detail = pgettext(\n \"api error\",\n \"Action link is invalid.\"\n )\n }\n }\n\n if (rejection.status === 500 && !rejection.detail) {\n rejection.detail = pgettext(\n \"api error\",\n \"Unknown error has occurred.\"\n )\n }\n\n rejection.statusText = jqXHR.statusText\n\n reject(rejection)\n },\n }\n\n $.ajax(xhr)\n })\n }\n}\n\nexport default new Ajax()\n","import { signIn, signOut } from \"misago/reducers/auth\"\n\nexport class Auth {\n init(store, local, modal) {\n this._store = store\n this._local = local\n this._modal = modal\n\n // tell other tabs what auth state is because we are most current with it\n this.syncSession()\n\n // listen for other tabs to tell us that state changed\n this.watchState()\n }\n\n syncSession() {\n const state = this._store.getState().auth\n if (state.isAuthenticated) {\n this._local.set(\"auth\", {\n isAuthenticated: true,\n username: state.user.username,\n })\n } else {\n this._local.set(\"auth\", {\n isAuthenticated: false,\n })\n }\n }\n\n watchState() {\n const state = this._store.getState().auth\n this._local.watch(\"auth\", (newState) => {\n if (newState.isAuthenticated) {\n this._store.dispatch(\n signIn({\n username: newState.username,\n })\n )\n } else if (state.isAuthenticated) {\n // check if we are authenticated in this tab\n // because some browser plugins prune local store\n // aggressively, forcing erroneous message to display here\n // tracking bug #955\n this._store.dispatch(signOut())\n }\n })\n this._modal.hide()\n }\n\n signIn(user) {\n this._store.dispatch(signIn(user))\n this._local.set(\"auth\", {\n isAuthenticated: true,\n username: user.username,\n })\n this._modal.hide()\n }\n\n signOut() {\n this._store.dispatch(signOut())\n this._local.set(\"auth\", {\n isAuthenticated: false,\n })\n this._modal.hide()\n }\n\n softSignOut() {\n this._store.dispatch(signOut(true))\n this._local.set(\"auth\", {\n isAuthenticated: false,\n })\n this._modal.hide()\n }\n}\n\nexport default new Auth()\n","/* global grecaptcha */\nimport React from \"react\"\nimport FormGroup from \"misago/components/form-group\"\n\nexport class BaseCaptcha {\n init(context, ajax, include, snackbar) {\n this._context = context\n this._ajax = ajax\n this._include = include\n this._snackbar = snackbar\n }\n}\n\nexport class NoCaptcha extends BaseCaptcha {\n load() {\n return new Promise(function (resolve) {\n // immediately resolve as we don't have anything to validate\n resolve()\n })\n }\n\n validator() {\n return null\n }\n\n component() {\n return null\n }\n}\n\nexport class QACaptcha extends BaseCaptcha {\n load() {\n var self = this\n return new Promise((resolve, reject) => {\n self._ajax.get(self._context.get(\"CAPTCHA_API\")).then(\n function (data) {\n self.question = data.question\n self.helpText = data.help_text\n resolve()\n },\n function () {\n self._snackbar.error(\n pgettext(\"captcha field\", \"Failed to load CAPTCHA.\")\n )\n reject()\n }\n )\n })\n }\n\n validator() {\n return []\n }\n\n component(kwargs) {\n return (\n \n \n \n )\n }\n}\n\nexport class ReCaptchaComponent extends React.Component {\n componentDidMount() {\n grecaptcha.render(\"recaptcha\", {\n sitekey: this.props.siteKey,\n callback: (response) => {\n // fire fakey event to binding\n this.props.binding({\n target: {\n value: response,\n },\n })\n },\n })\n }\n\n render() {\n return
    \n }\n}\n\nexport class ReCaptcha extends BaseCaptcha {\n load() {\n this._include.include(\"https://www.google.com/recaptcha/api.js\", true)\n\n return new Promise(function (resolve) {\n var wait = function () {\n if (typeof grecaptcha === \"undefined\") {\n window.setTimeout(function () {\n wait()\n }, 200)\n } else {\n resolve()\n }\n }\n wait()\n })\n }\n\n validator() {\n return []\n }\n\n component(kwargs) {\n return (\n \n \n \n )\n }\n}\n\nexport class Captcha {\n init(context, ajax, include, snackbar) {\n switch (context.get(\"SETTINGS\").captcha_type) {\n case \"no\":\n this._captcha = new NoCaptcha()\n break\n\n case \"qa\":\n this._captcha = new QACaptcha()\n break\n\n case \"re\":\n this._captcha = new ReCaptcha()\n break\n }\n\n this._captcha.init(context, ajax, include, snackbar)\n }\n\n // accessors for underlying strategy\n\n load() {\n return this._captcha.load()\n }\n\n validator() {\n return this._captcha.validator()\n }\n\n component(kwargs) {\n return this._captcha.component(kwargs)\n }\n}\n\nexport default new Captcha()\n","export class Include {\n init(staticUrl) {\n this._staticUrl = staticUrl\n this._included = []\n }\n\n include(script, remote = false) {\n if (this._included.indexOf(script) === -1) {\n this._included.push(script)\n this._include(script, remote)\n }\n }\n\n _include(script, remote) {\n $.ajax({\n url: (!remote ? this._staticUrl : \"\") + script,\n cache: true,\n dataType: \"script\",\n })\n }\n}\n\nexport default new Include()\n","let storage = window.localStorage\n\nexport class LocalStorage {\n init(prefix) {\n this._prefix = prefix\n this._watchers = []\n\n window.addEventListener(\"storage\", (e) => {\n let newValueJson = JSON.parse(e.newValue)\n this._watchers.forEach(function (watcher) {\n if (watcher.key === e.key && e.oldValue !== e.newValue) {\n watcher.callback(newValueJson)\n }\n })\n })\n }\n\n set(key, value) {\n storage.setItem(this._prefix + key, JSON.stringify(value))\n }\n\n get(key) {\n let itemString = storage.getItem(this._prefix + key)\n if (itemString) {\n return JSON.parse(itemString)\n } else {\n return null\n }\n }\n\n watch(key, callback) {\n this._watchers.push({\n key: this._prefix + key,\n callback: callback,\n })\n }\n}\n\nexport default new LocalStorage()\n","import ReactDOM from \"react-dom\"\nimport mount from \"misago/utils/mount-component\"\n\nexport class Modal {\n init(element) {\n this._element = element\n\n this._modal = $(element).modal({ show: false })\n\n this._modal.on(\"hidden.bs.modal\", () => {\n ReactDOM.unmountComponentAtNode(this._element)\n })\n }\n\n show(component) {\n mount(component, this._element.id)\n this._modal.modal(\"show\")\n }\n\n hide() {\n this._modal.modal(\"hide\")\n }\n}\n\nexport default new Modal()\n","export class PageTitle {\n init(indexTitle, forumName) {\n this._indexTitle = indexTitle\n this._forumName = forumName\n }\n\n set(title) {\n if (!title) {\n document.title = this._indexTitle || this._forumName\n return\n }\n\n if (typeof title === \"string\") {\n title = { title: title }\n }\n\n let finalTitle = title.title\n\n if (title.page > 1) {\n const pageLabel = interpolate(\n pgettext(\"page title pagination\", \"page: %(page)s\"),\n {\n page: title.page,\n },\n true\n )\n\n finalTitle += \" (\" + pageLabel + \")\"\n }\n\n if (title.parent) {\n finalTitle += \" | \" + title.parent\n }\n\n document.title = finalTitle + \" | \" + this._forumName\n }\n}\n\nexport default new PageTitle()\n","export class Polls {\n init(ajax, snackbar) {\n this._ajax = ajax\n this._snackbar = snackbar\n\n this._polls = {}\n }\n\n start(kwargs) {\n this.stop(kwargs.poll)\n\n const poolServer = () => {\n this._polls[kwargs.poll] = kwargs\n\n this._ajax.get(kwargs.url, kwargs.data || null).then(\n (data) => {\n if (!this._polls[kwargs.poll]._stopped) {\n kwargs.update(data)\n\n this._polls[kwargs.poll].timeout = window.setTimeout(\n poolServer,\n kwargs.frequency\n )\n }\n },\n (rejection) => {\n if (!this._polls[kwargs.poll]._stopped) {\n if (kwargs.error) {\n kwargs.error(rejection)\n } else {\n this._snackbar.apiError(rejection)\n }\n }\n }\n )\n }\n\n if (kwargs.delayed) {\n this._polls[kwargs.poll] = {\n timeout: window.setTimeout(poolServer, kwargs.frequency),\n }\n } else {\n poolServer()\n }\n }\n\n stop(pollId) {\n if (this._polls[pollId]) {\n window.clearTimeout(this._polls[pollId].timeout)\n this._polls[pollId]._stopped = true\n }\n }\n}\n\nexport default new Polls()\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport PostingComponent from \"misago/components/posting\"\nimport mount from \"misago/utils/mount-component\"\n\nexport class Posting {\n init(ajax, snackbar, mount) {\n this._ajax = ajax\n this._snackbar = snackbar\n this._mount = mount\n\n this._mode = null\n this._spacer = document.getElementById(\"posting-spacer\")\n this._observer = new ResizeObserver((entries) => {\n this._spacer.style.height = entries[0].contentRect.height + \"px\"\n })\n\n this._isOpen = false\n this._isClosing = false\n\n this._beforeunloadSet = false\n this._props = null\n }\n\n isOpen() {\n return this._isOpen\n }\n\n setBeforeUnload() {\n if (!this._beforeunloadSet) {\n window.addEventListener(\"beforeunload\", this.beforeUnload, {\n capture: true,\n })\n this._beforeunloadSet = true\n }\n }\n\n unsetBeforeUnload() {\n window.removeEventListener(\"beforeunload\", this.beforeUnload, {\n capture: true,\n })\n this._beforeunloadSet = false\n }\n\n beforeUnload(event) {\n event.returnValue = \"true\"\n return \"true\"\n }\n\n open(props) {\n if (this._isOpen === false) {\n if (props.mode === \"QUOTE\") {\n this._mode = \"REPLY\"\n } else {\n this._mode = props.mode\n }\n\n this._isOpen = props.submit\n this._realOpen(Object.assign({}, props, { mode: this._mode }))\n } else if (props.mode === \"QUOTE\") {\n this._realOpen(\n Object.assign({}, this._props, {\n config: props.config,\n context: props.context,\n })\n )\n } else if (this._isOpen !== props.submit) {\n let message = gettext(\n \"You are already working on other message. Do you want to discard it?\"\n )\n\n const changeForm = window.confirm(message)\n if (changeForm) {\n this._mode = props.mode\n this._isOpen = props.submit\n this._realOpen(props)\n }\n } else if (this._mode == \"REPLY\" && props.mode == \"REPLY\") {\n this._realOpen(props)\n }\n }\n\n _realOpen(props) {\n mount(, this._mount.id)\n\n this._props = props\n this._mount.classList.add(\"show\")\n this._observer.observe(this._mount)\n this.setBeforeUnload()\n }\n\n close = () => {\n this.unsetBeforeUnload()\n this._props = null\n\n if (this._isOpen && !this._isClosing) {\n this._isClosing = true\n this._mount.classList.remove(\"show\")\n\n window.setTimeout(() => {\n ReactDOM.unmountComponentAtNode(this._mount)\n this._observer.unobserve(this._mount)\n this._spacer.style.height = \"0px;\"\n this._isClosing = false\n this._isOpen = false\n this._mode = null\n }, 300)\n }\n }\n}\n\nexport default new Posting()\n","import { showSnackbar, hideSnackbar } from \"misago/reducers/snackbar\"\n\nconst HIDE_ANIMATION_LENGTH = 300\nconst MESSAGE_SHOW_LENGTH = 5000\n\nexport class Snackbar {\n init(store) {\n this._store = store\n this._timeout = null\n }\n\n alert = (message, type) => {\n if (this._timeout) {\n window.clearTimeout(this._timeout)\n this._store.dispatch(hideSnackbar())\n\n this._timeout = window.setTimeout(() => {\n this._timeout = null\n this.alert(message, type)\n }, HIDE_ANIMATION_LENGTH)\n } else {\n this._store.dispatch(showSnackbar(message, type))\n this._timeout = window.setTimeout(() => {\n this._store.dispatch(hideSnackbar())\n this._timeout = null\n }, MESSAGE_SHOW_LENGTH)\n }\n }\n\n // shorthands for message types\n\n info = (message) => {\n this.alert(message, \"info\")\n }\n\n success = (message) => {\n this.alert(message, \"success\")\n }\n\n warning = (message) => {\n this.alert(message, \"warning\")\n }\n\n error = (message) => {\n this.alert(message, \"error\")\n }\n\n // shorthand for api errors\n\n apiError = (rejection) => {\n let message = rejection.data ? rejection.data.detail : rejection.detail\n\n if (!message) {\n if (rejection.status === 0) {\n message = pgettext(\"api error\", \"Could not connect to the site.\")\n } else if (rejection.status === 404) {\n message = pgettext(\"api error\", \"Action link is invalid.\")\n } else {\n message = pgettext(\"api error\", \"Unknown error has occurred.\")\n }\n }\n\n if (rejection.status === 403 && message === \"Permission denied\") {\n message = pgettext(\n \"api error\",\n \"You don't have permission to perform this action.\"\n )\n }\n\n this.error(message)\n }\n}\n\nexport default new Snackbar()\n","import { combineReducers, createStore } from \"redux\"\n\nexport class StoreWrapper {\n constructor() {\n this._store = null\n this._reducers = {}\n this._initialState = {}\n }\n\n addReducer(name, reducer, initialState) {\n this._reducers[name] = reducer\n this._initialState[name] = initialState\n }\n\n init() {\n this._store = createStore(\n combineReducers(this._reducers),\n this._initialState\n )\n }\n\n getStore() {\n return this._store\n }\n\n // Store API\n\n getState() {\n return this._store.getState()\n }\n\n dispatch(action) {\n return this._store.dispatch(action)\n }\n}\n\nexport default new StoreWrapper()\n","/* global zxcvbn */\nexport class Zxcvbn {\n init(include) {\n this._include = include\n this._isLoaded = false\n }\n\n scorePassword(password, inputs) {\n // 0-4 score, the more the stronger password\n if (this._isLoaded) {\n return zxcvbn(password, inputs).score\n }\n\n return 0\n }\n\n load() {\n if (!this._isLoaded) {\n this._include.include(\"misago/js/zxcvbn.js\")\n return this._loadingPromise()\n } else {\n return this._loadedPromise()\n }\n }\n\n _loadingPromise() {\n const self = this\n\n return new Promise(function (resolve, reject) {\n var wait = function (tries = 0) {\n tries += 1\n if (tries > 200) {\n reject()\n } else if (typeof zxcvbn === \"undefined\") {\n window.setTimeout(function () {\n wait(tries)\n }, 200)\n } else {\n self._isLoaded = true\n resolve()\n }\n }\n wait()\n })\n }\n\n _loadedPromise() {\n // we have already loaded zxcvbn.js, resolve away!\n return new Promise(function (resolve) {\n resolve()\n })\n }\n}\n\nexport default new Zxcvbn()\n","import moment from \"moment\"\nimport React from \"react\"\n\nexport default class extends React.Component {\n getReasonMessage() {\n if (this.props.message.html) {\n return (\n \n )\n } else {\n return

    {this.props.message.plain}

    \n }\n }\n\n getExpirationMessage() {\n if (this.props.expires) {\n if (this.props.expires.isAfter(moment())) {\n let title = interpolate(\n pgettext(\"banned page\", \"This ban expires on %(expires_on)s.\"),\n {\n expires_on: this.props.expires.format(\"LL, LT\"),\n },\n true\n )\n\n let message = interpolate(\n pgettext(\"banned page\", \"This ban expires %(expires_on)s.\"),\n {\n expires_on: this.props.expires.fromNow(),\n },\n true\n )\n\n return {message}\n } else {\n return pgettext(\"banned page\", \"This ban has expired.\")\n }\n } else {\n return pgettext(\"banned page\", \"This ban is permanent.\")\n }\n }\n\n render() {\n return (\n
    \n
    \n
    \n
    \n highlight_off\n
    \n
    \n {this.getReasonMessage()}\n

    {this.getExpirationMessage()}

    \n
    \n
    \n
    \n
    \n )\n }\n}\n","import moment from \"moment\"\nimport React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider, connect } from \"react-redux\"\nimport BannedPage from \"misago/components/banned-page\"\nimport misago from \"misago/index\"\nimport store from \"misago/services/store\"\n\nlet select = function (state) {\n return state.tick\n}\n\nlet RedrawedBannedPage = connect(select)(BannedPage)\n\nexport default function (ban, changeState) {\n ReactDOM.render(\n \n \n ,\n\n document.getElementById(\"page-mount\")\n )\n\n if (typeof changeState === \"undefined\" || changeState) {\n let forumName = misago.get(\"SETTINGS\").forum_name\n document.title =\n pgettext(\"banned error title\", \"You are banned\") + \" | \" + forumName\n window.history.pushState({}, \"\", misago.get(\"BANNED_URL\"))\n }\n}\n","export default function (list, rowWidth, padding = false) {\n let rows = []\n let row = []\n\n list.forEach(function (element) {\n row.push(element)\n if (row.length === rowWidth) {\n rows.push(row)\n row = []\n }\n })\n\n // pad row to required length?\n if (padding !== false && row.length > 0 && row.length < rowWidth) {\n for (let i = row.length; i < rowWidth; i++) {\n row.push(padding)\n }\n }\n\n if (row.length) {\n rows.push(row)\n }\n\n return rows\n}\n","export default function (a, b) {\n let ids = []\n return a.concat(b).filter(function (item) {\n if (ids.indexOf(item.id) === -1) {\n ids.push(item.id)\n return true\n } else {\n return false\n }\n })\n}\n","const map = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n}\n\nexport default function (text) {\n return text.replace(/[&<>\"']/g, function (m) {\n return map[m]\n })\n}\n","export default function (bytes) {\n if (bytes > 1024 * 1024 * 1024) {\n return roundSize(bytes / (1024 * 1024 * 1024)) + \" GB\"\n } else if (bytes > 1024 * 1024) {\n return roundSize(bytes / (1024 * 1024)) + \" MB\"\n } else if (bytes > 1024) {\n return roundSize(bytes / 1024) + \" KB\"\n } else {\n return roundSize(bytes) + \" B\"\n }\n}\n\nexport function roundSize(value) {\n return value.toFixed(1)\n}\n","export const ALPHA = \"12345678990abcdefghijklmnopqrstuvwxyz\"\nexport const ALPHA_LEN = ALPHA.length\n\nexport default function getRandomString(len) {\n const chars = []\n for (let i = 0; i < len; i++) {\n const index = Math.floor(Math.random() * ALPHA_LEN)\n chars.push(ALPHA[index])\n }\n return chars.join(\"\")\n}\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport store from \"misago/services/store\"\n\nexport default function (Component, rootElementId, connected = true) {\n let rootElement = document.getElementById(rootElementId)\n\n let finalComponent = Component.props ? Component : \n\n if (rootElement) {\n if (connected) {\n ReactDOM.render(\n {finalComponent},\n\n rootElement\n )\n } else {\n ReactDOM.render(finalComponent, rootElement)\n }\n }\n}\n","export function int(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n\nexport function range(min, max) {\n let array = new Array(int(min, max))\n for (let i = 0; i < array.length; i++) {\n array[i] = i\n }\n\n return array\n}\n","import React from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Provider } from \"react-redux\"\nimport { Router, browserHistory } from \"react-router\"\nimport store from \"misago/services/store\"\n\nconst rootElement = document.getElementById(\"page-mount\")\n\nexport default function (options) {\n let routes = {\n component: options.component || null,\n childRoutes: [],\n }\n\n if (options.root) {\n routes.childRoutes = [\n {\n path: options.root,\n onEnter: function (nextState, replaceState) {\n replaceState(null, options.paths[0].path)\n },\n },\n ].concat(options.paths)\n } else {\n routes.childRoutes = options.paths\n }\n\n ReactDOM.render(\n \n \n ,\n rootElement\n )\n}\n","const EMAIL =\n /^(([^<>()[\\]\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/i\nconst USERNAME = new RegExp(\"^[0-9a-z_]+$\", \"i\")\nconst USERNAME_ALPHANUMERIC = new RegExp(\"[0-9a-z]\", \"i\")\n\nexport function required(message) {\n return function (value) {\n if (\n value === false ||\n value === null ||\n String(value).trim().length === 0\n ) {\n return message || gettext(\"This field is required.\")\n }\n }\n}\n\nexport function requiredTermsOfService(message) {\n const error = pgettext(\n \"agreement validator\",\n \"You have to accept the terms of service.\"\n )\n return required(message || error)\n}\n\nexport function requiredPrivacyPolicy(message) {\n const error = pgettext(\n \"agreement validator\",\n \"You have to accept the privacy policy.\"\n )\n return required(message || error)\n}\n\nexport function email(message) {\n return function (value) {\n if (!EMAIL.test(value)) {\n return (\n message || pgettext(\"email validator\", \"Enter a valid e-mail address.\")\n )\n }\n }\n}\n\nexport function minLength(limitValue, message) {\n return function (value) {\n var returnMessage = \"\"\n var length = value.trim().length\n\n if (length < limitValue) {\n if (message) {\n returnMessage = message(limitValue, length)\n } else {\n returnMessage = npgettext(\n \"value length validator\",\n \"Ensure this value has at least %(limit_value)s character (it has %(show_value)s).\",\n \"Ensure this value has at least %(limit_value)s characters (it has %(show_value)s).\",\n limitValue\n )\n }\n return interpolate(\n returnMessage,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n }\n}\n\nexport function maxLength(limitValue, message) {\n return function (value) {\n var returnMessage = \"\"\n var length = value.trim().length\n\n if (length > limitValue) {\n if (message) {\n returnMessage = message(limitValue, length)\n } else {\n returnMessage = npgettext(\n \"value length validator\",\n \"Ensure this value has at most %(limit_value)s character (it has %(show_value)s).\",\n \"Ensure this value has at most %(limit_value)s characters (it has %(show_value)s).\",\n limitValue\n )\n }\n return interpolate(\n returnMessage,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n }\n}\n\nexport function usernameMinLength(lengthMin) {\n var message = function (lengthMin) {\n return npgettext(\n \"username length validator\",\n \"Username must be at least %(limit_value)s character long.\",\n \"Username must be at least %(limit_value)s characters long.\",\n lengthMin\n )\n }\n return minLength(lengthMin, message)\n}\n\nexport function usernameMaxLength(lengthMax) {\n var message = function (lengthMax) {\n return npgettext(\n \"username length validator\",\n \"Username cannot be longer than %(limit_value)s character.\",\n \"Username cannot be longer than %(limit_value)s characters.\",\n lengthMax\n )\n }\n return maxLength(lengthMax, message)\n}\n\nexport function usernameContent() {\n return function (value) {\n const valueTrimmed = value.trim()\n if (!USERNAME.test(valueTrimmed)) {\n return pgettext(\n \"username validator\",\n \"Username can only contain Latin alphabet letters, digits, and an underscore sign.\"\n )\n }\n if (!USERNAME_ALPHANUMERIC.test(valueTrimmed)) {\n return pgettext(\n \"username validator\",\n \"Username must contain Latin alphabet letters or digits.\"\n )\n }\n }\n}\n\nexport function passwordMinLength(limitValue) {\n return function (value) {\n const length = value.length\n\n if (length < limitValue) {\n const returnMessage = npgettext(\n \"password length validator\",\n \"Valid password must be at least %(limit_value)s character long.\",\n \"Valid password must be at least %(limit_value)s characters long.\",\n limitValue\n )\n\n return interpolate(\n returnMessage,\n {\n limit_value: limitValue,\n show_value: length,\n },\n true\n )\n }\n }\n}\n","var map = {\n\t\"./af\": 42786,\n\t\"./af.js\": 42786,\n\t\"./ar\": 30867,\n\t\"./ar-dz\": 14130,\n\t\"./ar-dz.js\": 14130,\n\t\"./ar-kw\": 96135,\n\t\"./ar-kw.js\": 96135,\n\t\"./ar-ly\": 56440,\n\t\"./ar-ly.js\": 56440,\n\t\"./ar-ma\": 47702,\n\t\"./ar-ma.js\": 47702,\n\t\"./ar-sa\": 16040,\n\t\"./ar-sa.js\": 16040,\n\t\"./ar-tn\": 37100,\n\t\"./ar-tn.js\": 37100,\n\t\"./ar.js\": 30867,\n\t\"./az\": 31083,\n\t\"./az.js\": 31083,\n\t\"./be\": 9808,\n\t\"./be.js\": 9808,\n\t\"./bg\": 68338,\n\t\"./bg.js\": 68338,\n\t\"./bm\": 67438,\n\t\"./bm.js\": 67438,\n\t\"./bn\": 8905,\n\t\"./bn-bd\": 76225,\n\t\"./bn-bd.js\": 76225,\n\t\"./bn.js\": 8905,\n\t\"./bo\": 11560,\n\t\"./bo.js\": 11560,\n\t\"./br\": 1278,\n\t\"./br.js\": 1278,\n\t\"./bs\": 80622,\n\t\"./bs.js\": 80622,\n\t\"./ca\": 2468,\n\t\"./ca.js\": 2468,\n\t\"./cs\": 5822,\n\t\"./cs.js\": 5822,\n\t\"./cv\": 50877,\n\t\"./cv.js\": 50877,\n\t\"./cy\": 47373,\n\t\"./cy.js\": 47373,\n\t\"./da\": 24780,\n\t\"./da.js\": 24780,\n\t\"./de\": 59740,\n\t\"./de-at\": 60217,\n\t\"./de-at.js\": 60217,\n\t\"./de-ch\": 60894,\n\t\"./de-ch.js\": 60894,\n\t\"./de.js\": 59740,\n\t\"./dv\": 5300,\n\t\"./dv.js\": 5300,\n\t\"./el\": 50837,\n\t\"./el.js\": 50837,\n\t\"./en-au\": 78348,\n\t\"./en-au.js\": 78348,\n\t\"./en-ca\": 77925,\n\t\"./en-ca.js\": 77925,\n\t\"./en-gb\": 22243,\n\t\"./en-gb.js\": 22243,\n\t\"./en-ie\": 46436,\n\t\"./en-ie.js\": 46436,\n\t\"./en-il\": 47207,\n\t\"./en-il.js\": 47207,\n\t\"./en-in\": 44175,\n\t\"./en-in.js\": 44175,\n\t\"./en-nz\": 76319,\n\t\"./en-nz.js\": 76319,\n\t\"./en-sg\": 31662,\n\t\"./en-sg.js\": 31662,\n\t\"./eo\": 92915,\n\t\"./eo.js\": 92915,\n\t\"./es\": 55655,\n\t\"./es-do\": 55251,\n\t\"./es-do.js\": 55251,\n\t\"./es-mx\": 96112,\n\t\"./es-mx.js\": 96112,\n\t\"./es-us\": 71146,\n\t\"./es-us.js\": 71146,\n\t\"./es.js\": 55655,\n\t\"./et\": 5603,\n\t\"./et.js\": 5603,\n\t\"./eu\": 77763,\n\t\"./eu.js\": 77763,\n\t\"./fa\": 76959,\n\t\"./fa.js\": 76959,\n\t\"./fi\": 11897,\n\t\"./fi.js\": 11897,\n\t\"./fil\": 42549,\n\t\"./fil.js\": 42549,\n\t\"./fo\": 94694,\n\t\"./fo.js\": 94694,\n\t\"./fr\": 94470,\n\t\"./fr-ca\": 63049,\n\t\"./fr-ca.js\": 63049,\n\t\"./fr-ch\": 52330,\n\t\"./fr-ch.js\": 52330,\n\t\"./fr.js\": 94470,\n\t\"./fy\": 5044,\n\t\"./fy.js\": 5044,\n\t\"./ga\": 29295,\n\t\"./ga.js\": 29295,\n\t\"./gd\": 2101,\n\t\"./gd.js\": 2101,\n\t\"./gl\": 38794,\n\t\"./gl.js\": 38794,\n\t\"./gom-deva\": 27884,\n\t\"./gom-deva.js\": 27884,\n\t\"./gom-latn\": 23168,\n\t\"./gom-latn.js\": 23168,\n\t\"./gu\": 95349,\n\t\"./gu.js\": 95349,\n\t\"./he\": 24206,\n\t\"./he.js\": 24206,\n\t\"./hi\": 30094,\n\t\"./hi.js\": 30094,\n\t\"./hr\": 30316,\n\t\"./hr.js\": 30316,\n\t\"./hu\": 22138,\n\t\"./hu.js\": 22138,\n\t\"./hy-am\": 11423,\n\t\"./hy-am.js\": 11423,\n\t\"./id\": 29218,\n\t\"./id.js\": 29218,\n\t\"./is\": 90135,\n\t\"./is.js\": 90135,\n\t\"./it\": 90626,\n\t\"./it-ch\": 10150,\n\t\"./it-ch.js\": 10150,\n\t\"./it.js\": 90626,\n\t\"./ja\": 39183,\n\t\"./ja.js\": 39183,\n\t\"./jv\": 24286,\n\t\"./jv.js\": 24286,\n\t\"./ka\": 12105,\n\t\"./ka.js\": 12105,\n\t\"./kk\": 47772,\n\t\"./kk.js\": 47772,\n\t\"./km\": 18758,\n\t\"./km.js\": 18758,\n\t\"./kn\": 79282,\n\t\"./kn.js\": 79282,\n\t\"./ko\": 33730,\n\t\"./ko.js\": 33730,\n\t\"./ku\": 1408,\n\t\"./ku.js\": 1408,\n\t\"./ky\": 33291,\n\t\"./ky.js\": 33291,\n\t\"./lb\": 36841,\n\t\"./lb.js\": 36841,\n\t\"./lo\": 55466,\n\t\"./lo.js\": 55466,\n\t\"./lt\": 57010,\n\t\"./lt.js\": 57010,\n\t\"./lv\": 37595,\n\t\"./lv.js\": 37595,\n\t\"./me\": 39861,\n\t\"./me.js\": 39861,\n\t\"./mi\": 35493,\n\t\"./mi.js\": 35493,\n\t\"./mk\": 95966,\n\t\"./mk.js\": 95966,\n\t\"./ml\": 87341,\n\t\"./ml.js\": 87341,\n\t\"./mn\": 5115,\n\t\"./mn.js\": 5115,\n\t\"./mr\": 10370,\n\t\"./mr.js\": 10370,\n\t\"./ms\": 9847,\n\t\"./ms-my\": 41237,\n\t\"./ms-my.js\": 41237,\n\t\"./ms.js\": 9847,\n\t\"./mt\": 72126,\n\t\"./mt.js\": 72126,\n\t\"./my\": 56165,\n\t\"./my.js\": 56165,\n\t\"./nb\": 64924,\n\t\"./nb.js\": 64924,\n\t\"./ne\": 16744,\n\t\"./ne.js\": 16744,\n\t\"./nl\": 93901,\n\t\"./nl-be\": 59814,\n\t\"./nl-be.js\": 59814,\n\t\"./nl.js\": 93901,\n\t\"./nn\": 83877,\n\t\"./nn.js\": 83877,\n\t\"./oc-lnc\": 92135,\n\t\"./oc-lnc.js\": 92135,\n\t\"./pa-in\": 15858,\n\t\"./pa-in.js\": 15858,\n\t\"./pl\": 64495,\n\t\"./pl.js\": 64495,\n\t\"./pt\": 89520,\n\t\"./pt-br\": 57971,\n\t\"./pt-br.js\": 57971,\n\t\"./pt.js\": 89520,\n\t\"./ro\": 96459,\n\t\"./ro.js\": 96459,\n\t\"./ru\": 21793,\n\t\"./ru.js\": 21793,\n\t\"./sd\": 40950,\n\t\"./sd.js\": 40950,\n\t\"./se\": 10490,\n\t\"./se.js\": 10490,\n\t\"./si\": 90124,\n\t\"./si.js\": 90124,\n\t\"./sk\": 64249,\n\t\"./sk.js\": 64249,\n\t\"./sl\": 14985,\n\t\"./sl.js\": 14985,\n\t\"./sq\": 51104,\n\t\"./sq.js\": 51104,\n\t\"./sr\": 49131,\n\t\"./sr-cyrl\": 79915,\n\t\"./sr-cyrl.js\": 79915,\n\t\"./sr.js\": 49131,\n\t\"./ss\": 85893,\n\t\"./ss.js\": 85893,\n\t\"./sv\": 98760,\n\t\"./sv.js\": 98760,\n\t\"./sw\": 91172,\n\t\"./sw.js\": 91172,\n\t\"./ta\": 27333,\n\t\"./ta.js\": 27333,\n\t\"./te\": 23110,\n\t\"./te.js\": 23110,\n\t\"./tet\": 52095,\n\t\"./tet.js\": 52095,\n\t\"./tg\": 27321,\n\t\"./tg.js\": 27321,\n\t\"./th\": 9041,\n\t\"./th.js\": 9041,\n\t\"./tk\": 19005,\n\t\"./tk.js\": 19005,\n\t\"./tl-ph\": 75768,\n\t\"./tl-ph.js\": 75768,\n\t\"./tlh\": 89444,\n\t\"./tlh.js\": 89444,\n\t\"./tr\": 72397,\n\t\"./tr.js\": 72397,\n\t\"./tzl\": 28254,\n\t\"./tzl.js\": 28254,\n\t\"./tzm\": 51106,\n\t\"./tzm-latn\": 30699,\n\t\"./tzm-latn.js\": 30699,\n\t\"./tzm.js\": 51106,\n\t\"./ug-cn\": 9288,\n\t\"./ug-cn.js\": 9288,\n\t\"./uk\": 67691,\n\t\"./uk.js\": 67691,\n\t\"./ur\": 13795,\n\t\"./ur.js\": 13795,\n\t\"./uz\": 6791,\n\t\"./uz-latn\": 60588,\n\t\"./uz-latn.js\": 60588,\n\t\"./uz.js\": 6791,\n\t\"./vi\": 65666,\n\t\"./vi.js\": 65666,\n\t\"./x-pseudo\": 14378,\n\t\"./x-pseudo.js\": 14378,\n\t\"./yo\": 75805,\n\t\"./yo.js\": 75805,\n\t\"./zh-cn\": 83839,\n\t\"./zh-cn.js\": 83839,\n\t\"./zh-hk\": 55726,\n\t\"./zh-hk.js\": 55726,\n\t\"./zh-mo\": 99807,\n\t\"./zh-mo.js\": 99807,\n\t\"./zh-tw\": 74152,\n\t\"./zh-tw.js\": 74152\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 46700;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + \"hljs\" + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.hmd = (module) => {\n\tmodule = Object.create(module);\n\tif (!module.children) module.children = [];\n\tObject.defineProperty(module, 'exports', {\n\t\tenumerable: true,\n\t\tset: () => {\n\t\t\tthrow new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);\n\t\t}\n\t});\n\treturn module;\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript)\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) scriptUrl = scripts[scripts.length - 1].src\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t174: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t} else installedChunks[chunkId] = 0;\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkmisago\"] = self[\"webpackChunkmisago\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(99170)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(58339)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(64109)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(46226)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(93240)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(75147)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(4894)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(29223)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(73806)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(27015)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(88097)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(46016)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(32488)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(11768)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(61323)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(64752)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(40949)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(78679)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(61814)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(95920)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(44095)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(63290)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(77031)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(97751)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(76093)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(87336)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(47549)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(22331)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(21513)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(98749)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(98251)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(6720)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(66806)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(10846)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(18255)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(14113)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(24444)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(1764)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(68351)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(81521)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(68585)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(41229)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(43589)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(62894)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(33934)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(85577)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(83526)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(43060)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(92292)))\n__webpack_require__.O(undefined, [736], () => (__webpack_require__(33409)))\nvar __webpack_exports__ = __webpack_require__.O(undefined, [736], () => (__webpack_require__(31341)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","inProgress","dataWebpackPrefix","ApiFetch","props","url","cache","data","setState","loading","error","onData","fetch","method","credentials","signal","then","response","status","json","setCache","headers","get","rejection","request","mutation","state","controller","AbortController","this","disabled","prevProps","urlChanged","disabledChanged","abort","hasCache","getCache","children","Object","assign","refetch","update","React","ApiMutation","options","body","onSuccess","onError","mutate","csrfToken","JSON","stringify","cookieName","window","misago_csrf","document","cookie","indexOf","cookieRegex","RegExp","match","split","Dropdown","event","isOpen","root","contains","target","menu","closest","prevState","dropdown","addEventListener","handleClick","removeEventListener","onOpen","onClose","id","className","classnames","open","ref","element","toggle","aria","ariaProps","menuAlignRight","menuClassName","role","close","DropdownDivider","DropdownFooter","listItem","DropdownHeader","DropdownMenuItem","DropdownPills","DropdownSubheader","shrink","auto","ListGroup","ListGroupItem","ListGroupEmpty","icon","message","ListGroupError","detail","ListGroupLoading","ListGroupMessage","getApiUrl","filter","query","api","misago","after","before","connect","auth","user","unreadNotifications","dispatch","updateAuthenticatedUser","NotificationsListEmpty","emptyMessage","pgettext","NotificationsListGroup","NotificationsListItemActor","notification","actor","href","title","username","size","actor_name","NotificationsListItemMessage","isRead","dangerouslySetInnerHTML","__html","NotificationsListItemReadStatus","NotificationsListItemTimestamp","Timestamp","datetime","createdAt","NotificationsListItem","NotificationsList","items","length","map","NotificationsListError","gettext","NotificationsListLoading","BODY_CLASS","Overlay","scrollOrigin","pageYOffset","classList","add","remove","scrollTo","onClick","closeOnNavigation","type","styleName","header","STYLES","LABELS","_score","_password","_inputs","loaded","zxcvbn","password","inputs","cacheStale","value","i","trim","score","getScore","style","width","RegisterForm","handleToggleAgreement","agreement","errors","validator","validators","criteria","passwordMinLength","forEach","item","name","min_length","formValidators","max_length","email","captcha","termsOfService","privacyPolicy","isLoading","isValid","snackbar","validate","ajax","terms_of_service","privacy_policy","apiResponse","callback","__all__","ban","showBannedPage","modal","onSubmit","handleSubmit","display","StartSocialAuth","buttonClassName","buttonLabel","formLabel","label","for","validation","onChange","bindInput","extra","form","RegisterLegalFootnote","onPrivacyPolicyChange","handlePrivacyPolicyChange","onTermsOfServiceChange","handleTermsOfServiceChange","Form","RegisterComplete","activation","interpolate","getLead","getSubscript","complete","completeRegistration","account_activation","isLoaded","Promise","all","result","block","showRegisterForm","LegalAgreement","checked","agreementHtml","escapeHtml","termsOfServiceId","termsOfServiceUrl","privacyPolicyId","privacyPolicyUrl","SearchResultsList","SearchMessage","SearchResultPost","post","index","thread","content","category","poster","poster_name","posted_on","SearchResultUser","rank","joined_on","SearchResults","results","threads","users","count","encodeURIComponent","npgettext","replace","SearchResultsEmpty","SearchResultsError","errorDetail","SearchResultsLoading","CACHE","SearchFetch","debounce","clearTimeout","setTimeout","Api","resultsCount","isResultEmpty","SearchInput","setQuery","placeholder","SearchQuery","SearchDropdown","overlay","search","querySelector","focus","settings","DELEGATE_AUTH","LOGIN_URL","SiteNavMenuConnected","isAnonymous","baseUrl","mainItems","extraItems","extraFooterItems","categories","authDelegated","enable_oauth2_client","topNav","push","footerNav","tosTitle","tosUrl","privacyTitle","privacyUrl","SignInButton","RegisterButton","forum_name","targetBlank","rel","is_vanilla","last","color","short_name","SiteNavDropdown","siteNav","FormHeader","text","labelClassName","socialAuth","pk","button_text","button_color","finalButtonLabel","site","tick","now","Date","diff","Math","ceil","abs","round","date","timeout","scheduleNextUpdate","displayed","narrow","formatNarrow","formatRelative","fullDateTime","callApi","avatarType","avatar","onComplete","showError","gravatar","setGravatar","crop_src","showCrop","upload","showUpload","galleries","showGallery","userPeview","avatars","getAvatarPreview","getGravatarButton","setGenerated","getCropButton","getUploadButton","getGalleryButton","cropit","$","deviceRatio","cropitOffset","crop","offset","x","y","zoom","crop_tmp","dataUrl","cropperWidth","getAvatarSize","initialWidth","height","exportZoom","imageState","src","getImagePath","onImageLoaded","zoomLevel","imageSize","offsetX","offsetY","cropAvatar","showIndex","getElementById","click","image","files","validationError","validateFile","preview","URL","createObjectURL","progress","FormData","append","uploaded","limit","filesize","fileSize","invalidTypeMsg","allowed_mime_types","extensionFound","loweredFilename","toLowerCase","allowed_extensions","extension","substr","extensions","join","pickFile","getUploadRequirements","getUploadProgressLabel","uploadFile","getUploadProgress","renderCrop","renderUpload","GalleryItem","select","selection","getClassName","Gallery","batch","images","row","save","ChangeAvatarError","reason","getErrorReason","component","AvatarIndex","AvatarUpload","AvatarCrop","AvatarGallery","store","updateAvatar","completeFlow","getBody","logout","submit","UserNavMenu","selectAvatar","ChangeAvatarModal","optionsMore","slice","adminUrl","showPrivateThreads","unreadPrivateThreads","changeAvatar","revealOptions","unread_private_threads","acl","can_use_private_threads","UserNavDropdown","userNav","size2x","alt","getSrc","srcSet","av","resolveAvatarForSize","Button","defaultProps","choices","repeat","level","isValidated","helpText","labelClass","htmlFor","controlClass","getFeedbackDescription","getFeedback","getHelpText","validateRequired","required","changeValue","newState","formErrors","validateField","preventDefault","clean","promise","send","success","handleSuccess","handleError","optional","validatedFields","hasOwnProperty","fieldErrors","field","requiredError","isControlled","isActive","path","location","pathname","activeClassName","ytRegExp","highlightCode","embedYoutubePlayers","_youtube","hljs","codeblocks","querySelectorAll","highlightElement","anchors","a","onlyChild","parentNode","childNodes","parseYoutubeUrl","youtubeMovie","swapYoutubePlayer","youtube","video","start","player","replaceWith","wrap","cleanedUrl","cleanUrl","getVideoIdFromUrl","timebit","bits","parseInt","onebox","documentNode","find","revealSpoiler","nextProps","nextState","markup","author","undefined","node","btn","parent","addClass","PanelMessage","Default","Invalid","tooltip","format","fromNow","userTitle","css_class","is_tab","random","isReady","posts","PostingQuoteSelection","range","getQuoteSelection","rect","getBoundingClientRect","posting","globalState","getGlobalState","quote","getQuoteMarkup","focusEditor","default","onMouseUp","selected","onTouchEnd","position","left","scrollX","top","bottom","scrollY","reply","textarea","selectionStart","selectionEnd","container","getSelection","rangeCount","getRangeAt","isRangeContained","isPostContained","isAnyTextSelected","cloneContents","commonAncestorContainer","p","nodeName","dataset","noquote","child","nodeType","Node","TEXT_NODE","textContent","metadata","getQuoteMetadata","convertNodesToMarkup","prefix","suffix","codeBlock","getQuoteCodeBlock","syntax","isNodeInlineCodeBlock","isNodeElementWithQuoteMetadata","getQuoteMetadataFromNode","ELEMENT_NODE","isNodeCodeBlock","getNodeCodeBlockMeta","nodes","stack","convertNodeToMarkup","SIMPLE_NODE_MAPPINGS","H1","H2","H3","H4","H5","H6","STRONG","EM","DEL","B","U","I","SUB","SUP","toUpperCase","code","innerText","misagoReply","setGlobalState","clearGlobalState","attachments","attachment","isRemoved","MarkupAttachmentModal","is_image","filename","filetype","formatFilesize","uploaded_on","uploader","uploader_name","wrapSelection","def","newValue","caret","setSelectionRange","replaceSelection","end","createRange","moveStart","substring","scroll","scrollTop","thumb","getAttachmentMarkup","confirm","key","canProtect","empty","isProtected","submitText","showPreview","closePreview","enableProtection","disableProtection","MarkupCodeModal","ev","LANGUAGES","rows","MarkupFormattingHelpModal","ExampleFormatting","ExampleFormattingSpoiler","reveal","URL_PATTERN","isUrl","str","test","textUrl","file","maxSize","max_attachment_size","getRandomString","concat","refreshState","moment","updateAttachments","actions","insertSpoiler","input","createElement","multiple","parsed","stopPropagation","dataTransfer","onAttachmentsChange","clipboardData","kind","getAsFile","focused","atwho","at","displayTpl","insertTpl","searchKey","callbacks","remoteFilter","getJSON","q","on","_storage","source","headPos","endPos","setMentions","onDrop","onFocus","onPaste","onBlur","post_length_min","CLASS_ACTIVE","CLASS_DEFAULT","CLASS_MINIMIZED","CLASS_FULLSCREEN","fullscreen","minimized","minimize","fullscreenEnter","fullscreenExit","PostingThreadOptions","isClosed","isHidden","isPinned","hide","unhide","pinGlobally","pinLocally","unpin","icons","closed","hidden","pinned","getIcons","pin","categoryOptions","getTitleValidators","getPostValidators","config","loadSuccess","loadError","non_field_errors","dialogProps","onCancel","PostingDialogStart","Toolbar","showOptions","onTitleChange","onCategoryChange","onHide","onUnhide","onPinGlobally","onPinLocally","onUnpin","onPostChange","usernames","removedBlanks","pos","to","cleanUsernames","PostingDialogStartPrivate","onToChange","quoteText","newPost","context","onQuote","newContext","appendData","PostingDialogReply","originalPost","protect","is_protected","can_protect","originalPostSameAsCurrentPost","noAttachementsAdded","PostingDialogEditReply","mode","minLength","thread_title_length_min","limitValue","limit_value","show_value","maxLength","thread_title_length_max","post_length_max","validatePostLengthMin","choice","getChoice","Icon","getIcon","getLabel","change","showActivation","val","getActivationButton","is_banned","is_hidden","is_online_hidden","is_offline_hidden","is_online","is_offline","getClass","StatusIcon","StatusLabel","banned_until","ban_expires","last_click","getHelp","showStatus","Status","JoinDate","Posts","Threads","Followers","getStatClassName","followers","stat","colClassName","cols","list","Array","apply","Number","call","iconOn","iconOff","labelOn","labelOff","locale","misago_locale","momentAgo","momentAgoNarrow","dayAt","soonAt","tomorrowAt","yesterdayAt","minuteShort","hourShort","dayShort","thisYearShort","otherYearShort","relativeNumeric","Intl","RelativeTimeFormat","numeric","DateTimeFormat","dateStyle","timeStyle","thisYearDate","month","day","otherYearDate","year","short","weekday","shortTime","formatShort","absDiff","minutes","hours","days","parts","formatToParts","getFullYear","sign","isSameDay","yesterday","setDate","getDate","isYesterday","isTomorrow","formatDayAtTime","getMonth","isOrdered","_items","order","values","values_only","_order","unordered","ordered","ordering","insertItem","insertAt","splice","iterations","useLoader","silent","getAttribute","requests","onRemoveSelection","onAction","moderation","htmx","swap","tagName","control","button","selector","registerEvents","registerActions","registerElementValidator","strip","csrf","setAttribute","setFormControlValidationState","callValidationUrl","clearFormControlValidationMessages","clearFormControlValidationState","setFormControlErrorValidationState","setFormControlSuccessValidationState","set","removeSnackbars","replaceChildren","renderSnackbars","SNACKBAR_TTL","appendChild","isEventVisible","requestConfig","verb","xhr","getResponseHeader","parse","getResponseErrorMessage","updateTimestamp","timestamp","hasAttribute","updateLiveTimestamps","setInterval","loader","AjaxLoader","_initializers","_context","initializer","OrderedList","orderedValues","fallback","has","snackbars","BulkModeration","show","patch","AUTH_SYNC_RATE","storage","include","AcceptAgreement","submiting","accept","reload","handleDecline","handleAccept","mount","signedIn","signedOut","getMessage","refresh","AuthMessage","NavbarBranding","logo","logoXs","NavbarExtraMenu","NotificationsDropdownBody","showAll","showUnread","unread","NotificationsDropdownBodyPill","active","NotificationsFetch","NavbarNotificationsToggle","badge","NavbarNotificationsDropdown","NavbarPrivateThreads","NavbarSearchToggle","NavbarSearchDropdown","Search","NavbarSiteNavToggle","NavbarSiteNavDropdown","SiteNav","NavbarUserNavToggle","NavbarUserNavDropdown","UserNav","branding","logo_small","logo_text","extraMenuItems","searchUrl","notificationsUrl","privateThreadsUrl","showSearch","can_search","addInitializer","ReactDOM","NotificationsOverlayBody","NotificationsOverlayBodyPill","NotificationsOverlay","notifications","NotificationsHeader","PageHeader","subtitle","PillsNav","PillsNavLink","link","NotificationsPills","basename","NotificationsPagination","NotificationsPaginationLink","hasPrevious","firstCursor","lastCursor","hasNext","NotificationsToolbar","markAllAsRead","getSubtitle","route","getBaseUrl","PageContainer","readAll","mutating","toolbarProps","history","replaceState","browserHistory","routes","NotificationsRoute","startsWith","expires_on","initWithPreloadedData","initWithoutPreloadedData","startPolling","profile","polls","poll","frequency","user_message","html","staff_message","isAfter","keys","getUserMessage","getStaffMessage","getExpirationMessage","getPanelBody","fieldname","fields","help_text","groups","group","f","initial","CancelButton","cancel","FormDisplay","isAuthenticated","SafeValue","onEdit","showEditButton","details","load","editing","newDetails","loadDetails","profileDetails","edit","edit_details","loadItems","next","Feed","loadMore","LoadMoreButton","isBusy","loadUsers","page","more","pages","setSpecialProps","PRELOADED_DATA_KEY","TITLE","API_FILTER","hydrate","apiUrl","getEmptyMessage","getMoreButton","getListBody","changed_by","changed_by_username","renderUserAvatar","renderUsername","old_username","new_username","changed_on","changes","hiddenOnMobile","loadChanges","is_followed","follow","action","canMessage","can_start_private_threads","isProfileOwner","is_avatar_locked","avatar_lock_user_message","avatar_lock_staff_message","moderate_avatar","avatar_hash","getFormBody","getModalBody","moderate_username","addNameChange","updateUsername","slug","countdown","isDeleted","with_content","getButtonLabel","getDeletedBody","getForm","AvatarControls","ChangeUsername","DeleteAccount","showAvatarDialog","rename","showRenameDialog","showDeleteDialog","is_active","ProfileModerationButton","FlexRow","available","getModeration","can_follow","WithDropdown","delete","is_anonymous","can_rename","can_moderate_avatar","can_delete","COMPONENTS","follows","Follows","Details","UsernameHistory","BanDetails","paths","Profile","RequestLinkForm","LinkSent","reset","RequestActivationLink","RequestResetForm","showInactivePage","AccountInactivePage","getActivateButton","RequestPasswordReset","ResetPasswordForm","PasswordChangedPage","SignInModal","showSignIn","updateSearch","urlQuery","pushState","providers","provider","updateUsers","updatePosts","onQueryChange","Badge","SearchTime","time","copy","LoadMore","appendPosts","updateProvider","Blankslate","components","TYPES_CLASSES","info","warning","Snackbar","snackbarClass","isVisible","getSnackbarClass","backendName","pageTitleTpl","pageTitle","backend","Register","emailProtected","onRegistrationComplete","step","stateUpdate","backend_name","emailHelpText","emailHelpTextTpl","SocialAuth","handleRegistrationComplete","op","updateAcl","participants","ModalHeader","onUsernameChange","can_add_participants","participant","confirmed","isUser","is_owner","can_change_owner","isModerator","can_moderate_private_threads","userIsOwner","UserStatus","isOwner","getUserIsOwner","utils","PollChoice","hash","proc","votes","getVotesLabel","ChoiceVotes","UserChoice","hydratedData","voters","voter","voted_on","ModalBody","ChoicesList","ChoiceDetails","VotesCount","VotesList","Voter","VoteDate","isPollOver","showVoting","is_public","can_edit","can_see_votes","can_vote","hasSelectedChoices","allow_revotes","controls","canVote","canChangeVote","ChangeVote","SeeVotes","Edit","Delete","newThreadAcl","DATE_ABBR","PollVotes","PollLength","PollIsPublic","PollCreation","getPoster","getPostedOn","absolute","relative","ends_on","getEndsOn","endsOn","question","PollChoicesLeft","choicesLeft","PollAllowRevote","ChoiceSelect","toggleChoice","getChoicesLeft","allowed_choices","getChoiceFromHash","deselectChoice","selectChoice","showResults","getIsPollOver","setChoices","canDelete","onDelete","onAdd","every","isEdit","PollPublicSwitch","ICON","changed_title","pinned_globally","pinned_locally","unpinned","moved","merged","approved","opened","unhid","hid","changed_owner","tookover","added_participant","owner_left","participant_left","removed_participant","event_type","can_hide","Hide","Unhide","hidden_on","hidden_by_name","hidden_by","USER_SPAN","USER_URL","Hidden","Poster","event_by","event_on","MESSAGE","ITEM_LINK","ITEM_SPAN","ChangedTitle","Moved","Merged","ChangedOwner","AddedParticipant","RemovedParticipant","msgstring","oldTitle","event_context","old_title","fromCategory","from_category","mergedThread","merged_thread","newOwner","is_read","initialized","observer","IntersectionObserver","entries","observe","entry","isIntersecting","primed","read","destroy","disconnect","ready","initialize","AttachmentPreview","AttachmentDetails","AttachmentThumbnail","AttachmentIcon","backgroundImage","can_see_hidden","Row","FlagBestAnswer","best_answer","best_answer_marked_by","marked_on","best_answer_marked_on","marked_by","best_answer_marked_by_name","FlagHidden","FlagUnapproved","is_unapproved","FlagProtected","approve","unprotect","like","lastLikes","last_likes","concatedLikes","finalLikes","is_liked","likes","unlike","previousState","ops","markAsBestAnswer","best_answer_is_protected","best_answer_marked_by_slug","patchThread","unmarkBestAnswer","hydrateLike","ModalDialog","LikesList","liked_on","likesCount","LikeDetails","liker_id","LikeDate","likedOn","can_reply","can_see_likes","can_like","MarkAsBestAnswer","MarkAsBestAnswerCompact","Like","Likes","LikesCompact","Reply","Quote","can_mark_best_answer","can_mark_as_best_answer","can_change_best_answer","hasLikes","getLikesMessage","u","hiddenLikes","otherUsers","lastUser","usernamesList","last_user","editor","move","new_thread","onUrlChange","DiffItem","revertEdit","canRevert","goToEdit","previous","GoBackBtn","goBack","GoForwardBtn","goForward","GoLastBtn","goLast","Label","RevertBtn","editor_name","edited_on","edited_by","hydrateEdit","edits","hydratedPost","PostingConfig","ModerationForm","isError","Error","Loader","categoryId","can_pin_threads","weight","can_hide_threads","can_close_threads","is_closed","isHiddenChoices","isClosedChoices","getWeightChoices","Modal","renderWeightField","renderHiddenField","renderClosedField","Permalink","UnmarkMarkBestAnswer","PostEdits","Approve","Move","Split","Protect","Unprotect","permaUrl","protocol","host","prompt","can_unmark_best_answer","isUnedited","can_approve","can_move","can_unhide","isSelected","can_merge_posts","UnreadLabel","UnreadCompact","PostedOn","PostedOnCompact","PostEditsCompacts","ProtectedLabel","postAuthor","hasAcl","hasVisibleTitle","ListItem","is_event","has_poll","has_unapproved_posts","replies","starter","starter_name","started_on","handleSuccessUnmounted","bestAnswer","BestAnswerSelect","bestAnswers","onBestAnswerChange","PollSelect","onPollChange","best_answers","merge","other_thread","post_set","ModalMessage","ModalLoading","successMessage","changeTitle","dropup","stickToBottom","watch","setNotifications","special_role","breadcrumbs","hasFlags","is_authenticated","enabled","resetScroll","ThreadPaginatorConnected","withRouter","router","scrollToTop","first","formData","min","max","PostErrors","heading","ids","rollback","isArray","Merge","can_merge","onReply","compact","is_new","new_post","unapproved_post","last_post","pollDisabled","onPoll","can_start_poll","setPageTitle","editPoll","shouldFetchData","fetchData","startPollingApi","stopPollingApi","params","delayed","threadModeration","getThreadModeration","postsModeration","getPostsModeration","openPollForm","openReplyForm","closePollForm","can_close","can_pin_globally","can_pin","can_unprotect","basePath","Route","getPageUrl","trackedPeriod","rankUrl","getUserStatus","getRankName","getUserTitle","counter","meta","posters","getLeadMessage","tracked_period","string","subString","n","stringCount","description","getRankDescription","getComponent","Rank","ActivePosters","Users","_element","_component","removeClass","attr","forum_index_title","reducer","initialState","array","SELECT_ALL","SELECT_NONE","SELECT_ITEM","APPEND_THREADS","DELETE_THREAD","FILTER_THREADS","HYDRATE_THREADS","PATCH_THREAD","SORT_THREADS","MODERATION_PERMISSIONS","hydrateThread","thread_acl","perm","mergedState","concatUnique","sort","sorting","itemCategory","categoriesMap","lft","rght","patchedState","doTick","UPDATE_AUTHENTICATED_USER","PATCH_USER","SIGN_IN","SIGN_OUT","signIn","signOut","soft","updatedState","UPDATE_AVATAR","userId","UPDATE_USERNAME","OPEN_SITE_NAV","OPEN_SEARCH","OPEN_NOTIFICATIONS","OPEN_PRIVATE_THREADS","OPEN_USER_NAV","CLOSE","openSiteNav","openSearch","openNotifications","openUserNav","privateThreads","REPLACE_PARTICIPANTS","BUSY_POLL","RELEASE_POLL","REMOVE_POLL","REPLACE_POLL","UPDATE_POLL","busy","release","hydrated","PATCH_POST","updated_on","hydrateAttachment","hydrateUser","APPEND_POSTS","SELECT_POST","DESELECT_POST","DESELECT_POSTS","LOAD_POSTS","UNLOAD_POSTS","UPDATE_POSTS","deselect","deselectAll","hydratePost","unload","selectedPosts","deseletedPosts","deseletedAllPosts","resultsIds","reducedPosts","postReducer","LOAD_DETAILS","HYDRATE_PROFILE","PATCH_PROFILE","hydrateStatus","REPLACE_SEARCH","UPDATE_SEARCH","UPDATE_SEARCH_PROVIDER","SHOW_SNACKBAR","HIDE_SNACKBAR","showSnackbar","messageType","hideSnackbar","BUSY_THREAD","RELEASE_THREAD","REPLACE_THREAD","UPDATE_THREAD","UPDATE_THREAD_ACL","last_post_on","TICK","ADD_NAME_CHANGE","APPEND_HISTORY","HYDRATE_HISTORY","changedBy","hydrateNamechange","namechange","unshift","floor","APPEND_USERS","HYDRATE_USERS","_cookieName","_csrfToken","_locks","self","resolve","reject","getCsrfToken","contentType","dataType","jqXHR","responseJSON","statusText","lock","param","waiter","wait","processData","XMLHttpRequest","evt","lengthComputable","total","local","_store","_local","_modal","syncSession","watchState","getState","BaseCaptcha","_ajax","_include","_snackbar","NoCaptcha","QACaptcha","kwargs","ReCaptchaComponent","grecaptcha","render","sitekey","siteKey","binding","ReCaptcha","recaptcha_site_key","captcha_type","_captcha","init","staticUrl","_staticUrl","_included","script","remote","localStorage","_prefix","_watchers","e","newValueJson","watcher","oldValue","setItem","itemString","getItem","indexTitle","forumName","_indexTitle","_forumName","finalTitle","_polls","stop","poolServer","_stopped","apiError","pollId","unsetBeforeUnload","_props","_isOpen","_isClosing","_mount","_observer","unobserve","_spacer","_mode","ResizeObserver","contentRect","_beforeunloadSet","beforeUnload","capture","returnValue","_realOpen","setBeforeUnload","_timeout","alert","_reducers","_initialState","createStore","combineReducers","_isLoaded","_loadedPromise","_loadingPromise","tries","plain","expires","getReasonMessage","RedrawedBannedPage","BannedPage","changeState","rowWidth","padding","b","m","bytes","roundSize","toFixed","ALPHA","ALPHA_LEN","len","chars","Component","rootElementId","connected","rootElement","finalComponent","int","childRoutes","onEnter","EMAIL","USERNAME","USERNAME_ALPHANUMERIC","String","requiredTermsOfService","requiredPrivacyPolicy","returnMessage","usernameMinLength","lengthMin","usernameMaxLength","lengthMax","usernameContent","valueTrimmed","webpackContext","req","webpackContextResolve","__webpack_require__","o","module","exports","__webpack_module_cache__","moduleId","cachedModule","__webpack_modules__","O","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","r","getter","__esModule","d","definition","defineProperty","enumerable","chunkId","reduce","promises","miniCssF","g","globalThis","Function","hmd","create","obj","prop","prototype","l","done","needAttach","scripts","getElementsByTagName","s","charset","nc","onScriptComplete","prev","onerror","onload","doneFns","removeChild","bind","head","Symbol","toStringTag","nmd","scriptUrl","importScripts","currentScript","installedChunks","installedChunkData","errorType","realSrc","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","chunkLoadingGlobal","__webpack_exports__"],"sourceRoot":""} \ No newline at end of file