mirror of
https://github.com/flarum/core.git
synced 2025-08-14 04:14:06 +02:00
Compare commits
1 Commits
1.x
...
as/postnum
Author | SHA1 | Date | |
---|---|---|---|
|
b17f26e6a8 |
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
@@ -1 +0,0 @@
|
||||
* @flarum/core
|
39
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
39
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: "🐛 Bug Report"
|
||||
about: "If something isn't working as expected"
|
||||
|
||||
---
|
||||
## Bug Report
|
||||
|
||||
**Current Behavior**
|
||||
A clear and concise description of the behavior.
|
||||
|
||||
**Steps to Reproduce**
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected Behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Environment**
|
||||
- Flarum version: x.y.z
|
||||
- Website URL: http://example.com
|
||||
- Webserver: [e.g. apache, nginx]
|
||||
- Hosting environment: [e.g. shared, vps]
|
||||
- PHP version: x.y.z
|
||||
- Browser: [e.g. chrome 67, safari 11]
|
||||
|
||||
```
|
||||
Output of "php flarum info", run this in terminal in your Flarum directory.
|
||||
```
|
||||
|
||||
**Possible Solution**
|
||||
<!--- Only if you have suggestions or a fix for the bug -->
|
||||
|
||||
**Additional Context**
|
||||
Add any other context about the problem here.
|
78
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
78
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -1,78 +0,0 @@
|
||||
name: "🐛 Bug Report"
|
||||
description: If something isn't working as expected
|
||||
labels: ["type/bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
- type: textarea
|
||||
id: current_behavior
|
||||
attributes:
|
||||
label: Current Behavior
|
||||
description: A clear and concise description of the behavior.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: steps_to_reproduce
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
description: The exact steps to reproduce the bug.
|
||||
placeholder: |
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error message '....'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected_behavior
|
||||
attributes:
|
||||
label: Expected Behavior
|
||||
description: A clear and concise description of what you expected to happen.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: screenshots
|
||||
attributes:
|
||||
label: Screenshots
|
||||
description: If applicable, add screenshots to help explain your problem.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: enironment
|
||||
attributes:
|
||||
label: Environment
|
||||
value: |
|
||||
- Flarum version: x.y.z
|
||||
- Website URL: http://example.com
|
||||
- Webserver: [e.g. apache, nginx]
|
||||
- Hosting environment: [e.g. shared, vps]
|
||||
- PHP version: x.y.z
|
||||
- Browser: [e.g. chrome 67, safari 11]
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: php_flarum_info
|
||||
attributes:
|
||||
label: "Output of `php flarum info`"
|
||||
value: |
|
||||
```
|
||||
Output of "php flarum info", run this in terminal in your Flarum directory.
|
||||
```
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: possible_solution
|
||||
attributes:
|
||||
label: Possible Solution
|
||||
description: Only if you have suggestions or a fix for the bug.
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: additional_context
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: Add any other context about the problem here.
|
||||
validations:
|
||||
required: false
|
17
.github/ISSUE_TEMPLATE/config.yml
vendored
17
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,17 +0,0 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: "🚀 Feature Request"
|
||||
url: https://discuss.flarum.org/t/proposals
|
||||
about: |
|
||||
Thanks for taking the time to fill out this feature request!
|
||||
We primarily use GitHub as a bug tracker and issue tracker for items we are sure to tackle in the near future.
|
||||
For feature requests, ideas and feedback please post in the Flarum Community.
|
||||
Feature requests are added to GitHub only when they have been accepted by the development team and implementation details have been laid out.
|
||||
- name: "🙋 Support Question"
|
||||
url: https://discuss.flarum.org/t/support
|
||||
about: |
|
||||
We primarily use GitHub as a bug tracker and issue tracker for items we are sure to tackle in the near future; for usage and support questions, please check out these resources below. Thanks!
|
||||
|
||||
* Flarum Community: https://discuss.flarum.org/
|
||||
* Discord Chat: https://flarum.org/discord/
|
||||
* Twitter: https://twitter.com/Flarum
|
26
.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
26
.github/ISSUE_TEMPLATE/feature-request.md
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
name: "🚀 Feature Request"
|
||||
about: "I have a suggestion (and may want to implement it!)"
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
IMPORTANT: Feature requests on this GitHub issue tracker are only accepted in case they have been approved by a core developer or contain extensive argumentation and directions for implementation. For all other feature requests, ideas and feedback please post in the Flarum Community: https://discuss.flarum.org/t/feedback.
|
||||
-->
|
||||
|
||||
## Feature Request
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. eg. I have an issue when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A detailed description of your proposed solution. Include:
|
||||
- How the feature would work/behave
|
||||
- Any potential drawbacks
|
||||
- Maybe a screenshot, design, or example code
|
||||
|
||||
**Justify why this feature belongs in Flarum's core, rather than in a third-party extension**
|
||||
Consider who this change will be useful to – most Flarum forums, or just a few?
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
11
.github/ISSUE_TEMPLATE/support-question.md
vendored
Normal file
11
.github/ISSUE_TEMPLATE/support-question.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
name: "🙋 Support Question"
|
||||
about: "If you have a question, please check out our forum or Discord!"
|
||||
|
||||
---
|
||||
|
||||
We primarily use GitHub as an issue tracker; for usage and support questions, please check out these resources below. Thanks!
|
||||
|
||||
* Flarum Community: https://discuss.flarum.org/
|
||||
* Discord Chat: https://flarum.org/discord/
|
||||
* Twitter: https://twitter.com/Flarum
|
208
.github/workflows/REUSABLE_backend.yml
vendored
208
.github/workflows/REUSABLE_backend.yml
vendored
@@ -1,208 +0,0 @@
|
||||
name: Flarum Backend Jobs
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
enable_backend_testing:
|
||||
description: "Enable Backend Testing?"
|
||||
type: boolean
|
||||
default: true
|
||||
required: false
|
||||
|
||||
enable_phpstan:
|
||||
description: "Enable PHPStan Static Analysis?"
|
||||
type: boolean
|
||||
default: false
|
||||
required: false
|
||||
|
||||
backend_directory:
|
||||
description: The directory of the project where backend code is located. This should contain a `composer.json` file, and is generally the root directory of the repo.
|
||||
type: string
|
||||
required: false
|
||||
default: '.'
|
||||
|
||||
php_versions:
|
||||
description: Versions of PHP to test with. Should be array of strings encoded as JSON array
|
||||
type: string
|
||||
required: false
|
||||
default: '["7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]'
|
||||
|
||||
php_extensions:
|
||||
description: PHP extensions to install.
|
||||
type: string
|
||||
required: false
|
||||
default: 'curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip'
|
||||
|
||||
db_versions:
|
||||
description: Versions of databases to test with. Should be array of strings encoded as JSON array
|
||||
type: string
|
||||
required: false
|
||||
default: '["mysql:5.7", "mysql:8.0.30", "mariadb"]'
|
||||
|
||||
php_ini_values:
|
||||
description: PHP ini values
|
||||
type: string
|
||||
required: false
|
||||
default: error_reporting=E_ALL
|
||||
|
||||
runner_type:
|
||||
description: The type of runner to use for the jobs. This should be one of the types supported by the `runs-on` keyword.
|
||||
type: string
|
||||
required: false
|
||||
default: 'ubuntu-latest'
|
||||
|
||||
secrets:
|
||||
composer_auth:
|
||||
description: The Composer auth tokens to use for private packages.
|
||||
required: false
|
||||
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: dev-main
|
||||
FLARUM_TEST_TMP_DIR_LOCAL: tests/integration/tmp
|
||||
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ inputs.runner_type }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php: ${{ fromJSON(inputs.php_versions) }}
|
||||
service: ${{ fromJSON(inputs.db_versions) }}
|
||||
prefix: ['']
|
||||
php_ini_values: [inputs.php_ini_values]
|
||||
|
||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude
|
||||
include:
|
||||
# Expands the matrix by naming DBs.
|
||||
- service: 'mysql:5.7'
|
||||
db: MySQL 5.7
|
||||
- service: 'mysql:8.0.30'
|
||||
db: MySQL 8.0
|
||||
- service: mariadb
|
||||
db: MariaDB
|
||||
|
||||
# Include Database prefix tests with only one PHP version.
|
||||
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||
service: 'mysql:5.7'
|
||||
db: MySQL 5.7
|
||||
prefix: flarum_
|
||||
prefixStr: (prefix)
|
||||
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||
service: 'mysql:8.0.30'
|
||||
db: MySQL 8.0
|
||||
prefix: flarum_
|
||||
prefixStr: (prefix)
|
||||
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||
service: mariadb
|
||||
db: MariaDB
|
||||
prefix: flarum_
|
||||
prefixStr: (prefix)
|
||||
|
||||
# @TODO: remove in 2.0
|
||||
# Include testing PHP 8.2 with deprecation warnings disabled.
|
||||
- php: 8.2
|
||||
php_ini_values: error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
|
||||
- php: 8.3
|
||||
php_ini_values: error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
|
||||
- php: 8.4
|
||||
php_ini_values: error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
|
||||
|
||||
# To reduce number of actions, we exclude some PHP versions from running with some DB versions.
|
||||
exclude:
|
||||
- php: ${{ fromJSON(inputs.php_versions)[1] }}
|
||||
service: 'mysql:8.0.30'
|
||||
- php: ${{ fromJSON(inputs.php_versions)[2] }}
|
||||
service: 'mysql:8.0.30'
|
||||
- php: ${{ fromJSON(inputs.php_versions)[3] }}
|
||||
service: 'mysql:8.0.30'
|
||||
|
||||
# @TODO: remove in 2.0
|
||||
# Exclude testing PHP 8.2 with deprecation warnings enabled.
|
||||
- php: 8.2
|
||||
php_ini_values: error_reporting=E_ALL
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: ${{ matrix.service }}
|
||||
ports:
|
||||
- 13306:3306
|
||||
|
||||
name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}'
|
||||
|
||||
if: >-
|
||||
inputs.enable_backend_testing &&
|
||||
((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || github.event_name != 'pull_request')
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
coverage: xdebug
|
||||
extensions: ${{ inputs.php_extensions }}
|
||||
tools: phpunit, composer:v2
|
||||
ini-values: ${{ matrix.php_ini_values }}
|
||||
|
||||
# The authentication alter is necessary because newer mysql versions use the `caching_sha2_password` driver,
|
||||
# which isn't supported prior to PHP7.4
|
||||
# When we drop support for PHP7.3, we should remove this from the setup.
|
||||
- name: Create MySQL Database
|
||||
run: |
|
||||
sudo systemctl start mysql
|
||||
mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 13306
|
||||
mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" --port 13306
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: composer install
|
||||
working-directory: ${{ inputs.backend_directory }}
|
||||
|
||||
- name: Setup Composer tests
|
||||
run: composer test:setup
|
||||
working-directory: ${{ inputs.backend_directory }}
|
||||
env:
|
||||
DB_PORT: 13306
|
||||
DB_PASSWORD: root
|
||||
DB_PREFIX: ${{ matrix.prefix }}
|
||||
|
||||
- name: Run Composer tests
|
||||
run: composer test
|
||||
working-directory: ${{ inputs.backend_directory }}
|
||||
env:
|
||||
COMPOSER_PROCESS_TIMEOUT: 600
|
||||
|
||||
phpstan:
|
||||
runs-on: ${{ inputs.runner_type }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
php: ${{ fromJSON(inputs.php_versions) }}
|
||||
exclude:
|
||||
- php: 8.4
|
||||
|
||||
name: 'PHPStan PHP ${{ matrix.php }}'
|
||||
|
||||
if: >-
|
||||
inputs.enable_phpstan &&
|
||||
((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || github.event_name != 'pull_request')
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php }}
|
||||
coverage: xdebug
|
||||
extensions: ${{ inputs.php_extensions }}
|
||||
tools: phpunit, composer:v2
|
||||
ini-values: ${{ matrix.php_ini_values }}
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: composer install
|
||||
working-directory: ${{ inputs.backend_directory }}
|
||||
|
||||
- name: Run PHPStan
|
||||
run: composer analyse:phpstan
|
182
.github/workflows/REUSABLE_frontend.yml
vendored
182
.github/workflows/REUSABLE_frontend.yml
vendored
@@ -1,182 +0,0 @@
|
||||
name: Flarum Frontend Jobs
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build_script:
|
||||
description: "Script to run for production build. Empty value to disable."
|
||||
type: string
|
||||
required: false
|
||||
default: build
|
||||
build_typings_script:
|
||||
description: "Script to run for typings build. Empty value to disable."
|
||||
type: string
|
||||
required: false
|
||||
default: build-typings
|
||||
format_script:
|
||||
description: "Script to run for code formatting. Empty value to disable."
|
||||
type: string
|
||||
required: false
|
||||
default: format-check
|
||||
check_typings_script:
|
||||
description: "Script to run for tyiping check. Empty value to disable."
|
||||
type: string
|
||||
required: false
|
||||
default: check-typings
|
||||
type_coverage_script:
|
||||
description: "Script to run for type coverage. Empty value to disable."
|
||||
type: string
|
||||
required: false
|
||||
default: check-typings-coverage
|
||||
test_script:
|
||||
description: "Script to run for tests. Empty value to disable."
|
||||
type: string
|
||||
required: false
|
||||
default: test
|
||||
|
||||
enable_bundlewatch:
|
||||
description: "Enable Bundlewatch?"
|
||||
type: boolean
|
||||
default: false
|
||||
required: false
|
||||
enable_prettier:
|
||||
description: "Enable Prettier?"
|
||||
type: boolean
|
||||
default: true
|
||||
required: false
|
||||
enable_typescript:
|
||||
description: "Enable TypeScript?"
|
||||
type: boolean
|
||||
default: true
|
||||
required: false
|
||||
enable_tests:
|
||||
description: "Enable Tests?"
|
||||
type: boolean
|
||||
default: false
|
||||
required: false
|
||||
|
||||
backend_directory:
|
||||
description: The directory of the project where backend code is located. This should contain a `composer.json` file, and is generally the root directory of the repo.
|
||||
type: string
|
||||
required: false
|
||||
default: '.'
|
||||
frontend_directory:
|
||||
description: The directory of the project where frontend code is located. This should contain a `package.json` file.
|
||||
type: string
|
||||
required: false
|
||||
default: './js'
|
||||
main_git_branch:
|
||||
description: The main git branch to use for the workflow.
|
||||
type: string
|
||||
required: false
|
||||
default: main
|
||||
node_version:
|
||||
description: The node version to use for the workflow.
|
||||
type: number
|
||||
required: false
|
||||
default: 20
|
||||
|
||||
js_package_manager:
|
||||
description: "Enable TypeScript?"
|
||||
type: string
|
||||
default: yarn
|
||||
required: false
|
||||
cache_dependency_path:
|
||||
description: "The path to the cache dependency file."
|
||||
type: string
|
||||
required: false
|
||||
|
||||
runner_type:
|
||||
description: The type of runner to use for the jobs. This should be one of the types supported by the `runs-on` keyword.
|
||||
type: string
|
||||
required: false
|
||||
default: 'ubuntu-latest'
|
||||
|
||||
git_actor_name:
|
||||
description: The name of the git actor to use for the bundled JS output.
|
||||
type: string
|
||||
required: false
|
||||
git_actor_email:
|
||||
description: The email of the git actor to use for the bundled JS output.
|
||||
type: string
|
||||
required: false
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token:
|
||||
description: The GitHub token to use for Bundlewatch.
|
||||
required: false
|
||||
composer_auth:
|
||||
description: The Composer auth tokens to use for private packages.
|
||||
required: false
|
||||
git_actor_token:
|
||||
description: The personal access token from the custom git actor.
|
||||
required: false
|
||||
|
||||
env:
|
||||
COMPOSER_ROOT_VERSION: dev-main
|
||||
ci_script: ${{ inputs.js_package_manager == 'yarn' && 'yarn install --immutable' || 'npm ci' }}
|
||||
cache_dependency_path: ${{ inputs.cache_dependency_path || format(inputs.js_package_manager == 'yarn' && '{0}/yarn.lock' || '{0}/package-lock.json', inputs.frontend_directory) }}
|
||||
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||
DISABLE_V8_COMPILE_CACHE: 1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Checks & Build
|
||||
runs-on: ${{ inputs.runner_type }}
|
||||
env:
|
||||
GIT_ACTOR_TOKEN: ${{ secrets.git_actor_token }}
|
||||
|
||||
if: >-
|
||||
((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || github.event_name != 'pull_request')
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.git_actor_token != '' && secrets.git_actor_token || secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ inputs.node_version }}
|
||||
cache: ${{ inputs.js_package_manager }}
|
||||
cache-dependency-path: ${{ env.cache_dependency_path }}
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.2'
|
||||
extensions: curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
|
||||
tools: composer:v2
|
||||
|
||||
# Needed since tsconfig draws typings from vendor folder.
|
||||
- name: Install Composer dependencies
|
||||
run: composer install
|
||||
working-directory: ${{ inputs.backend_directory }}
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: ${{ env.ci_script }}
|
||||
working-directory: ${{ inputs.frontend_directory }}
|
||||
|
||||
- name: JS Checks & Production Build
|
||||
uses: flarum/action-build@v4.1
|
||||
with:
|
||||
build_script: ${{ inputs.build_script }}
|
||||
build_typings_script: ${{ inputs.build_typings_script }}
|
||||
format_script: ${{ inputs.enable_prettier == true && inputs.format_script || '' }}
|
||||
check_typings_script: ${{ inputs.enable_typescript == true && inputs.check_typings_script || '' }}
|
||||
type_coverage_script: ${{ inputs.enable_typescript == true && inputs.type_coverage_script || '' }}
|
||||
test_script: ${{ inputs.enable_tests == true && inputs.test_script || '' }}
|
||||
package_manager: ${{ inputs.js_package_manager }}
|
||||
js_path: ${{ inputs.frontend_directory }}
|
||||
do_not_commit: ${{ github.ref != format('refs/heads/{0}', inputs.main_git_branch) || github.event_name != 'push' }}
|
||||
git_actor_name: ${{ inputs.git_actor_name || '' }}
|
||||
git_actor_email: ${{ inputs.git_actor_email || '' }}
|
||||
|
||||
- name: Check bundle size change
|
||||
if: ${{ inputs.enable_bundlewatch }}
|
||||
run: node_modules/.bin/bundlewatch --config .bundlewatch.config.json
|
||||
working-directory: ${{ inputs.frontend_directory }}
|
||||
env:
|
||||
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.bundlewatch_github_token }}
|
||||
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
|
6
.github/workflows/flarum-akismet-backend.yml
vendored
6
.github/workflows/flarum-akismet-backend.yml
vendored
@@ -2,9 +2,13 @@ name: Akismet PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
|
||||
|
23
.github/workflows/flarum-akismet-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-akismet-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Akismet JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: true
|
||||
|
||||
frontend_directory: ./extensions/akismet/js
|
||||
backend_directory: ./extensions/akismet
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
@@ -2,10 +2,14 @@ name: Approval PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
enable_backend_testing: false
|
||||
|
||||
backend_directory: ./extensions/approval
|
||||
|
23
.github/workflows/flarum-approval-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-approval-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Approval JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/approval/js
|
||||
backend_directory: ./extensions/approval
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
6
.github/workflows/flarum-core-backend.yml
vendored
6
.github/workflows/flarum-core-backend.yml
vendored
@@ -2,9 +2,13 @@ name: Core PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
|
||||
|
23
.github/workflows/flarum-core-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-core-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Core JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: true
|
||||
enable_prettier: true
|
||||
enable_typescript: true
|
||||
|
||||
frontend_directory: ./framework/core/js
|
||||
backend_directory: ./framework/core
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
6
.github/workflows/flarum-embed-backend.yml
vendored
6
.github/workflows/flarum-embed-backend.yml
vendored
@@ -2,9 +2,13 @@ name: Embed PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: false
|
||||
|
||||
|
23
.github/workflows/flarum-embed-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-embed-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Embed JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/embed/js
|
||||
backend_directory: ./extensions/embed
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
6
.github/workflows/flarum-emoji-backend.yml
vendored
6
.github/workflows/flarum-emoji-backend.yml
vendored
@@ -2,9 +2,13 @@ name: Emoji PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: false
|
||||
|
||||
|
23
.github/workflows/flarum-emoji-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-emoji-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Emoji JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/emoji/js
|
||||
backend_directory: ./extensions/emoji
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
@@ -1,11 +0,0 @@
|
||||
name: Extension Manager PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
with:
|
||||
enable_backend_testing: false
|
||||
|
||||
backend_directory: ./extensions/package-manager
|
6
.github/workflows/flarum-flags-backend.yml
vendored
6
.github/workflows/flarum-flags-backend.yml
vendored
@@ -2,9 +2,13 @@ name: Flags PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
|
||||
|
23
.github/workflows/flarum-flags-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-flags-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Flags JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: true
|
||||
|
||||
frontend_directory: ./extensions/flags/js
|
||||
backend_directory: ./extensions/flags
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
8
.github/workflows/flarum-likes-backend.yml
vendored
8
.github/workflows/flarum-likes-backend.yml
vendored
@@ -2,10 +2,14 @@ name: Likes PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
enable_backend_testing: false
|
||||
|
||||
backend_directory: ./extensions/likes
|
||||
|
23
.github/workflows/flarum-likes-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-likes-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Likes JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/likes/js
|
||||
backend_directory: ./extensions/likes
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
6
.github/workflows/flarum-lock-backend.yml
vendored
6
.github/workflows/flarum-lock-backend.yml
vendored
@@ -2,9 +2,13 @@ name: Lock PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: false
|
||||
|
||||
|
23
.github/workflows/flarum-lock-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-lock-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Lock JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/lock/js
|
||||
backend_directory: ./extensions/lock
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
@@ -2,9 +2,13 @@ name: Markdown PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: false
|
||||
|
||||
|
23
.github/workflows/flarum-markdown-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-markdown-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Markdown JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/markdown/js
|
||||
backend_directory: ./extensions/markdown
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
@@ -2,9 +2,13 @@ name: Mentions PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
|
||||
|
23
.github/workflows/flarum-mentions-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-mentions-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Mentions JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/mentions/js
|
||||
backend_directory: ./extensions/mentions
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
@@ -2,9 +2,13 @@ name: Nicknames PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
|
||||
|
23
.github/workflows/flarum-nicknames-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-nicknames-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Nicknames JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/nicknames/js
|
||||
backend_directory: ./extensions/nicknames
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
23
.github/workflows/flarum-package-manager-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-package-manager-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Package Manager JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: true
|
||||
|
||||
frontend_directory: ./extensions/package-manager/js
|
||||
backend_directory: ./extensions/package-manager
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
6
.github/workflows/flarum-pusher-backend.yml
vendored
6
.github/workflows/flarum-pusher-backend.yml
vendored
@@ -2,9 +2,13 @@ name: Pusher PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: false
|
||||
|
||||
|
23
.github/workflows/flarum-pusher-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-pusher-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Pusher JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: true
|
||||
|
||||
frontend_directory: ./extensions/pusher/js
|
||||
backend_directory: ./extensions/pusher
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
@@ -2,9 +2,13 @@ name: Statistics PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
|
||||
|
23
.github/workflows/flarum-statistics-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-statistics-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Statistics JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: true
|
||||
|
||||
frontend_directory: ./extensions/statistics/js
|
||||
backend_directory: ./extensions/statistics
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
8
.github/workflows/flarum-sticky-backend.yml
vendored
8
.github/workflows/flarum-sticky-backend.yml
vendored
@@ -2,10 +2,14 @@ name: Sticky PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
enable_backend_testing: false
|
||||
|
||||
backend_directory: ./extensions/sticky
|
||||
|
23
.github/workflows/flarum-sticky-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-sticky-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Sticky JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/sticky/js
|
||||
backend_directory: ./extensions/sticky
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
@@ -2,10 +2,14 @@ name: Subscriptions PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
enable_backend_testing: false
|
||||
|
||||
backend_directory: ./extensions/subscriptions
|
||||
|
23
.github/workflows/flarum-subscriptions-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-subscriptions-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Subscriptions JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/subscriptions/js
|
||||
backend_directory: ./extensions/subscriptions
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
8
.github/workflows/flarum-suspend-backend.yml
vendored
8
.github/workflows/flarum-suspend-backend.yml
vendored
@@ -2,10 +2,14 @@ name: Suspend PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
enable_backend_testing: false
|
||||
|
||||
backend_directory: ./extensions/suspend
|
||||
|
23
.github/workflows/flarum-suspend-frontend.yml
vendored
Executable file
23
.github/workflows/flarum-suspend-frontend.yml
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
name: Suspend JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: true
|
||||
enable_typescript: false
|
||||
|
||||
frontend_directory: ./extensions/suspend/js
|
||||
backend_directory: ./extensions/suspend
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
6
.github/workflows/flarum-tags-backend.yml
vendored
6
.github/workflows/flarum-tags-backend.yml
vendored
@@ -2,9 +2,13 @@ name: Tags PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
|
||||
|
22
.github/workflows/flarum-tags-frontend.yml
vendored
Executable file
22
.github/workflows/flarum-tags-frontend.yml
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
name: Tags JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
|
||||
# This will break your current script.
|
||||
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
|
||||
with:
|
||||
enable_bundlewatch: false
|
||||
enable_prettier: false
|
||||
enable_typescript: true
|
||||
|
||||
frontend_directory: ./extensions/tags/js
|
||||
backend_directory: ./extensions/tags
|
||||
js_package_manager: yarn
|
||||
main_git_branch: main
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
19
.github/workflows/frontend.yml
vendored
19
.github/workflows/frontend.yml
vendored
@@ -1,19 +0,0 @@
|
||||
name: Framework JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_frontend.yml
|
||||
with:
|
||||
frontend_directory: ./
|
||||
backend_directory: ./
|
||||
js_package_manager: yarn
|
||||
cache_dependency_path: ./yarn.lock
|
||||
main_git_branch: 1.x
|
||||
enable_tests: true
|
||||
# @TODO: fix bundlewatch
|
||||
enable_bundlewatch: false
|
||||
|
||||
secrets:
|
||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
12
.github/workflows/phpstan.yml
vendored
12
.github/workflows/phpstan.yml
vendored
@@ -1,12 +0,0 @@
|
||||
name: Framework PHP
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
with:
|
||||
enable_backend_testing: false
|
||||
enable_phpstan: true
|
||||
|
||||
backend_directory: .
|
26
.github/workflows/prepare-release.yml
vendored
26
.github/workflows/prepare-release.yml
vendored
@@ -1,26 +0,0 @@
|
||||
name: Prepare Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version to release'
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
pull-requests: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Prepare release
|
||||
uses: flarum/action-release@master
|
||||
with:
|
||||
next_tag: ${{ inputs.version }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
open_collective_token: ${{ secrets.OPEN_COLLECTIVE_TOKEN }}
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1 @@
|
||||
node_modules
|
||||
vendor
|
||||
composer.lock
|
||||
node_modules
|
1122
CHANGELOG.md
1122
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,11 @@
|
||||
<p align="center">
|
||||
<a href="https://flarum.org/"><img src="https://flarum.org/images/flarum.svg"></a>
|
||||
</p>
|
||||
<p align="center"><img src="https://flarum.org/assets/img/logo.png"></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/flarum/core/actions?query=workflow%3ATests"><img src="https://github.com/flarum/core/workflows/Tests/badge.svg" alt="PHP Tests"></a>
|
||||
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/packagist/dt/flarum/core" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/github/v/release/flarum/core?sort=semver" alt="Latest Version"></a>
|
||||
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/packagist/l/flarum/core" alt="License"></a>
|
||||
<a href="https://huntr.dev/bounties/disclose/?target=https://github.com/flarum/core"><img src="https://cdn.huntr.dev/huntr_security_badge_mono.svg" alt="huntr"></a>
|
||||
<a href="https://github.styleci.io/repos/28257573"><img src="https://github.styleci.io/repos/28257573/shield?style=flat" alt="StyleCI"></a>
|
||||
</p>
|
||||
|
||||
@@ -37,4 +36,3 @@ If you discover a security vulnerability within Flarum, please send an e-mail to
|
||||
## License
|
||||
|
||||
Flarum is open-source software licensed under the [MIT License](https://github.com/flarum/flarum/blob/master/LICENSE).
|
||||
|
||||
|
192
composer.json
192
composer.json
@@ -1,192 +0,0 @@
|
||||
{
|
||||
"name": "flarum/framework",
|
||||
"description": "Delightfully simple forum software.",
|
||||
"keywords": [
|
||||
"forum",
|
||||
"discussion"
|
||||
],
|
||||
"homepage": "https://flarum.org/",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Flarum",
|
||||
"email": "info@flarum.org",
|
||||
"homepage": "https://flarum.org/team"
|
||||
}
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/flarum"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/flarum"
|
||||
},
|
||||
{
|
||||
"type": "other",
|
||||
"url": "https://flarum.org/donate"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/flarum/framework/issues",
|
||||
"source": "https://github.com/flarum/framework",
|
||||
"docs": "https://docs.flarum.org",
|
||||
"forum": "https://discuss.flarum.org",
|
||||
"chat": "https://flarum.org/chat"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Flarum\\": "framework/core/src",
|
||||
"Flarum\\Akismet\\": "extensions/akismet/src",
|
||||
"Flarum\\Approval\\": "extensions/approval/src",
|
||||
"Flarum\\BBCode\\": "extensions/bbcode/src",
|
||||
"Flarum\\Flags\\": "extensions/flags/src",
|
||||
"Flarum\\Likes\\": "extensions/likes/src",
|
||||
"Flarum\\Lock\\": "extensions/lock/src",
|
||||
"Flarum\\Mentions\\": "extensions/mentions/src",
|
||||
"Flarum\\Nicknames\\": "extensions/nicknames/src",
|
||||
"Flarum\\ExtensionManager\\": "extensions/package-manager/src",
|
||||
"Flarum\\Pusher\\": "extensions/pusher/src",
|
||||
"Flarum\\Statistics\\": "extensions/statistics/src",
|
||||
"Flarum\\Sticky\\": "extensions/sticky/src",
|
||||
"Flarum\\Subscriptions\\": "extensions/subscriptions/src",
|
||||
"Flarum\\Suspend\\": "extensions/suspend/src",
|
||||
"Flarum\\Tags\\": "extensions/tags/src",
|
||||
"Flarum\\PHPStan\\": "php-packages/phpstan/src",
|
||||
"Flarum\\Testing\\": "php-packages/testing/src"
|
||||
},
|
||||
"files": [
|
||||
"framework/core/src/helpers.php"
|
||||
]
|
||||
},
|
||||
"replace": {
|
||||
"flarum/core": "self.version",
|
||||
"flarum/akismet": "self.version",
|
||||
"flarum/approval": "self.version",
|
||||
"flarum/bbcode": "self.version",
|
||||
"flarum/embed": "self.version",
|
||||
"flarum/emoji": "self.version",
|
||||
"flarum/flags": "self.version",
|
||||
"flarum/lang-english": "self.version",
|
||||
"flarum/likes": "self.version",
|
||||
"flarum/lock": "self.version",
|
||||
"flarum/markdown": "self.version",
|
||||
"flarum/mentions": "self.version",
|
||||
"flarum/nicknames": "self.version",
|
||||
"flarum/extension-manager": "self.version",
|
||||
"flarum/pusher": "self.version",
|
||||
"flarum/statistics": "self.version",
|
||||
"flarum/sticky": "self.version",
|
||||
"flarum/subscriptions": "self.version",
|
||||
"flarum/suspend": "self.version",
|
||||
"flarum/tags": "self.version",
|
||||
"flarum/phpstan": "self.version",
|
||||
"flarum/testing": "self.version"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"ext-json": "*",
|
||||
"components/font-awesome": "^5.14.0",
|
||||
"composer/composer": "^2.0",
|
||||
"dflydev/fig-cookies": "^3.0.0",
|
||||
"doctrine/dbal": "^2.7",
|
||||
"dragonmantank/cron-expression": "^3.1.0",
|
||||
"franzl/whoops-middleware": "^2.0.0",
|
||||
"guzzlehttp/guzzle": "^6.0|^7.4",
|
||||
"illuminate/bus": "^8.0",
|
||||
"illuminate/cache": "^8.0",
|
||||
"illuminate/config": "^8.0",
|
||||
"illuminate/console": "^8.0",
|
||||
"illuminate/container": "^8.0",
|
||||
"illuminate/contracts": "^8.0",
|
||||
"illuminate/database": "^8.0",
|
||||
"illuminate/events": "^8.0",
|
||||
"illuminate/filesystem": "^8.0",
|
||||
"illuminate/hashing": "^8.0",
|
||||
"illuminate/mail": "^8.0",
|
||||
"illuminate/queue": "^8.0",
|
||||
"illuminate/session": "^8.0",
|
||||
"illuminate/support": "^8.0",
|
||||
"illuminate/validation": "^8.0",
|
||||
"illuminate/view": "^8.0",
|
||||
"intervention/image": "2.5.* || ^2.6.1",
|
||||
"jenssegers/agent": "^2.6",
|
||||
"laminas/laminas-diactoros": "^2.4.1 || ^3.0.0",
|
||||
"laminas/laminas-httphandlerrunner": "^1.2.0 || ^2.3.0 || ^3.0.0",
|
||||
"laminas/laminas-stratigility": "^3.2.2 || ^4.0.0",
|
||||
"league/flysystem": "^1.0.11",
|
||||
"matthiasmullie/minify": "^1.3",
|
||||
"middlewares/base-path": "^2.0.1",
|
||||
"middlewares/base-path-router": "^2.0.1",
|
||||
"middlewares/request-handler": "^2.0.1",
|
||||
"monolog/monolog": "^1.16.0",
|
||||
"nesbot/carbon": "^2.0",
|
||||
"nikic/fast-route": "^0.6",
|
||||
"psr/http-message": "^1.0",
|
||||
"psr/http-server-handler": "^1.0",
|
||||
"psr/http-server-middleware": "^1.0",
|
||||
"pusher/pusher-php-server": "^2.2",
|
||||
"s9e/text-formatter": ">=2.3.6 <2.15",
|
||||
"staudenmeir/eloquent-eager-limit": "^1.0",
|
||||
"sycho/json-api": "^0.5.0",
|
||||
"sycho/sourcemap": "^2.0.0",
|
||||
"symfony/config": "^5.2.2",
|
||||
"symfony/console": "^5.2.2",
|
||||
"symfony/event-dispatcher": "^5.2.2",
|
||||
"symfony/mime": "^5.2.0",
|
||||
"symfony/polyfill-intl-messageformatter": "^1.22.0",
|
||||
"symfony/translation": "^5.1.5",
|
||||
"symfony/yaml": "^5.2.2",
|
||||
"wikimedia/less.php": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.4",
|
||||
"phpunit/phpunit": "^9.0",
|
||||
"phpstan/phpstan": ">=1.8.11 < 1.9.0",
|
||||
"nunomaduro/larastan": "^1.0"
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"extra": {
|
||||
"flarum-subextensions": [
|
||||
"extensions/akismet",
|
||||
"extensions/approval",
|
||||
"extensions/bbcode",
|
||||
"extensions/embed",
|
||||
"extensions/emoji",
|
||||
"extensions/flags",
|
||||
"extensions/lang-english",
|
||||
"extensions/likes",
|
||||
"extensions/lock",
|
||||
"extensions/markdown",
|
||||
"extensions/mentions",
|
||||
"extensions/nicknames",
|
||||
"extensions/package-manager",
|
||||
"extensions/pusher",
|
||||
"extensions/statistics",
|
||||
"extensions/sticky",
|
||||
"extensions/subscriptions",
|
||||
"extensions/suspend",
|
||||
"extensions/tags"
|
||||
],
|
||||
"branch-alias": {
|
||||
"dev-main": "1.x-dev"
|
||||
},
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
"extension.neon"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"analyse:phpstan": "phpstan analyse",
|
||||
"clear-cache:phpstan": "phpstan clear-result-cache"
|
||||
},
|
||||
"scripts-descriptions": {
|
||||
"analyse:phpstan": "Run static analysis"
|
||||
}
|
||||
}
|
@@ -17,9 +17,3 @@ trim_trailing_whitespace = false
|
||||
|
||||
[*.{php,xml,json}]
|
||||
indent_size = 4
|
||||
|
||||
[{tsconfig.json,prettierrc.json}]
|
||||
indent_size = 2
|
||||
|
||||
[*.neon]
|
||||
indent_style = tab
|
20
extensions/akismet/.gitattributes
vendored
20
extensions/akismet/.gitattributes
vendored
@@ -1,20 +0,0 @@
|
||||
**/.gitattributes export-ignore
|
||||
**/.gitignore export-ignore
|
||||
**/.gitmodules export-ignore
|
||||
**/.github export-ignore
|
||||
**/.travis export-ignore
|
||||
**/.travis.yml export-ignore
|
||||
**/.editorconfig export-ignore
|
||||
**/.styleci.yml export-ignore
|
||||
|
||||
**/phpunit.xml export-ignore
|
||||
**/tests export-ignore
|
||||
|
||||
**/js/dist/**/* -diff
|
||||
**/js/dist/**/* linguist-generated
|
||||
**/js/dist-typings/**/* -diff
|
||||
**/js/dist-typings/**/* linguist-generated
|
||||
**/js/yarn.lock -diff
|
||||
**/js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"support": {
|
||||
"issues": "https://github.com/flarum/framework/issues",
|
||||
"issues": "https://github.com/flarum/core/issues",
|
||||
"source": "https://github.com/flarum/akismet",
|
||||
"forum": "https://discuss.flarum.org"
|
||||
},
|
||||
@@ -19,8 +19,9 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.8",
|
||||
"flarum/approval": "^1.7"
|
||||
"flarum/core": "^1.2",
|
||||
"flarum/approval": "^1.2",
|
||||
"guzzlehttp/guzzle": "^7.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -13,7 +13,6 @@ use Flarum\Approval\Event\PostWasApproved;
|
||||
use Flarum\Extend;
|
||||
use Flarum\Post\Event\Hidden;
|
||||
use Flarum\Post\Event\Saving;
|
||||
use Flarum\Post\Post;
|
||||
|
||||
return [
|
||||
(new Extend\Frontend('forum'))
|
||||
@@ -31,7 +30,4 @@ return [
|
||||
|
||||
(new Extend\ServiceProvider())
|
||||
->register(AkismetProvider::class),
|
||||
|
||||
(new Extend\Model(Post::class))
|
||||
->cast('is_spam', 'bool'),
|
||||
];
|
||||
|
2
extensions/akismet/js/dist/admin.js
generated
vendored
2
extensions/akismet/js/dist/admin.js
generated
vendored
@@ -1,2 +1,2 @@
|
||||
(()=>{var a={n:t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return a.d(e,{a:e}),e},d:(t,e)=>{for(var s in e)a.o(e,s)&&!a.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},o:(a,t)=>Object.prototype.hasOwnProperty.call(a,t)};(()=>{"use strict";const t=flarum.core.compat["admin/app"];var e=a.n(t);e().initializers.add("flarum-akismet",(function(){e().extensionData.for("flarum-akismet").registerSetting({setting:"flarum-akismet.api_key",type:"text",label:e().translator.trans("flarum-akismet.admin.akismet_settings.api_key_label")}).registerSetting({setting:"flarum-akismet.delete_blatant_spam",type:"boolean",label:e().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_label"),help:e().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_help")}).registerPermission({icon:"fas fa-vote-yea",label:e().translator.trans("flarum-akismet.admin.permissions.bypass_akismet"),permission:"bypassAkismet"},"start")}))})(),module.exports={}})();
|
||||
(()=>{var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};(()=>{"use strict";e.r(t);const a=flarum.core.compat["admin/app"];var r=e.n(a);r().initializers.add("flarum-akismet",(function(){r().extensionData.for("flarum-akismet").registerSetting({setting:"flarum-akismet.api_key",type:"text",label:r().translator.trans("flarum-akismet.admin.akismet_settings.api_key_label")}).registerSetting({setting:"flarum-akismet.delete_blatant_spam",type:"boolean",label:r().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_label"),help:r().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_help")}).registerPermission({icon:"fas fa-vote-yea",label:r().translator.trans("flarum-akismet.admin.permissions.bypass_akismet"),permission:"bypassAkismet"},"start")}))})(),module.exports=t})();
|
||||
//# sourceMappingURL=admin.js.map
|
2
extensions/akismet/js/dist/admin.js.map
generated
vendored
2
extensions/akismet/js/dist/admin.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,mBCAlF,MAAM,EAA+BI,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAiBC,IAAI,kBAAkB,WACrCD,IAAAA,cAAiB,IACV,kBACJE,gBAAgB,CACfC,QAAS,yBACTC,KAAM,OACNC,MAAOL,IAAAA,WAAeM,MAAM,yDAE7BJ,gBAAgB,CAEfC,QAAS,qCACTC,KAAM,UACNC,MAAOL,IAAAA,WAAeM,MAAM,mEAC5BC,KAAMP,IAAAA,WAAeM,MAAM,oEAE5BE,mBACC,CACEC,KAAM,kBACNJ,MAAOL,IAAAA,WAAeM,MAAM,mDAC5BI,WAAY,iBAEd,QAEN,G","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/akismet/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\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__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('flarum-akismet', () => {\n app.extensionData\n .for('flarum-akismet')\n .registerSetting({\n setting: 'flarum-akismet.api_key',\n type: 'text',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label'),\n })\n .registerSetting({\n //https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/\n setting: 'flarum-akismet.delete_blatant_spam',\n type: 'boolean',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'),\n help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help'),\n })\n .registerPermission(\n {\n icon: 'fas fa-vote-yea',\n label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),\n permission: 'bypassAkismet',\n },\n 'start'\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","core","compat","app","add","registerSetting","setting","type","label","trans","help","registerPermission","icon","permission"],"sourceRoot":""}
|
||||
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,IACzBH,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAAA,IAAqB,kBAAkB,WACrCA,IAAAA,cAAAA,IACO,kBACJC,gBAAgB,CACfC,QAAS,yBACTC,KAAM,OACNC,MAAOJ,IAAAA,WAAAA,MAAqB,yDAE7BC,gBAAgB,CAEfC,QAAS,qCACTC,KAAM,UACNC,MAAOJ,IAAAA,WAAAA,MAAqB,mEAC5BK,KAAML,IAAAA,WAAAA,MAAqB,oEAE5BM,mBACC,CACEC,KAAM,kBACNH,MAAOJ,IAAAA,WAAAA,MAAqB,mDAC5BQ,WAAY,iBAEd,a","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/akismet/./src/admin/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\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__.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};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import app from 'flarum/admin/app';\n\napp.initializers.add('flarum-akismet', () => {\n app.extensionData\n .for('flarum-akismet')\n .registerSetting({\n setting: 'flarum-akismet.api_key',\n type: 'text',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label'),\n })\n .registerSetting({\n //https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/\n setting: 'flarum-akismet.delete_blatant_spam',\n type: 'boolean',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'),\n help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help'),\n })\n .registerPermission(\n {\n icon: 'fas fa-vote-yea',\n label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),\n permission: 'bypassAkismet',\n },\n 'start'\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","registerSetting","setting","type","label","help","registerPermission","icon","permission"],"sourceRoot":""}
|
2
extensions/akismet/js/dist/forum.js
generated
vendored
2
extensions/akismet/js/dist/forum.js
generated
vendored
@@ -1,2 +1,2 @@
|
||||
(()=>{var t={n:o=>{var r=o&&o.__esModule?()=>o.default:()=>o;return t.d(r,{a:r}),r},d:(o,r)=>{for(var e in r)t.o(r,e)&&!t.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:r[e]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o)};(()=>{"use strict";const o=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/app"];var e=t.n(r);const a=flarum.core.compat["forum/utils/PostControls"];var n=t.n(a);const s=flarum.core.compat["forum/components/Post"];var m=t.n(s);e().initializers.add("flarum-akismet",(function(){(0,o.extend)(n(),"destructiveControls",(function(t,o){if(t.has("approve")){var r=o.flags();if(r&&r.some((function(t){return"akismet"===(null==t?void 0:t.type())}))){var a=t.get("approve");a&&"object"==typeof a&&"children"in a&&(a.children=e().translator.trans("flarum-akismet.forum.post.not_spam_button"))}}})),(0,o.override)(m().prototype,"flagReason",(function(t,o){return"akismet"===o.type()?e().translator.trans("flarum-akismet.forum.post.akismet_flagged_text"):t(o)}))}))})(),module.exports={}})();
|
||||
(()=>{var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};(()=>{"use strict";t.r(e);const o=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/app"];var a=t.n(r);const n=flarum.core.compat["forum/utils/PostControls"];var m=t.n(n);const s=flarum.core.compat["forum/components/CommentPost"];var u=t.n(s);a().initializers.add("flarum-akismet",(function(){(0,o.extend)(m(),"destructiveControls",(function(t,e){if(t.has("approve")){var o=e.flags();o&&o.some((function(t){return"akismet"===t.type()}))&&(t.get("approve").children=a().translator.trans("flarum-akismet.forum.post.not_spam_button"))}})),(0,o.override)(u().prototype,"flagReason",(function(t,e){return"akismet"===e.type()?a().translator.trans("flarum-akismet.forum.post.akismet_flagged_text"):t(e)}))}))})(),module.exports=e})();
|
||||
//# sourceMappingURL=forum.js.map
|
2
extensions/akismet/js/dist/forum.js.map
generated
vendored
2
extensions/akismet/js/dist/forum.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,mBCAlF,MAAM,EAA+BI,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,yB,aCSxDC,IAAAA,aAAiBC,IAAI,kBAAkB,YACrCC,EAAAA,EAAAA,QAAOC,IAAc,uBAAuB,SAAUC,EAAmCC,GACvF,GAAID,EAAME,IAAI,WAAY,CACxB,IAAMC,EAAQF,EAAKE,QAEnB,GAAIA,GAASA,EAAMC,MAAK,SAACC,GAAI,MAAsB,aAAb,MAAJA,OAAI,EAAJA,EAAMC,OAAoB,IAAG,CAC7D,IAAMC,EAAcP,EAAMb,IAAI,WAC1BoB,GAAsC,iBAAhBA,GAA4B,aAAcA,IAClEA,EAAYC,SAAWZ,IAAAA,WAAea,MAAM,6CAEhD,CACF,CACF,KAEAC,EAAAA,EAAAA,UAASC,IAAAA,UAAyB,cAAc,SAAUC,EAAUP,GAClE,MAAoB,YAAhBA,EAAKC,OACAV,IAAAA,WAAea,MAAM,kDAGvBG,EAASP,EAClB,GACF,G","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/components/Post']\"","webpack://@flarum/akismet/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\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__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Post'];","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport type Post from 'flarum/common/models/Post';\nimport type ItemList from 'flarum/common/utils/ItemList';\n\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport PostComponent from 'flarum/forum/components/Post';\nimport type Mithril from 'mithril';\n\napp.initializers.add('flarum-akismet', () => {\n extend(PostControls, 'destructiveControls', function (items: ItemList<Mithril.Children>, post: Post) {\n if (items.has('approve')) {\n const flags = post.flags();\n\n if (flags && flags.some((flag) => flag?.type() === 'akismet')) {\n const approveItem = items.get('approve');\n if (approveItem && typeof approveItem === 'object' && 'children' in approveItem) {\n approveItem.children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');\n }\n }\n }\n });\n\n override(PostComponent.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'akismet') {\n return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');\n }\n\n return original(flag);\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","core","compat","app","add","extend","PostControls","items","post","has","flags","some","flag","type","approveItem","children","trans","override","PostComponent","original"],"sourceRoot":""}
|
||||
{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,gC,aCQxDC,IAAAA,aAAAA,IAAqB,kBAAkB,YACrCC,EAAAA,EAAAA,QAAOC,IAAc,uBAAuB,SAAUC,EAAiBC,GACrE,GAAID,EAAME,IAAI,WAAY,CACxB,IAAMC,EAAQF,EAAKE,QAEfA,GAASA,EAAMC,MAAK,SAACC,GAAD,MAA0B,YAAhBA,EAAKC,YACrCN,EAAMf,IAAI,WAAWsB,SAAWV,IAAAA,WAAAA,MAAqB,mDAK3DW,EAAAA,EAAAA,UAASC,IAAAA,UAAuB,cAAc,SAAUC,EAAUL,GAChE,MAAoB,YAAhBA,EAAKC,OACAT,IAAAA,WAAAA,MAAqB,kDAGvBa,EAASL,U","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/akismet/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\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__.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};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\n\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Post from 'flarum/common/models/Post';\n\napp.initializers.add('flarum-akismet', () => {\n extend(PostControls, 'destructiveControls', function (items: ItemList, post: Post) {\n if (items.has('approve')) {\n const flags = post.flags();\n\n if (flags && flags.some((flag) => flag.type() === 'akismet')) {\n items.get('approve').children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');\n }\n }\n });\n\n override(CommentPost.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'akismet') {\n return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');\n }\n\n return original(flag);\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","extend","PostControls","items","post","has","flags","some","flag","type","children","override","CommentPost","original"],"sourceRoot":""}
|
@@ -9,18 +9,18 @@
|
||||
"analyze": "cross-env ANALYZER=true yarn run build",
|
||||
"format": "prettier --write src",
|
||||
"format-check": "prettier --check src",
|
||||
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
|
||||
"check-typings-coverage": "typescript-coverage-report",
|
||||
"clean-typings": "npx rimraf dist-typings && mkdir dist-typings",
|
||||
"build-typings": "yarn run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && yarn run post-build-typings",
|
||||
"post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'",
|
||||
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
|
||||
"check-typings-coverage": "typescript-coverage-report"
|
||||
"post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@flarum/prettier-config": "^1.0.0",
|
||||
"flarum-tsconfig": "^1.0.2",
|
||||
"prettier": "^2.5.1",
|
||||
"flarum-webpack-config": "^2.0.0",
|
||||
"webpack": "^5.76.0",
|
||||
"webpack": "^5.65.0",
|
||||
"webpack-cli": "^4.9.1",
|
||||
"typescript": "^4.5.4",
|
||||
"typescript-coverage-report": "^0.6.1"
|
||||
|
@@ -4,7 +4,7 @@ import type Post from 'flarum/common/models/Post';
|
||||
import type ItemList from 'flarum/common/utils/ItemList';
|
||||
|
||||
import PostControls from 'flarum/forum/utils/PostControls';
|
||||
import PostComponent from 'flarum/forum/components/Post';
|
||||
import CommentPost from 'flarum/forum/components/CommentPost';
|
||||
import type Mithril from 'mithril';
|
||||
|
||||
app.initializers.add('flarum-akismet', () => {
|
||||
@@ -21,7 +21,7 @@ app.initializers.add('flarum-akismet', () => {
|
||||
}
|
||||
});
|
||||
|
||||
override(PostComponent.prototype, 'flagReason', function (original, flag) {
|
||||
override(CommentPost.prototype, 'flagReason', function (original, flag) {
|
||||
if (flag.type() === 'akismet') {
|
||||
return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');
|
||||
}
|
||||
|
@@ -4,19 +4,14 @@
|
||||
// This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
|
||||
// and also tells your Typescript server to read core's global typings for
|
||||
// access to `dayjs` and `$` in the global namespace.
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"../../../framework/core/js/dist-typings/@types/**/*",
|
||||
"../../flags/js/dist-typings/@types/**/*",
|
||||
"@types/**/*"
|
||||
],
|
||||
"include": ["src/**/*", "../vendor/*/*/js/dist-typings/@types/**/*", "@types/**/*"],
|
||||
"compilerOptions": {
|
||||
// This will output typings to `dist-typings`
|
||||
"declarationDir": "./dist-typings",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
|
||||
"@flarum/core/*": ["../../../framework/core/js/dist-typings/*"],
|
||||
"flarum/flags/*": ["../../flags/js/dist-typings/*"]
|
||||
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"],
|
||||
"flarum/flags/*": ["../vendor/flarum/flags/js/dist-typings/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2868
extensions/akismet/js/yarn.lock
Normal file
2868
extensions/akismet/js/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -50,7 +50,7 @@ class Akismet
|
||||
$client = new Client();
|
||||
|
||||
return $client->request('POST', "$this->apiUrl/$type", [
|
||||
'headers' => [
|
||||
'headers' => [
|
||||
'User-Agent' => "Flarum/$this->flarumVersion | Akismet/$this->extensionVersion",
|
||||
],
|
||||
'form_params' => $this->params,
|
||||
|
@@ -50,7 +50,7 @@ class ValidatePost
|
||||
->withContent($post->content)
|
||||
->withAuthorName($post->user->username)
|
||||
->withAuthorEmail($post->user->email)
|
||||
->withType($post->number === 1 ? 'forum-post' : 'reply')
|
||||
->withType($post->number == 1 ? 'forum-post' : 'reply')
|
||||
->withIp($post->ip_address)
|
||||
->withUserAgent($_SERVER['HTTP_USER_AGENT'])
|
||||
->checkSpam();
|
||||
|
@@ -38,7 +38,7 @@ class AkismetProvider extends AbstractServiceProvider
|
||||
$settings->get('flarum-akismet.api_key'),
|
||||
$url->to('forum')->base(),
|
||||
$app::VERSION,
|
||||
$extensions->getExtension('flarum-akismet')->getVersion() ?? 'unknown',
|
||||
$extensions->getExtension('flarum-akismet')->getVersion(),
|
||||
$config->inDebugMode()
|
||||
);
|
||||
});
|
||||
|
19
extensions/approval/.editorconfig
Normal file
19
extensions/approval/.editorconfig
Normal file
@@ -0,0 +1,19 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{diff,md}]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{php,xml,json}]
|
||||
indent_size = 4
|
20
extensions/approval/.gitattributes
vendored
20
extensions/approval/.gitattributes
vendored
@@ -1,20 +0,0 @@
|
||||
**/.gitattributes export-ignore
|
||||
**/.gitignore export-ignore
|
||||
**/.gitmodules export-ignore
|
||||
**/.github export-ignore
|
||||
**/.travis export-ignore
|
||||
**/.travis.yml export-ignore
|
||||
**/.editorconfig export-ignore
|
||||
**/.styleci.yml export-ignore
|
||||
|
||||
**/phpunit.xml export-ignore
|
||||
**/tests export-ignore
|
||||
|
||||
**/js/dist/**/* -diff
|
||||
**/js/dist/**/* linguist-generated
|
||||
**/js/dist-typings/**/* -diff
|
||||
**/js/dist-typings/**/* linguist-generated
|
||||
**/js/yarn.lock -diff
|
||||
**/js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"support": {
|
||||
"issues": "https://github.com/flarum/framework/issues",
|
||||
"issues": "https://github.com/flarum/core/issues",
|
||||
"source": "https://github.com/flarum/approval",
|
||||
"forum": "https://discuss.flarum.org"
|
||||
},
|
||||
@@ -19,8 +19,8 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.8",
|
||||
"flarum/flags": "^1.7"
|
||||
"flarum/core": "^1.2",
|
||||
"flarum/flags": "^1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -52,7 +52,7 @@
|
||||
"prettier": true,
|
||||
"typescript": false,
|
||||
"bundlewatch": false,
|
||||
"backendTesting": true,
|
||||
"backendTesting": false,
|
||||
"editorConfig": true,
|
||||
"styleci": true
|
||||
}
|
||||
@@ -65,28 +65,5 @@
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Flarum\\Approval\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"@test:unit",
|
||||
"@test:integration"
|
||||
],
|
||||
"test:unit": "phpunit -c tests/phpunit.unit.xml",
|
||||
"test:integration": "phpunit -c tests/phpunit.integration.xml",
|
||||
"test:setup": "@php tests/integration/setup.php"
|
||||
},
|
||||
"scripts-descriptions": {
|
||||
"test": "Runs all tests.",
|
||||
"test:unit": "Runs all unit tests.",
|
||||
"test:integration": "Runs all integration tests.",
|
||||
"test:setup": "Sets up a database for use with integration tests. Execute this only once."
|
||||
},
|
||||
"require-dev": {
|
||||
"flarum/testing": "^1.0.0"
|
||||
}
|
||||
"prefer-stable": true
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ use Flarum\Approval\Listener;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Extend;
|
||||
use Flarum\Post\CommentPost;
|
||||
use Flarum\Post\Event\Saving;
|
||||
use Flarum\Post\Post;
|
||||
use Flarum\Tags\Tag;
|
||||
|
||||
@@ -28,17 +29,15 @@ return [
|
||||
|
||||
// Discussions should be approved by default
|
||||
(new Extend\Model(Discussion::class))
|
||||
->default('is_approved', true)
|
||||
->cast('is_approved', 'bool'),
|
||||
->default('is_approved', true),
|
||||
|
||||
// Posts should be approved by default
|
||||
(new Extend\Model(Post::class))
|
||||
->default('is_approved', true)
|
||||
->cast('is_approved', 'bool'),
|
||||
->default('is_approved', true),
|
||||
|
||||
(new Extend\ApiSerializer(BasicDiscussionSerializer::class))
|
||||
->attribute('isApproved', function ($serializer, Discussion $discussion) {
|
||||
return $discussion->is_approved;
|
||||
return (bool) $discussion->is_approved;
|
||||
}),
|
||||
|
||||
(new Extend\ApiSerializer(PostSerializer::class))
|
||||
@@ -51,9 +50,9 @@ return [
|
||||
new Extend\Locales(__DIR__.'/locale'),
|
||||
|
||||
(new Extend\Event())
|
||||
->listen(PostWasApproved::class, Listener\UpdateDiscussionAfterPostApproval::class)
|
||||
->subscribe(Listener\ApproveContent::class)
|
||||
->subscribe(Listener\UnapproveNewContent::class),
|
||||
->listen(Saving::class, [Listener\ApproveContent::class, 'approvePost'])
|
||||
->listen(Saving::class, [Listener\UnapproveNewContent::class, 'unapproveNewPosts'])
|
||||
->listen(PostWasApproved::class, [Listener\ApproveContent::class, 'approveDiscussion']),
|
||||
|
||||
(new Extend\Policy())
|
||||
->modelPolicy(Tag::class, Access\TagPolicy::class),
|
||||
|
2
extensions/approval/js/dist/admin.js
generated
vendored
2
extensions/approval/js/dist/admin.js
generated
vendored
@@ -1,2 +1,2 @@
|
||||
(()=>{var s={n:r=>{var a=r&&r.__esModule?()=>r.default:()=>r;return s.d(a,{a}),a},d:(r,a)=>{for(var o in a)s.o(a,o)&&!s.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:a[o]})},o:(s,r)=>Object.prototype.hasOwnProperty.call(s,r)};(()=>{"use strict";const r=flarum.core.compat["common/extend"],a=flarum.core.compat["admin/app"];var o=s.n(a);o().initializers.add("flarum-approval",(function(){(0,r.extend)(o(),"getRequiredPermissions",(function(s,r){"discussion.startWithoutApproval"===r&&s.push("startDiscussion"),"discussion.replyWithoutApproval"===r&&s.push("discussion.reply")})),o().extensionData.for("flarum-approval").registerPermission({icon:"fas fa-check",label:o().translator.trans("flarum-approval.admin.permissions.start_discussions_without_approval_label"),permission:"discussion.startWithoutApproval"},"start",95).registerPermission({icon:"fas fa-check",label:o().translator.trans("flarum-approval.admin.permissions.reply_without_approval_label"),permission:"discussion.replyWithoutApproval"},"reply",95).registerPermission({icon:"fas fa-check",label:o().translator.trans("flarum-approval.admin.permissions.approve_posts_label"),permission:"discussion.approvePosts"},"moderate",65)}))})(),module.exports={}})();
|
||||
(()=>{var r={n:s=>{var e=s&&s.__esModule?()=>s.default:()=>s;return r.d(e,{a:e}),e},d:(s,e)=>{for(var a in e)r.o(e,a)&&!r.o(s,a)&&Object.defineProperty(s,a,{enumerable:!0,get:e[a]})},o:(r,s)=>Object.prototype.hasOwnProperty.call(r,s),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},s={};(()=>{"use strict";r.r(s);const e=flarum.core.compat["common/extend"],a=flarum.core.compat["admin/app"];var o=r.n(a);o().initializers.add("flarum-approval",(function(){(0,e.extend)(o(),"getRequiredPermissions",(function(r,s){"discussion.startWithoutApproval"===s&&r.push("startDiscussion"),"discussion.replyWithoutApproval"===s&&r.push("discussion.reply")})),o().extensionData.for("flarum-approval").registerPermission({icon:"fas fa-check",label:o().translator.trans("flarum-approval.admin.permissions.start_discussions_without_approval_label"),permission:"discussion.startWithoutApproval"},"start",95).registerPermission({icon:"fas fa-check",label:o().translator.trans("flarum-approval.admin.permissions.reply_without_approval_label"),permission:"discussion.replyWithoutApproval"},"reply",95).registerPermission({icon:"fas fa-check",label:o().translator.trans("flarum-approval.admin.permissions.approve_posts_label"),permission:"discussion.approvePosts"},"moderate",65)}))})(),module.exports=s})();
|
||||
//# sourceMappingURL=admin.js.map
|
2
extensions/approval/js/dist/admin.js.map
generated
vendored
2
extensions/approval/js/dist/admin.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,IACzBH,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,I,mBCAlF,MAAM,EAA+BI,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCGxDC,IAAAA,aAAiBC,IAAI,mBAAmB,YACtCC,EAAAA,EAAAA,QAAOF,IAAK,0BAA0B,SAAUG,EAAUC,GACrC,oCAAfA,GACFD,EAASE,KAAK,mBAEG,oCAAfD,GACFD,EAASE,KAAK,mBAElB,IAEAL,IAAAA,cAAiB,IACV,mBACJM,mBACC,CACEC,KAAM,eACNC,MAAOR,IAAAA,WAAeS,MAAM,8EAC5BL,WAAY,mCAEd,QACA,IAEDE,mBACC,CACEC,KAAM,eACNC,MAAOR,IAAAA,WAAeS,MAAM,kEAC5BL,WAAY,mCAEd,QACA,IAEDE,mBACC,CACEC,KAAM,eACNC,MAAOR,IAAAA,WAAeS,MAAM,yDAC5BL,WAAY,2BAEd,WACA,GAEN,G","sources":["webpack://@flarum/approval/webpack/bootstrap","webpack://@flarum/approval/webpack/runtime/compat get default export","webpack://@flarum/approval/webpack/runtime/define property getters","webpack://@flarum/approval/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/approval/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/approval/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/approval/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\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__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/admin/app';\n\napp.initializers.add('flarum-approval', () => {\n extend(app, 'getRequiredPermissions', function (required, permission) {\n if (permission === 'discussion.startWithoutApproval') {\n required.push('startDiscussion');\n }\n if (permission === 'discussion.replyWithoutApproval') {\n required.push('discussion.reply');\n }\n });\n\n app.extensionData\n .for('flarum-approval')\n .registerPermission(\n {\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'),\n permission: 'discussion.startWithoutApproval',\n },\n 'start',\n 95\n )\n .registerPermission(\n {\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'),\n permission: 'discussion.replyWithoutApproval',\n },\n 'reply',\n 95\n )\n .registerPermission(\n {\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),\n permission: 'discussion.approvePosts',\n },\n 'moderate',\n 65\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","flarum","core","compat","app","add","extend","required","permission","push","registerPermission","icon","label","trans"],"sourceRoot":""}
|
||||
{"version":3,"file":"admin.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCGxDC,IAAAA,aAAAA,IAAqB,mBAAmB,YACtCC,EAAAA,EAAAA,QAAOD,IAAK,0BAA0B,SAAUE,EAAUC,GACrC,oCAAfA,GACFD,EAASE,KAAK,mBAEG,oCAAfD,GACFD,EAASE,KAAK,uBAIlBJ,IAAAA,cAAAA,IACO,mBACJK,mBACC,CACEC,KAAM,eACNC,MAAOP,IAAAA,WAAAA,MAAqB,8EAC5BG,WAAY,mCAEd,QACA,IAEDE,mBACC,CACEC,KAAM,eACNC,MAAOP,IAAAA,WAAAA,MAAqB,kEAC5BG,WAAY,mCAEd,QACA,IAEDE,mBACC,CACEC,KAAM,eACNC,MAAOP,IAAAA,WAAAA,MAAqB,yDAC5BG,WAAY,2BAEd,WACA,Q","sources":["webpack://@flarum/approval/webpack/bootstrap","webpack://@flarum/approval/webpack/runtime/compat get default export","webpack://@flarum/approval/webpack/runtime/define property getters","webpack://@flarum/approval/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/approval/webpack/runtime/make namespace object","webpack://@flarum/approval/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/approval/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/approval/./src/admin/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\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__.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};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['admin/app'];","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/admin/app';\n\napp.initializers.add('flarum-approval', () => {\n extend(app, 'getRequiredPermissions', function (required, permission) {\n if (permission === 'discussion.startWithoutApproval') {\n required.push('startDiscussion');\n }\n if (permission === 'discussion.replyWithoutApproval') {\n required.push('discussion.reply');\n }\n });\n\n app.extensionData\n .for('flarum-approval')\n .registerPermission(\n {\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'),\n permission: 'discussion.startWithoutApproval',\n },\n 'start',\n 95\n )\n .registerPermission(\n {\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'),\n permission: 'discussion.replyWithoutApproval',\n },\n 'reply',\n 95\n )\n .registerPermission(\n {\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),\n permission: 'discussion.approvePosts',\n },\n 'moderate',\n 65\n );\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","extend","required","permission","push","registerPermission","icon","label"],"sourceRoot":""}
|
2
extensions/approval/js/dist/forum.js
generated
vendored
2
extensions/approval/js/dist/forum.js
generated
vendored
@@ -1,2 +1,2 @@
|
||||
(()=>{var o={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return o.d(r,{a:r}),r},d:(t,r)=>{for(var a in r)o.o(r,a)&&!o.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(o,t)=>Object.prototype.hasOwnProperty.call(o,t)};(()=>{"use strict";const t=flarum.core.compat["common/extend"],r=flarum.core.compat["forum/app"];var a=o.n(r);const e=flarum.core.compat["common/models/Discussion"];var p=o.n(e);const n=flarum.core.compat["common/models/Post"];var s=o.n(n);const i=flarum.core.compat["common/components/Badge"];var c=o.n(i);const u=flarum.core.compat["forum/components/DiscussionListItem"];var l=o.n(u);const d=flarum.core.compat["forum/components/Post"];var v=o.n(d);const f=flarum.core.compat["forum/components/CommentPost"];var A=o.n(f);const h=flarum.core.compat["common/components/Button"];var b=o.n(h);const y=flarum.core.compat["forum/utils/PostControls"];var g=o.n(y);a().initializers.add("flarum-approval",(function(){p().prototype.isApproved=p().attribute("isApproved"),(0,t.extend)(p().prototype,"badges",(function(o){this.isApproved()||o.has("hidden")||o.add("awaitingApproval",m(c(),{type:"awaitingApproval",icon:"fas fa-gavel",label:a().translator.trans("flarum-approval.forum.badge.awaiting_approval_tooltip")}))})),s().prototype.isApproved=s().attribute("isApproved"),s().prototype.canApprove=s().attribute("canApprove"),(0,t.extend)(l().prototype,"elementAttrs",(function(o){this.attrs.discussion.isApproved()||(o.className+=" DiscussionListItem--unapproved")})),(0,t.extend)(v().prototype,"elementAttrs",(function(o){this.attrs.post.isApproved()||(o.className+=" Post--unapproved")})),(0,t.extend)(A().prototype,"headerItems",(function(o){this.attrs.post.isApproved()||this.attrs.post.isHidden()||o.add("unapproved",a().translator.trans("flarum-approval.forum.post.awaiting_approval_text"))})),(0,t.override)(v().prototype,"flagReason",(function(o,t){return"approval"===t.type()?a().translator.trans("flarum-approval.forum.post.awaiting_approval_text"):o(t)})),(0,t.extend)(g(),"destructiveControls",(function(o,t){!t.isApproved()&&t.canApprove()&&o.add("approve",m(b(),{icon:"fas fa-check",onclick:g().approveAction.bind(t)},a().translator.trans("flarum-approval.forum.post_controls.approve_button")),10)})),g().approveAction=function(){this.save({isApproved:!0}),1===this.number()&&this.discussion().pushAttributes({isApproved:!0})}}),-10)})(),module.exports={}})();
|
||||
(()=>{var o={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return o.d(r,{a:r}),r},d:(t,r)=>{for(var e in r)o.o(r,e)&&!o.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})},o:(o,t)=>Object.prototype.hasOwnProperty.call(o,t),r:o=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})}},t={};(()=>{"use strict";o.r(t);const r=flarum.core.compat["common/extend"],e=flarum.core.compat["forum/app"];var a=o.n(e);const p=flarum.core.compat["common/models/Discussion"];var n=o.n(p);const s=flarum.core.compat["common/models/Post"];var i=o.n(s);const c=flarum.core.compat["common/components/Badge"];var u=o.n(c);const l=flarum.core.compat["forum/components/DiscussionListItem"];var d=o.n(l);const v=flarum.core.compat["forum/components/Post"];var f=o.n(v);const A=flarum.core.compat["forum/components/CommentPost"];var y=o.n(A);const b=flarum.core.compat["common/components/Button"];var g=o.n(b);const h=flarum.core.compat["forum/utils/PostControls"];var _=o.n(h);a().initializers.add("flarum-approval",(function(){n().prototype.isApproved=n().attribute("isApproved"),(0,r.extend)(n().prototype,"badges",(function(o){this.isApproved()||o.has("hidden")||o.add("awaitingApproval",m(u(),{type:"awaitingApproval",icon:"fas fa-gavel",label:a().translator.trans("flarum-approval.forum.badge.awaiting_approval_tooltip")}))})),i().prototype.isApproved=i().attribute("isApproved"),i().prototype.canApprove=i().attribute("canApprove"),(0,r.extend)(d().prototype,"elementAttrs",(function(o){this.attrs.discussion.isApproved()||(o.className+=" DiscussionListItem--unapproved")})),(0,r.extend)(f().prototype,"elementAttrs",(function(o){this.attrs.post.isApproved()||(o.className+=" Post--unapproved")})),(0,r.extend)(y().prototype,"headerItems",(function(o){this.attrs.post.isApproved()||this.attrs.post.isHidden()||o.add("unapproved",a().translator.trans("flarum-approval.forum.post.awaiting_approval_text"))})),(0,r.override)(f().prototype,"flagReason",(function(o,t){return"approval"===t.type()?a().translator.trans("flarum-approval.forum.post.awaiting_approval_text"):o(t)})),(0,r.extend)(_(),"destructiveControls",(function(o,t){!t.isApproved()&&t.canApprove()&&o.add("approve",m(g(),{icon:"fas fa-check",onclick:_().approveAction.bind(t)},a().translator.trans("flarum-approval.forum.post_controls.approve_button")),10)})),_().approveAction=function(){this.save({isApproved:!0}),1===this.number()&&this.discussion().pushAttributes({isApproved:!0})}}),-10)})(),module.exports=t})();
|
||||
//# sourceMappingURL=forum.js.map
|
2
extensions/approval/js/dist/forum.js.map
generated
vendored
2
extensions/approval/js/dist/forum.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -6,7 +6,7 @@
|
||||
"devDependencies": {
|
||||
"prettier": "^2.5.1",
|
||||
"flarum-webpack-config": "^2.0.0",
|
||||
"webpack": "^5.76.0",
|
||||
"webpack": "^5.65.0",
|
||||
"webpack-cli": "^4.9.1",
|
||||
"@flarum/prettier-config": "^1.0.0"
|
||||
},
|
||||
|
15
extensions/approval/js/src/@types/shims.d.ts
vendored
15
extensions/approval/js/src/@types/shims.d.ts
vendored
@@ -1,15 +0,0 @@
|
||||
import 'flarum/common/models/Discussion';
|
||||
import 'flarum/common/models/Post';
|
||||
|
||||
declare module 'flarum/common/models/Discussion' {
|
||||
export default interface Discussion {
|
||||
isApproved(): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'flarum/common/models/Post' {
|
||||
export default interface Post {
|
||||
isApproved(): boolean;
|
||||
canApprove(): boolean;
|
||||
}
|
||||
}
|
2284
extensions/approval/js/yarn.lock
Normal file
2284
extensions/approval/js/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace Flarum\Approval\Access;
|
||||
|
||||
use Closure;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\User\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -40,23 +39,14 @@ class ScopePrivatePostVisibility
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks if the actor has permission to approve posts,
|
||||
* within the discussion which the post is a part of.
|
||||
*
|
||||
* For example, the tags extension,
|
||||
* turns the `approvePosts` ability into per tag basis.
|
||||
*/
|
||||
private function discussionWhereCanApprovePosts(User $actor): Closure
|
||||
private function discussionWhereCanApprovePosts(User $actor)
|
||||
{
|
||||
return function ($query) use ($actor) {
|
||||
$query->selectRaw('1')
|
||||
->from('discussions')
|
||||
->whereColumn('discussions.id', 'posts.discussion_id')
|
||||
->where(function ($query) use ($actor) {
|
||||
$query->whereRaw('1 != 1')->orWhere(function ($query) use ($actor) {
|
||||
Discussion::query()->setQuery($query)->whereVisibleTo($actor, 'approvePosts');
|
||||
});
|
||||
Discussion::query()->setQuery($query)->whereVisibleTo($actor, 'approvePosts');
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@@ -11,55 +11,55 @@ namespace Flarum\Approval\Listener;
|
||||
|
||||
use Flarum\Approval\Event\PostWasApproved;
|
||||
use Flarum\Post\Event\Saving;
|
||||
use Flarum\User\Exception\PermissionDeniedException;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class ApproveContent
|
||||
{
|
||||
/**
|
||||
* @param Dispatcher $events
|
||||
* @param Saving $event
|
||||
*/
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(Saving::class, [$this, 'approvePost']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws PermissionDeniedException
|
||||
*/
|
||||
public function approvePost(Saving $event)
|
||||
public static function approvePost(Saving $event)
|
||||
{
|
||||
$attributes = $event->data['attributes'];
|
||||
$post = $event->post;
|
||||
|
||||
// Nothing to do if it is already approved.
|
||||
if ($post->is_approved) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* We approve a post in one of two cases:
|
||||
* - The post was unapproved and the allowed action is approving it. We trigger an event.
|
||||
* - The post was unapproved and the allowed actor is hiding or un-hiding it.
|
||||
* We approve it silently if the action is unhiding.
|
||||
*/
|
||||
$approvingSilently = false;
|
||||
|
||||
if (isset($attributes['isApproved'])) {
|
||||
$event->actor->assertCan('approve', $post);
|
||||
|
||||
$isApproved = (bool) $attributes['isApproved'];
|
||||
} elseif (isset($attributes['isHidden']) && $event->actor->can('approve', $post)) {
|
||||
} elseif (! empty($attributes['isHidden']) && $event->actor->can('approve', $post)) {
|
||||
$isApproved = true;
|
||||
$approvingSilently = $attributes['isHidden'];
|
||||
}
|
||||
|
||||
if (! empty($isApproved)) {
|
||||
$post->is_approved = true;
|
||||
|
||||
if (! $approvingSilently) {
|
||||
$post->raise(new PostWasApproved($post, $event->actor));
|
||||
}
|
||||
$post->raise(new PostWasApproved($post, $event->actor));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PostWasApproved $event
|
||||
*/
|
||||
public static function approveDiscussion(PostWasApproved $event)
|
||||
{
|
||||
$post = $event->post;
|
||||
$discussion = $post->discussion;
|
||||
$user = $discussion->user;
|
||||
|
||||
$discussion->refreshCommentCount();
|
||||
$discussion->refreshLastPost();
|
||||
|
||||
if ($post->number == 1) {
|
||||
$discussion->is_approved = true;
|
||||
|
||||
$discussion->afterSave(function () use ($user) {
|
||||
$user->refreshDiscussionCount();
|
||||
});
|
||||
}
|
||||
|
||||
$discussion->save();
|
||||
|
||||
$user->refreshCommentCount();
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
|
@@ -9,32 +9,22 @@
|
||||
|
||||
namespace Flarum\Approval\Listener;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Flarum\Discussion\Discussion;
|
||||
use Flarum\Flags\Flag;
|
||||
use Flarum\Post\CommentPost;
|
||||
use Flarum\Post\Event\Saving;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class UnapproveNewContent
|
||||
{
|
||||
/**
|
||||
* @param Dispatcher $events
|
||||
*/
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(Saving::class, [$this, 'unapproveNewPosts']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Saving $event
|
||||
*/
|
||||
public function unapproveNewPosts(Saving $event)
|
||||
public static function unapproveNewPosts(Saving $event)
|
||||
{
|
||||
$post = $event->post;
|
||||
|
||||
if (! $post->exists) {
|
||||
$ability = $post->discussion->first_post_id === null ? 'startWithoutApproval' : 'replyWithoutApproval';
|
||||
$ability = $post->discussion->post_number_index == 0 ? 'startWithoutApproval' : 'replyWithoutApproval';
|
||||
|
||||
if ($event->actor->can($ability, $post->discussion)) {
|
||||
if ($post->is_approved === null) {
|
||||
@@ -56,7 +46,7 @@ class UnapproveNewContent
|
||||
|
||||
$flag->post_id = $post->id;
|
||||
$flag->type = 'approval';
|
||||
$flag->created_at = Carbon::now();
|
||||
$flag->created_at = time();
|
||||
|
||||
$flag->save();
|
||||
});
|
||||
|
@@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Approval\Listener;
|
||||
|
||||
use Flarum\Approval\Event\PostWasApproved;
|
||||
|
||||
class UpdateDiscussionAfterPostApproval
|
||||
{
|
||||
public function handle(PostWasApproved $event)
|
||||
{
|
||||
$post = $event->post;
|
||||
$discussion = $post->discussion;
|
||||
$user = $discussion->user;
|
||||
|
||||
$discussion->refreshCommentCount();
|
||||
$discussion->refreshLastPost();
|
||||
|
||||
if ($post->number === 1) {
|
||||
$discussion->is_approved = true;
|
||||
|
||||
$discussion->afterSave(function () use ($user) {
|
||||
$user->refreshDiscussionCount();
|
||||
});
|
||||
}
|
||||
|
||||
$discussion->save();
|
||||
|
||||
if ($discussion->user) {
|
||||
$user->refreshCommentCount();
|
||||
$user->save();
|
||||
}
|
||||
|
||||
if ($post->user) {
|
||||
$post->user->refreshCommentCount();
|
||||
$post->user->save();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Approval\Tests\integration;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
trait InteractsWithUnapprovedContent
|
||||
{
|
||||
protected function prepareUnapprovedDatabaseContent()
|
||||
{
|
||||
$this->prepareDatabase([
|
||||
'users' => [
|
||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1],
|
||||
['id' => 4, 'username' => 'luceos', 'email' => 'luceos@machine.local', 'is_email_confirmed' => 1],
|
||||
],
|
||||
'discussions' => [
|
||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 1, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 2, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
||||
['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 3, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
||||
['id' => 4, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 4, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
||||
['id' => 5, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 5, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
||||
['id' => 6, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 6, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
||||
['id' => 7, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 7, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
||||
],
|
||||
'posts' => [
|
||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
['id' => 2, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
['id' => 3, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
['id' => 4, 'discussion_id' => 4, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
['id' => 5, 'discussion_id' => 5, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
['id' => 6, 'discussion_id' => 6, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
['id' => 7, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||
|
||||
['id' => 8, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 2],
|
||||
['id' => 9, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 1, 'is_approved' => 0, 'number' => 3],
|
||||
['id' => 10, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 4],
|
||||
['id' => 11, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 1, 'is_approved' => 0, 'number' => 5],
|
||||
],
|
||||
'groups' => [
|
||||
['id' => 4, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0]
|
||||
],
|
||||
'group_user' => [
|
||||
['user_id' => 3, 'group_id' => 4]
|
||||
],
|
||||
'group_permission' => [
|
||||
['permission' => 'discussion.approvePosts', 'group_id' => 4]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* null: Guest, 2: Normal User.
|
||||
*/
|
||||
public function unallowedUsers(): array
|
||||
{
|
||||
return [[null], [2]];
|
||||
}
|
||||
|
||||
/**
|
||||
* 1: Admin, 3: Permission Given, 4: Discussions Author.
|
||||
*/
|
||||
public function allowedUsers(): array
|
||||
{
|
||||
return [[1], [3], [4]];
|
||||
}
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Approval\Tests\integration\api;
|
||||
|
||||
use Flarum\Approval\Tests\integration\InteractsWithUnapprovedContent;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListDiscussionsTest extends TestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
use InteractsWithUnapprovedContent;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->extension('flarum-approval');
|
||||
|
||||
$this->prepareUnapprovedDatabaseContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider unallowedUsers
|
||||
* @test
|
||||
*/
|
||||
public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs)
|
||||
{
|
||||
$response = $this->send(
|
||||
$this->request('GET', '/api/discussions', compact('authenticatedAs'))
|
||||
);
|
||||
|
||||
$body = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertEqualsCanonicalizing([1, 4, 5, 7], Arr::pluck($body['data'], 'id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider allowedUsers
|
||||
* @test
|
||||
*/
|
||||
public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs)
|
||||
{
|
||||
$response = $this->send(
|
||||
$this->request('GET', '/api/discussions', compact('authenticatedAs'))
|
||||
);
|
||||
|
||||
$body = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertEqualsCanonicalizing([1, 2, 3, 4, 5, 6, 7], Arr::pluck($body['data'], 'id'));
|
||||
}
|
||||
}
|
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Approval\Tests\integration\api;
|
||||
|
||||
use Flarum\Approval\Tests\integration\InteractsWithUnapprovedContent;
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class ListPostsTest extends TestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
use InteractsWithUnapprovedContent;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->extension('flarum-approval');
|
||||
|
||||
$this->prepareUnapprovedDatabaseContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider unallowedUsers
|
||||
* @test
|
||||
*/
|
||||
public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs)
|
||||
{
|
||||
$response = $this->send(
|
||||
$this
|
||||
->request('GET', '/api/posts', compact('authenticatedAs'))
|
||||
->withQueryParams([
|
||||
'filter' => [
|
||||
'discussion' => 7
|
||||
]
|
||||
])
|
||||
);
|
||||
|
||||
$body = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertEqualsCanonicalizing([7, 8, 10], Arr::pluck($body['data'], 'id'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider allowedUsers
|
||||
* @test
|
||||
*/
|
||||
public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs)
|
||||
{
|
||||
$response = $this->send(
|
||||
$this
|
||||
->request('GET', '/api/posts', compact('authenticatedAs'))
|
||||
->withQueryParams([
|
||||
'filter' => [
|
||||
'discussion' => 7
|
||||
]
|
||||
])
|
||||
);
|
||||
|
||||
$body = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertEqualsCanonicalizing([7, 8, 9, 10, 11], Arr::pluck($body['data'], 'id'));
|
||||
}
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Testing\integration\Setup\SetupScript;
|
||||
|
||||
require __DIR__.'/../../vendor/autoload.php';
|
||||
|
||||
$setup = new SetupScript();
|
||||
|
||||
$setup->run();
|
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="true"
|
||||
stopOnFailure="false"
|
||||
>
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">../src/</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Flarum Integration Tests">
|
||||
<directory suffix="Test.php">./integration</directory>
|
||||
<exclude>./integration/tmp</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
>
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">../src/</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Flarum Unit Tests">
|
||||
<directory suffix="Test.php">./unit</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<listeners>
|
||||
<listener class="\Mockery\Adapter\Phpunit\TestListener" />
|
||||
</listeners>
|
||||
</phpunit>
|
19
extensions/bbcode/.editorconfig
Normal file
19
extensions/bbcode/.editorconfig
Normal file
@@ -0,0 +1,19 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{diff,md}]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{php,xml,json}]
|
||||
indent_size = 4
|
20
extensions/bbcode/.gitattributes
vendored
20
extensions/bbcode/.gitattributes
vendored
@@ -1,20 +0,0 @@
|
||||
**/.gitattributes export-ignore
|
||||
**/.gitignore export-ignore
|
||||
**/.gitmodules export-ignore
|
||||
**/.github export-ignore
|
||||
**/.travis export-ignore
|
||||
**/.travis.yml export-ignore
|
||||
**/.editorconfig export-ignore
|
||||
**/.styleci.yml export-ignore
|
||||
|
||||
**/phpunit.xml export-ignore
|
||||
**/tests export-ignore
|
||||
|
||||
**/js/dist/**/* -diff
|
||||
**/js/dist/**/* linguist-generated
|
||||
**/js/dist-typings/**/* -diff
|
||||
**/js/dist-typings/**/* linguist-generated
|
||||
**/js/yarn.lock -diff
|
||||
**/js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"support": {
|
||||
"issues": "https://github.com/flarum/framework/issues",
|
||||
"issues": "https://github.com/flarum/core/issues",
|
||||
"source": "https://github.com/flarum/bbcode",
|
||||
"forum": "https://discuss.flarum.org"
|
||||
},
|
||||
@@ -19,12 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Flarum\\BBCode\\": "src"
|
||||
}
|
||||
"flarum/core": "^1.2"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@@ -7,14 +7,24 @@
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\BBCode;
|
||||
|
||||
use Flarum\Extend;
|
||||
use s9e\TextFormatter\Configurator;
|
||||
|
||||
return [
|
||||
new Extend\Locales(__DIR__.'/locale'),
|
||||
|
||||
(new Extend\Formatter)
|
||||
->render(Render::class)
|
||||
->configure(Configure::class),
|
||||
];
|
||||
return (new Extend\Formatter)
|
||||
->configure(function (Configurator $config) {
|
||||
$config->BBCodes->addFromRepository('B');
|
||||
$config->BBCodes->addFromRepository('I');
|
||||
$config->BBCodes->addFromRepository('U');
|
||||
$config->BBCodes->addFromRepository('S');
|
||||
$config->BBCodes->addFromRepository('URL');
|
||||
$config->BBCodes->addFromRepository('IMG');
|
||||
$config->BBCodes->addFromRepository('EMAIL');
|
||||
$config->BBCodes->addFromRepository('CODE');
|
||||
$config->BBCodes->addFromRepository('QUOTE');
|
||||
$config->BBCodes->addFromRepository('LIST');
|
||||
$config->BBCodes->addFromRepository('DEL');
|
||||
$config->BBCodes->addFromRepository('COLOR');
|
||||
$config->BBCodes->addFromRepository('CENTER');
|
||||
$config->BBCodes->addFromRepository('SIZE');
|
||||
$config->BBCodes->addFromRepository('*');
|
||||
});
|
||||
|
@@ -1,10 +0,0 @@
|
||||
flarum-bbcode:
|
||||
|
||||
##
|
||||
# UNIQUE KEYS - The following keys are used in only one location each.
|
||||
##
|
||||
|
||||
# Translations in this namespace are used by the forum user interface.
|
||||
forum:
|
||||
quote:
|
||||
wrote: wrote
|
@@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\BBCode;
|
||||
|
||||
use s9e\TextFormatter\Configurator;
|
||||
|
||||
class Configure
|
||||
{
|
||||
public function __invoke(Configurator $config)
|
||||
{
|
||||
$this->addTagsFromRepositories($config);
|
||||
$this->adaptHighlightJs($config);
|
||||
}
|
||||
|
||||
protected function addTagsFromRepositories(Configurator $config): void
|
||||
{
|
||||
$config->BBCodes->addFromRepository('B');
|
||||
$config->BBCodes->addFromRepository('I');
|
||||
$config->BBCodes->addFromRepository('U');
|
||||
$config->BBCodes->addFromRepository('S');
|
||||
$config->BBCodes->addFromRepository('URL');
|
||||
$config->BBCodes->addFromRepository('IMG');
|
||||
$config->BBCodes->addFromRepository('EMAIL');
|
||||
$config->BBCodes->addFromRepository('CODE');
|
||||
$config->BBCodes->addFromRepository('QUOTE', 'default', [
|
||||
'authorStr' => '<xsl:value-of select="@author"/> <xsl:value-of select="$L_WROTE"/>'
|
||||
]);
|
||||
$config->BBCodes->addFromRepository('LIST');
|
||||
$config->BBCodes->addFromRepository('DEL');
|
||||
$config->BBCodes->addFromRepository('COLOR');
|
||||
$config->BBCodes->addFromRepository('CENTER');
|
||||
$config->BBCodes->addFromRepository('SIZE');
|
||||
$config->BBCodes->addFromRepository('*');
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix for highlight JS not working after changing post content.
|
||||
*
|
||||
* @link https://github.com/flarum/framework/issues/3794
|
||||
*/
|
||||
protected function adaptHighlightJs(Configurator $config): void
|
||||
{
|
||||
$codeTag = $config->tags->get('CODE');
|
||||
$script = '
|
||||
<script>
|
||||
if(window.hljsLoader && !document.currentScript.parentNode.hasAttribute(\'data-s9e-livepreview-onupdate\')) {
|
||||
window.hljsLoader.highlightBlocks(document.currentScript.parentNode);
|
||||
}
|
||||
</script>';
|
||||
$codeTag->template = str_replace('</pre>', $script.'</pre>', $codeTag->template);
|
||||
}
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* For detailed copyright and license information, please view the
|
||||
* LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\BBCode;
|
||||
|
||||
use s9e\TextFormatter\Renderer;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class Render
|
||||
{
|
||||
/**
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
public function __invoke(Renderer $renderer, $context, string $xml): string
|
||||
{
|
||||
$renderer->setParameter('L_WROTE', $this->translator->trans('flarum-bbcode.forum.quote.wrote'));
|
||||
|
||||
return $xml;
|
||||
}
|
||||
}
|
19
extensions/embed/.editorconfig
Normal file
19
extensions/embed/.editorconfig
Normal file
@@ -0,0 +1,19 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{diff,md}]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{php,xml,json}]
|
||||
indent_size = 4
|
20
extensions/embed/.gitattributes
vendored
20
extensions/embed/.gitattributes
vendored
@@ -1,20 +0,0 @@
|
||||
**/.gitattributes export-ignore
|
||||
**/.gitignore export-ignore
|
||||
**/.gitmodules export-ignore
|
||||
**/.github export-ignore
|
||||
**/.travis export-ignore
|
||||
**/.travis.yml export-ignore
|
||||
**/.editorconfig export-ignore
|
||||
**/.styleci.yml export-ignore
|
||||
|
||||
**/phpunit.xml export-ignore
|
||||
**/tests export-ignore
|
||||
|
||||
**/js/dist/**/* -diff
|
||||
**/js/dist/**/* linguist-generated
|
||||
**/js/dist-typings/**/* -diff
|
||||
**/js/dist-typings/**/* linguist-generated
|
||||
**/js/yarn.lock -diff
|
||||
**/js/package-lock.json -diff
|
||||
|
||||
* text=auto eol=lf
|
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"support": {
|
||||
"issues": "https://github.com/flarum/framework/issues",
|
||||
"issues": "https://github.com/flarum/core/issues",
|
||||
"source": "https://github.com/flarum/embed",
|
||||
"forum": "https://discuss.flarum.org"
|
||||
},
|
||||
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.8"
|
||||
"flarum/core": "^1.2"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
2
extensions/embed/js/dist/forum.js
generated
vendored
2
extensions/embed/js/dist/forum.js
generated
vendored
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user