mirror of
https://github.com/flarum/core.git
synced 2025-08-29 02:50:57 +02:00
Compare commits
401 Commits
v1.5.0
...
dk/2.x-db-
Author | SHA1 | Date | |
---|---|---|---|
|
9faf01f965 | ||
|
88cce7d7cf | ||
|
e771b908d5 | ||
|
721e2eae3d | ||
|
3fbe05fd18 | ||
|
8f29b7af82 | ||
|
734f4a150c | ||
|
0186ca909e | ||
|
1aa7806244 | ||
|
e3350543af | ||
|
d400dcbc2f | ||
|
430709bf5b | ||
|
f784f48906 | ||
|
3a34136e36 | ||
|
fb1703cd9b | ||
|
b58fec7ead | ||
|
537f97a07a | ||
|
c1be00e79a | ||
|
91b89bc698 | ||
|
278617a10d | ||
|
f793e5b8f8 | ||
|
01598555a9 | ||
|
5399c86a1b | ||
|
74ce4cf1a7 | ||
|
b4a82e81fc | ||
|
471ce0ea2a | ||
|
723cb73d48 | ||
|
e4abf93763 | ||
|
9310ce13d8 | ||
|
d4c532c949 | ||
|
46357ee9a9 | ||
|
6cbdfb6aa1 | ||
|
4b126d9f4c | ||
|
9e04b010d8 | ||
|
1c0e0933b0 | ||
|
60ffa78531 | ||
|
294878291c | ||
|
05a7e24836 | ||
|
eaabeab8c9 | ||
|
9ef366493c | ||
|
208b94dc12 | ||
|
5e3f8db095 | ||
|
deb99f0de4 | ||
|
693bce912a | ||
|
3107319812 | ||
|
a9756cb5eb | ||
|
bbdf3b5aba | ||
|
e2281a2123 | ||
|
d01c0e5210 | ||
|
bee50bec73 | ||
|
679d32729e | ||
|
e978e29e00 | ||
|
5cdfa0f640 | ||
|
a3192d2934 | ||
|
96ba2f5f2d | ||
|
87a83d33b3 | ||
|
015529ff1e | ||
|
2950290ad1 | ||
|
d154388468 | ||
|
7c885c72fd | ||
|
577fc3e6a8 | ||
|
e4e0fbff73 | ||
|
94de8b42b4 | ||
|
db0d9cb006 | ||
|
5ab5257ff5 | ||
|
24d13e33bb | ||
|
412cfafb3a | ||
|
ec5cb98c77 | ||
|
23fdddf185 | ||
|
be9eb16d7d | ||
|
ee34217b15 | ||
|
e731fb6189 | ||
|
229a7affa5 | ||
|
2ffbc44b4e | ||
|
b2a5a970e8 | ||
|
781000e047 | ||
|
608e2a7e5a | ||
|
7467beb72f | ||
|
6ec0911cd1 | ||
|
992d85e3b8 | ||
|
59586e63e1 | ||
|
76004ed844 | ||
|
e014aa0105 | ||
|
ce334156d5 | ||
|
4d0190d4b0 | ||
|
da1aa2aa92 | ||
|
c80220ad9b | ||
|
3593d53795 | ||
|
07623afacd | ||
|
f2f7f16c68 | ||
|
f3b5313557 | ||
|
0b128a5612 | ||
|
102e31754a | ||
|
8538f9c8f6 | ||
|
5a4bb7ccf2 | ||
|
d2a6329689 | ||
|
40dcaf882c | ||
|
2bc2899a1d | ||
|
9feb9dd4eb | ||
|
016503d8c3 | ||
|
cf70865aa6 | ||
|
b003736d75 | ||
|
0cf2001478 | ||
|
5820a16a96 | ||
|
4a966b830f | ||
|
7799c2fcd5 | ||
|
11b4a810b7 | ||
|
493ffa0538 | ||
|
64b25b26c3 | ||
|
6bc19e2e52 | ||
|
3757bde4fc | ||
|
f67ca5782a | ||
|
fad818d1e5 | ||
|
12ef1bfdbb | ||
|
951f58e567 | ||
|
082f04d3c3 | ||
|
04fe2616a4 | ||
|
c94c140484 | ||
|
7b9605bb4e | ||
|
6e783b9c78 | ||
|
6f11e044a7 | ||
|
34a04b0746 | ||
|
069677b2e3 | ||
|
57e05a5eaf | ||
|
b6a6248dff | ||
|
5437bf5c23 | ||
|
717af13bb1 | ||
|
e72541e35d | ||
|
577890d89c | ||
|
253a3d281d | ||
|
d27f952584 | ||
|
e5abffc75b | ||
|
d1059c1cc7 | ||
|
777c304ab7 | ||
|
789246b621 | ||
|
980cfd6c28 | ||
|
65390a4fc0 | ||
|
c7c86a77e9 | ||
|
f1f6051deb | ||
|
bded3da42d | ||
|
231cee1f78 | ||
|
f6c9bbb427 | ||
|
feb968780a | ||
|
5b89d3e91a | ||
|
ba7599e6fe | ||
|
80b34d1164 | ||
|
3accdc322c | ||
|
4247e54c64 | ||
|
ef35faaded | ||
|
715b8c39ae | ||
|
232618aba6 | ||
|
96e1411b7d | ||
|
21b483625e | ||
|
9363682e1c | ||
|
c766881e1f | ||
|
e63e161be6 | ||
|
3264455068 | ||
|
d7fcd8a9e5 | ||
|
b4f3f0558e | ||
|
919c3bb770 | ||
|
7298ccb301 | ||
|
cfdd6910eb | ||
|
7ebeb9c0a5 | ||
|
af3f91ca5b | ||
|
4784307e26 | ||
|
105b22976e | ||
|
fea31a8290 | ||
|
accdfde6e1 | ||
|
7684a1086a | ||
|
f8577c8078 | ||
|
e55844f3db | ||
|
1d20f4d4aa | ||
|
803f0cd0f4 | ||
|
8576df1a43 | ||
|
1792e22639 | ||
|
5e281136f6 | ||
|
b868c3d763 | ||
|
297a2d8c5c | ||
|
c0af41c305 | ||
|
d0669b08aa | ||
|
6b8e9ce1db | ||
|
fbbece4bda | ||
|
13e655aca5 | ||
|
c00e8706e1 | ||
|
1b5da13e8a | ||
|
ecfbcd1c30 | ||
|
818a100625 | ||
|
176b5540d8 | ||
|
2e76a8ecb5 | ||
|
11aa7bbb35 | ||
|
3a26c29935 | ||
|
94e92cf24e | ||
|
aa33cfd1f8 | ||
|
4901c586ce | ||
|
7a6d477550 | ||
|
b89a01c010 | ||
|
8b11fef3ee | ||
|
8a114cd826 | ||
|
62c93b4a05 | ||
|
fab71f2d01 | ||
|
e8c867dcac | ||
|
1247a7f1dd | ||
|
b0aad1a2d6 | ||
|
bddc9d96f2 | ||
|
d684248492 | ||
|
85b63681ae | ||
|
8372363cc2 | ||
|
a6a067ad48 | ||
|
241eba4d0c | ||
|
a6b12826c3 | ||
|
dd868ab44e | ||
|
5f3e0d6a09 | ||
|
661b9d7d9a | ||
|
b7498d6cb1 | ||
|
e7c55532a0 | ||
|
cce6b74fce | ||
|
da651c722b | ||
|
abc9670659 | ||
|
b66fe5dd5f | ||
|
7d79895ae0 | ||
|
3ab4529232 | ||
|
360a2ba1d8 | ||
|
eaa4063fef | ||
|
72d277bd45 | ||
|
28e3ccfde6 | ||
|
3f864bafc8 | ||
|
3af0481f30 | ||
|
1761660c98 | ||
|
8ddb0feb09 | ||
|
fa30f4f250 | ||
|
79a9b23096 | ||
|
33e2bd1a77 | ||
|
a3a39caa44 | ||
|
bbf873442a | ||
|
d35bb873a8 | ||
|
598ff21d7d | ||
|
9342903d68 | ||
|
ea7b270f47 | ||
|
906b0fb633 | ||
|
408a92b4ea | ||
|
0da069ba9f | ||
|
d8fa791d9c | ||
|
fee6ffe396 | ||
|
7a60a529da | ||
|
37fd218723 | ||
|
1ee5cf6ba9 | ||
|
ced1c2d94f | ||
|
f8d856028d | ||
|
748cca6d12 | ||
|
f4f8369dc0 | ||
|
aa0b3288d5 | ||
|
153bb1a53c | ||
|
ee1e04cdc2 | ||
|
77a0b11bc8 | ||
|
7e6458a125 | ||
|
675cdab658 | ||
|
e7fc29a59f | ||
|
08dead81ce | ||
|
47b670aa29 | ||
|
f9a5d485c3 | ||
|
5717a74fcc | ||
|
2e0f026dde | ||
|
bf52743510 | ||
|
da1bf8da21 | ||
|
ccf9442d79 | ||
|
4bb3b2235d | ||
|
03d2d7eabb | ||
|
4d292263b5 | ||
|
6adae00f72 | ||
|
d7f4975330 | ||
|
5fe3cfd837 | ||
|
2d2bf5c504 | ||
|
a4f4ee8e71 | ||
|
4a38047bfb | ||
|
d5e6f6db5f | ||
|
20e7d245da | ||
|
243bc139b0 | ||
|
adf78bbd95 | ||
|
c8d9f1111e | ||
|
e5f05166a0 | ||
|
02556c6ca6 | ||
|
666223fa8c | ||
|
12dfcc5c79 | ||
|
248a71d9b5 | ||
|
a131e87911 | ||
|
be63b28437 | ||
|
132fdea659 | ||
|
fe8480c8f7 | ||
|
1e8a0f930d | ||
|
d7b9a03f31 | ||
|
78189f29d2 | ||
|
07f8b6161a | ||
|
0eff1f6b2d | ||
|
a53a0db2b7 | ||
|
a129999132 | ||
|
8f80cde5b7 | ||
|
4de3cd4d9c | ||
|
3dd2cadb9b | ||
|
605225c851 | ||
|
f33fbdd0b5 | ||
|
5bc47c0278 | ||
|
0e238a9c82 | ||
|
64fa35f2f3 | ||
|
c99d04fce2 | ||
|
67c0d75ebc | ||
|
6f4f964ce8 | ||
|
67dd2c21b6 | ||
|
e5d2b8cad9 | ||
|
f5c346f1c7 | ||
|
5bb0593bad | ||
|
47d2053766 | ||
|
e0b9dcfbcd | ||
|
8a65ad980d | ||
|
9a0668effd | ||
|
224b122303 | ||
|
ed0cee97f5 | ||
|
543c5f2a2e | ||
|
690de9ce0f | ||
|
50253a2eb8 | ||
|
92473c0967 | ||
|
361234205c | ||
|
54798aaa47 | ||
|
fe5d543864 | ||
|
2517bc0f70 | ||
|
b5f324a7b3 | ||
|
8ef0df94b2 | ||
|
c50c924242 | ||
|
18bdd48835 | ||
|
f49cf887dc | ||
|
19793d5617 | ||
|
4a2f48ad04 | ||
|
2b413b06c5 | ||
|
2b89dedc08 | ||
|
00a880c467 | ||
|
92d2adc5fd | ||
|
bc59b8d9ab | ||
|
bb9f01372f | ||
|
069a29d22a | ||
|
105170b5bc | ||
|
b8261ef055 | ||
|
d14770188b | ||
|
e9bb646dbf | ||
|
46adf40675 | ||
|
6938a13223 | ||
|
ab56aefeaa | ||
|
259db92b9a | ||
|
094ec77980 | ||
|
bb712693d4 | ||
|
1e00e3fdbb | ||
|
47d7a6e155 | ||
|
45d91212f6 | ||
|
1a81c98d43 | ||
|
c98e6ba5a7 | ||
|
eeb00cc56b | ||
|
87cdb5b4d8 | ||
|
bc4b0b864c | ||
|
53ab1503e4 | ||
|
62a396e434 | ||
|
2096fa2807 | ||
|
06963df407 | ||
|
8fe09815f5 | ||
|
fccc3e2188 | ||
|
f0a867b20f | ||
|
69311ae689 | ||
|
f005b9e031 | ||
|
31ced98e0d | ||
|
9964ddd731 | ||
|
32ac0a8d8f | ||
|
827e905f8e | ||
|
cdc76567d4 | ||
|
5898a50463 | ||
|
72d9ee2010 | ||
|
4e5e4e5c6e | ||
|
201d7430fe | ||
|
52f6148876 | ||
|
dc215aba59 | ||
|
90a68506b8 | ||
|
bd0577f435 | ||
|
d33f1abffc | ||
|
b0b47a0888 | ||
|
8c0a14aff2 | ||
|
76788efaba | ||
|
973ec32e13 | ||
|
cf818aae9e | ||
|
6da0bc63b7 | ||
|
6e1bc2daed | ||
|
7ce9d63ed6 | ||
|
267f6759f8 | ||
|
b5874a08e4 | ||
|
368e08bb9b | ||
|
5f2d7fb7b6 | ||
|
68d6e30143 | ||
|
c5c312db0d | ||
|
05f80b7b83 | ||
|
31c3cfc4ea | ||
|
fd196454a5 | ||
|
f6761843b2 | ||
|
84c31165e5 | ||
|
fc4d5e3d43 | ||
|
b2fa28e4b5 | ||
|
fc743ba888 |
25
.bundlewatch.config.json
Normal file
25
.bundlewatch.config.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"path": "./framework/core/js/dist/*.js",
|
||||||
|
"maxSize": "150KB"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./framework/core/js/dist/*/**/*.js",
|
||||||
|
"maxSize": "30KB"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./extensions/*/js/dist/*.js",
|
||||||
|
"maxSize": "30KB"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./extensions/*/js/dist/*/**/*.js",
|
||||||
|
"maxSize": "30KB"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"defaultCompression": "gzip",
|
||||||
|
"ci": {
|
||||||
|
"repoBranchBase": "2.x",
|
||||||
|
"trackBranches": ["2.x"]
|
||||||
|
}
|
||||||
|
}
|
@@ -18,5 +18,8 @@ trim_trailing_whitespace = false
|
|||||||
[*.{php,xml,json}]
|
[*.{php,xml,json}]
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
[tsconfig.json]
|
[{tsconfig.json,prettierrc.json}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.neon]
|
||||||
|
indent_style = tab
|
||||||
|
128
.github/workflows/REUSABLE_backend.yml
vendored
128
.github/workflows/REUSABLE_backend.yml
vendored
@@ -9,22 +9,42 @@ on:
|
|||||||
default: true
|
default: true
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
enable_phpstan:
|
||||||
|
description: "Enable PHPStan Static Analysis?"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
required: false
|
||||||
|
|
||||||
backend_directory:
|
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.
|
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
|
type: string
|
||||||
required: false
|
required: false
|
||||||
default: '.'
|
default: '.'
|
||||||
|
|
||||||
|
# Only relevant in mono-repos.
|
||||||
|
monorepo_tests:
|
||||||
|
description: "The list of directories to test in a monorepo. This should be a space-separated list of directories relative to the backend directory."
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
|
||||||
php_versions:
|
php_versions:
|
||||||
description: Versions of PHP to test with. Should be array of strings encoded as JSON array
|
description: Versions of PHP to test with. Should be array of strings encoded as JSON array
|
||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
default: '["7.3", "7.4", "8.0", "8.1"]'
|
# Keep PHP versions synced with build-install-packages.yml
|
||||||
|
default: '["8.1", "8.2", "8.3"]'
|
||||||
|
|
||||||
|
php_extensions:
|
||||||
|
description: PHP extensions to install.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: 'curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip'
|
||||||
|
|
||||||
db_versions:
|
db_versions:
|
||||||
description: Versions of databases to test with. Should be array of strings encoded as JSON array
|
description: Versions of databases to test with. Should be array of strings encoded as JSON array
|
||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
default: '["mysql:5.7", "mysql:8.0.30", "mariadb"]'
|
default: '["mysql:5.7", "mysql:8.0.30", "mysql:8.1.0", "mariadb", "postgres:16"]'
|
||||||
|
|
||||||
php_ini_values:
|
php_ini_values:
|
||||||
description: PHP ini values
|
description: PHP ini values
|
||||||
@@ -32,9 +52,16 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
default: error_reporting=E_ALL
|
default: error_reporting=E_ALL
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
composer_auth:
|
||||||
|
description: The Composer auth tokens to use for private packages.
|
||||||
|
required: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
COMPOSER_ROOT_VERSION: dev-main
|
COMPOSER_ROOT_VERSION: dev-main
|
||||||
|
# `inputs.composer_directory` defaults to `inputs.backend_directory`
|
||||||
FLARUM_TEST_TMP_DIR_LOCAL: tests/integration/tmp
|
FLARUM_TEST_TMP_DIR_LOCAL: tests/integration/tmp
|
||||||
|
COMPOSER_AUTH: ${{ secrets.composer_auth }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -45,6 +72,7 @@ jobs:
|
|||||||
php: ${{ fromJSON(inputs.php_versions) }}
|
php: ${{ fromJSON(inputs.php_versions) }}
|
||||||
service: ${{ fromJSON(inputs.db_versions) }}
|
service: ${{ fromJSON(inputs.db_versions) }}
|
||||||
prefix: ['']
|
prefix: ['']
|
||||||
|
php_ini_values: [inputs.php_ini_values]
|
||||||
|
|
||||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude
|
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude
|
||||||
include:
|
include:
|
||||||
@@ -55,6 +83,8 @@ jobs:
|
|||||||
db: MySQL 8.0
|
db: MySQL 8.0
|
||||||
- service: mariadb
|
- service: mariadb
|
||||||
db: MariaDB
|
db: MariaDB
|
||||||
|
- service: 'mysql:8.1.0'
|
||||||
|
db: MySQL 8.1
|
||||||
|
|
||||||
# Include Database prefix tests with only one PHP version.
|
# Include Database prefix tests with only one PHP version.
|
||||||
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||||
@@ -72,19 +102,30 @@ jobs:
|
|||||||
db: MariaDB
|
db: MariaDB
|
||||||
prefix: flarum_
|
prefix: flarum_
|
||||||
prefixStr: (prefix)
|
prefixStr: (prefix)
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||||
|
service: 'mysql:8.1.0'
|
||||||
|
db: MySQL 8.1
|
||||||
|
prefix: flarum_
|
||||||
|
prefixStr: (prefix)
|
||||||
|
|
||||||
# To reduce number of actions, we exclude some PHP versions from running with some DB versions.
|
# To reduce number of actions, we exclude some PHP versions from running with some DB versions.
|
||||||
exclude:
|
exclude:
|
||||||
- php: ${{ fromJSON(inputs.php_versions)[1] }}
|
- php: ${{ fromJSON(inputs.php_versions)[1] }}
|
||||||
service: 'mysql:8.0.30'
|
service: 'mysql:8.0.30'
|
||||||
- php: ${{ fromJSON(inputs.php_versions)[2] }}
|
|
||||||
service: 'mysql:8.0.30'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: ${{ matrix.service }}
|
image: ${{ matrix.service }}
|
||||||
ports:
|
ports:
|
||||||
- 13306:3306
|
- 13306:3306
|
||||||
|
postgres:
|
||||||
|
image: ${{ matrix.service }}
|
||||||
|
ports:
|
||||||
|
- 13306:5432
|
||||||
|
env:
|
||||||
|
POSTGRES_USER: root
|
||||||
|
POSTGRES_PASSWORD: root
|
||||||
|
POSTGRES_DB: flarum_test
|
||||||
|
|
||||||
name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}'
|
name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}'
|
||||||
|
|
||||||
@@ -100,33 +141,86 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php }}
|
php-version: ${{ matrix.php }}
|
||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
extensions: curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
|
extensions: ${{ inputs.php_extensions }}
|
||||||
tools: phpunit, composer:v2
|
tools: phpunit, composer:v2
|
||||||
ini-values: ${{ inputs.php_ini_values }}
|
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
|
- name: Create MySQL Database
|
||||||
run: |
|
run: |
|
||||||
sudo systemctl start mysql
|
sudo systemctl start mysql
|
||||||
mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 13306
|
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
|
- name: Install Composer dependencies
|
||||||
run: composer install
|
run: composer install
|
||||||
working-directory: ${{ inputs.backend_directory }}
|
working-directory: ${{ inputs.backend_directory }}
|
||||||
|
|
||||||
- name: Setup Composer tests
|
# If we have a `inputs.monorepo_tests`, we will run tests for each item of the provided array in a ::group::item
|
||||||
run: composer test:setup
|
# If we don't have a `inputs.monorepo_tests`, we will run tests for the current repository
|
||||||
|
# We also have to run the `composer test:setup` script first before running each test
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
if [ -z "${{ inputs.monorepo_tests }}" ]; then
|
||||||
|
composer test:setup
|
||||||
|
composer test
|
||||||
|
else
|
||||||
|
for test in ${{ inputs.monorepo_tests }}; do
|
||||||
|
echo "::group::Running tests for $test"
|
||||||
|
composer test:setup --working-dir=$test
|
||||||
|
composer test --working-dir=$test
|
||||||
|
echo "::endgroup::"
|
||||||
|
done
|
||||||
|
fi
|
||||||
working-directory: ${{ inputs.backend_directory }}
|
working-directory: ${{ inputs.backend_directory }}
|
||||||
env:
|
env:
|
||||||
DB_PORT: 13306
|
DB_PORT: 13306
|
||||||
DB_PASSWORD: root
|
DB_PASSWORD: root
|
||||||
DB_PREFIX: ${{ matrix.prefix }}
|
DB_PREFIX: ${{ matrix.prefix }}
|
||||||
|
|
||||||
- name: Run Composer tests
|
|
||||||
run: composer test
|
|
||||||
working-directory: ${{ inputs.backend_directory }}
|
|
||||||
env:
|
|
||||||
COMPOSER_PROCESS_TIMEOUT: 600
|
COMPOSER_PROCESS_TIMEOUT: 600
|
||||||
|
|
||||||
|
phpstan:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
php: ${{ fromJSON(inputs.php_versions) }}
|
||||||
|
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:8.0.30
|
||||||
|
ports:
|
||||||
|
- 33306:3306
|
||||||
|
|
||||||
|
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: Create MySQL Database
|
||||||
|
run: |
|
||||||
|
sudo systemctl start mysql
|
||||||
|
mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 33306
|
||||||
|
|
||||||
|
- name: Run PHPStan
|
||||||
|
run: composer analyse:phpstan
|
||||||
|
env:
|
||||||
|
DB_PORT: 33306
|
||||||
|
DB_PASSWORD: root
|
||||||
|
COMPOSER_PROCESS_TIMEOUT: 600
|
||||||
|
FLARUM_TEST_TMP_DIR_LOCAL: ./tmp
|
||||||
|
24
.github/workflows/REUSABLE_frontend.yml
vendored
24
.github/workflows/REUSABLE_frontend.yml
vendored
@@ -28,6 +28,11 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
default: check-typings-coverage
|
default: check-typings-coverage
|
||||||
|
test_script:
|
||||||
|
description: "Script to run for tests. Empty value to disable."
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: test
|
||||||
|
|
||||||
enable_bundlewatch:
|
enable_bundlewatch:
|
||||||
description: "Enable Bundlewatch?"
|
description: "Enable Bundlewatch?"
|
||||||
@@ -44,6 +49,11 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
required: false
|
required: false
|
||||||
|
enable_tests:
|
||||||
|
description: "Enable Tests?"
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
required: false
|
||||||
|
|
||||||
backend_directory:
|
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.
|
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.
|
||||||
@@ -80,11 +90,15 @@ on:
|
|||||||
bundlewatch_github_token:
|
bundlewatch_github_token:
|
||||||
description: The GitHub token to use for Bundlewatch.
|
description: The GitHub token to use for Bundlewatch.
|
||||||
required: false
|
required: false
|
||||||
|
composer_auth:
|
||||||
|
description: The Composer auth tokens to use for private packages.
|
||||||
|
required: false
|
||||||
|
|
||||||
env:
|
env:
|
||||||
COMPOSER_ROOT_VERSION: dev-main
|
COMPOSER_ROOT_VERSION: dev-main
|
||||||
ci_script: ${{ inputs.js_package_manager == 'yarn' && 'yarn install --immutable' || 'npm ci' }}
|
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) }}
|
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 }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -96,10 +110,10 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ inputs.node_version }}
|
node-version: ${{ inputs.node_version }}
|
||||||
cache: ${{ inputs.js_package_manager }}
|
cache: ${{ inputs.js_package_manager }}
|
||||||
@@ -108,7 +122,7 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.0'
|
php-version: '8.2'
|
||||||
extensions: curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
|
extensions: curl, dom, gd, json, mbstring, openssl, pdo_mysql, tokenizer, zip
|
||||||
tools: composer:v2
|
tools: composer:v2
|
||||||
|
|
||||||
@@ -122,7 +136,7 @@ jobs:
|
|||||||
working-directory: ${{ inputs.frontend_directory }}
|
working-directory: ${{ inputs.frontend_directory }}
|
||||||
|
|
||||||
- name: JS Checks & Production Build
|
- name: JS Checks & Production Build
|
||||||
uses: flarum/action-build@3
|
uses: flarum/action-build@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
build_script: ${{ inputs.build_script }}
|
build_script: ${{ inputs.build_script }}
|
||||||
@@ -130,6 +144,7 @@ jobs:
|
|||||||
format_script: ${{ inputs.enable_prettier == true && inputs.format_script || '' }}
|
format_script: ${{ inputs.enable_prettier == true && inputs.format_script || '' }}
|
||||||
check_typings_script: ${{ inputs.enable_typescript == true && inputs.check_typings_script || '' }}
|
check_typings_script: ${{ inputs.enable_typescript == true && inputs.check_typings_script || '' }}
|
||||||
type_coverage_script: ${{ inputs.enable_typescript == true && inputs.type_coverage_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 }}
|
package_manager: ${{ inputs.js_package_manager }}
|
||||||
js_path: ${{ inputs.frontend_directory }}
|
js_path: ${{ inputs.frontend_directory }}
|
||||||
do_not_commit: ${{ github.ref != format('refs/heads/{0}', inputs.main_git_branch) || github.event_name != 'push' }}
|
do_not_commit: ${{ github.ref != format('refs/heads/{0}', inputs.main_git_branch) || github.event_name != 'push' }}
|
||||||
@@ -141,3 +156,4 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.bundlewatch_github_token }}
|
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.bundlewatch_github_token }}
|
||||||
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
|
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
|
||||||
|
CI_BRANCH_BASE: ${{ github.event.pull_request.base.ref }}
|
||||||
|
11
.github/workflows/backend.yml
vendored
Normal file
11
.github/workflows/backend.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
name: Backend Tests
|
||||||
|
|
||||||
|
on: [workflow_dispatch, push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
run:
|
||||||
|
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||||
|
with:
|
||||||
|
enable_backend_testing: true
|
||||||
|
backend_directory: .
|
||||||
|
monorepo_tests: "framework/core extensions/akismet extensions/approval extensions/flags extensions/likes extensions/mentions extensions/nicknames extensions/statistics extensions/sticky extensions/subscriptions extensions/suspend extensions/tags"
|
29
.github/workflows/build-install-packages.yml
vendored
Normal file
29
.github/workflows/build-install-packages.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
name: Build Install Packages
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
|
||||||
|
env:
|
||||||
|
VERSION: ${{ github.event.release.tag_name }}
|
||||||
|
PHP_VERSIONS: '8.1 8.2 8.3'
|
||||||
|
INSTALL_PACKAGES_INPUTS: '{ "flarum_version": "{0}", "php_versions": "{1}" }'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
delay:
|
||||||
|
name: Wait for packagist to publish new packages
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: sleep 30m
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build Installation Packages
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Trigger build in flarum/installation-packages
|
||||||
|
uses: benc-uk/workflow-dispatch@v1
|
||||||
|
with:
|
||||||
|
workflow: Build Flarum Install Packages
|
||||||
|
repo: flarum/installation-packages
|
||||||
|
token: ${{ secrets.PACKAGES_BUILD_TOKEN }}
|
||||||
|
inputs: ${{ format(env.INSTALL_PACKAGES_INPUTS, env.VERSION, env.PHP_VERSIONS) }}
|
11
.github/workflows/flarum-akismet-backend.yml
vendored
11
.github/workflows/flarum-akismet-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Akismet PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/akismet
|
|
11
.github/workflows/flarum-approval-backend.yml
vendored
11
.github/workflows/flarum-approval-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Approval PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/approval
|
|
11
.github/workflows/flarum-core-backend.yml
vendored
11
.github/workflows/flarum-core-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Core PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./framework/core
|
|
11
.github/workflows/flarum-embed-backend.yml
vendored
11
.github/workflows/flarum-embed-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Embed PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: false
|
|
||||||
|
|
||||||
backend_directory: ./extensions/embed
|
|
11
.github/workflows/flarum-flags-backend.yml
vendored
11
.github/workflows/flarum-flags-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Flags PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/flags
|
|
11
.github/workflows/flarum-likes-backend.yml
vendored
11
.github/workflows/flarum-likes-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Likes PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/likes
|
|
11
.github/workflows/flarum-lock-backend.yml
vendored
11
.github/workflows/flarum-lock-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Lock PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: false
|
|
||||||
|
|
||||||
backend_directory: ./extensions/lock
|
|
11
.github/workflows/flarum-markdown-backend.yml
vendored
11
.github/workflows/flarum-markdown-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Markdown PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: false
|
|
||||||
|
|
||||||
backend_directory: ./extensions/markdown
|
|
11
.github/workflows/flarum-mentions-backend.yml
vendored
11
.github/workflows/flarum-mentions-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Mentions PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/mentions
|
|
11
.github/workflows/flarum-nicknames-backend.yml
vendored
11
.github/workflows/flarum-nicknames-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Nicknames PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/nicknames
|
|
@@ -1,11 +0,0 @@
|
|||||||
name: Package Manager PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/package-manager
|
|
11
.github/workflows/flarum-pusher-backend.yml
vendored
11
.github/workflows/flarum-pusher-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Pusher PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: false
|
|
||||||
|
|
||||||
backend_directory: ./extensions/pusher
|
|
11
.github/workflows/flarum-statistics-backend.yml
vendored
11
.github/workflows/flarum-statistics-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Statistics PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/statistics
|
|
11
.github/workflows/flarum-sticky-backend.yml
vendored
11
.github/workflows/flarum-sticky-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Sticky PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/sticky
|
|
@@ -1,11 +0,0 @@
|
|||||||
name: Subscriptions PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/subscriptions
|
|
11
.github/workflows/flarum-suspend-backend.yml
vendored
11
.github/workflows/flarum-suspend-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Suspend PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/suspend
|
|
11
.github/workflows/flarum-tags-backend.yml
vendored
11
.github/workflows/flarum-tags-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Tags PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: true
|
|
||||||
|
|
||||||
backend_directory: ./extensions/tags
|
|
6
.github/workflows/frontend.yml
vendored
6
.github/workflows/frontend.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Framework JS
|
name: Frontend Workflow
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
on: [workflow_dispatch, push, pull_request]
|
||||||
|
|
||||||
@@ -10,7 +10,9 @@ jobs:
|
|||||||
backend_directory: ./
|
backend_directory: ./
|
||||||
js_package_manager: yarn
|
js_package_manager: yarn
|
||||||
cache_dependency_path: ./yarn.lock
|
cache_dependency_path: ./yarn.lock
|
||||||
main_git_branch: main
|
main_git_branch: 2.x
|
||||||
|
enable_tests: true
|
||||||
|
enable_bundlewatch: true
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
name: Emoji PHP
|
name: Static Code Analysis
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
on: [workflow_dispatch, push, pull_request]
|
||||||
|
|
||||||
@@ -7,5 +7,5 @@ jobs:
|
|||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||||
with:
|
with:
|
||||||
enable_backend_testing: false
|
enable_backend_testing: false
|
||||||
|
enable_phpstan: true
|
||||||
backend_directory: ./extensions/emoji
|
backend_directory: .
|
8
.github/workflows/prepare-release.yml
vendored
8
.github/workflows/prepare-release.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- name: Prepare release
|
- name: Prepare release
|
||||||
uses: flarum/action-release@master
|
uses: flarum/action-release@master
|
||||||
env:
|
with:
|
||||||
NEXT_TAG: ${{ inputs.version }}
|
next_tag: ${{ inputs.version }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
OPEN_COLLECTIVE_TOKEN: ${{ secrets.OPEN_COLLECTIVE_TOKEN }}
|
open_collective_token: ${{ secrets.OPEN_COLLECTIVE_TOKEN }}
|
||||||
|
174
CHANGELOG.md
174
CHANGELOG.md
@@ -1,5 +1,178 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [v1.8.1](https://github.com/flarum/framework/compare/v1.8.0...v1.8.1)
|
||||||
|
### Fixed
|
||||||
|
* recover temporary solution for html entities in browser title (e72541e35de4f71f9d870bbd9bb46ddf586bdf1d)
|
||||||
|
* custom contrast color affected by parents (577890d89c593ae5b6cb96083fab69e2f1ae600c)
|
||||||
|
* reply placeholder wrong positioning (253a3d281dbf5ce3fa712b629b80587cf67e7dbe)
|
||||||
|
* (mentions) missed post mentions UI changes with lazy loading [#3832]
|
||||||
|
* (mentions) cannot use newly introduced mentionables extender [#3849]
|
||||||
|
* (mentions) missing slug from post mention links ([5a4bb7c](5a4bb7ccf226f66dd44816cb69b3d7cfe4ad7f7c))
|
||||||
|
|
||||||
|
## [v1.8.0](https://github.com/flarum/framework/compare/v1.7.1...v1.8.0)
|
||||||
|
### Fixed
|
||||||
|
- (a11y) reply placeholder not accessible [#3793]
|
||||||
|
- (bbcode) highlight.js does not work after changing post content [#3817]
|
||||||
|
- (bbcode) localize quote `wrote` string [#3809]
|
||||||
|
- (mentions) mentions XHR fired even after mentioning is done [#3806]
|
||||||
|
- (package-manager) available core updates cause an error in the dashboard ([fab71f2](fab71f2d01fa20ce9b3002833339dc5ea3ea6301))
|
||||||
|
- (tags) not all tags are loaded in the permission grid [#3804]
|
||||||
|
- (tags) tag discussion modal filters with exact matches only after first index [#3786]
|
||||||
|
- (testing) always clear cache in integration test's tearDown [#3818]
|
||||||
|
- `UserSecurityPage` not exported ([232618a](232618aba604ab003425df38b895208c863d3260))
|
||||||
|
- `isDark()` utility can receive null value [#3774]
|
||||||
|
- approving a post does not bump user `comment_count` [#3790]
|
||||||
|
- circular dependencies disable all involved extensions [#3785]
|
||||||
|
- color input overflowing the input box [#3796]
|
||||||
|
- deleting a discussion from the profile does not visually remove it [#3799]
|
||||||
|
- discussion page showing horizontal scroll on iOS [#3821]
|
||||||
|
- empty string displayed as SelectDropdown title [#3773]
|
||||||
|
- filter values are not validated [#3795]
|
||||||
|
- infinite scroll not initialized for notifications on big screens [#3733]
|
||||||
|
- notification subject discussion eager loading fails [#3788]
|
||||||
|
- null as 2nd param in `preg_match` is deprecated [#3801]
|
||||||
|
- unread count in post stream not visible [#3791]
|
||||||
|
- unreadable badge icon on certain colors [#3810]
|
||||||
|
- integrity constraint violation [#3772]
|
||||||
|
### Changed
|
||||||
|
- (core,mentions) limit `mentionedBy` post relation results [#3780]
|
||||||
|
- (likes) limit `likes` relationship results [#3781]
|
||||||
|
- Change some methods from private to protected, to be able to extend the affected classes [#3802]
|
||||||
|
- Do not catch exceptions when testing Console commands [#3813]
|
||||||
|
- drop usage of jquery in `install` and `update` interfaces [#3797]
|
||||||
|
- extensibility improvements [#3729]
|
||||||
|
- major frontend JS cleanup [#3609]
|
||||||
|
- revert ineffective code for encoding of page title [#3768]
|
||||||
|
- speed up post creation time [#3808]
|
||||||
|
### Added
|
||||||
|
- (mentions,tags) tag mentions [#3769]
|
||||||
|
- add delete own posts permission [#3784]
|
||||||
|
- add a trait to flush the formatter cache in tests [#3811]
|
||||||
|
- add user creation to users list page [#3744]
|
||||||
|
- cli command for enabling or disabling an extension [#3816]
|
||||||
|
- conditional extenders [#3759]
|
||||||
|
- provide old content to `Revised` event [#3789]
|
||||||
|
|
||||||
|
## [v1.7.1](https://github.com/flarum/framework/compare/v1.7.0...v1.7.1)
|
||||||
|
### Fixed
|
||||||
|
- (tags) composer tag selection modal using wrong primary max & min numbers (abc9670659426b765274376945b818b70d84848c)
|
||||||
|
- missing parameter names in token title translation. (#3752)
|
||||||
|
- hardcoded language strings in StatusWidget (#3754)
|
||||||
|
- hide developer tokens section in if there is nothing to display or create (#3753)
|
||||||
|
- improve sessions user UI on mobile (dd868ab44e11e892d020e3b9412553c6a789e68d)
|
||||||
|
|
||||||
|
## [v1.7.0](https://github.com/flarum/framework/compare/v1.6.3...v1.7.0)
|
||||||
|
### Added
|
||||||
|
- (actions) allow running JS tests in GH actions [#3730]
|
||||||
|
- (core) PHP 8.2 Support [#3709]
|
||||||
|
- (jest) create jest config package for unit testing [#3678]
|
||||||
|
- (jest) mithril component testing [#3679]
|
||||||
|
- (phpstan) foundation for usage in extensions [#3666]
|
||||||
|
- (seo) Do not use h3 header for poster author in posts stream [#3732]
|
||||||
|
- (seo) Use h2 header for discussions on discussions list [#3731]
|
||||||
|
- (seo) shift h1 tag from logo to discussion title [#3724]
|
||||||
|
- (tags) admin tag selection component (reusable tag selection modal) [#3686]
|
||||||
|
- Admin User Search [#3712]
|
||||||
|
- access tokens user management UI [#3587]
|
||||||
|
- add display name column to admin users list [#3740]
|
||||||
|
- allow push additional items to the end of the poststream [#3691]
|
||||||
|
- allow using utf8 characters in tag slugs [#3588]
|
||||||
|
- expose queue driver, schedule status [#3593]
|
||||||
|
- expose {time} to eventPost data, fix renamed tooltip [#3698]
|
||||||
|
- frontend `Model` extender [#3646]
|
||||||
|
- global logout to clear all sessions, access tokens, email tokens and password tokens [#3605]
|
||||||
|
- improved page navigation for users list [#3741]
|
||||||
|
- introduce frontend extenders [#3645]
|
||||||
|
### Fixed
|
||||||
|
- (mentions) correctly convert a 3 char. hex color to a 6 char. one [#3694]
|
||||||
|
- (mentions) post reply mention missing notification on approval [#3738]
|
||||||
|
- (phpstan) adapt phpstan package for extension use [#3727]
|
||||||
|
- (tags) clickable tag labels have underline [#3737]
|
||||||
|
- (tags) tag text color contrast [#3653]
|
||||||
|
- 3 digit hex color value in color input not supported [#3706]
|
||||||
|
- column `id` can be ambiguous in group filter with extensions [#3696]
|
||||||
|
- disallow certain dangerous LESS features ([1761660](1761660c98ea5a3e9665fb8e6041d1f2ee62a444))
|
||||||
|
- evaluated page title content [#3684]
|
||||||
|
- invalid translation key for scheduler dashboard [#3736]
|
||||||
|
- load actor.groups on showforumcontroller [#3716]
|
||||||
|
- make go-to-page input number-like [#3743]
|
||||||
|
- normal logout affects all sessions [#3571]
|
||||||
|
- permissions table on mobile is unusable [#3722]
|
||||||
|
- post dropdown opens all dropdowns in `.Post-actions` [#3675]
|
||||||
|
- typo in Formatter extender docblock [#3676]
|
||||||
|
- undefined showing in dropdown active title [#3700]
|
||||||
|
### Changed
|
||||||
|
- (phpstan) enable phpstan in bundled extensions [#3667]
|
||||||
|
- Add missing states exports to `compat.ts` [#3683]
|
||||||
|
- Indicate cross-origin request in generic error message [#3669]
|
||||||
|
- Merge branch 'release/v1.6.2' ([e0b9dcf](e0b9dcfbcd7db175368dbc98255f9223da8df17d))
|
||||||
|
- The negate field doesn't get used, which means you cant exclude tags [#3713]
|
||||||
|
- Update forum.less to fix the misalignment of the choose tags button [#3726]
|
||||||
|
- `yarn audit-fix` ([8ddb0fe](8ddb0feb097dad06c5763107d7a7f7b5a55562c4))
|
||||||
|
- `yarn` ([ee1e04c](ee1e04cdc26b3e63057a58899f32f482901a95fd))
|
||||||
|
- convert `Dropdown` components to TS [#3608]
|
||||||
|
- fix php 8.1 on preg_match 2nd argument being null, which also optimizes slightly ([d7b9a03](d7b9a03f31847c39631ba495df8f515509774610))
|
||||||
|
- improve group mentions parsing [#3723]
|
||||||
|
- prepare `@flarum/jest-config` for release ([748cca6](748cca6d12f8b1744a6017c09395725bdbb4a118))
|
||||||
|
- remove use of deprecated phpunit assertion ([3af0481](3af0481f304277f5380fac9c9b169a7fa651f53b))
|
||||||
|
- set flarum version to 1.7.0 for dev ([2517bc0](2517bc0f70b0f0e3d3ea3f6ae06af8604d89b25d))
|
||||||
|
- update JS dependencies [#3695]
|
||||||
|
|
||||||
|
## [v1.6.3](https://github.com/flarum/framework/compare/v1.6.2...v1.6.3)
|
||||||
|
### Fixed
|
||||||
|
* Post mentions can be used to read any post on the forum without access control (ab1c868b978e8b0d09a5d682c54665dae17d0985).
|
||||||
|
* Notifications can leak restricted content (d0a2b95dca57d3dae9a0d77b610b1cb1d0b1766a).
|
||||||
|
* Any user including unactivated can reply in public discussions whose first post was permanently deleted (12f14112a0ecd1484d97330b82beb2a145919015).
|
||||||
|
* (subscriptions) Post notifications not getting access checked (https://github.com/flarum/framework/commit/e5f05166a062a9a6eb7c12e28728bfd5db7270e3).
|
||||||
|
|
||||||
|
## [v1.6.2](https://github.com/flarum/framework/compare/v1.6.1...v1.6.2)
|
||||||
|
### Fixed
|
||||||
|
* XSS Vulnerability in core (https://github.com/flarum/framework/pull/3684).
|
||||||
|
|
||||||
|
## [v1.6.1](https://github.com/flarum/framework/compare/v1.6.0...v1.6.1)
|
||||||
|
### Fixed
|
||||||
|
* JS dependencies update breaks utilities.
|
||||||
|
|
||||||
|
## [v1.6.0](https://github.com/flarum/framework/compare/v1.5.0...v1.6.0)
|
||||||
|
### Fixed
|
||||||
|
- (approval) posts approved for deleted users error ([b5874a0](b5874a08e482196f50af50aa78e43c93c29fb647))
|
||||||
|
- (regression) bad import ([5f2d7fb](5f2d7fb7b6e430d40cf2bb05eca7c73f6ca5a2cc))
|
||||||
|
- akismet fails when the extension is not on a version ([45d9121](45d91212f6bfa777cae9fc06c55c85d01ffd174d))
|
||||||
|
- apply flex for AppearancePage colors input [#3651]
|
||||||
|
- groupmentions have poor contrast on some backgrounds [#3672]
|
||||||
|
- larastan v1 incompatible with phpstan v1.9.0 [#3665]
|
||||||
|
- package manager failures not showing alerts [#3647]
|
||||||
|
- password reset leaks user existence [#3616]
|
||||||
|
- statistics previous period chart is unclear [#3654]
|
||||||
|
### Changed
|
||||||
|
- (package-manager) config composer to use web php version ([fd19645](fd196454a5641776784fa80886cc7577c840f8ed))
|
||||||
|
- (package-manager) set min core version and add warning ([31c3cfc](31c3cfc4eab4c314260b9b0d11e53ac2d4be158d))
|
||||||
|
- (statistics) prepare v1.5.1 ([dc215ab](dc215aba59145dfd7b0d6efad4388444f30e47fb))
|
||||||
|
- Apply fixes from StyleCI ([267f675](267f6759f80bd06f468337245ea6045635e827d9))
|
||||||
|
- Fix tag discussion count decreased by 2 when hiding before deleting [#3660]
|
||||||
|
- Log migration path when up/down keys are missing [#3664]
|
||||||
|
- Make it possible to extend SetupScript [#3643]
|
||||||
|
- Setup PHPStan Level 5 [#3553]
|
||||||
|
- `yarn format` ([c5c312d](c5c312db0d800e3b84b94a4abb9691e348dea742))
|
||||||
|
- add missing last period to custom date ranges [#3661]
|
||||||
|
- add priorities to profile settings page [#3657]
|
||||||
|
- allow specifying php extensions in workflow ([b0b47a0](b0b47a0888f513a459b67e9f89e72a61de38f1ce))
|
||||||
|
- format js ([06963df](06963df4079373fc8fc51b7479e9576f02beb098))
|
||||||
|
- group mentions [#3658]
|
||||||
|
- remove styleci from changelog ([b2fa28e](b2fa28e4b57094e46dbdb3d79fab74f290a17d17))
|
||||||
|
- set flarum version to dev for 1.6.0 ([fc743ba](fc743ba88872031db13597d7365a063b8004c78f))
|
||||||
|
- throw an exception when no serializer is provided to the controller [#3614]
|
||||||
|
### Added
|
||||||
|
- (statistics) support for custom date ranges [#3622]
|
||||||
|
- Allow additional login params, Introduce `LogInValidator` [#3670]
|
||||||
|
- Allow additional reset password params, introduce `ForgotPasswordValidator` [#3671]
|
||||||
|
- add statistics chart export button [#3662]
|
||||||
|
- allow specifying extensions when installing an instance [#3655]
|
||||||
|
- contrast util with yiq calculator [#3652]
|
||||||
|
- customizable session driver [#3610]
|
||||||
|
- replace `ColorPreviewInput` for GroupModal color input [#3650]
|
||||||
|
- send notifications of a new reply when post is approved [#3656]
|
||||||
|
|
||||||
## [v1.5.0](https://github.com/flarum/framework/compare/v1.4.0...v1.5.0)
|
## [v1.5.0](https://github.com/flarum/framework/compare/v1.4.0...v1.5.0)
|
||||||
### Fixed
|
### Fixed
|
||||||
- (a11y) add accessible labels to notification grid options [#3520]
|
- (a11y) add accessible labels to notification grid options [#3520]
|
||||||
@@ -38,7 +211,6 @@
|
|||||||
- (statistics) split timed data into per-model XHR requests [#3601]
|
- (statistics) split timed data into per-model XHR requests [#3601]
|
||||||
- (tags) Replace event helper with event dispatcher [#3570]
|
- (tags) Replace event helper with event dispatcher [#3570]
|
||||||
- Add `loading="lazy"` attribute for avatars [#3578]
|
- Add `loading="lazy"` attribute for avatars [#3578]
|
||||||
- Apply fixes from StyleCI ([bb64114](bb641144b6bc5c59798351459fbf8df8cbf6aec6))
|
|
||||||
- Create CODEOWNERS ([6e48a03](6e48a0303e45bcf210e550ba3e0772bc8443a207))
|
- Create CODEOWNERS ([6e48a03](6e48a0303e45bcf210e550ba3e0772bc8443a207))
|
||||||
- MyISAM tables for extensions during installation" ([f128190](f128190f143398dd1262fd1379e634794daee4c1))
|
- MyISAM tables for extensions during installation" ([f128190](f128190f143398dd1262fd1379e634794daee4c1))
|
||||||
- convert `AlertManager` `IndexPage` and `UserPage` components to TS [#3536]
|
- convert `AlertManager` `IndexPage` and `UserPage` components to TS [#3536]
|
||||||
|
@@ -38,3 +38,4 @@ If you discover a security vulnerability within Flarum, please send an e-mail to
|
|||||||
## License
|
## License
|
||||||
|
|
||||||
Flarum is open-source software licensed under the [MIT License](https://github.com/flarum/flarum/blob/master/LICENSE).
|
Flarum is open-source software licensed under the [MIT License](https://github.com/flarum/flarum/blob/master/LICENSE).
|
||||||
|
|
||||||
|
139
composer.json
139
composer.json
@@ -40,12 +40,13 @@
|
|||||||
"Flarum\\": "framework/core/src",
|
"Flarum\\": "framework/core/src",
|
||||||
"Flarum\\Akismet\\": "extensions/akismet/src",
|
"Flarum\\Akismet\\": "extensions/akismet/src",
|
||||||
"Flarum\\Approval\\": "extensions/approval/src",
|
"Flarum\\Approval\\": "extensions/approval/src",
|
||||||
|
"Flarum\\BBCode\\": "extensions/bbcode/src",
|
||||||
"Flarum\\Flags\\": "extensions/flags/src",
|
"Flarum\\Flags\\": "extensions/flags/src",
|
||||||
"Flarum\\Likes\\": "extensions/likes/src",
|
"Flarum\\Likes\\": "extensions/likes/src",
|
||||||
"Flarum\\Lock\\": "extensions/lock/src",
|
"Flarum\\Lock\\": "extensions/lock/src",
|
||||||
"Flarum\\Mentions\\": "extensions/mentions/src",
|
"Flarum\\Mentions\\": "extensions/mentions/src",
|
||||||
"Flarum\\Nicknames\\": "extensions/nicknames/src",
|
"Flarum\\Nicknames\\": "extensions/nicknames/src",
|
||||||
"Flarum\\PackageManager\\": "extensions/package-manager/src",
|
"Flarum\\ExtensionManager\\": "extensions/package-manager/src",
|
||||||
"Flarum\\Pusher\\": "extensions/pusher/src",
|
"Flarum\\Pusher\\": "extensions/pusher/src",
|
||||||
"Flarum\\Statistics\\": "extensions/statistics/src",
|
"Flarum\\Statistics\\": "extensions/statistics/src",
|
||||||
"Flarum\\Sticky\\": "extensions/sticky/src",
|
"Flarum\\Sticky\\": "extensions/sticky/src",
|
||||||
@@ -59,6 +60,26 @@
|
|||||||
"framework/core/src/helpers.php"
|
"framework/core/src/helpers.php"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Flarum\\Tests\\": "tests",
|
||||||
|
"Flarum\\Akismet\\Tests\\": "extensions/akismet/tests",
|
||||||
|
"Flarum\\Approval\\Tests\\": "extensions/approval/tests",
|
||||||
|
"Flarum\\Flags\\Tests\\": "extensions/flags/tests",
|
||||||
|
"Flarum\\Likes\\Tests\\": "extensions/likes/tests",
|
||||||
|
"Flarum\\Lock\\Tests\\": "extensions/lock/tests",
|
||||||
|
"Flarum\\Mentions\\Tests\\": "extensions/mentions/tests",
|
||||||
|
"Flarum\\Nicknames\\Tests\\": "extensions/nicknames/tests",
|
||||||
|
"Flarum\\ExtensionManager\\Tests\\": "extensions/package-manager/tests",
|
||||||
|
"Flarum\\Pusher\\Tests\\": "extensions/pusher/tests",
|
||||||
|
"Flarum\\Statistics\\Tests\\": "extensions/statistics/tests",
|
||||||
|
"Flarum\\Sticky\\Tests\\": "extensions/sticky/tests",
|
||||||
|
"Flarum\\Subscriptions\\Tests\\": "extensions/subscriptions/tests",
|
||||||
|
"Flarum\\Suspend\\Tests\\": "extensions/suspend/tests",
|
||||||
|
"Flarum\\Tags\\Tests\\": "extensions/tags/tests",
|
||||||
|
"Flarum\\Testing\\Tests\\": "php-packages/testing/tests"
|
||||||
|
}
|
||||||
|
},
|
||||||
"replace": {
|
"replace": {
|
||||||
"flarum/core": "self.version",
|
"flarum/core": "self.version",
|
||||||
"flarum/akismet": "self.version",
|
"flarum/akismet": "self.version",
|
||||||
@@ -73,7 +94,7 @@
|
|||||||
"flarum/markdown": "self.version",
|
"flarum/markdown": "self.version",
|
||||||
"flarum/mentions": "self.version",
|
"flarum/mentions": "self.version",
|
||||||
"flarum/nicknames": "self.version",
|
"flarum/nicknames": "self.version",
|
||||||
"flarum/package-manager": "self.version",
|
"flarum/extension-manager": "self.version",
|
||||||
"flarum/pusher": "self.version",
|
"flarum/pusher": "self.version",
|
||||||
"flarum/statistics": "self.version",
|
"flarum/statistics": "self.version",
|
||||||
"flarum/sticky": "self.version",
|
"flarum/sticky": "self.version",
|
||||||
@@ -84,64 +105,71 @@
|
|||||||
"flarum/testing": "self.version"
|
"flarum/testing": "self.version"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
"php": "^8.1",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"php": ">=7.3",
|
"components/font-awesome": "^5.15.0",
|
||||||
"components/font-awesome": "^5.14.0",
|
|
||||||
"composer/composer": "^2.0",
|
"composer/composer": "^2.0",
|
||||||
"dflydev/fig-cookies": "^3.0.0",
|
"dflydev/fig-cookies": "^3.0",
|
||||||
"doctrine/dbal": "^2.7",
|
"doctrine/dbal": "^3.6.2",
|
||||||
"dragonmantank/cron-expression": "^3.1.0",
|
"dragonmantank/cron-expression": "^3.3",
|
||||||
"franzl/whoops-middleware": "^2.0.0",
|
"franzl/whoops-middleware": "2.0",
|
||||||
"guzzlehttp/guzzle": "^6.0|^7.4",
|
"guzzlehttp/guzzle": "*",
|
||||||
"illuminate/bus": "^8.0",
|
"illuminate/bus": "^10.0",
|
||||||
"illuminate/cache": "^8.0",
|
"illuminate/cache": "^10.0",
|
||||||
"illuminate/config": "^8.0",
|
"illuminate/config": "^10.0",
|
||||||
"illuminate/console": "^8.0",
|
"illuminate/console": "^10.0",
|
||||||
"illuminate/container": "^8.0",
|
"illuminate/container": "^10.0",
|
||||||
"illuminate/contracts": "^8.0",
|
"illuminate/contracts": "^10.0",
|
||||||
"illuminate/database": "^8.0",
|
"illuminate/database": "^10.0",
|
||||||
"illuminate/events": "^8.0",
|
"illuminate/events": "^10.0",
|
||||||
"illuminate/filesystem": "^8.0",
|
"illuminate/filesystem": "^10.0",
|
||||||
"illuminate/hashing": "^8.0",
|
"illuminate/hashing": "^10.0",
|
||||||
"illuminate/mail": "^8.0",
|
"illuminate/mail": "^10.0",
|
||||||
"illuminate/queue": "^8.0",
|
"illuminate/queue": "^10.0",
|
||||||
"illuminate/session": "^8.0",
|
"illuminate/session": "^10.0",
|
||||||
"illuminate/support": "^8.0",
|
"illuminate/support": "^10.0",
|
||||||
"illuminate/validation": "^8.0",
|
"illuminate/validation": "^10.0",
|
||||||
"illuminate/view": "^8.0",
|
"illuminate/view": "^10.0",
|
||||||
"intervention/image": "2.5.* || ^2.6.1",
|
"intervention/image": "^3.2",
|
||||||
"laminas/laminas-diactoros": "^2.4.1",
|
"jenssegers/agent": "^2.6",
|
||||||
"laminas/laminas-httphandlerrunner": "^1.2.0",
|
"laminas/laminas-diactoros": "^3.0",
|
||||||
"laminas/laminas-stratigility": "^3.2.2",
|
"laminas/laminas-httphandlerrunner": "^2.6",
|
||||||
"league/flysystem": "^1.0.11",
|
"laminas/laminas-stratigility": "^3.10",
|
||||||
|
"league/flysystem": "^3.15",
|
||||||
|
"league/flysystem-memory": "^3.15",
|
||||||
"matthiasmullie/minify": "^1.3",
|
"matthiasmullie/minify": "^1.3",
|
||||||
"middlewares/base-path": "^2.0.1",
|
"middlewares/base-path": "^v2.1",
|
||||||
"middlewares/base-path-router": "^2.0.1",
|
"middlewares/base-path-router": "^2.0.1",
|
||||||
"middlewares/request-handler": "^2.0.1",
|
"middlewares/request-handler": "^2.0.2",
|
||||||
"monolog/monolog": "^1.16.0",
|
"monolog/monolog": "^3.3",
|
||||||
"nesbot/carbon": "^2.0",
|
"nesbot/carbon": "^2.66",
|
||||||
"nikic/fast-route": "^0.6",
|
"nikic/fast-route": "^1.3",
|
||||||
"psr/http-message": "^1.0",
|
"psr/http-message": "^1.1",
|
||||||
"psr/http-server-handler": "^1.0",
|
"psr/http-server-handler": "^1.0.2",
|
||||||
"psr/http-server-middleware": "^1.0",
|
"psr/http-server-middleware": "^1.0.2",
|
||||||
"pusher/pusher-php-server": "^2.2",
|
"pusher/pusher-php-server": "^7.2",
|
||||||
"s9e/text-formatter": "^2.3.6",
|
"s9e/text-formatter": "^2.13",
|
||||||
|
"staudenmeir/eloquent-eager-limit": "^1.8.2",
|
||||||
"sycho/json-api": "^0.5.0",
|
"sycho/json-api": "^0.5.0",
|
||||||
"sycho/sourcemap": "^2.0.0",
|
"sycho/sourcemap": "^2.0.0",
|
||||||
"symfony/config": "^5.2.2",
|
"symfony/config": "^6.3",
|
||||||
"symfony/console": "^5.2.2",
|
"symfony/console": "^6.3",
|
||||||
"symfony/event-dispatcher": "^5.2.2",
|
"symfony/event-dispatcher": "^6.3",
|
||||||
"symfony/mime": "^5.2.0",
|
"symfony/http-client": "^6.3",
|
||||||
"symfony/polyfill-intl-messageformatter": "^1.22.0",
|
"symfony/mailgun-mailer": "^6.3",
|
||||||
"symfony/translation": "^5.1.5",
|
"symfony/mime": "^6.3",
|
||||||
"symfony/yaml": "^5.2.2",
|
"symfony/polyfill-intl-messageformatter": "^1.27",
|
||||||
"wikimedia/less.php": "^3.0"
|
"symfony/postmark-mailer": "^6.3",
|
||||||
|
"symfony/translation": "^6.3",
|
||||||
|
"symfony/yaml": "^6.3",
|
||||||
|
"wikimedia/less.php": "^4.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mockery/mockery": "^1.4",
|
"mockery/mockery": "^1.5",
|
||||||
"phpunit/phpunit": "^9.0",
|
"phpunit/phpunit": "^9.0",
|
||||||
"phpstan/phpstan-php-parser": "^1.0",
|
"phpstan/phpstan": "^1.10.0",
|
||||||
"phpstan/phpstan": "^1.2"
|
"larastan/larastan": "^2.7",
|
||||||
|
"symfony/var-dumper": "^6.3"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"sort-packages": true
|
"sort-packages": true
|
||||||
@@ -171,12 +199,19 @@
|
|||||||
"extensions/tags"
|
"extensions/tags"
|
||||||
],
|
],
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "1.x-dev"
|
"dev-main": "2.x-dev"
|
||||||
},
|
},
|
||||||
"phpstan": {
|
"phpstan": {
|
||||||
"includes": [
|
"includes": [
|
||||||
"extension.neon"
|
"extension.neon"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"analyse:phpstan": "phpstan analyse",
|
||||||
|
"clear-cache:phpstan": "phpstan clear-result-cache"
|
||||||
|
},
|
||||||
|
"scripts-descriptions": {
|
||||||
|
"analyse:phpstan": "Run static analysis"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,8 +19,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.5",
|
"flarum/core": "^2.0",
|
||||||
"flarum/approval": "^1.2"
|
"flarum/approval": "^2.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "1.x-dev"
|
"dev-main": "2.x-dev"
|
||||||
},
|
},
|
||||||
"flarum-extension": {
|
"flarum-extension": {
|
||||||
"title": "Akismet",
|
"title": "Akismet",
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
"test:setup": "Sets up a database for use with integration tests. Execute this only once."
|
"test:setup": "Sets up a database for use with integration tests. Execute this only once."
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"flarum/testing": "^1.0.0"
|
"flarum/testing": "^2.0"
|
||||||
},
|
},
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
{
|
||||||
|
@@ -13,6 +13,7 @@ use Flarum\Approval\Event\PostWasApproved;
|
|||||||
use Flarum\Extend;
|
use Flarum\Extend;
|
||||||
use Flarum\Post\Event\Hidden;
|
use Flarum\Post\Event\Hidden;
|
||||||
use Flarum\Post\Event\Saving;
|
use Flarum\Post\Event\Saving;
|
||||||
|
use Flarum\Post\Post;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
(new Extend\Frontend('forum'))
|
(new Extend\Frontend('forum'))
|
||||||
@@ -30,4 +31,7 @@ return [
|
|||||||
|
|
||||||
(new Extend\ServiceProvider())
|
(new Extend\ServiceProvider())
|
||||||
->register(AkismetProvider::class),
|
->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 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})();
|
(()=>{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.reg.get("core","admin/app");var r=e.n(a);r().initializers.add("flarum-akismet",(()=>{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
|
//# 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,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,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,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,QAEL,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/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":""}
|
{"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,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCC5D,qBAAqB,kBAAkB,KACrC,sBAAsB,kBAAkBW,gBAAgB,CACtDC,QAAS,yBACTC,KAAM,OACNC,MAAO,qBAAqB,yDAC3BH,gBAAgB,CAEjBC,QAAS,qCACTC,KAAM,UACNC,MAAO,qBAAqB,mEAC5BC,KAAM,qBAAqB,oEAC1BC,mBAAmB,CACpBC,KAAM,kBACNH,MAAO,qBAAqB,mDAC5BI,WAAY,iBACX,QAAQ,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/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.reg.get('core', '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.reg.get('core', 'admin/app');","import app from 'flarum/admin/app';\napp.initializers.add('flarum-akismet', () => {\n app.extensionData.for('flarum-akismet').registerSetting({\n setting: 'flarum-akismet.api_key',\n type: 'text',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label')\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 }).registerPermission({\n icon: 'fas fa-vote-yea',\n label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),\n permission: 'bypassAkismet'\n }, 'start');\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","reg","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: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 l=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();if(o&&o.some((function(t){return"akismet"===(null==t?void 0:t.type())}))){var r=t.get("approve");r&&"object"==typeof r&&"children"in r&&(r.children=a().translator.trans("flarum-akismet.forum.post.not_spam_button"))}}})),(0,o.override)(l().prototype,"flagReason",(function(t,e){return"akismet"===e.type()?a().translator.trans("flarum-akismet.forum.post.akismet_flagged_text"):t(e)}))}))})(),module.exports=e})();
|
(()=>{var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},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 r=flarum.reg.get("core","common/extend"),o=flarum.reg.get("core","forum/app");var a=e.n(o);const n=flarum.reg.get("core","forum/utils/PostControls");var s=e.n(n);const l=flarum.reg.get("core","forum/components/Post");var u=e.n(l);a().initializers.add("flarum-akismet",(()=>{(0,r.extend)(s(),"destructiveControls",(function(e,t){if(e.has("approve")){const r=t.flags();if(r&&r.some((e=>"akismet"===(null==e?void 0:e.type())))){const t=e.get("approve");t&&"object"==typeof t&&"children"in t&&(t.children=a().translator.trans("flarum-akismet.forum.post.not_spam_button"))}}})),(0,r.override)(u().prototype,"flagReason",(function(e,t){return"akismet"===t.type()?a().translator.trans("flarum-akismet.forum.post.akismet_flagged_text"):e(t)}))}))})(),module.exports=t})();
|
||||||
//# sourceMappingURL=forum.js.map
|
//# 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,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,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,aCSxDC,IAAAA,aAAAA,IAAqB,kBAAkB,YACrCC,EAAAA,EAAAA,QAAOC,IAAc,uBAAuB,SAAUC,EAAmCC,GACvF,GAAID,EAAME,IAAI,WAAY,CACxB,IAAMC,EAAQF,EAAKE,QAEnB,GAAIA,GAASA,EAAMC,MAAK,SAACC,GAAD,MAA2B,aAAb,MAAJA,OAAA,EAAAA,EAAMC,OAAhB,IAAuC,CAC7D,IAAMC,EAAcP,EAAMf,IAAI,WAC1BsB,GAAsC,iBAAhBA,GAA4B,aAAcA,IAClEA,EAAYC,SAAWX,IAAAA,WAAAA,MAAqB,6CAE/C,CACF,CACF,KAEDY,EAAAA,EAAAA,UAASC,IAAAA,UAAuB,cAAc,SAAUC,EAAUN,GAChE,MAAoB,YAAhBA,EAAKC,OACAT,IAAAA,WAAAA,MAAqB,kDAGvBc,EAASN,EACjB,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/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';\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 CommentPost from 'flarum/forum/components/CommentPost';\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(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","approveItem","children","override","CommentPost","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,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,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,iBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,4B,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,yB,aCI5D,qBAAqB,kBAAkB,MACrC,IAAAW,QAAO,IAAc,uBAAuB,SAAUC,EAAOC,GAC3D,GAAID,EAAME,IAAI,WAAY,CACxB,MAAMC,EAAQF,EAAKE,QACnB,GAAIA,GAASA,EAAMC,MAAKC,GAAkD,aAAjC,MAARA,OAAe,EAASA,EAAKC,UAAwB,CACpF,MAAMC,EAAcP,EAAMZ,IAAI,WAC1BmB,GAAsC,iBAAhBA,GAA4B,aAAcA,IAClEA,EAAYC,SAAW,qBAAqB,6CAEhD,CACF,CACF,KACA,IAAAC,UAAS,cAAyB,cAAc,SAAUC,EAAUL,GAClE,MAAoB,YAAhBA,EAAKC,OACA,qBAAqB,kDAEvBI,EAASL,EAClB,GAAE,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/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/akismet/external root \"flarum.reg.get('core', 'forum/app')\"","webpack://@flarum/akismet/external root \"flarum.reg.get('core', 'forum/utils/PostControls')\"","webpack://@flarum/akismet/external root \"flarum.reg.get('core', '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))","// 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.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/utils/PostControls');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'forum/components/Post');","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport PostComponent from 'flarum/forum/components/Post';\napp.initializers.add('flarum-akismet', () => {\n extend(PostControls, 'destructiveControls', function (items, post) {\n if (items.has('approve')) {\n const flags = post.flags();\n if (flags && flags.some(flag => (flag == null ? void 0 : 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 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 return original(flag);\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","reg","extend","items","post","has","flags","some","flag","type","approveItem","children","override","original"],"sourceRoot":""}
|
@@ -20,7 +20,7 @@
|
|||||||
"flarum-tsconfig": "^1.0.2",
|
"flarum-tsconfig": "^1.0.2",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"flarum-webpack-config": "^2.0.0",
|
"flarum-webpack-config": "^2.0.0",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.76.0",
|
||||||
"webpack-cli": "^4.9.1",
|
"webpack-cli": "^4.9.1",
|
||||||
"typescript": "^4.5.4",
|
"typescript": "^4.5.4",
|
||||||
"typescript-coverage-report": "^0.6.1"
|
"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 type ItemList from 'flarum/common/utils/ItemList';
|
||||||
|
|
||||||
import PostControls from 'flarum/forum/utils/PostControls';
|
import PostControls from 'flarum/forum/utils/PostControls';
|
||||||
import CommentPost from 'flarum/forum/components/CommentPost';
|
import PostComponent from 'flarum/forum/components/Post';
|
||||||
import type Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
|
|
||||||
app.initializers.add('flarum-akismet', () => {
|
app.initializers.add('flarum-akismet', () => {
|
||||||
@@ -21,7 +21,7 @@ app.initializers.add('flarum-akismet', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
override(CommentPost.prototype, 'flagReason', function (original, flag) {
|
override(PostComponent.prototype, 'flagReason', function (original, flag) {
|
||||||
if (flag.type() === 'akismet') {
|
if (flag.type() === 'akismet') {
|
||||||
return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');
|
return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');
|
||||||
}
|
}
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
"declarationDir": "./dist-typings",
|
"declarationDir": "./dist-typings",
|
||||||
"paths": {
|
"paths": {
|
||||||
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
|
"flarum/*": ["../../../framework/core/js/dist-typings/*"],
|
||||||
"flarum/flags/*": ["../../flags/js/dist-typings/*"]
|
"ext:flarum/flags/*": ["../../flags/js/dist-typings/*"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,22 +15,19 @@ use Psr\Http\Message\ResponseInterface;
|
|||||||
|
|
||||||
class Akismet
|
class Akismet
|
||||||
{
|
{
|
||||||
private $apiKey;
|
private string $apiUrl;
|
||||||
private $apiUrl;
|
private array $params = [];
|
||||||
private $flarumVersion;
|
|
||||||
private $extensionVersion;
|
|
||||||
|
|
||||||
private $params = [];
|
public function __construct(
|
||||||
|
private readonly string $apiKey,
|
||||||
public function __construct(string $apiKey, string $homeUrl, string $flarumVersion, string $extensionVersion, bool $inDebugMode = false)
|
string $homeUrl,
|
||||||
{
|
private readonly string $flarumVersion,
|
||||||
$this->apiKey = $apiKey;
|
private readonly string $extensionVersion,
|
||||||
|
bool $inDebugMode = false
|
||||||
|
) {
|
||||||
$this->apiUrl = "https://$apiKey.rest.akismet.com/1.1";
|
$this->apiUrl = "https://$apiKey.rest.akismet.com/1.1";
|
||||||
$this->params['blog'] = $homeUrl;
|
$this->params['blog'] = $homeUrl;
|
||||||
|
|
||||||
$this->flarumVersion = $flarumVersion;
|
|
||||||
$this->extensionVersion = $extensionVersion;
|
|
||||||
|
|
||||||
if ($inDebugMode) {
|
if ($inDebugMode) {
|
||||||
$this->params['is_test'] = true;
|
$this->params['is_test'] = true;
|
||||||
}
|
}
|
||||||
@@ -73,7 +70,7 @@ class Akismet
|
|||||||
/**
|
/**
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function submitSpam()
|
public function submitSpam(): void
|
||||||
{
|
{
|
||||||
$this->sendRequest('submit-spam');
|
$this->sendRequest('submit-spam');
|
||||||
}
|
}
|
||||||
@@ -81,7 +78,7 @@ class Akismet
|
|||||||
/**
|
/**
|
||||||
* @throws GuzzleException
|
* @throws GuzzleException
|
||||||
*/
|
*/
|
||||||
public function submitHam()
|
public function submitHam(): void
|
||||||
{
|
{
|
||||||
$this->sendRequest('submit-ham');
|
$this->sendRequest('submit-ham');
|
||||||
}
|
}
|
||||||
@@ -90,7 +87,7 @@ class Akismet
|
|||||||
* Allows you to set additional parameter
|
* Allows you to set additional parameter
|
||||||
* This lets you use Akismet features not supported directly in this util.
|
* This lets you use Akismet features not supported directly in this util.
|
||||||
*/
|
*/
|
||||||
public function withParam(string $key, $value): Akismet
|
public function withParam(string $key, mixed $value): Akismet
|
||||||
{
|
{
|
||||||
$new = clone $this;
|
$new = clone $this;
|
||||||
$new->params[$key] = $value;
|
$new->params[$key] = $value;
|
||||||
|
@@ -14,17 +14,12 @@ use Flarum\Approval\Event\PostWasApproved;
|
|||||||
|
|
||||||
class SubmitHam
|
class SubmitHam
|
||||||
{
|
{
|
||||||
/**
|
public function __construct(
|
||||||
* @var Akismet
|
protected Akismet $akismet
|
||||||
*/
|
) {
|
||||||
protected $akismet;
|
|
||||||
|
|
||||||
public function __construct(Akismet $akismet)
|
|
||||||
{
|
|
||||||
$this->akismet = $akismet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(PostWasApproved $event)
|
public function handle(PostWasApproved $event): void
|
||||||
{
|
{
|
||||||
if (! $this->akismet->isConfigured()) {
|
if (! $this->akismet->isConfigured()) {
|
||||||
return;
|
return;
|
||||||
|
@@ -14,17 +14,12 @@ use Flarum\Post\Event\Hidden;
|
|||||||
|
|
||||||
class SubmitSpam
|
class SubmitSpam
|
||||||
{
|
{
|
||||||
/**
|
public function __construct(
|
||||||
* @var Akismet
|
protected Akismet $akismet
|
||||||
*/
|
) {
|
||||||
protected $akismet;
|
|
||||||
|
|
||||||
public function __construct(Akismet $akismet)
|
|
||||||
{
|
|
||||||
$this->akismet = $akismet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(Hidden $event)
|
public function handle(Hidden $event): void
|
||||||
{
|
{
|
||||||
if (! $this->akismet->isConfigured()) {
|
if (! $this->akismet->isConfigured()) {
|
||||||
return;
|
return;
|
||||||
|
@@ -18,22 +18,13 @@ use Flarum\Settings\SettingsRepositoryInterface;
|
|||||||
|
|
||||||
class ValidatePost
|
class ValidatePost
|
||||||
{
|
{
|
||||||
/**
|
public function __construct(
|
||||||
* @var Akismet
|
protected Akismet $akismet,
|
||||||
*/
|
protected SettingsRepositoryInterface $settings
|
||||||
protected $akismet;
|
) {
|
||||||
/**
|
|
||||||
* @var SettingsRepositoryInterface
|
|
||||||
*/
|
|
||||||
private $settings;
|
|
||||||
|
|
||||||
public function __construct(Akismet $akismet, SettingsRepositoryInterface $settings)
|
|
||||||
{
|
|
||||||
$this->akismet = $akismet;
|
|
||||||
$this->settings = $settings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(Saving $event)
|
public function handle(Saving $event): void
|
||||||
{
|
{
|
||||||
if (! $this->akismet->isConfigured()) {
|
if (! $this->akismet->isConfigured()) {
|
||||||
return;
|
return;
|
||||||
@@ -50,7 +41,7 @@ class ValidatePost
|
|||||||
->withContent($post->content)
|
->withContent($post->content)
|
||||||
->withAuthorName($post->user->username)
|
->withAuthorName($post->user->username)
|
||||||
->withAuthorEmail($post->user->email)
|
->withAuthorEmail($post->user->email)
|
||||||
->withType($post->number == 1 ? 'forum-post' : 'reply')
|
->withType($post->number === 1 ? 'forum-post' : 'reply')
|
||||||
->withIp($post->ip_address)
|
->withIp($post->ip_address)
|
||||||
->withUserAgent($_SERVER['HTTP_USER_AGENT'])
|
->withUserAgent($_SERVER['HTTP_USER_AGENT'])
|
||||||
->checkSpam();
|
->checkSpam();
|
||||||
|
@@ -20,7 +20,7 @@ use Illuminate\Container\Container;
|
|||||||
|
|
||||||
class AkismetProvider extends AbstractServiceProvider
|
class AkismetProvider extends AbstractServiceProvider
|
||||||
{
|
{
|
||||||
public function register()
|
public function register(): void
|
||||||
{
|
{
|
||||||
$this->container->bind(Akismet::class, function (Container $container) {
|
$this->container->bind(Akismet::class, function (Container $container) {
|
||||||
/** @var SettingsRepositoryInterface $settings */
|
/** @var SettingsRepositoryInterface $settings */
|
||||||
@@ -38,7 +38,7 @@ class AkismetProvider extends AbstractServiceProvider
|
|||||||
$settings->get('flarum-akismet.api_key'),
|
$settings->get('flarum-akismet.api_key'),
|
||||||
$url->to('forum')->base(),
|
$url->to('forum')->base(),
|
||||||
$app::VERSION,
|
$app::VERSION,
|
||||||
$extensions->getExtension('flarum-akismet')->getVersion(),
|
$extensions->getExtension('flarum-akismet')->getVersion() ?? 'unknown',
|
||||||
$config->inDebugMode()
|
$config->inDebugMode()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@@ -7,10 +7,6 @@
|
|||||||
* LICENSE file that was distributed with this source code.
|
* LICENSE file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Flarum\Testing\integration\Setup\SetupScript;
|
$setup = require __DIR__.'/../../../../php-packages/testing/bootstrap/monorepo.php';
|
||||||
|
|
||||||
require __DIR__.'/../../vendor/autoload.php';
|
|
||||||
|
|
||||||
$setup = new SetupScript();
|
|
||||||
|
|
||||||
$setup->run();
|
$setup->run();
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
convertWarningsToExceptions="true"
|
convertWarningsToExceptions="true"
|
||||||
processIsolation="true"
|
processIsolation="true"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
|
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
|
||||||
>
|
>
|
||||||
<coverage processUncoveredFiles="true">
|
<coverage processUncoveredFiles="true">
|
||||||
<include>
|
<include>
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
convertWarningsToExceptions="true"
|
convertWarningsToExceptions="true"
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
|
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
|
||||||
>
|
>
|
||||||
<coverage processUncoveredFiles="true">
|
<coverage processUncoveredFiles="true">
|
||||||
<include>
|
<include>
|
||||||
|
@@ -19,8 +19,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.5",
|
"flarum/core": "^2.0",
|
||||||
"flarum/flags": "^1.2"
|
"flarum/flags": "^2.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "1.x-dev"
|
"dev-main": "2.x-dev"
|
||||||
},
|
},
|
||||||
"flarum-extension": {
|
"flarum-extension": {
|
||||||
"title": "Approval",
|
"title": "Approval",
|
||||||
@@ -87,6 +87,6 @@
|
|||||||
"test:setup": "Sets up a database for use with integration tests. Execute this only once."
|
"test:setup": "Sets up a database for use with integration tests. Execute this only once."
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"flarum/testing": "^1.0.0"
|
"flarum/testing": "^2.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
use Flarum\Api\Serializer\BasicDiscussionSerializer;
|
use Flarum\Api\Serializer\BasicDiscussionSerializer;
|
||||||
use Flarum\Api\Serializer\PostSerializer;
|
use Flarum\Api\Serializer\PostSerializer;
|
||||||
use Flarum\Approval\Access;
|
use Flarum\Approval\Access;
|
||||||
|
use Flarum\Approval\Event\PostWasApproved;
|
||||||
use Flarum\Approval\Listener;
|
use Flarum\Approval\Listener;
|
||||||
use Flarum\Discussion\Discussion;
|
use Flarum\Discussion\Discussion;
|
||||||
use Flarum\Extend;
|
use Flarum\Extend;
|
||||||
@@ -27,15 +28,17 @@ return [
|
|||||||
|
|
||||||
// Discussions should be approved by default
|
// Discussions should be approved by default
|
||||||
(new Extend\Model(Discussion::class))
|
(new Extend\Model(Discussion::class))
|
||||||
->default('is_approved', true),
|
->default('is_approved', true)
|
||||||
|
->cast('is_approved', 'bool'),
|
||||||
|
|
||||||
// Posts should be approved by default
|
// Posts should be approved by default
|
||||||
(new Extend\Model(Post::class))
|
(new Extend\Model(Post::class))
|
||||||
->default('is_approved', true),
|
->default('is_approved', true)
|
||||||
|
->cast('is_approved', 'bool'),
|
||||||
|
|
||||||
(new Extend\ApiSerializer(BasicDiscussionSerializer::class))
|
(new Extend\ApiSerializer(BasicDiscussionSerializer::class))
|
||||||
->attribute('isApproved', function ($serializer, Discussion $discussion) {
|
->attribute('isApproved', function (BasicDiscussionSerializer $serializer, Discussion $discussion): bool {
|
||||||
return (bool) $discussion->is_approved;
|
return $discussion->is_approved;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
(new Extend\ApiSerializer(PostSerializer::class))
|
(new Extend\ApiSerializer(PostSerializer::class))
|
||||||
@@ -48,6 +51,7 @@ return [
|
|||||||
new Extend\Locales(__DIR__.'/locale'),
|
new Extend\Locales(__DIR__.'/locale'),
|
||||||
|
|
||||||
(new Extend\Event())
|
(new Extend\Event())
|
||||||
|
->listen(PostWasApproved::class, Listener\UpdateDiscussionAfterPostApproval::class)
|
||||||
->subscribe(Listener\ApproveContent::class)
|
->subscribe(Listener\ApproveContent::class)
|
||||||
->subscribe(Listener\UnapproveNewContent::class),
|
->subscribe(Listener\UnapproveNewContent::class),
|
||||||
|
|
||||||
@@ -61,8 +65,8 @@ return [
|
|||||||
->scope(Access\ScopePrivateDiscussionVisibility::class, 'viewPrivate'),
|
->scope(Access\ScopePrivateDiscussionVisibility::class, 'viewPrivate'),
|
||||||
|
|
||||||
(new Extend\ModelPrivate(Discussion::class))
|
(new Extend\ModelPrivate(Discussion::class))
|
||||||
->checker([Listener\UnapproveNewContent::class, 'markUnapprovedContentAsPrivate']),
|
->checker(Listener\UnapproveNewContent::markUnapprovedContentAsPrivate(...)),
|
||||||
|
|
||||||
(new Extend\ModelPrivate(CommentPost::class))
|
(new Extend\ModelPrivate(CommentPost::class))
|
||||||
->checker([Listener\UnapproveNewContent::class, 'markUnapprovedContentAsPrivate']),
|
->checker(Listener\UnapproveNewContent::markUnapprovedContentAsPrivate(...)),
|
||||||
];
|
];
|
||||||
|
2
extensions/approval/js/dist/admin.js
generated
vendored
2
extensions/approval/js/dist/admin.js
generated
vendored
@@ -1,2 +1,2 @@
|
|||||||
(()=>{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})();
|
(()=>{var r={n:e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return r.d(s,{a:s}),s},d:(e,s)=>{for(var a in s)r.o(s,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:s[a]})},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},e={};(()=>{"use strict";r.r(e);const s=flarum.reg.get("core","common/extend"),a=flarum.reg.get("core","admin/app");var o=r.n(a);o().initializers.add("flarum-approval",(()=>{(0,s.extend)(o(),"getRequiredPermissions",(function(r,e){"discussion.startWithoutApproval"===e&&r.push("startDiscussion"),"discussion.replyWithoutApproval"===e&&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=e})();
|
||||||
//# sourceMappingURL=admin.js.map
|
//# 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,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,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,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,mBAEjB,IAEDJ,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,GAEL,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/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":""}
|
{"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,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,iBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,a,aCE5D,qBAAqB,mBAAmB,MACtC,IAAAW,QAAO,IAAK,0BAA0B,SAAUC,EAAUC,GACrC,oCAAfA,GACFD,EAASE,KAAK,mBAEG,oCAAfD,GACFD,EAASE,KAAK,mBAElB,IACA,sBAAsB,mBAAmBC,mBAAmB,CAC1DC,KAAM,eACNC,MAAO,qBAAqB,8EAC5BJ,WAAY,mCACX,QAAS,IAAIE,mBAAmB,CACjCC,KAAM,eACNC,MAAO,qBAAqB,kEAC5BJ,WAAY,mCACX,QAAS,IAAIE,mBAAmB,CACjCC,KAAM,eACNC,MAAO,qBAAqB,yDAC5BJ,WAAY,2BACX,WAAY,GAAG,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/webpack/runtime/make namespace object","webpack://@flarum/approval/external root \"flarum.reg.get('core', 'common/extend')\"","webpack://@flarum/approval/external root \"flarum.reg.get('core', '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.reg.get('core', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/admin/app';\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 app.extensionData.for('flarum-approval').registerPermission({\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'),\n permission: 'discussion.startWithoutApproval'\n }, 'start', 95).registerPermission({\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'),\n permission: 'discussion.replyWithoutApproval'\n }, 'reply', 95).registerPermission({\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),\n permission: 'discussion.approvePosts'\n }, 'moderate', 65);\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","reg","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 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})();
|
(()=>{var o={n:t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},d:(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},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 e=flarum.reg.get("core","common/extend"),r=flarum.reg.get("core","forum/app");var a=o.n(r);const n=flarum.reg.get("core","common/models/Discussion");var p=o.n(n);const s=flarum.reg.get("core","common/models/Post");var i=o.n(s);const c=flarum.reg.get("core","common/components/Badge");var u=o.n(c);const l=flarum.reg.get("core","forum/components/DiscussionListItem");var d=o.n(l);const v=flarum.reg.get("core","forum/components/Post");var f=o.n(v);const g=flarum.reg.get("core","forum/components/CommentPost");var A=o.n(g);const y=flarum.reg.get("core","common/components/Button");var b=o.n(y);const h=flarum.reg.get("core","forum/utils/PostControls");var _=o.n(h);a().initializers.add("flarum-approval",(()=>{p().prototype.isApproved=p().attribute("isApproved"),(0,e.extend)(p().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,e.extend)(d().prototype,"elementAttrs",(function(o){this.attrs.discussion.isApproved()||(o.className+=" DiscussionListItem--unapproved")})),(0,e.extend)(f().prototype,"elementAttrs",(function(o){this.attrs.post.isApproved()||(o.className+=" Post--unapproved")})),(0,e.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,e.override)(f().prototype,"flagReason",(function(o,t){return"approval"===t.type()?a().translator.trans("flarum-approval.forum.post.awaiting_approval_text"):o(t)})),(0,e.extend)(_(),"destructiveControls",(function(o,t){!t.isApproved()&&t.canApprove()&&o.add("approve",m(b(),{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
|
//# 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": {
|
"devDependencies": {
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"flarum-webpack-config": "^2.0.0",
|
"flarum-webpack-config": "^2.0.0",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.76.0",
|
||||||
"webpack-cli": "^4.9.1",
|
"webpack-cli": "^4.9.1",
|
||||||
"@flarum/prettier-config": "^1.0.0"
|
"@flarum/prettier-config": "^1.0.0"
|
||||||
},
|
},
|
||||||
|
@@ -14,11 +14,7 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
|
|
||||||
class ScopePrivateDiscussionVisibility
|
class ScopePrivateDiscussionVisibility
|
||||||
{
|
{
|
||||||
/**
|
public function __invoke(User $actor, Builder $query): void
|
||||||
* @param Builder $query
|
|
||||||
* @param User $actor
|
|
||||||
*/
|
|
||||||
public function __invoke(User $actor, Builder $query)
|
|
||||||
{
|
{
|
||||||
// All statements need to be wrapped in an orWhere, since we're adding a
|
// All statements need to be wrapped in an orWhere, since we're adding a
|
||||||
// subset of private discussions that should be visible, not restricting the visible
|
// subset of private discussions that should be visible, not restricting the visible
|
||||||
|
@@ -16,11 +16,7 @@ use Illuminate\Database\Eloquent\Builder;
|
|||||||
|
|
||||||
class ScopePrivatePostVisibility
|
class ScopePrivatePostVisibility
|
||||||
{
|
{
|
||||||
/**
|
public function __invoke(User $actor, Builder $query): void
|
||||||
* @param Builder $query
|
|
||||||
* @param User $actor
|
|
||||||
*/
|
|
||||||
public function __invoke(User $actor, Builder $query)
|
|
||||||
{
|
{
|
||||||
// All statements need to be wrapped in an orWhere, since we're adding a
|
// All statements need to be wrapped in an orWhere, since we're adding a
|
||||||
// subset of private posts that should be visible, not restricting the visible
|
// subset of private posts that should be visible, not restricting the visible
|
||||||
|
@@ -15,10 +15,7 @@ use Flarum\User\User;
|
|||||||
|
|
||||||
class TagPolicy extends AbstractPolicy
|
class TagPolicy extends AbstractPolicy
|
||||||
{
|
{
|
||||||
/**
|
public function addToDiscussion(User $actor, Tag $tag): bool
|
||||||
* @return bool|null
|
|
||||||
*/
|
|
||||||
public function addToDiscussion(User $actor, Tag $tag)
|
|
||||||
{
|
{
|
||||||
return $actor->can('discussion.startWithoutApproval', $tag);
|
return $actor->can('discussion.startWithoutApproval', $tag);
|
||||||
}
|
}
|
||||||
|
@@ -14,25 +14,9 @@ use Flarum\User\User;
|
|||||||
|
|
||||||
class PostWasApproved
|
class PostWasApproved
|
||||||
{
|
{
|
||||||
/**
|
public function __construct(
|
||||||
* The post that was approved.
|
public Post $post,
|
||||||
*
|
public User $actor
|
||||||
* @var Post
|
) {
|
||||||
*/
|
|
||||||
public $post;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var User
|
|
||||||
*/
|
|
||||||
public $actor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Post $post
|
|
||||||
* @param User $actor
|
|
||||||
*/
|
|
||||||
public function __construct(Post $post, User $actor)
|
|
||||||
{
|
|
||||||
$this->post = $post;
|
|
||||||
$this->actor = $actor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,65 +11,52 @@ namespace Flarum\Approval\Listener;
|
|||||||
|
|
||||||
use Flarum\Approval\Event\PostWasApproved;
|
use Flarum\Approval\Event\PostWasApproved;
|
||||||
use Flarum\Post\Event\Saving;
|
use Flarum\Post\Event\Saving;
|
||||||
|
use Flarum\User\Exception\PermissionDeniedException;
|
||||||
use Illuminate\Contracts\Events\Dispatcher;
|
use Illuminate\Contracts\Events\Dispatcher;
|
||||||
|
|
||||||
class ApproveContent
|
class ApproveContent
|
||||||
{
|
{
|
||||||
/**
|
public function subscribe(Dispatcher $events): void
|
||||||
* @param Dispatcher $events
|
|
||||||
*/
|
|
||||||
public function subscribe(Dispatcher $events)
|
|
||||||
{
|
{
|
||||||
$events->listen(Saving::class, [$this, 'approvePost']);
|
$events->listen(Saving::class, $this->approvePost(...));
|
||||||
$events->listen(PostWasApproved::class, [$this, 'approveDiscussion']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Saving $event
|
* @throws PermissionDeniedException
|
||||||
*/
|
*/
|
||||||
public function approvePost(Saving $event)
|
public function approvePost(Saving $event): void
|
||||||
{
|
{
|
||||||
$attributes = $event->data['attributes'];
|
$attributes = $event->data['attributes'];
|
||||||
$post = $event->post;
|
$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'])) {
|
if (isset($attributes['isApproved'])) {
|
||||||
$event->actor->assertCan('approve', $post);
|
$event->actor->assertCan('approve', $post);
|
||||||
|
|
||||||
$isApproved = (bool) $attributes['isApproved'];
|
$isApproved = (bool) $attributes['isApproved'];
|
||||||
} elseif (! empty($attributes['isHidden']) && $event->actor->can('approve', $post)) {
|
} elseif (isset($attributes['isHidden']) && $event->actor->can('approve', $post)) {
|
||||||
$isApproved = true;
|
$isApproved = true;
|
||||||
|
$approvingSilently = $attributes['isHidden'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($isApproved)) {
|
if (! empty($isApproved)) {
|
||||||
$post->is_approved = true;
|
$post->is_approved = true;
|
||||||
|
|
||||||
|
if (! $approvingSilently) {
|
||||||
$post->raise(new PostWasApproved($post, $event->actor));
|
$post->raise(new PostWasApproved($post, $event->actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param PostWasApproved $event
|
|
||||||
*/
|
|
||||||
public 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,6 +9,7 @@
|
|||||||
|
|
||||||
namespace Flarum\Approval\Listener;
|
namespace Flarum\Approval\Listener;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
use Flarum\Discussion\Discussion;
|
use Flarum\Discussion\Discussion;
|
||||||
use Flarum\Flags\Flag;
|
use Flarum\Flags\Flag;
|
||||||
use Flarum\Post\CommentPost;
|
use Flarum\Post\CommentPost;
|
||||||
@@ -17,18 +18,12 @@ use Illuminate\Contracts\Events\Dispatcher;
|
|||||||
|
|
||||||
class UnapproveNewContent
|
class UnapproveNewContent
|
||||||
{
|
{
|
||||||
/**
|
public function subscribe(Dispatcher $events): void
|
||||||
* @param Dispatcher $events
|
|
||||||
*/
|
|
||||||
public function subscribe(Dispatcher $events)
|
|
||||||
{
|
{
|
||||||
$events->listen(Saving::class, [$this, 'unapproveNewPosts']);
|
$events->listen(Saving::class, $this->unapproveNewPosts(...));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function unapproveNewPosts(Saving $event): void
|
||||||
* @param Saving $event
|
|
||||||
*/
|
|
||||||
public function unapproveNewPosts(Saving $event)
|
|
||||||
{
|
{
|
||||||
$post = $event->post;
|
$post = $event->post;
|
||||||
|
|
||||||
@@ -55,21 +50,19 @@ class UnapproveNewContent
|
|||||||
|
|
||||||
$flag->post_id = $post->id;
|
$flag->post_id = $post->id;
|
||||||
$flag->type = 'approval';
|
$flag->type = 'approval';
|
||||||
$flag->created_at = time();
|
$flag->created_at = Carbon::now();
|
||||||
|
|
||||||
$flag->save();
|
$flag->save();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static function markUnapprovedContentAsPrivate(Discussion|CommentPost $instance): ?bool
|
||||||
* @param Discussion|CommentPost $instance
|
|
||||||
* @return bool|null
|
|
||||||
*/
|
|
||||||
public static function markUnapprovedContentAsPrivate($instance)
|
|
||||||
{
|
{
|
||||||
if (! $instance->is_approved) {
|
if (! $instance->is_approved) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,45 @@
|
|||||||
|
<?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): void
|
||||||
|
{
|
||||||
|
$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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -7,10 +7,6 @@
|
|||||||
* LICENSE file that was distributed with this source code.
|
* LICENSE file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Flarum\Testing\integration\Setup\SetupScript;
|
$setup = require __DIR__.'/../../../../php-packages/testing/bootstrap/monorepo.php';
|
||||||
|
|
||||||
require __DIR__.'/../../vendor/autoload.php';
|
|
||||||
|
|
||||||
$setup = new SetupScript();
|
|
||||||
|
|
||||||
$setup->run();
|
$setup->run();
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
convertWarningsToExceptions="true"
|
convertWarningsToExceptions="true"
|
||||||
processIsolation="true"
|
processIsolation="true"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
|
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
|
||||||
>
|
>
|
||||||
<coverage processUncoveredFiles="true">
|
<coverage processUncoveredFiles="true">
|
||||||
<include>
|
<include>
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
convertWarningsToExceptions="true"
|
convertWarningsToExceptions="true"
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
|
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
|
||||||
>
|
>
|
||||||
<coverage processUncoveredFiles="true">
|
<coverage processUncoveredFiles="true">
|
||||||
<include>
|
<include>
|
||||||
|
@@ -19,11 +19,16 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.5"
|
"flarum/core": "^2.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Flarum\\BBCode\\": "src"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "1.x-dev"
|
"dev-main": "2.x-dev"
|
||||||
},
|
},
|
||||||
"flarum-extension": {
|
"flarum-extension": {
|
||||||
"title": "BBCode",
|
"title": "BBCode",
|
||||||
|
@@ -7,24 +7,14 @@
|
|||||||
* LICENSE file that was distributed with this source code.
|
* LICENSE file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Flarum\Extend;
|
namespace Flarum\BBCode;
|
||||||
use s9e\TextFormatter\Configurator;
|
|
||||||
|
|
||||||
return (new Extend\Formatter)
|
use Flarum\Extend;
|
||||||
->configure(function (Configurator $config) {
|
|
||||||
$config->BBCodes->addFromRepository('B');
|
return [
|
||||||
$config->BBCodes->addFromRepository('I');
|
new Extend\Locales(__DIR__.'/locale'),
|
||||||
$config->BBCodes->addFromRepository('U');
|
|
||||||
$config->BBCodes->addFromRepository('S');
|
(new Extend\Formatter)
|
||||||
$config->BBCodes->addFromRepository('URL');
|
->render(Render::class)
|
||||||
$config->BBCodes->addFromRepository('IMG');
|
->configure(Configure::class),
|
||||||
$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('*');
|
|
||||||
});
|
|
||||||
|
10
extensions/bbcode/locale/en.yml
Normal file
10
extensions/bbcode/locale/en.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
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
|
59
extensions/bbcode/src/Configure.php
Normal file
59
extensions/bbcode/src/Configure.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<?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): void
|
||||||
|
{
|
||||||
|
$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);
|
||||||
|
}
|
||||||
|
}
|
28
extensions/bbcode/src/Render.php
Normal file
28
extensions/bbcode/src/Render.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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 Flarum\Locale\TranslatorInterface;
|
||||||
|
use s9e\TextFormatter\Renderer;
|
||||||
|
|
||||||
|
class Render
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
protected TranslatorInterface $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,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.5"
|
"flarum/core": "^2.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "1.x-dev"
|
"dev-main": "2.x-dev"
|
||||||
},
|
},
|
||||||
"flarum-extension": {
|
"flarum-extension": {
|
||||||
"title": "Embed",
|
"title": "Embed",
|
||||||
|
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
2
extensions/embed/js/dist/forum.js.map
generated
vendored
2
extensions/embed/js/dist/forum.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -9,7 +9,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"flarum-webpack-config": "^2.0.0",
|
"flarum-webpack-config": "^2.0.0",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.76.0",
|
||||||
"webpack-cli": "^4.9.1",
|
"webpack-cli": "^4.9.1",
|
||||||
"@flarum/prettier-config": "^1.0.0"
|
"@flarum/prettier-config": "^1.0.0"
|
||||||
},
|
},
|
||||||
|
@@ -4,8 +4,6 @@ import { override, extend } from 'flarum/common/extend';
|
|||||||
import app from 'flarum/forum/app';
|
import app from 'flarum/forum/app';
|
||||||
import Stream from 'flarum/common/utils/Stream';
|
import Stream from 'flarum/common/utils/Stream';
|
||||||
import ForumApplication from 'flarum/forum/ForumApplication';
|
import ForumApplication from 'flarum/forum/ForumApplication';
|
||||||
import Composer from 'flarum/forum/components/Composer';
|
|
||||||
import PostStream from 'flarum/forum/components/PostStream';
|
|
||||||
import ModalManager from 'flarum/common/components/ModalManager';
|
import ModalManager from 'flarum/common/components/ModalManager';
|
||||||
import PostMeta from 'flarum/forum/components/PostMeta';
|
import PostMeta from 'flarum/forum/components/PostMeta';
|
||||||
|
|
||||||
@@ -13,7 +11,7 @@ import DiscussionPage from 'flarum/forum/components/DiscussionPage';
|
|||||||
|
|
||||||
extend(ForumApplication.prototype, 'mount', function () {
|
extend(ForumApplication.prototype, 'mount', function () {
|
||||||
if (m.route.param('hideFirstPost')) {
|
if (m.route.param('hideFirstPost')) {
|
||||||
extend(PostStream.prototype, 'view', (vdom) => {
|
extend('flarum/forum/components/PostStream', 'view', (vdom) => {
|
||||||
if (vdom.children[0].attrs['data-number'] === 1) {
|
if (vdom.children[0].attrs['data-number'] === 1) {
|
||||||
vdom.children.splice(0, 1);
|
vdom.children.splice(0, 1);
|
||||||
}
|
}
|
||||||
@@ -42,7 +40,7 @@ const reposition = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
extend(ModalManager.prototype, 'show', reposition);
|
extend(ModalManager.prototype, 'show', reposition);
|
||||||
extend(Composer.prototype, 'show', reposition);
|
extend('flarum/forum/components/Composer', 'show', reposition);
|
||||||
|
|
||||||
window.iFrameResizer = {
|
window.iFrameResizer = {
|
||||||
readyCallback: function () {
|
readyCallback: function () {
|
||||||
@@ -50,7 +48,7 @@ window.iFrameResizer = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
extend(PostStream.prototype, 'goToNumber', function (promise, number) {
|
extend('flarum/forum/components/PostStream', 'goToNumber', function (promise, number) {
|
||||||
if (number === 'reply' && 'parentIFrame' in window && app.composer.isFullScreen()) {
|
if (number === 'reply' && 'parentIFrame' in window && app.composer.isFullScreen()) {
|
||||||
const itemTop = this.$('.PostStream-item:last').offset().top;
|
const itemTop = this.$('.PostStream-item:last').offset().top;
|
||||||
window.parentIFrame.scrollToOffset(0, itemTop);
|
window.parentIFrame.scrollToOffset(0, itemTop);
|
||||||
|
@@ -50,7 +50,7 @@
|
|||||||
padding: 15px 15px;
|
padding: 15px 15px;
|
||||||
|
|
||||||
.scrolled & {
|
.scrolled & {
|
||||||
.box-shadow(0 2px 6px @shadow-color);
|
box-shadow: 0 2px 6px var(--shadow-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
&, a {
|
&, a {
|
||||||
color: @muted-color;
|
color: var(--muted-color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,11 +19,11 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.5"
|
"flarum/core": "^2.0"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "1.x-dev"
|
"dev-main": "2.x-dev"
|
||||||
},
|
},
|
||||||
"flarum-extension": {
|
"flarum-extension": {
|
||||||
"title": "Emoji",
|
"title": "Emoji",
|
||||||
|
@@ -13,7 +13,8 @@ use s9e\TextFormatter\Configurator;
|
|||||||
return [
|
return [
|
||||||
(new Extend\Frontend('forum'))
|
(new Extend\Frontend('forum'))
|
||||||
->js(__DIR__.'/js/dist/forum.js')
|
->js(__DIR__.'/js/dist/forum.js')
|
||||||
->css(__DIR__.'/less/forum.less'),
|
->css(__DIR__.'/less/forum.less')
|
||||||
|
->jsDirectory(__DIR__.'/js/dist/forum'),
|
||||||
|
|
||||||
(new Extend\Formatter)
|
(new Extend\Formatter)
|
||||||
->configure(function (Configurator $config) {
|
->configure(function (Configurator $config) {
|
||||||
|
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"printWidth": 150,
|
|
||||||
"singleQuote": true,
|
|
||||||
"tabWidth": 2,
|
|
||||||
"trailingComma": "es5"
|
|
||||||
}
|
|
2
extensions/emoji/js/dist/forum.js
generated
vendored
2
extensions/emoji/js/dist/forum.js
generated
vendored
File diff suppressed because one or more lines are too long
2
extensions/emoji/js/dist/forum.js.map
generated
vendored
2
extensions/emoji/js/dist/forum.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
extensions/emoji/js/dist/forum/emojiMap.js
generated
vendored
Normal file
2
extensions/emoji/js/dist/forum/emojiMap.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
extensions/emoji/js/dist/forum/emojiMap.js.map
generated
vendored
Normal file
1
extensions/emoji/js/dist/forum/emojiMap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"forum/emojiMap.js","mappings":"kJACA,E","sources":["webpack://@flarum/emoji/./src/forum/emojiMap.ts"],"sourcesContent":["import emojiMap from 'simple-emoji-map';\nexport default emojiMap;"],"names":[],"sourceRoot":""}
|
@@ -14,7 +14,7 @@
|
|||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"typescript": "^4.5.4",
|
"typescript": "^4.5.4",
|
||||||
"typescript-coverage-report": "^0.6.1",
|
"typescript-coverage-report": "^0.6.1",
|
||||||
"webpack": "^5.65.0",
|
"webpack": "^5.76.0",
|
||||||
"webpack-cli": "^4.9.1"
|
"webpack-cli": "^4.9.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@@ -1,44 +1,47 @@
|
|||||||
import emojiMap from 'simple-emoji-map';
|
|
||||||
|
|
||||||
import { extend } from 'flarum/common/extend';
|
import { extend } from 'flarum/common/extend';
|
||||||
import TextEditor from 'flarum/common/components/TextEditor';
|
|
||||||
import TextEditorButton from 'flarum/common/components/TextEditorButton';
|
import TextEditorButton from 'flarum/common/components/TextEditorButton';
|
||||||
import KeyboardNavigatable from 'flarum/forum/utils/KeyboardNavigatable';
|
import KeyboardNavigatable from 'flarum/common/utils/KeyboardNavigatable';
|
||||||
|
import Tooltip from 'flarum/common/components/Tooltip';
|
||||||
|
import AutocompleteReader from 'flarum/common/utils/AutocompleteReader';
|
||||||
|
|
||||||
import AutocompleteDropdown from './fragments/AutocompleteDropdown';
|
import AutocompleteDropdown from './fragments/AutocompleteDropdown';
|
||||||
import getEmojiIconCode from './helpers/getEmojiIconCode';
|
import getEmojiIconCode from './helpers/getEmojiIconCode';
|
||||||
import cdn from './cdn';
|
import cdn from './cdn';
|
||||||
|
|
||||||
export default function addComposerAutocomplete() {
|
export default function addComposerAutocomplete() {
|
||||||
const emojiKeys = Object.keys(emojiMap);
|
let emojiMap = null;
|
||||||
const $container = $('<div class="ComposerBody-emojiDropdownContainer"></div>');
|
|
||||||
const dropdown = new AutocompleteDropdown();
|
|
||||||
|
|
||||||
extend(TextEditor.prototype, 'oncreate', function () {
|
extend('flarum/common/components/TextEditor', 'oninit', function () {
|
||||||
|
this._loaders.push(async () => await import('./emojiMap').then((m) => (emojiMap = m.default)));
|
||||||
|
// prettier-ignore
|
||||||
|
this.commonEmoji = [
|
||||||
|
'😀', '😁', '😂', '😃', '😄', '😅', '😆', '😇', '😈', '😉', '😊', '😋', '😌', '😍', '😎', '😏', '😐️', '😑', '😒',
|
||||||
|
'😓', '😔', '😕', '😖', '😗', '😘', '😙', '😚', '😛', '😜', '😝', '😞', '😟', '😠', '😡', '😢', '😣', '😤', '😥',
|
||||||
|
'😦', '😧', '😨', '😩', '😪', '😫', '😬', '😭', '😮', '😮💨', '😯', '😰', '😱', '😲', '😳', '😴', '😵', '😵💫',
|
||||||
|
'😶', '😶🌫️', '😷', '😸', '😹', '😺', '😻', '😼', '😽', '😾', '😿', '🙀', '🙁', '🙂', '🙃', '🙄',
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
extend('flarum/common/components/TextEditor', 'onbuild', function () {
|
||||||
|
this.emojiDropdown = new AutocompleteDropdown();
|
||||||
const $editor = this.$('.TextEditor-editor').wrap('<div class="ComposerBody-emojiWrapper"></div>');
|
const $editor = this.$('.TextEditor-editor').wrap('<div class="ComposerBody-emojiWrapper"></div>');
|
||||||
|
|
||||||
this.navigator = new KeyboardNavigatable();
|
this.navigator = new KeyboardNavigatable();
|
||||||
this.navigator
|
this.navigator
|
||||||
.when(() => dropdown.active)
|
.when(() => this.emojiDropdown.active)
|
||||||
.onUp(() => dropdown.navigate(-1))
|
.onUp(() => this.emojiDropdown.navigate(-1))
|
||||||
.onDown(() => dropdown.navigate(1))
|
.onDown(() => this.emojiDropdown.navigate(1))
|
||||||
.onSelect(dropdown.complete.bind(dropdown))
|
.onSelect(this.emojiDropdown.complete.bind(this.emojiDropdown))
|
||||||
.onCancel(dropdown.hide.bind(dropdown))
|
.onCancel(this.emojiDropdown.hide.bind(this.emojiDropdown))
|
||||||
.bindTo($editor);
|
.bindTo($editor);
|
||||||
|
|
||||||
$editor.after($container);
|
$editor.after($('<div class="ComposerBody-emojiDropdownContainer"></div>'));
|
||||||
});
|
});
|
||||||
|
|
||||||
extend(TextEditor.prototype, 'buildEditorParams', function (params) {
|
extend('flarum/common/components/TextEditor', 'buildEditorParams', function (params) {
|
||||||
let relEmojiStart;
|
const emojiKeys = Object.keys(emojiMap);
|
||||||
let absEmojiStart;
|
|
||||||
let typed;
|
|
||||||
|
|
||||||
const applySuggestion = (replacement) => {
|
const autocompleteReader = new AutocompleteReader(':');
|
||||||
this.attrs.composer.editor.replaceBeforeCursor(absEmojiStart - 1, replacement + ' ');
|
|
||||||
|
|
||||||
dropdown.hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
params.inputListeners.push(() => {
|
params.inputListeners.push(() => {
|
||||||
const selection = this.attrs.composer.editor.getSelectionRange();
|
const selection = this.attrs.composer.editor.getSelectionRange();
|
||||||
@@ -47,42 +50,34 @@ export default function addComposerAutocomplete() {
|
|||||||
|
|
||||||
if (selection[1] - cursor > 0) return;
|
if (selection[1] - cursor > 0) return;
|
||||||
|
|
||||||
// Search backwards from the cursor for an ':' symbol. If we find
|
|
||||||
// one and followed by a whitespace, we will want to show the
|
|
||||||
// autocomplete dropdown!
|
|
||||||
const lastChunk = this.attrs.composer.editor.getLastNChars(15);
|
const lastChunk = this.attrs.composer.editor.getLastNChars(15);
|
||||||
absEmojiStart = 0;
|
const autocompleting = autocompleteReader.check(lastChunk, cursor, /[a-z0-9]|\+|\-|_|\:/);
|
||||||
for (let i = lastChunk.length - 1; i >= 0; i--) {
|
|
||||||
const character = lastChunk.substr(i, 1);
|
|
||||||
// check what user typed, emoji names only contains alphanumeric,
|
|
||||||
// underline, '+' and '-'
|
|
||||||
if (!/[a-z0-9]|\+|\-|_|\:/.test(character)) break;
|
|
||||||
// make sure ':' preceded by a whitespace or newline
|
|
||||||
if (character === ':' && (i == 0 || /\s/.test(lastChunk.substr(i - 1, 1)))) {
|
|
||||||
relEmojiStart = i + 1;
|
|
||||||
absEmojiStart = cursor - lastChunk.length + i + 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dropdown.hide();
|
this.emojiDropdown.hide();
|
||||||
dropdown.active = false;
|
this.emojiDropdown.active = false;
|
||||||
|
|
||||||
if (absEmojiStart) {
|
if (autocompleting) {
|
||||||
typed = lastChunk.substring(relEmojiStart).toLowerCase();
|
const typed = autocompleting.typed;
|
||||||
|
const emojiDropdown = this.emojiDropdown;
|
||||||
|
|
||||||
|
const applySuggestion = (replacement) => {
|
||||||
|
this.attrs.composer.editor.replaceBeforeCursor(autocompleting.absoluteStart - 1, replacement + ' ');
|
||||||
|
this.emojiDropdown.hide();
|
||||||
|
};
|
||||||
|
|
||||||
const makeSuggestion = function ({ emoji, name, code }) {
|
const makeSuggestion = function ({ emoji, name, code }) {
|
||||||
return (
|
return (
|
||||||
|
<Tooltip text={name}>
|
||||||
<button
|
<button
|
||||||
key={emoji}
|
key={emoji}
|
||||||
onclick={() => applySuggestion(emoji)}
|
onclick={() => applySuggestion(emoji)}
|
||||||
onmouseenter={function () {
|
onmouseenter={function () {
|
||||||
dropdown.setIndex($(this).parent().index() - 1);
|
emojiDropdown.setIndex($(this).parent().index() - 1);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<img alt={emoji} class="emoji" draggable="false" loading="lazy" src={`${cdn}72x72/${code}.png`} />
|
<img alt={emoji} className="emoji" draggable="false" loading="lazy" src={`${cdn}72x72/${code}.png`} title={name} />
|
||||||
{name}
|
|
||||||
</button>
|
</button>
|
||||||
|
</Tooltip>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -96,7 +91,7 @@ export default function addComposerAutocomplete() {
|
|||||||
};
|
};
|
||||||
const regTyped = fuzzyRegexp(typed);
|
const regTyped = fuzzyRegexp(typed);
|
||||||
|
|
||||||
let maxSuggestions = 7;
|
let maxSuggestions = 40;
|
||||||
|
|
||||||
const findMatchingEmojis = (matcher) => {
|
const findMatchingEmojis = (matcher) => {
|
||||||
for (let i = 0; i < emojiKeys.length && maxSuggestions > 0; i++) {
|
for (let i = 0; i < emojiKeys.length && maxSuggestions > 0; i++) {
|
||||||
@@ -105,7 +100,7 @@ export default function addComposerAutocomplete() {
|
|||||||
if (similarEmoji.indexOf(curEmoji) === -1) {
|
if (similarEmoji.indexOf(curEmoji) === -1) {
|
||||||
const names = emojiMap[curEmoji];
|
const names = emojiMap[curEmoji];
|
||||||
for (let name of names) {
|
for (let name of names) {
|
||||||
if (matcher(name)) {
|
if (matcher(name, curEmoji)) {
|
||||||
--maxSuggestions;
|
--maxSuggestions;
|
||||||
similarEmoji.push(curEmoji);
|
similarEmoji.push(curEmoji);
|
||||||
break;
|
break;
|
||||||
@@ -116,10 +111,17 @@ export default function addComposerAutocomplete() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// First, try to find all emojis starting with the given string
|
// First, try to find all emojis starting with the given string
|
||||||
findMatchingEmojis((emoji) => emoji.indexOf(typed) === 0);
|
findMatchingEmojis((emojiName, emoji) => {
|
||||||
|
// If no input is provided yet, match the most common emojis.
|
||||||
|
if (!typed) {
|
||||||
|
return this.commonEmoji?.includes(emoji);
|
||||||
|
}
|
||||||
|
|
||||||
|
return emojiName.indexOf(typed) === 0;
|
||||||
|
});
|
||||||
|
|
||||||
// If there are still suggestions left, try for some fuzzy matches
|
// If there are still suggestions left, try for some fuzzy matches
|
||||||
findMatchingEmojis((emoji) => regTyped.test(emoji));
|
findMatchingEmojis((emojiName) => regTyped.test(emojiName));
|
||||||
|
|
||||||
const suggestions = similarEmoji
|
const suggestions = similarEmoji
|
||||||
.map((emoji) => ({
|
.map((emoji) => ({
|
||||||
@@ -130,14 +132,14 @@ export default function addComposerAutocomplete() {
|
|||||||
.map(makeSuggestion);
|
.map(makeSuggestion);
|
||||||
|
|
||||||
if (suggestions.length) {
|
if (suggestions.length) {
|
||||||
dropdown.items = suggestions;
|
this.emojiDropdown.items = suggestions;
|
||||||
m.render($container[0], dropdown.render());
|
m.render(this.$('.ComposerBody-emojiDropdownContainer')[0], this.emojiDropdown.render());
|
||||||
|
|
||||||
dropdown.show();
|
this.emojiDropdown.show();
|
||||||
const coordinates = this.attrs.composer.editor.getCaretCoordinates(absEmojiStart);
|
const coordinates = this.attrs.composer.editor.getCaretCoordinates(autocompleting.absoluteStart);
|
||||||
const width = dropdown.$().outerWidth();
|
const width = this.emojiDropdown.$().outerWidth();
|
||||||
const height = dropdown.$().outerHeight();
|
const height = this.emojiDropdown.$().outerHeight();
|
||||||
const parent = dropdown.$().offsetParent();
|
const parent = this.emojiDropdown.$().offsetParent();
|
||||||
let left = coordinates.left;
|
let left = coordinates.left;
|
||||||
let top = coordinates.top + 15;
|
let top = coordinates.top + 15;
|
||||||
|
|
||||||
@@ -153,20 +155,20 @@ export default function addComposerAutocomplete() {
|
|||||||
top = Math.max(-(parent.offset().top - $(document).scrollTop()), top);
|
top = Math.max(-(parent.offset().top - $(document).scrollTop()), top);
|
||||||
left = Math.max(-parent.offset().left, left);
|
left = Math.max(-parent.offset().left, left);
|
||||||
|
|
||||||
dropdown.show(left, top);
|
this.emojiDropdown.show(left, top);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
buildSuggestions();
|
buildSuggestions();
|
||||||
|
|
||||||
dropdown.setIndex(0);
|
this.emojiDropdown.setIndex(0);
|
||||||
dropdown.$().scrollTop(0);
|
this.emojiDropdown.$().scrollTop(0);
|
||||||
dropdown.active = true;
|
this.emojiDropdown.active = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
extend(TextEditor.prototype, 'toolbarItems', function (items) {
|
extend('flarum/common/components/TextEditor', 'toolbarItems', function (items) {
|
||||||
items.add(
|
items.add(
|
||||||
'emoji',
|
'emoji',
|
||||||
<TextEditorButton onclick={() => this.attrs.composer.editor.insertAtCursor(' :')} icon="far fa-smile">
|
<TextEditorButton onclick={() => this.attrs.composer.editor.insertAtCursor(' :')} icon="far fa-smile">
|
||||||
|
3
extensions/emoji/js/src/forum/emojiMap.ts
Normal file
3
extensions/emoji/js/src/forum/emojiMap.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import emojiMap from 'simple-emoji-map';
|
||||||
|
|
||||||
|
export default emojiMap;
|
@@ -7,29 +7,28 @@ img.emoji {
|
|||||||
.EmojiDropdown {
|
.EmojiDropdown {
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
max-height: 200px;
|
max-height: 200px;
|
||||||
overflow: auto;
|
overflow: visible;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: 5px 0 !important;
|
padding: 8px;
|
||||||
|
|
||||||
> li > button {
|
> li {
|
||||||
color: @text-color;
|
display: inline-block;
|
||||||
|
|
||||||
|
> button {
|
||||||
|
color: var(--text-color);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
padding-top: 6px;
|
padding: 8px;
|
||||||
padding-bottom: 6px;
|
border-radius: var(--border-radius);
|
||||||
padding-left: 45px;
|
|
||||||
|
|
||||||
.emoji {
|
|
||||||
float: left;
|
|
||||||
margin-left: -30px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.Dropdown-header {
|
> .Dropdown-header {
|
||||||
color: @muted-more-color;
|
display: block;
|
||||||
|
color: var(--muted-more-color);
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
padding-bottom: 5px;
|
padding: 4px 8px;
|
||||||
font-size: 11px;
|
margin: 0 0 4px 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.5"
|
"flarum/core": "^2.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "1.x-dev"
|
"dev-main": "2.x-dev"
|
||||||
},
|
},
|
||||||
"flarum-extension": {
|
"flarum-extension": {
|
||||||
"title": "Flags",
|
"title": "Flags",
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
"require-dev": {
|
"require-dev": {
|
||||||
"flarum/core": "*@dev",
|
"flarum/core": "*@dev",
|
||||||
"flarum/tags": "*@dev",
|
"flarum/tags": "*@dev",
|
||||||
"flarum/testing": "^1.0.0"
|
"flarum/testing": "^2.0"
|
||||||
},
|
},
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
{
|
||||||
|
@@ -46,7 +46,7 @@ return [
|
|||||||
->delete('/posts/{id}/flags', 'flags.delete', DeleteFlagsController::class),
|
->delete('/posts/{id}/flags', 'flags.delete', DeleteFlagsController::class),
|
||||||
|
|
||||||
(new Extend\Model(User::class))
|
(new Extend\Model(User::class))
|
||||||
->dateAttribute('read_flags_at'),
|
->cast('read_flags_at', 'datetime'),
|
||||||
|
|
||||||
(new Extend\Model(Post::class))
|
(new Extend\Model(Post::class))
|
||||||
->hasMany('flags', Flag::class, 'post_id'),
|
->hasMany('flags', Flag::class, 'post_id'),
|
||||||
|
19
extensions/flags/js/dist-typings/forum/compat.d.ts
generated
vendored
19
extensions/flags/js/dist-typings/forum/compat.d.ts
generated
vendored
@@ -1,19 +0,0 @@
|
|||||||
declare var _default: {
|
|
||||||
'flags/addFlagsToPosts': typeof addFlagsToPosts;
|
|
||||||
'flags/addFlagControl': typeof addFlagControl;
|
|
||||||
'flags/addFlagsDropdown': typeof addFlagsDropdown;
|
|
||||||
'flags/models/Flag': typeof Flag;
|
|
||||||
'flags/components/FlagList': typeof FlagList;
|
|
||||||
'flags/components/FlagPostModal': typeof FlagPostModal;
|
|
||||||
'flags/components/FlagsPage': typeof FlagsPage;
|
|
||||||
'flags/components/FlagsDropdown': typeof FlagsDropdown;
|
|
||||||
};
|
|
||||||
export default _default;
|
|
||||||
import addFlagsToPosts from "./addFlagsToPosts";
|
|
||||||
import addFlagControl from "./addFlagControl";
|
|
||||||
import addFlagsDropdown from "./addFlagsDropdown";
|
|
||||||
import Flag from "./models/Flag";
|
|
||||||
import FlagList from "./components/FlagList";
|
|
||||||
import FlagPostModal from "./components/FlagPostModal";
|
|
||||||
import FlagsPage from "./components/FlagsPage";
|
|
||||||
import FlagsDropdown from "./components/FlagsDropdown";
|
|
17
extensions/flags/js/dist-typings/forum/components/FlagList.d.ts
generated
vendored
17
extensions/flags/js/dist-typings/forum/components/FlagList.d.ts
generated
vendored
@@ -1,7 +1,12 @@
|
|||||||
export default class FlagList extends Component<import("flarum/common/Component").ComponentAttrs, undefined> {
|
import Component from 'flarum/common/Component';
|
||||||
constructor();
|
import type { ComponentAttrs } from 'flarum/common/Component';
|
||||||
oninit(vnode: any): void;
|
import type Mithril from 'mithril';
|
||||||
state: any;
|
import type FlagListState from '../states/FlagListState';
|
||||||
view(): JSX.Element;
|
export interface IFlagListAttrs extends ComponentAttrs {
|
||||||
|
state: FlagListState;
|
||||||
|
}
|
||||||
|
export default class FlagList<CustomAttrs extends IFlagListAttrs = IFlagListAttrs> extends Component<CustomAttrs, FlagListState> {
|
||||||
|
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
|
||||||
|
view(): JSX.Element;
|
||||||
|
content(state: FlagListState): JSX.Element[][] | null;
|
||||||
}
|
}
|
||||||
import Component from "flarum/common/Component";
|
|
||||||
|
4
extensions/flags/js/dist-typings/forum/components/FlagPostModal.d.ts
generated
vendored
4
extensions/flags/js/dist-typings/forum/components/FlagPostModal.d.ts
generated
vendored
@@ -1,5 +1,5 @@
|
|||||||
/// <reference types="flarum/@types/translator-icu-rich" />
|
/// <reference types="flarum/@types/translator-icu-rich" />
|
||||||
export default class FlagPostModal extends Modal<import("flarum/common/components/Modal").IInternalModalAttrs> {
|
export default class FlagPostModal extends FormModal<import("flarum/common/components/FormModal").IFormModalAttrs, undefined> {
|
||||||
constructor();
|
constructor();
|
||||||
oninit(vnode: any): void;
|
oninit(vnode: any): void;
|
||||||
success: boolean | undefined;
|
success: boolean | undefined;
|
||||||
@@ -10,6 +10,6 @@ export default class FlagPostModal extends Modal<import("flarum/common/component
|
|||||||
flagReasons(): ItemList<any>;
|
flagReasons(): ItemList<any>;
|
||||||
onsubmit(e: any): void;
|
onsubmit(e: any): void;
|
||||||
}
|
}
|
||||||
import Modal from "flarum/common/components/Modal";
|
import FormModal from "flarum/common/components/FormModal";
|
||||||
import Stream from "flarum/common/utils/Stream";
|
import Stream from "flarum/common/utils/Stream";
|
||||||
import ItemList from "flarum/common/utils/ItemList";
|
import ItemList from "flarum/common/utils/ItemList";
|
||||||
|
17
extensions/flags/js/dist-typings/forum/components/FlagsDropdown.d.ts
generated
vendored
17
extensions/flags/js/dist-typings/forum/components/FlagsDropdown.d.ts
generated
vendored
@@ -1,7 +1,12 @@
|
|||||||
export default class FlagsDropdown {
|
/// <reference types="mithril" />
|
||||||
static initAttrs(attrs: any): void;
|
import HeaderDropdown from 'flarum/forum/components/HeaderDropdown';
|
||||||
getMenu(): JSX.Element;
|
import type { IHeaderDropdownAttrs } from 'flarum/forum/components/HeaderDropdown';
|
||||||
goToRoute(): void;
|
export interface IFlagsDropdownAttrs extends IHeaderDropdownAttrs {
|
||||||
getUnreadCount(): any;
|
}
|
||||||
getNewCount(): unknown;
|
export default class FlagsDropdown<CustomAttrs extends IFlagsDropdownAttrs = IFlagsDropdownAttrs> extends HeaderDropdown<CustomAttrs> {
|
||||||
|
static initAttrs(attrs: IFlagsDropdownAttrs): void;
|
||||||
|
getContent(): JSX.Element;
|
||||||
|
goToRoute(): void;
|
||||||
|
getUnreadCount(): number;
|
||||||
|
getNewCount(): number;
|
||||||
}
|
}
|
||||||
|
5
extensions/flags/js/dist-typings/forum/components/FlagsPage.d.ts
generated
vendored
5
extensions/flags/js/dist-typings/forum/components/FlagsPage.d.ts
generated
vendored
@@ -2,8 +2,9 @@
|
|||||||
* The `FlagsPage` component shows the flags list. It is only
|
* The `FlagsPage` component shows the flags list. It is only
|
||||||
* used on mobile devices where the flags dropdown is within the drawer.
|
* used on mobile devices where the flags dropdown is within the drawer.
|
||||||
*/
|
*/
|
||||||
export default class FlagsPage {
|
export default class FlagsPage extends Page<import("flarum/common/components/Page").IPageAttrs, undefined> {
|
||||||
|
constructor();
|
||||||
oninit(vnode: any): void;
|
oninit(vnode: any): void;
|
||||||
bodyClass: string | undefined;
|
|
||||||
view(): JSX.Element;
|
view(): JSX.Element;
|
||||||
}
|
}
|
||||||
|
import Page from "flarum/common/components/Page";
|
||||||
|
2
extensions/flags/js/dist-typings/forum/extend.d.ts
generated
vendored
Normal file
2
extensions/flags/js/dist-typings/forum/extend.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
declare const _default: (import("flarum/common/extenders/Model").default | import("flarum/common/extenders/Routes").default | import("flarum/common/extenders/Store").default)[];
|
||||||
|
export default _default;
|
8
extensions/flags/js/dist-typings/forum/forum.d.ts
generated
vendored
Normal file
8
extensions/flags/js/dist-typings/forum/forum.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import './addFlagsToPosts';
|
||||||
|
import './addFlagControl';
|
||||||
|
import './addFlagsDropdown';
|
||||||
|
import './models/Flag';
|
||||||
|
import './components/FlagList';
|
||||||
|
import './components/FlagPostModal';
|
||||||
|
import './components/FlagsPage';
|
||||||
|
import './components/FlagsDropdown';
|
3
extensions/flags/js/dist-typings/forum/index.d.ts
generated
vendored
3
extensions/flags/js/dist-typings/forum/index.d.ts
generated
vendored
@@ -1 +1,2 @@
|
|||||||
export {};
|
export { default as extend } from './extend';
|
||||||
|
import './forum';
|
||||||
|
19
extensions/flags/js/dist-typings/forum/states/FlagListState.d.ts
generated
vendored
19
extensions/flags/js/dist-typings/forum/states/FlagListState.d.ts
generated
vendored
@@ -1,16 +1,13 @@
|
|||||||
export default class FlagListState {
|
import type ForumApplication from 'flarum/forum/ForumApplication';
|
||||||
constructor(app: any);
|
import type Flag from '../models/Flag';
|
||||||
app: any;
|
import PaginatedListState from 'flarum/common/states/PaginatedListState';
|
||||||
/**
|
export default class FlagListState extends PaginatedListState<Flag> {
|
||||||
* Whether or not the flags are loading.
|
app: ForumApplication;
|
||||||
*
|
constructor(app: ForumApplication);
|
||||||
* @type {Boolean}
|
get type(): string;
|
||||||
*/
|
|
||||||
loading: boolean;
|
|
||||||
/**
|
/**
|
||||||
* Load flags into the application's cache if they haven't already
|
* Load flags into the application's cache if they haven't already
|
||||||
* been loaded.
|
* been loaded.
|
||||||
*/
|
*/
|
||||||
load(): void;
|
load(): Promise<void>;
|
||||||
cache: any;
|
|
||||||
}
|
}
|
||||||
|
2
extensions/flags/js/dist/admin.js
generated
vendored
2
extensions/flags/js/dist/admin.js
generated
vendored
@@ -1,2 +1,2 @@
|
|||||||
(()=>{var e={n:a=>{var s=a&&a.__esModule?()=>a.default:()=>a;return e.d(s,{a:s}),s},d:(a,s)=>{for(var l in s)e.o(s,l)&&!e.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:s[l]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};(()=>{"use strict";e.r(a);const s=flarum.core.compat["admin/app"];var l=e.n(s);l().initializers.add("flarum-flags",(function(){l().extensionData.for("flarum-flags").registerSetting({setting:"flarum-flags.guidelines_url",type:"text",label:l().translator.trans("flarum-flags.admin.settings.guidelines_url_label")},15).registerSetting({setting:"flarum-flags.can_flag_own",type:"boolean",label:l().translator.trans("flarum-flags.admin.settings.flag_own_posts_label")}).registerPermission({icon:"fas fa-flag",label:l().translator.trans("flarum-flags.admin.permissions.view_flags_label"),permission:"discussion.viewFlags"},"moderate",65).registerPermission({icon:"fas fa-flag",label:l().translator.trans("flarum-flags.admin.permissions.flag_posts_label"),permission:"discussion.flagPosts"},"reply",65)}))})(),module.exports=a})();
|
(()=>{var e={n:a=>{var s=a&&a.__esModule?()=>a.default:()=>a;return e.d(s,{a:s}),s},d:(a,s)=>{for(var r in s)e.o(s,r)&&!e.o(a,r)&&Object.defineProperty(a,r,{enumerable:!0,get:s[r]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};(()=>{"use strict";e.r(a);const s=flarum.reg.get("core","admin/app");var r=e.n(s);r().initializers.add("flarum-flags",(()=>{r().extensionData.for("flarum-flags").registerSetting({setting:"flarum-flags.guidelines_url",type:"text",label:r().translator.trans("flarum-flags.admin.settings.guidelines_url_label")},15).registerSetting({setting:"flarum-flags.can_flag_own",type:"boolean",label:r().translator.trans("flarum-flags.admin.settings.flag_own_posts_label")}).registerPermission({icon:"fas fa-flag",label:r().translator.trans("flarum-flags.admin.permissions.view_flags_label"),permission:"discussion.viewFlags"},"moderate",65).registerPermission({icon:"fas fa-flag",label:r().translator.trans("flarum-flags.admin.permissions.flag_posts_label"),permission:"discussion.flagPosts"},"reply",65)}))})(),module.exports=a})();
|
||||||
//# sourceMappingURL=admin.js.map
|
//# sourceMappingURL=admin.js.map
|
2
extensions/flags/js/dist/admin.js.map
generated
vendored
2
extensions/flags/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,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,a,aCExDC,IAAAA,aAAAA,IAAqB,gBAAgB,WACnCA,IAAAA,cAAAA,IACO,gBACJC,gBACC,CACEC,QAAS,8BACTC,KAAM,OACNC,MAAOJ,IAAAA,WAAAA,MAAqB,qDAE9B,IAEDC,gBAAgB,CACfC,QAAS,4BACTC,KAAM,UACNC,MAAOJ,IAAAA,WAAAA,MAAqB,sDAE7BK,mBACC,CACEC,KAAM,cACNF,MAAOJ,IAAAA,WAAAA,MAAqB,mDAC5BO,WAAY,wBAEd,WACA,IAGDF,mBACC,CACEC,KAAM,cACNF,MAAOJ,IAAAA,WAAAA,MAAqB,mDAC5BO,WAAY,wBAEd,QACA,GAEL,G","sources":["webpack://@flarum/flags/webpack/bootstrap","webpack://@flarum/flags/webpack/runtime/compat get default export","webpack://@flarum/flags/webpack/runtime/define property getters","webpack://@flarum/flags/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/flags/webpack/runtime/make namespace object","webpack://@flarum/flags/external root \"flarum.core.compat['admin/app']\"","webpack://@flarum/flags/./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-flags', () => {\n app.extensionData\n .for('flarum-flags')\n .registerSetting(\n {\n setting: 'flarum-flags.guidelines_url',\n type: 'text',\n label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label'),\n },\n 15\n )\n .registerSetting({\n setting: 'flarum-flags.can_flag_own',\n type: 'boolean',\n label: app.translator.trans('flarum-flags.admin.settings.flag_own_posts_label'),\n })\n .registerPermission(\n {\n icon: 'fas fa-flag',\n label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),\n permission: 'discussion.viewFlags',\n },\n 'moderate',\n 65\n )\n\n .registerPermission(\n {\n icon: 'fas fa-flag',\n label: app.translator.trans('flarum-flags.admin.permissions.flag_posts_label'),\n permission: 'discussion.flagPosts',\n },\n 'reply',\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","registerSetting","setting","type","label","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,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,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCC5D,qBAAqB,gBAAgB,KACnC,sBAAsB,gBAAgBW,gBAAgB,CACpDC,QAAS,8BACTC,KAAM,OACNC,MAAO,qBAAqB,qDAC3B,IAAIH,gBAAgB,CACrBC,QAAS,4BACTC,KAAM,UACNC,MAAO,qBAAqB,sDAC3BC,mBAAmB,CACpBC,KAAM,cACNF,MAAO,qBAAqB,mDAC5BG,WAAY,wBACX,WAAY,IAAIF,mBAAmB,CACpCC,KAAM,cACNF,MAAO,qBAAqB,mDAC5BG,WAAY,wBACX,QAAS,GAAG,G","sources":["webpack://@flarum/flags/webpack/bootstrap","webpack://@flarum/flags/webpack/runtime/compat get default export","webpack://@flarum/flags/webpack/runtime/define property getters","webpack://@flarum/flags/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/flags/webpack/runtime/make namespace object","webpack://@flarum/flags/external root \"flarum.reg.get('core', 'admin/app')\"","webpack://@flarum/flags/./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.reg.get('core', 'admin/app');","import app from 'flarum/admin/app';\napp.initializers.add('flarum-flags', () => {\n app.extensionData.for('flarum-flags').registerSetting({\n setting: 'flarum-flags.guidelines_url',\n type: 'text',\n label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label')\n }, 15).registerSetting({\n setting: 'flarum-flags.can_flag_own',\n type: 'boolean',\n label: app.translator.trans('flarum-flags.admin.settings.flag_own_posts_label')\n }).registerPermission({\n icon: 'fas fa-flag',\n label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),\n permission: 'discussion.viewFlags'\n }, 'moderate', 65).registerPermission({\n icon: 'fas fa-flag',\n label: app.translator.trans('flarum-flags.admin.permissions.flag_posts_label'),\n permission: 'discussion.flagPosts'\n }, 'reply', 65);\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","reg","registerSetting","setting","type","label","registerPermission","icon","permission"],"sourceRoot":""}
|
2
extensions/flags/js/dist/forum.js
generated
vendored
2
extensions/flags/js/dist/forum.js
generated
vendored
File diff suppressed because one or more lines are too long
2
extensions/flags/js/dist/forum.js.map
generated
vendored
2
extensions/flags/js/dist/forum.js.map
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