mirror of
https://github.com/flarum/core.git
synced 2025-08-13 11:54:32 +02:00
Compare commits
623 Commits
cw/conditi
...
dk/info-v2
Author | SHA1 | Date | |
---|---|---|---|
|
06eab34a30 | ||
|
2ac40e3e03 | ||
|
1a206ff658 | ||
|
0ca99dcba5 | ||
|
12fc3aeec2 | ||
|
b07b310fdf | ||
|
e2221b5f74 | ||
|
f54a5200cf | ||
|
236a8e9e0a | ||
|
7feab89cca | ||
|
bbc4b6dd13 | ||
|
561e22784a | ||
|
469127ccf3 | ||
|
80c116b386 | ||
|
b74c7f9746 | ||
|
b7bab2811d | ||
|
3cbc7f4de1 | ||
|
1b9ff2b6fa | ||
|
d02a924bb8 | ||
|
973f4f6f6b | ||
|
9977d491cf | ||
|
9758592daa | ||
|
60feaa0184 | ||
|
5557bf82d3 | ||
|
090fd4dea5 | ||
|
ecb23a64fc | ||
|
7ba768bf68 | ||
|
f13dc05866 | ||
|
a34a5d4d62 | ||
|
79e969778e | ||
|
41d62b8c82 | ||
|
5dc94bf4e8 | ||
|
fdaf09752c | ||
|
975c2c936f | ||
|
ce5feca140 | ||
|
55cd0850c7 | ||
|
6b31a47f05 | ||
|
db1e36d545 | ||
|
333bbb11e2 | ||
|
863d6526df | ||
|
97e56af2cd | ||
|
21da7758af | ||
|
89ff984446 | ||
|
7136ad01d5 | ||
|
875fd241b7 | ||
|
962d95746d | ||
|
0b995b96ef | ||
|
76d8ea505e | ||
|
cf7ef48906 | ||
|
8f6e46346a | ||
|
670aa2e236 | ||
|
ac6133a768 | ||
|
48ec73f86e | ||
|
00426c85e3 | ||
|
33121ed1cc | ||
|
b2f6b4cf88 | ||
|
1cd644d27f | ||
|
68faca4d5f | ||
|
603140a0b1 | ||
|
36d0795607 | ||
|
a7d584f8e1 | ||
|
958dec5944 | ||
|
55aa8a7723 | ||
|
e3943eebba | ||
|
101ff98822 | ||
|
6a9ce6f8e8 | ||
|
2366666091 | ||
|
8c9a772635 | ||
|
9d611d1ee2 | ||
|
e73ffee9e7 | ||
|
1b18f57353 | ||
|
9ce03c6ec8 | ||
|
1bdfb66f6c | ||
|
a3461a8020 | ||
|
da8ebe439b | ||
|
5d26485c04 | ||
|
38e1b49cc1 | ||
|
0c40e19cdf | ||
|
6d1e90c969 | ||
|
3294941226 | ||
|
87fa4a32dd | ||
|
e08a987842 | ||
|
8dd9455f68 | ||
|
a1e1f6ad33 | ||
|
55979706f1 | ||
|
cebb1f27f5 | ||
|
9fe17b3c24 | ||
|
4dce4d40a3 | ||
|
a81d13e26c | ||
|
382991648c | ||
|
b44d5175b6 | ||
|
d9e79608fb | ||
|
5d281b9471 | ||
|
27087cc713 | ||
|
d5f944023c | ||
|
153fb8684e | ||
|
eca21fa1bf | ||
|
c835bdb59a | ||
|
570580dcf0 | ||
|
e43449c32d | ||
|
bc695e9865 | ||
|
6d88c99782 | ||
|
097a54289f | ||
|
d90573f8f1 | ||
|
f6e84a0dc5 | ||
|
22b74d0404 | ||
|
94b0d67a40 | ||
|
9920a9f2f0 | ||
|
08b36149fd | ||
|
7f001dfe3b | ||
|
5fbb9fe9a7 | ||
|
33a72f5c14 | ||
|
af2a32a3a4 | ||
|
bcff06a362 | ||
|
e1c82a19dc | ||
|
770feabb59 | ||
|
464b67f848 | ||
|
41e5ff2525 | ||
|
49064f6912 | ||
|
7cfa560b4e | ||
|
70081a267f | ||
|
70158aa0ef | ||
|
5e7fbcb0e8 | ||
|
4feb4a3820 | ||
|
6323314ad7 | ||
|
3b69af2ae6 | ||
|
c401e678f3 | ||
|
03fe885b56 | ||
|
1ebceab85a | ||
|
dd45d75cd8 | ||
|
820894a7c9 | ||
|
845228f251 | ||
|
8c331038da | ||
|
04fe684db8 | ||
|
75d05ee85d | ||
|
8ba9f14642 | ||
|
c2b91ba1cd | ||
|
5d10fdc66a | ||
|
d7a54037c2 | ||
|
ffea0db012 | ||
|
b3a40115af | ||
|
c754ced61c | ||
|
849faf8065 | ||
|
6e90945922 | ||
|
cf9d88f334 | ||
|
0c32184775 | ||
|
0ac01b9053 | ||
|
4d227a6dda | ||
|
535dbb4a10 | ||
|
bb29e8793e | ||
|
9817cb8a60 | ||
|
ff7b02ac1b | ||
|
9f87bf18c2 | ||
|
1ead69e9b6 | ||
|
53ac644516 | ||
|
6e5180dcfe | ||
|
d09ff7176c | ||
|
3af78c1a3d | ||
|
38585cf478 | ||
|
5435d1758e | ||
|
d6abfb0e26 | ||
|
11c5a8a8eb | ||
|
017b90b97d | ||
|
4715293164 | ||
|
30c7602814 | ||
|
3b7b4055f1 | ||
|
4d8e6abff6 | ||
|
3b66925a66 | ||
|
eae355ddaf | ||
|
91fd28c319 | ||
|
cacf556c9a | ||
|
73a029641a | ||
|
0464324485 | ||
|
1af7a36c18 | ||
|
e030c1ee8c | ||
|
ea9b059f70 | ||
|
d041515e19 | ||
|
983d42160d | ||
|
dc5a7ac647 | ||
|
51015b3ca4 | ||
|
6a3be3301e | ||
|
f51df1c486 | ||
|
d8faf25383 | ||
|
f729a4d054 | ||
|
808a060a0d | ||
|
d3002106d5 | ||
|
f97c67e2f9 | ||
|
8219e76da4 | ||
|
30a6a9b697 | ||
|
a0311dfb2b | ||
|
b86a4a0fe0 | ||
|
1584174e1c | ||
|
b75a51c271 | ||
|
265d0e1dd1 | ||
|
084ae6fceb | ||
|
ee60a7f8ca | ||
|
b9b52d85a7 | ||
|
57879974ca | ||
|
a3333320d7 | ||
|
dccf1535f9 | ||
|
6f823731ca | ||
|
caefacbecd | ||
|
a47bd2d457 | ||
|
17ec1567a4 | ||
|
e3f969588c | ||
|
e9be7b9aea | ||
|
8742790980 | ||
|
321020ab83 | ||
|
a5a1f6a9d2 | ||
|
53de041194 | ||
|
5d26a72e98 | ||
|
09c70006c6 | ||
|
feff1a1e7a | ||
|
356f97641e | ||
|
bfb82fca4b | ||
|
4acb6e36f5 | ||
|
139adb0e65 | ||
|
fc8b58945d | ||
|
675c6840ac | ||
|
b112fec3e7 | ||
|
498b8dfe6a | ||
|
b866623c94 | ||
|
07b98030df | ||
|
7264941f91 | ||
|
876a964e1e | ||
|
db17253ccd | ||
|
0107c96fb7 | ||
|
b0e8f5ca36 | ||
|
40996de39a | ||
|
7383bc94df | ||
|
abe1a4cc30 | ||
|
f83020cd1f | ||
|
77f3685033 | ||
|
4291918171 | ||
|
da441c77ca | ||
|
1a12209fdc | ||
|
e5f124b696 | ||
|
f8560ef51b | ||
|
40a84fc3d8 | ||
|
6444ccd6a5 | ||
|
1f3afca482 | ||
|
d818e83235 | ||
|
257be2b9db | ||
|
c0d3d976fa | ||
|
29bb477efe | ||
|
feca3d0da6 | ||
|
077363a085 | ||
|
5ff66fd033 | ||
|
ae03e6d473 | ||
|
35f76bce60 | ||
|
124b7968f2 | ||
|
53f4179134 | ||
|
3a266d5195 | ||
|
4b2c787c3f | ||
|
e5389acd6e | ||
|
94991862ed | ||
|
b74ecbfacf | ||
|
bc4356a7f5 | ||
|
5cea3d3b9b | ||
|
e08a9f6146 | ||
|
3f4b1592af | ||
|
c5b4ff7b27 | ||
|
9b9fd76045 | ||
|
d3144ee234 | ||
|
e1a77fd7c8 | ||
|
aafc615d67 | ||
|
f13a1c8387 | ||
|
c28eee59b3 | ||
|
2204157ac0 | ||
|
3a8e8ecab9 | ||
|
7ecc8b0cba | ||
|
f66a1b998f | ||
|
1ab3029e78 | ||
|
06eb613c9b | ||
|
9dc5f1572c | ||
|
b9037df05c | ||
|
270ba09d08 | ||
|
75399117e3 | ||
|
4cb6b8fbb9 | ||
|
a00b0df4d8 | ||
|
09b9b4a083 | ||
|
6663b5dff0 | ||
|
6b336c5ea8 | ||
|
2f92a6c739 | ||
|
770f9370af | ||
|
2b56129d70 | ||
|
873db6e00b | ||
|
3f6e9e6b0c | ||
|
19196c219c | ||
|
f3c8921b09 | ||
|
c8dc8f6922 | ||
|
d52068cf5b | ||
|
b91caec30b | ||
|
379298acb0 | ||
|
d04cda6ca3 | ||
|
6339446c82 | ||
|
a002571984 | ||
|
3dd2382ea0 | ||
|
d73cd0ecdd | ||
|
a8777c6198 | ||
|
10514709f1 | ||
|
eb6e599df1 | ||
|
5ce1aeab47 | ||
|
389d004ddc | ||
|
72f89c0209 | ||
|
1e7eddb61e | ||
|
1302378141 | ||
|
29ede5aa27 | ||
|
d273b1920f | ||
|
b02f8190ea | ||
|
e0025df3e7 | ||
|
b8e17182e9 | ||
|
2b917372a7 | ||
|
270188b5b0 | ||
|
9149ecc7aa | ||
|
5fc2bb5eb6 | ||
|
24f3a6829f | ||
|
bf523b2325 | ||
|
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 |
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,8 +18,11 @@ trim_trailing_whitespace = false
|
|||||||
[*.{php,xml,json}]
|
[*.{php,xml,json}]
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
|
||||||
[tsconfig.json]
|
[{tsconfig.json,prettierrc.json,package.json}]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
[*.neon]
|
[*.neon]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
|
|
||||||
|
[{install,update}.php]
|
||||||
|
indent_size = 2
|
||||||
|
2
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
@@ -40,7 +40,7 @@ body:
|
|||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: enironment
|
id: environment
|
||||||
attributes:
|
attributes:
|
||||||
label: Environment
|
label: Environment
|
||||||
value: |
|
value: |
|
||||||
|
173
.github/workflows/REUSABLE_backend.yml
vendored
173
.github/workflows/REUSABLE_backend.yml
vendored
@@ -21,11 +21,18 @@ on:
|
|||||||
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.2", "8.3", "8.4"]'
|
||||||
|
|
||||||
php_extensions:
|
php_extensions:
|
||||||
description: PHP extensions to install.
|
description: PHP extensions to install.
|
||||||
@@ -37,7 +44,7 @@ on:
|
|||||||
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", "sqlite:3", "postgres:10"]'
|
||||||
|
|
||||||
php_ini_values:
|
php_ini_values:
|
||||||
description: PHP ini values
|
description: PHP ini values
|
||||||
@@ -45,44 +52,82 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
default: error_reporting=E_ALL
|
default: error_reporting=E_ALL
|
||||||
|
|
||||||
|
runner_type:
|
||||||
|
description: The type of runner to use for the jobs. This should be one of the types supported by the `runs-on` keyword.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: 'ubuntu-latest'
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
composer_auth:
|
||||||
|
description: The Composer auth tokens to use for private packages.
|
||||||
|
required: false
|
||||||
|
|
||||||
env:
|
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 }}
|
||||||
|
DB_DATABASE: flarum_test
|
||||||
|
DB_USERNAME: flarum
|
||||||
|
DB_PASSWORD: password
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ inputs.runner_type }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
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:
|
||||||
# Expands the matrix by naming DBs.
|
# Expands the matrix by naming DBs.
|
||||||
- service: 'mysql:5.7'
|
- service: 'mysql:5.7'
|
||||||
db: MySQL 5.7
|
db: MySQL 5.7
|
||||||
|
driver: mysql
|
||||||
- service: 'mysql:8.0.30'
|
- service: 'mysql:8.0.30'
|
||||||
db: MySQL 8.0
|
db: MySQL 8.0
|
||||||
|
driver: mysql
|
||||||
- service: mariadb
|
- service: mariadb
|
||||||
db: MariaDB
|
db: MariaDB
|
||||||
|
driver: mariadb
|
||||||
|
- service: 'mysql:8.1.0'
|
||||||
|
db: MySQL 8.1
|
||||||
|
driver: mysql
|
||||||
|
- service: 'sqlite:3'
|
||||||
|
db: SQLite
|
||||||
|
driver: sqlite
|
||||||
|
- service: 'postgres:10'
|
||||||
|
db: PostgreSQL 10
|
||||||
|
driver: pgsql
|
||||||
|
|
||||||
# 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] }}
|
||||||
service: 'mysql:5.7'
|
service: 'mysql:5.7'
|
||||||
db: MySQL 5.7
|
db: MySQL 5.7
|
||||||
prefix: flarum_
|
driver: mysql
|
||||||
prefixStr: (prefix)
|
|
||||||
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
|
||||||
service: 'mysql:8.0.30'
|
|
||||||
db: MySQL 8.0
|
|
||||||
prefix: flarum_
|
prefix: flarum_
|
||||||
prefixStr: (prefix)
|
prefixStr: (prefix)
|
||||||
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||||
service: mariadb
|
service: mariadb
|
||||||
db: MariaDB
|
db: MariaDB
|
||||||
|
driver: mariadb
|
||||||
|
prefix: flarum_
|
||||||
|
prefixStr: (prefix)
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||||
|
service: 'sqlite:3'
|
||||||
|
db: SQLite
|
||||||
|
driver: sqlite
|
||||||
|
prefix: flarum_
|
||||||
|
prefixStr: (prefix)
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||||
|
service: 'postgres:10'
|
||||||
|
db: PostgreSQL 10
|
||||||
|
driver: pgsql
|
||||||
prefix: flarum_
|
prefix: flarum_
|
||||||
prefixStr: (prefix)
|
prefixStr: (prefix)
|
||||||
|
|
||||||
@@ -90,14 +135,57 @@ jobs:
|
|||||||
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] }}
|
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||||
service: 'mysql:8.0.30'
|
service: mariadb
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[1] }}
|
||||||
|
service: mariadb
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||||
|
service: 'mysql:8.1.0'
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[1] }}
|
||||||
|
service: 'mysql:8.1.0'
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||||
|
service: 'sqlite:3'
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[1] }}
|
||||||
|
service: 'sqlite:3'
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[0] }}
|
||||||
|
service: 'postgres:10'
|
||||||
|
- php: ${{ fromJSON(inputs.php_versions)[1] }}
|
||||||
|
service: 'postgres:10'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
mysql:
|
mysql:
|
||||||
image: ${{ matrix.service }}
|
image: ${{ matrix.driver == 'mysql' && matrix.service || '' }}
|
||||||
|
env:
|
||||||
|
MYSQL_DATABASE: ${{ env.DB_DATABASE }}
|
||||||
|
MYSQL_USER: ${{ env.DB_USERNAME }}
|
||||||
|
MYSQL_PASSWORD: ${{ env.DB_PASSWORD }}
|
||||||
|
MYSQL_ROOT_PASSWORD: root
|
||||||
ports:
|
ports:
|
||||||
- 13306:3306
|
- 3306
|
||||||
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=10
|
||||||
|
mariadb:
|
||||||
|
image: ${{ matrix.driver == 'mariadb' && matrix.service || '' }}
|
||||||
|
env:
|
||||||
|
MARIADB_DATABASE: ${{ env.DB_DATABASE }}
|
||||||
|
MARIADB_USER: ${{ env.DB_USERNAME }}
|
||||||
|
MARIADB_PASSWORD: ${{ env.DB_PASSWORD }}
|
||||||
|
MARIADB_ROOT_PASSWORD: root
|
||||||
|
ports:
|
||||||
|
- 3306
|
||||||
|
options: --health-cmd="healthcheck.sh --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||||
|
postgres:
|
||||||
|
image: ${{ matrix.driver == 'pgsql' && matrix.service || '' }}
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: ${{ env.DB_DATABASE }}
|
||||||
|
POSTGRES_USER: ${{ env.DB_USERNAME }}
|
||||||
|
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
|
||||||
|
ports:
|
||||||
|
- 5432
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
|
||||||
name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}'
|
name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}'
|
||||||
|
|
||||||
@@ -106,7 +194,10 @@ jobs:
|
|||||||
((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || github.event_name != 'pull_request')
|
((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || github.event_name != 'pull_request')
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
@@ -115,41 +206,42 @@ jobs:
|
|||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
extensions: ${{ inputs.php_extensions }}
|
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
|
|
||||||
run: |
|
|
||||||
sudo systemctl start mysql
|
|
||||||
mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 13306
|
|
||||||
mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" --port 13306
|
|
||||||
|
|
||||||
- name: Install Composer dependencies
|
- 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_HOST: 127.0.0.1
|
||||||
DB_PASSWORD: root
|
DB_PORT: ${{ (matrix.driver == 'mysql' && job.services.mysql.ports['3306']) || (matrix.driver == 'mariadb' && job.services.mariadb.ports['3306']) || (matrix.driver == 'pgsql' && job.services.postgres.ports['5432']) }}
|
||||||
DB_PREFIX: ${{ matrix.prefix }}
|
DB_PREFIX: ${{ matrix.prefix }}
|
||||||
|
DB_DRIVER: ${{ matrix.driver }}
|
||||||
- name: Run Composer tests
|
|
||||||
run: composer test
|
|
||||||
working-directory: ${{ inputs.backend_directory }}
|
|
||||||
env:
|
|
||||||
COMPOSER_PROCESS_TIMEOUT: 600
|
COMPOSER_PROCESS_TIMEOUT: 600
|
||||||
|
|
||||||
phpstan:
|
phpstan:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ inputs.runner_type }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php: ${{ fromJSON(inputs.php_versions) }}
|
php: ${{ fromJson(inputs.php_versions) }}
|
||||||
|
|
||||||
name: 'PHPStan PHP ${{ matrix.php }}'
|
name: 'PHPStan PHP ${{ matrix.php }}'
|
||||||
|
|
||||||
@@ -167,11 +259,22 @@ jobs:
|
|||||||
coverage: xdebug
|
coverage: xdebug
|
||||||
extensions: ${{ inputs.php_extensions }}
|
extensions: ${{ inputs.php_extensions }}
|
||||||
tools: phpunit, composer:v2
|
tools: phpunit, composer:v2
|
||||||
ini-values: ${{ inputs.php_ini_values }}
|
ini-values: ${{ matrix.php_ini_values }}
|
||||||
|
|
||||||
- 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: Create MySQL Database
|
||||||
|
run: |
|
||||||
|
sudo systemctl start mysql
|
||||||
|
mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 3306
|
||||||
|
|
||||||
- name: Run PHPStan
|
- name: Run PHPStan
|
||||||
run: composer analyse:phpstan
|
run: composer analyse:phpstan
|
||||||
|
env:
|
||||||
|
DB_USERNAME: root
|
||||||
|
DB_PORT: 3306
|
||||||
|
DB_PASSWORD: root
|
||||||
|
COMPOSER_PROCESS_TIMEOUT: 600
|
||||||
|
FLARUM_TEST_TMP_DIR_LOCAL: ./tmp
|
||||||
|
35
.github/workflows/REUSABLE_frontend.yml
vendored
35
.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.
|
||||||
@@ -64,7 +74,7 @@ on:
|
|||||||
description: The node version to use for the workflow.
|
description: The node version to use for the workflow.
|
||||||
type: number
|
type: number
|
||||||
required: false
|
required: false
|
||||||
default: 16
|
default: 20
|
||||||
|
|
||||||
js_package_manager:
|
js_package_manager:
|
||||||
description: "Enable TypeScript?"
|
description: "Enable TypeScript?"
|
||||||
@@ -76,30 +86,41 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
|
runner_type:
|
||||||
|
description: The type of runner to use for the jobs. This should be one of the types supported by the `runs-on` keyword.
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: 'ubuntu-latest'
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
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 }}
|
||||||
|
DISABLE_V8_COMPILE_CACHE: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Checks & Build
|
name: Checks & Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ${{ inputs.runner_type }}
|
||||||
|
|
||||||
if: >-
|
if: >-
|
||||||
((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || github.event_name != 'pull_request')
|
((github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) || github.event_name != 'pull_request')
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ inputs.node_version }}
|
node-version: ${{ inputs.node_version }}
|
||||||
cache: ${{ inputs.js_package_manager }}
|
cache: ${{ inputs.js_package_manager }}
|
||||||
@@ -108,7 +129,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 +143,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@v4
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
build_script: ${{ inputs.build_script }}
|
build_script: ${{ inputs.build_script }}
|
||||||
@@ -130,6 +151,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 +163,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 extensions/messages php-packages/testing/tests"
|
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.2 8.3 8.4'
|
||||||
|
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-emoji-backend.yml
vendored
11
.github/workflows/flarum-emoji-backend.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
name: Emoji PHP
|
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
|
||||||
with:
|
|
||||||
enable_backend_testing: false
|
|
||||||
|
|
||||||
backend_directory: ./extensions/emoji
|
|
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 }}
|
||||||
|
3
.github/workflows/phpstan.yml
vendored
3
.github/workflows/phpstan.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Framework PHP
|
name: Static Code Analysis
|
||||||
|
|
||||||
on: [workflow_dispatch, push, pull_request]
|
on: [workflow_dispatch, push, pull_request]
|
||||||
|
|
||||||
@@ -8,5 +8,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
enable_backend_testing: false
|
enable_backend_testing: false
|
||||||
enable_phpstan: true
|
enable_phpstan: true
|
||||||
|
|
||||||
backend_directory: .
|
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 }}
|
||||||
|
270
CHANGELOG.md
270
CHANGELOG.md
@@ -1,5 +1,273 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [v2.0.0-beta.2](https://github.com/flarum/framework/compare/v2.0.0-beta.1...v2.0.0-beta.2)
|
||||||
|
### Fixed
|
||||||
|
- (em) incorrect extension compatibility check [#4155]
|
||||||
|
- (webpack) produces incorrect ext namespace (a7d584f8e1ec650035dafd660a70586d1d0d6bb9)
|
||||||
|
- bad modal alert text alignment [#4152]
|
||||||
|
- beta.1 early bugs (a81d13e26c1c2191859493de2ad45a515ad07b90)
|
||||||
|
- code split fails with common module [#4151]
|
||||||
|
- composer no longer autofocusing [#4149]
|
||||||
|
- conditional renders 0 (1cd644d27feb4eeea5cbaedd009a3af2643af396)
|
||||||
|
- custom styles from 1.x can crash the app [#4159]
|
||||||
|
- discussion page renders before loading is finished [#4158]
|
||||||
|
- discussion posts not always properly loaded [#4156]
|
||||||
|
- fixed side nav missing top spacing [#4147]
|
||||||
|
- invisible dropdown text when header is colored (958dec594486cbc14cf8f922db324a8ffc0245e3)
|
||||||
|
- lazy module import always returns default module [#4148]
|
||||||
|
- mistakenly removed code (33121ed1cc260bf967f0b8c4d10ab5099410bac0)
|
||||||
|
- select input cuts off [#4157]
|
||||||
|
- tag selection icon alignment [#4153]
|
||||||
|
- unexpected subscription breaks rendering [#4150]
|
||||||
|
- use correct human time format key [#4154]
|
||||||
|
### Changed
|
||||||
|
- (mentions) only access related mentions if loaded (9fe17b3c24c5b9236e419a00c1230b2994b8c009)
|
||||||
|
- extensibility improvements (00426c85e38efc91554af33644b088e72b3b3c1b)
|
||||||
|
|
||||||
|
## [v2.0.0-beta.1](https://github.com/flarum/framework/compare/v1.8.9...v2.0.0-beta.1)
|
||||||
|
### Changed
|
||||||
|
- php 8.4 [#4103]
|
||||||
|
- JSON:API refactor [#3971]
|
||||||
|
- (mentions) allow renderer to be used without context [#3954]
|
||||||
|
- (flags) add pagination to flags list [#3931]
|
||||||
|
- (mentions) add integration test for reply approval notification [#3748]
|
||||||
|
- (mentions,emoji) tie autocomplete to editor instance [#3913]
|
||||||
|
- (phpstan) upgrade to be compatible with latest dependency updates [#3835]
|
||||||
|
- (tags) prevent loading tag state if loaded previously [#4009]
|
||||||
|
- (testing) run flarum/testing packages tests back again [#3844]
|
||||||
|
- Do not catch exceptions when testing Console commands [#3813]
|
||||||
|
- Patch vulnerability advisory [#3966]
|
||||||
|
- Search box improvements on tablet devices [#4076]
|
||||||
|
- Test using MySQL 8.1 [#3870]
|
||||||
|
- Upgrade dependencies [#3830], [#4012]
|
||||||
|
- Upgrade `intervention/image` to 3.2 [#3947]
|
||||||
|
- Upgrade Wikimedia/less.php to 4.1 [#3837]
|
||||||
|
- Upgrade Mithril to 2.2 [#3831]
|
||||||
|
- (tags) Wrong tag input width if contains CJK characters [#4127]
|
||||||
|
- allow custom actions runner to be defined [#3988]
|
||||||
|
- avoid using `.fa()` mixins and `@fa-var` vars [#3912]
|
||||||
|
- cleanup composer deps (40dcaf882cd017463ca792762d4aa11de8c5c7da)
|
||||||
|
- corrected typos in routes comments [#3840]
|
||||||
|
- extract `FormModal` from `Modal` [#3922]
|
||||||
|
- extract `buildSettingComponent` method into a `FormGroup` component [#3927]
|
||||||
|
- fix typos [#4021]
|
||||||
|
- function names (d15438846895a5cf7b5a584479ef63a6e3119925)
|
||||||
|
- handle deprecations from 1.x [#3909]
|
||||||
|
- ignore deprecation errors in prod [#4072]
|
||||||
|
- improve debugging experience [#3944]
|
||||||
|
- improve test suite [#3814]
|
||||||
|
- increase phpstan level to 6 [#3836]
|
||||||
|
- `HeaderPrimary.js` converted to typescript [#4052]
|
||||||
|
- merge the app with the container & implement the ApplicationContract [#3862]
|
||||||
|
- recover bundlewatch [#3829]
|
||||||
|
- remove ExtenderInterface[] as a conditional option, only support callable or ::class invoke [#3904]
|
||||||
|
- remove listing of posts in the show discussion endpoint [#4067]
|
||||||
|
- remove unused vars in catch [#3839]
|
||||||
|
- simplify if else conditions [#3843]
|
||||||
|
- simplify variable assignment using null coalescing operator [#4000]
|
||||||
|
- support composer auth in workflows [#3961]
|
||||||
|
- switch formatter to `format-message` [#4088]
|
||||||
|
- transpile js to es6 [#3699]
|
||||||
|
- unify frontend initializers naming [#4003]
|
||||||
|
- update FontAwesome v6 icon search link [#4036]
|
||||||
|
- use `::class` syntax to fetch class name instead of `get_class()` function [#3910]
|
||||||
|
- use `hex_color` rule for color validation [#3936]
|
||||||
|
- use `str_contains` instead of `strpos` [#3841]
|
||||||
|
- graceful failure from extend/override errors [#4134]
|
||||||
|
### Fixed
|
||||||
|
- (a11y) convert empty links to buttons [#3926]
|
||||||
|
- (approval) `PostWasApproved` event triggered incorrectly [#3930]
|
||||||
|
- (em) prevent use if missing php functions (94b0d67a4020e1b7027e0df53dee1d681dc822e1)
|
||||||
|
- (em) production ready check (f6e84a0dc576d1cfe8539b7438244edf156e3b1a)
|
||||||
|
- (testing) use cookie for testing authentication [#3924]
|
||||||
|
- 3 char hex color is incorrectly modified to 6 [#4013]
|
||||||
|
- Add conditional rendering for email status in MailPage.tsx [#3997]
|
||||||
|
- Logout controller allows open redirects [#3948], [#4091]
|
||||||
|
- allow use of an attribute named `relationships` (1ead69e9b66ae9bc335be663498b7ea706adbf73)
|
||||||
|
- cannot install without db prefix [#4001]
|
||||||
|
- change length of email field [#4118]
|
||||||
|
- color input changes while typing [#3919]
|
||||||
|
- console extender does not accept `::class` attribute for schedule [#3903]
|
||||||
|
- default labels with `SettingDropdown` and `SelectDropdown` [#3854]
|
||||||
|
- duplicated `mentionsUsers` in extend.php (2b56129d70d18686a73d044ff65b418eef83f388)
|
||||||
|
- handled API errors break preloaded content [#3920]
|
||||||
|
- improve the flarum validator [#4133]
|
||||||
|
- installation command config path can be null (07623afacde590c45a20537add3b72a919050819)
|
||||||
|
- larastan changed namespace [#3955]
|
||||||
|
- larastan changes frequently (af2a32a3a4f50874c63785f5168e1df60f947553)
|
||||||
|
- load event mentioned tags on show discussion endpoint [#3915]
|
||||||
|
- move `UserSearchResult` to common (35f76bce60361caac8001c41c421de30f567b221)
|
||||||
|
- notify for all posts switch field loading state [#3938]
|
||||||
|
- only set actor on events that have it [#3914]
|
||||||
|
- overflowing forum stats [#3940]
|
||||||
|
- paginated list limit hard to change [#3918]
|
||||||
|
- prevent wiping out existing database on install [#4092]
|
||||||
|
- reset save button state when an error occurs in admin page [#4010]
|
||||||
|
- usage of `aria-hidden=false` might cause inconsistent behavior [#4074]
|
||||||
|
- use dynamic viewport units for height of Modals [#3951]
|
||||||
|
- user pages history not registered [#3916]
|
||||||
|
- validate required cli install args [#4093]
|
||||||
|
- make `WelcomeHero` extensible [#3848]
|
||||||
|
- Update the scheduler info link in admin (#3826)
|
||||||
|
### Added
|
||||||
|
- Export Registry [#3842]
|
||||||
|
- Code Splitting [#3860]
|
||||||
|
- Fontawesome v6 [#4020]
|
||||||
|
- extension bisect [#3980]
|
||||||
|
- extension list UI [#4066]
|
||||||
|
- admin search UI [#4022]
|
||||||
|
- add support for `PgSQL` [#3985]
|
||||||
|
- add support for `SQLite` [#3984]
|
||||||
|
- separate `MariaDB` driver [#4132]
|
||||||
|
- advanced maintenance modes [#3977]
|
||||||
|
- notification unsubscribe links [#3872]
|
||||||
|
- email overhaul with HTML multipart [#3872]
|
||||||
|
- date time formats from locales [#4029]
|
||||||
|
- messages extension [#4028]
|
||||||
|
- search drivers (revamp search system) [#3893]
|
||||||
|
- search UI/UX revamp [#3941]
|
||||||
|
- post search adapted with global search [#4019]
|
||||||
|
- vanilla CSS color scheme changes [#3996]
|
||||||
|
- (emoji) allow the user to set the CDN address [#3908]
|
||||||
|
- (nicknames) allow OAuth to provide a nickname [#4004]
|
||||||
|
- (sticky) make excerpt optional in sticky [#4016]
|
||||||
|
- JS `Notification` extender [#3974]
|
||||||
|
- add `whenExtensionDisabled` to `Conditional` extender [#3847]
|
||||||
|
- add option for filtering read stickied on all discussions page [#4073]
|
||||||
|
- allow resetting settings to default [#3935]
|
||||||
|
- define `FLARUM_START` constant [#4082]
|
||||||
|
- dispatch event to `flarum/installation-packages` on release [#3625]
|
||||||
|
- eloquent factories (primarily for tests) [#3982]
|
||||||
|
- frontend content flexible order priorities [#3765]
|
||||||
|
- improve emoji autocomplete [#3923]
|
||||||
|
- recover support for ico favicon [#4126]
|
||||||
|
- theming and extensibility improvements [#3876]
|
||||||
|
|
||||||
|
## [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)
|
## [v1.6.2](https://github.com/flarum/framework/compare/v1.6.1...v1.6.2)
|
||||||
### Fixed
|
### Fixed
|
||||||
* XSS Vulnerability in core (https://github.com/flarum/framework/pull/3684).
|
* XSS Vulnerability in core (https://github.com/flarum/framework/pull/3684).
|
||||||
@@ -345,7 +613,7 @@ looks rather complex and messy compared to the full list of changes made for thi
|
|||||||
- Pass filter params to getApiDocument (https://github.com/flarum/framework/pull/3037)
|
- Pass filter params to getApiDocument (https://github.com/flarum/framework/pull/3037)
|
||||||
- Use author filter instead of gambit to get a user's discussions (https://github.com/flarum/framework/pull/3068)
|
- Use author filter instead of gambit to get a user's discussions (https://github.com/flarum/framework/pull/3068)
|
||||||
- [A11Y] Accessibility improvements for the Search component (https://github.com/flarum/framework/pull/3017)
|
- [A11Y] Accessibility improvements for the Search component (https://github.com/flarum/framework/pull/3017)
|
||||||
- Add determinsm to extension order resolution (https://github.com/flarum/framework/pull/3076)
|
- Add determinism to extension order resolution (https://github.com/flarum/framework/pull/3076)
|
||||||
- Add cache control headers to the admin area (https://github.com/flarum/framework/pull/3097)
|
- Add cache control headers to the admin area (https://github.com/flarum/framework/pull/3097)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://flarum.org/"><img src="https://flarum.org/assets/img/logo.png"></a>
|
<a href="https://flarum.org/"><img src="https://flarum.org/images/flarum.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/packagist/dt/flarum/core" alt="Total Downloads"></a>
|
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/packagist/dt/flarum/core" alt="Total Downloads"></a>
|
||||||
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/github/v/release/flarum/core?sort=semver" alt="Latest Version"></a>
|
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/github/v/release/flarum/core?sort=semver" alt="Latest Version"></a>
|
||||||
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/packagist/l/flarum/core" alt="License"></a>
|
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/packagist/l/flarum/core" alt="License"></a>
|
||||||
<a href="https://huntr.dev/bounties/disclose/?target=https://github.com/flarum/core"><img src="https://cdn.huntr.dev/huntr_security_badge_mono.svg" alt="huntr"></a>
|
|
||||||
<a href="https://github.styleci.io/repos/28257573"><img src="https://github.styleci.io/repos/28257573/shield?style=flat" alt="StyleCI"></a>
|
<a href="https://github.styleci.io/repos/28257573"><img src="https://github.styleci.io/repos/28257573/shield?style=flat" alt="StyleCI"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
@@ -21,7 +20,7 @@
|
|||||||
|
|
||||||
* **Powerful and extensible.** Customize, extend, and integrate Flarum to suit your community. Flarum’s architecture is amazingly flexible, with a powerful Extension API.
|
* **Powerful and extensible.** Customize, extend, and integrate Flarum to suit your community. Flarum’s architecture is amazingly flexible, with a powerful Extension API.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -38,3 +37,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).
|
||||||
|
|
||||||
|
16
bin/test.sh
Normal file
16
bin/test.sh
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MONOREPO_TEST="framework/core extensions/akismet extensions/approval extensions/flags extensions/likes extensions/mentions extensions/nicknames extensions/statistics extensions/sticky extensions/subscriptions extensions/suspend extensions/tags extensions/messages php-packages/testing/tests"
|
||||||
|
|
||||||
|
for test in $MONOREPO_TEST; do
|
||||||
|
echo ""
|
||||||
|
echo "===> Testing $test"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# composer test:setup --working-dir=$test
|
||||||
|
composer test --working-dir=$test
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "===> Done testing $test"
|
||||||
|
echo ""
|
||||||
|
done
|
156
composer.json
156
composer.json
@@ -40,18 +40,20 @@
|
|||||||
"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",
|
||||||
"Flarum\\Subscriptions\\": "extensions/subscriptions/src",
|
"Flarum\\Subscriptions\\": "extensions/subscriptions/src",
|
||||||
"Flarum\\Suspend\\": "extensions/suspend/src",
|
"Flarum\\Suspend\\": "extensions/suspend/src",
|
||||||
"Flarum\\Tags\\": "extensions/tags/src",
|
"Flarum\\Tags\\": "extensions/tags/src",
|
||||||
|
"Flarum\\Messages\\": "extensions/messages/src",
|
||||||
"Flarum\\PHPStan\\": "php-packages/phpstan/src",
|
"Flarum\\PHPStan\\": "php-packages/phpstan/src",
|
||||||
"Flarum\\Testing\\": "php-packages/testing/src"
|
"Flarum\\Testing\\": "php-packages/testing/src"
|
||||||
},
|
},
|
||||||
@@ -59,6 +61,27 @@
|
|||||||
"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\\Messages\\Tests\\": "extensions/messages/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,75 +96,84 @@
|
|||||||
"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",
|
||||||
"flarum/subscriptions": "self.version",
|
"flarum/subscriptions": "self.version",
|
||||||
"flarum/suspend": "self.version",
|
"flarum/suspend": "self.version",
|
||||||
"flarum/tags": "self.version",
|
"flarum/tags": "self.version",
|
||||||
|
"flarum/messages": "self.version",
|
||||||
"flarum/phpstan": "self.version",
|
"flarum/phpstan": "self.version",
|
||||||
"flarum/testing": "self.version"
|
"flarum/testing": "self.version"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
"php": "^8.2",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"php": ">=7.3",
|
"components/font-awesome": "^6.5.2",
|
||||||
"components/font-awesome": "^5.14.0",
|
"composer/composer": "^2.7",
|
||||||
"composer/composer": "^2.0",
|
"dflydev/fig-cookies": "^3.0",
|
||||||
"dflydev/fig-cookies": "^3.0.0",
|
"doctrine/dbal": "^3.6.2",
|
||||||
"doctrine/dbal": "^2.7",
|
"dragonmantank/cron-expression": "^3.3",
|
||||||
"dragonmantank/cron-expression": "^3.1.0",
|
"fakerphp/faker": "^1.9.1",
|
||||||
"franzl/whoops-middleware": "^2.0.0",
|
"flarum/json-api-server": "^0.1.0",
|
||||||
"guzzlehttp/guzzle": "^6.0|^7.4",
|
"franzl/whoops-middleware": "2.0",
|
||||||
"illuminate/bus": "^8.0",
|
"guzzlehttp/guzzle": "*",
|
||||||
"illuminate/cache": "^8.0",
|
"illuminate/bus": "^11.0",
|
||||||
"illuminate/config": "^8.0",
|
"illuminate/cache": "^11.0",
|
||||||
"illuminate/console": "^8.0",
|
"illuminate/config": "^11.0",
|
||||||
"illuminate/container": "^8.0",
|
"illuminate/console": "^11.0",
|
||||||
"illuminate/contracts": "^8.0",
|
"illuminate/container": "^11.0",
|
||||||
"illuminate/database": "^8.0",
|
"illuminate/contracts": "^11.0",
|
||||||
"illuminate/events": "^8.0",
|
"illuminate/database": "^11.0",
|
||||||
"illuminate/filesystem": "^8.0",
|
"illuminate/events": "^11.0",
|
||||||
"illuminate/hashing": "^8.0",
|
"illuminate/filesystem": "^11.0",
|
||||||
"illuminate/mail": "^8.0",
|
"illuminate/hashing": "^11.0",
|
||||||
"illuminate/queue": "^8.0",
|
"illuminate/mail": "^11.0",
|
||||||
"illuminate/session": "^8.0",
|
"illuminate/queue": "^11.0",
|
||||||
"illuminate/support": "^8.0",
|
"illuminate/session": "^11.0",
|
||||||
"illuminate/validation": "^8.0",
|
"illuminate/support": "^11.0",
|
||||||
"illuminate/view": "^8.0",
|
"illuminate/validation": "^11.0",
|
||||||
"intervention/image": "2.5.* || ^2.6.1",
|
"illuminate/view": "^11.0",
|
||||||
"laminas/laminas-diactoros": "^2.4.1",
|
"intervention/image": "^3.2",
|
||||||
"laminas/laminas-httphandlerrunner": "^1.2.0",
|
"jenssegers/agent": "^2.6",
|
||||||
"laminas/laminas-stratigility": "^3.2.2",
|
"laminas/laminas-diactoros": "^3.0",
|
||||||
"league/flysystem": "^1.0.11",
|
"laminas/laminas-httphandlerrunner": "^2.6",
|
||||||
|
"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": "^3.0",
|
||||||
"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",
|
||||||
"sycho/json-api": "^0.5.0",
|
|
||||||
"sycho/sourcemap": "^2.0.0",
|
"sycho/sourcemap": "^2.0.0",
|
||||||
"symfony/config": "^5.2.2",
|
"symfony/config": "^7.0",
|
||||||
"symfony/console": "^5.2.2",
|
"symfony/console": "^7.0",
|
||||||
"symfony/event-dispatcher": "^5.2.2",
|
"symfony/event-dispatcher": "^7.0",
|
||||||
"symfony/mime": "^5.2.0",
|
"symfony/http-client": "^7.0",
|
||||||
"symfony/polyfill-intl-messageformatter": "^1.22.0",
|
"symfony/mailgun-mailer": "^7.0",
|
||||||
"symfony/translation": "^5.1.5",
|
"symfony/mime": "^7.0",
|
||||||
"symfony/yaml": "^5.2.2",
|
"symfony/polyfill-intl-messageformatter": "^1.27",
|
||||||
"wikimedia/less.php": "^3.0"
|
"symfony/postmark-mailer": "^7.0",
|
||||||
|
"symfony/translation": "^7.0",
|
||||||
|
"symfony/yaml": "^7.0",
|
||||||
|
"wikimedia/less.php": "^4.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mockery/mockery": "^1.4",
|
"mockery/mockery": "^1.5",
|
||||||
"phpunit/phpunit": "^9.0",
|
"phpunit/phpunit": "^11.0",
|
||||||
"phpstan/phpstan": ">=1.8.11 < 1.9.0",
|
"phpstan/phpstan": "^1.10.0",
|
||||||
"nunomaduro/larastan": "^1.0"
|
"larastan/larastan": "2.9.14",
|
||||||
|
"symfony/var-dumper": "^7.0",
|
||||||
|
"flarum/testing-tests": "*@dev"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"sort-packages": true
|
"sort-packages": true
|
||||||
@@ -168,10 +200,11 @@
|
|||||||
"extensions/sticky",
|
"extensions/sticky",
|
||||||
"extensions/subscriptions",
|
"extensions/subscriptions",
|
||||||
"extensions/suspend",
|
"extensions/suspend",
|
||||||
"extensions/tags"
|
"extensions/tags",
|
||||||
|
"extensions/messages"
|
||||||
],
|
],
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-main": "1.x-dev"
|
"dev-main": "2.x-dev"
|
||||||
},
|
},
|
||||||
"phpstan": {
|
"phpstan": {
|
||||||
"includes": [
|
"includes": [
|
||||||
@@ -180,9 +213,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"analyse:phpstan": "phpstan analyse"
|
"analyse:phpstan": "phpstan analyse",
|
||||||
|
"clear-cache:phpstan": "phpstan clear-result-cache"
|
||||||
},
|
},
|
||||||
"scripts-descriptions": {
|
"scripts-descriptions": {
|
||||||
"analyse:phpstan": "Run static analysis"
|
"analyse:phpstan": "Run static analysis"
|
||||||
}
|
},
|
||||||
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "path",
|
||||||
|
"url": "php-packages/testing/tests"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
1
extensions/akismet/.gitignore
vendored
1
extensions/akismet/.gitignore
vendored
@@ -4,6 +4,7 @@ composer.phar
|
|||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
tests/.phpunit.cache
|
||||||
tests/.phpunit.result.cache
|
tests/.phpunit.result.cache
|
||||||
/tests/integration/tmp
|
/tests/integration/tmp
|
||||||
.vagrant
|
.vagrant
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation)
|
Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation)
|
||||||
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
|
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
@@ -19,8 +19,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.6",
|
"flarum/core": "^2.0.0-beta.2",
|
||||||
"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-typings/admin/extend.d.ts
generated
vendored
Normal file
2
extensions/akismet/js/dist-typings/admin/extend.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
declare const _default: import("flarum/common/extenders/Admin").default[];
|
||||||
|
export default _default;
|
2
extensions/akismet/js/dist-typings/admin/index.d.ts
generated
vendored
2
extensions/akismet/js/dist-typings/admin/index.d.ts
generated
vendored
@@ -1 +1 @@
|
|||||||
export {};
|
export { default as extend } from './extend';
|
||||||
|
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 s in a)e.o(a,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:a[s]})},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),e.d(t,{extend:()=>n});const a=flarum.reg.get("core","admin/app");var s=e.n(a);const r=flarum.reg.get("core","common/extenders"),n=[(new(e.n(r)().Admin)).setting((()=>({setting:"flarum-akismet.api_key",type:"text",label:s().translator.trans("flarum-akismet.admin.akismet_settings.api_key_label")}))).setting((()=>({setting:"flarum-akismet.delete_blatant_spam",type:"boolean",label:s().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_label"),help:s().translator.trans("flarum-akismet.admin.akismet_settings.delete_blatant_spam_help")}))).permission((()=>({icon:"fas fa-vote-yea",label:s().translator.trans("flarum-akismet.admin.permissions.bypass_akismet"),permission:"bypassAkismet"})),"start")];s().initializers.add("flarum-akismet",(()=>{}))})(),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,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oBCE5D,IAAgB,I,MAAI,WAAeW,SAAQ,KAAM,CAC/CA,QAAS,yBACTC,KAAM,OACNC,MAAO,eAAeC,MAAM,2DAC1BH,SAAQ,KAAM,CAEhBA,QAAS,qCACTC,KAAM,UACNC,MAAO,eAAeC,MAAM,mEAC5BC,KAAM,eAAeD,MAAM,sEACzBE,YAAW,KAAM,CACnBC,KAAM,kBACNJ,MAAO,eAAeC,MAAM,mDAC5BE,WAAY,mBACV,UCdJ,iBAAiBE,IAAI,kBAAkB,Q","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/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/akismet/./src/admin/extend.tsx","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');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","import Extend from 'flarum/common/extenders';\nimport app from 'flarum/admin/app';\nexport default [new Extend.Admin().setting(() => ({\n setting: 'flarum-akismet.api_key',\n type: 'text',\n label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label')\n})).setting(() => ({\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})).permission(() => ({\n icon: 'fas fa-vote-yea',\n label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),\n permission: 'bypassAkismet'\n}), 'start')];","import app from 'flarum/admin/app';\nexport { default as extend } from './extend';\napp.initializers.add('flarum-akismet', () => {\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","setting","type","label","trans","help","permission","icon","add"],"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)};(()=>{"use strict";const t=flarum.reg.get("core","common/extend"),r=flarum.reg.get("core","forum/app");var o=e.n(r);const a=flarum.reg.get("core","forum/utils/PostControls");var n=e.n(a);const s=flarum.reg.get("core","forum/components/Post");var m=e.n(s);o().initializers.add("flarum-akismet",(()=>{(0,t.extend)(n(),"destructiveControls",(function(e,t){if(e.has("approve")){const r=t.flags();if(r&&r.some((e=>"akismet"===e?.type()))){const t=e.get("approve");t&&"object"==typeof t&&"children"in t&&(t.children=o().translator.trans("flarum-akismet.forum.post.not_spam_button"))}}})),(0,t.override)(m().prototype,"flagReason",(function(e,t){return"akismet"===t.type()?o().translator.trans("flarum-akismet.forum.post.akismet_flagged_text"):e(t)}))}))})(),module.exports={}})();
|
||||||
//# 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,I,mBCAlF,MAAM,EAA+BI,OAAOC,IAAIP,IAAI,OAAQ,iBCAtD,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,4B,aCA5D,MAAM,EAA+BM,OAAOC,IAAIP,IAAI,OAAQ,yB,aCI5D,iBAAiBQ,IAAI,kBAAkB,MACrC,IAAAC,QAAO,IAAc,uBAAuB,SAAUC,EAAOC,GAC3D,GAAID,EAAME,IAAI,WAAY,CACxB,MAAMC,EAAQF,EAAKE,QACnB,GAAIA,GAASA,EAAMC,MAAKC,GAAyB,YAAjBA,GAAMC,SAAuB,CAC3D,MAAMC,EAAcP,EAAMV,IAAI,WAC1BiB,GAAsC,iBAAhBA,GAA4B,aAAcA,IAClEA,EAAYC,SAAW,eAAeC,MAAM,6CAEhD,CACF,CACF,KACA,IAAAC,UAAS,cAAyB,cAAc,SAAUC,EAAUN,GAClE,MAAoB,YAAhBA,EAAKC,OACA,eAAeG,MAAM,kDAEvBE,EAASN,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/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))","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?.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","flarum","reg","add","extend","items","post","has","flags","some","flag","type","approveItem","children","trans","override","original"],"sourceRoot":""}
|
@@ -17,10 +17,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@flarum/prettier-config": "^1.0.0",
|
"@flarum/prettier-config": "^1.0.0",
|
||||||
"flarum-tsconfig": "^1.0.2",
|
"flarum-tsconfig": "^2.0.0",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"flarum-webpack-config": "^2.0.0",
|
"flarum-webpack-config": "^3.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"
|
||||||
|
26
extensions/akismet/js/src/admin/extend.tsx
Normal file
26
extensions/akismet/js/src/admin/extend.tsx
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import Extend from 'flarum/common/extenders';
|
||||||
|
import app from 'flarum/admin/app';
|
||||||
|
|
||||||
|
export default [
|
||||||
|
new Extend.Admin()
|
||||||
|
.setting(() => ({
|
||||||
|
setting: 'flarum-akismet.api_key',
|
||||||
|
type: 'text',
|
||||||
|
label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label'),
|
||||||
|
}))
|
||||||
|
.setting(() => ({
|
||||||
|
// https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/
|
||||||
|
setting: 'flarum-akismet.delete_blatant_spam',
|
||||||
|
type: 'boolean',
|
||||||
|
label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'),
|
||||||
|
help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help'),
|
||||||
|
}))
|
||||||
|
.permission(
|
||||||
|
() => ({
|
||||||
|
icon: 'fas fa-vote-yea',
|
||||||
|
label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),
|
||||||
|
permission: 'bypassAkismet',
|
||||||
|
}),
|
||||||
|
'start'
|
||||||
|
),
|
||||||
|
];
|
@@ -1,26 +1,7 @@
|
|||||||
import app from 'flarum/admin/app';
|
import app from 'flarum/admin/app';
|
||||||
|
|
||||||
|
export { default as extend } from './extend';
|
||||||
|
|
||||||
app.initializers.add('flarum-akismet', () => {
|
app.initializers.add('flarum-akismet', () => {
|
||||||
app.extensionData
|
// ...
|
||||||
.for('flarum-akismet')
|
|
||||||
.registerSetting({
|
|
||||||
setting: 'flarum-akismet.api_key',
|
|
||||||
type: 'text',
|
|
||||||
label: app.translator.trans('flarum-akismet.admin.akismet_settings.api_key_label'),
|
|
||||||
})
|
|
||||||
.registerSetting({
|
|
||||||
//https://blog.akismet.com/2014/04/23/theres-a-ninja-in-your-akismet/
|
|
||||||
setting: 'flarum-akismet.delete_blatant_spam',
|
|
||||||
type: 'boolean',
|
|
||||||
label: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_label'),
|
|
||||||
help: app.translator.trans('flarum-akismet.admin.akismet_settings.delete_blatant_spam_help'),
|
|
||||||
})
|
|
||||||
.registerPermission(
|
|
||||||
{
|
|
||||||
icon: 'fas fa-vote-yea',
|
|
||||||
label: app.translator.trans('flarum-akismet.admin.permissions.bypass_akismet'),
|
|
||||||
permission: 'bypassAkismet',
|
|
||||||
},
|
|
||||||
'start'
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -50,7 +47,7 @@ class Akismet
|
|||||||
$client = new Client();
|
$client = new Client();
|
||||||
|
|
||||||
return $client->request('POST', "$this->apiUrl/$type", [
|
return $client->request('POST', "$this->apiUrl/$type", [
|
||||||
'headers' => [
|
'headers' => [
|
||||||
'User-Agent' => "Flarum/$this->flarumVersion | Akismet/$this->extensionVersion",
|
'User-Agent' => "Flarum/$this->flarumVersion | Akismet/$this->extensionVersion",
|
||||||
],
|
],
|
||||||
'form_params' => $this->params,
|
'form_params' => $this->params,
|
||||||
@@ -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 */
|
||||||
|
@@ -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();
|
||||||
|
@@ -1,21 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit
|
<phpunit
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
backupStaticAttributes="false"
|
cacheDirectory=".phpunit.cache"
|
||||||
|
backupStaticProperties="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="true"
|
processIsolation="true"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
|
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
|
||||||
>
|
>
|
||||||
<coverage processUncoveredFiles="true">
|
<source>
|
||||||
<include>
|
<include>
|
||||||
<directory suffix=".php">../src/</directory>
|
<directory suffix=".php">../src/</directory>
|
||||||
</include>
|
</include>
|
||||||
</coverage>
|
</source>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Flarum Integration Tests">
|
<testsuite name="Flarum Integration Tests">
|
||||||
<directory suffix="Test.php">./integration</directory>
|
<directory suffix="Test.php">./integration</directory>
|
||||||
|
@@ -1,27 +1,23 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit
|
<phpunit
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
backupStaticAttributes="false"
|
cacheDirectory=".phpunit.cache"
|
||||||
|
backupStaticProperties="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
|
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
|
||||||
>
|
>
|
||||||
<coverage processUncoveredFiles="true">
|
<source>
|
||||||
<include>
|
<include>
|
||||||
<directory suffix=".php">../src/</directory>
|
<directory suffix=".php">../src/</directory>
|
||||||
</include>
|
</include>
|
||||||
</coverage>
|
</source>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Flarum Unit Tests">
|
<testsuite name="Flarum Unit Tests">
|
||||||
<directory suffix="Test.php">./unit</directory>
|
<directory suffix="Test.php">./unit</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
<listeners>
|
|
||||||
<listener class="\Mockery\Adapter\Phpunit\TestListener" />
|
|
||||||
</listeners>
|
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
1
extensions/approval/.gitignore
vendored
1
extensions/approval/.gitignore
vendored
@@ -4,6 +4,7 @@ composer.phar
|
|||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
tests/.phpunit.cache
|
||||||
tests/.phpunit.result.cache
|
tests/.phpunit.result.cache
|
||||||
/tests/integration/tmp
|
/tests/integration/tmp
|
||||||
.vagrant
|
.vagrant
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation)
|
Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation)
|
||||||
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
|
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
@@ -19,8 +19,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.6",
|
"flarum/core": "^2.0.0-beta.2",
|
||||||
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,9 +7,10 @@
|
|||||||
* LICENSE file that was distributed with this source code.
|
* LICENSE file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Flarum\Api\Serializer\BasicDiscussionSerializer;
|
use Flarum\Api\Resource;
|
||||||
use Flarum\Api\Serializer\PostSerializer;
|
use Flarum\Api\Schema;
|
||||||
use Flarum\Approval\Access;
|
use Flarum\Approval\Access;
|
||||||
|
use Flarum\Approval\Api\PostResourceFields;
|
||||||
use Flarum\Approval\Event\PostWasApproved;
|
use Flarum\Approval\Event\PostWasApproved;
|
||||||
use Flarum\Approval\Listener;
|
use Flarum\Approval\Listener;
|
||||||
use Flarum\Discussion\Discussion;
|
use Flarum\Discussion\Discussion;
|
||||||
@@ -28,23 +29,21 @@ 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\ApiResource(Resource\DiscussionResource::class))
|
||||||
->attribute('isApproved', function ($serializer, Discussion $discussion) {
|
->fields(fn () => [
|
||||||
return (bool) $discussion->is_approved;
|
Schema\Boolean::make('isApproved'),
|
||||||
}),
|
]),
|
||||||
|
|
||||||
(new Extend\ApiSerializer(PostSerializer::class))
|
(new Extend\ApiResource(Resource\PostResource::class))
|
||||||
->attribute('isApproved', function ($serializer, Post $post) {
|
->fields(PostResourceFields::class),
|
||||||
return (bool) $post->is_approved;
|
|
||||||
})->attribute('canApprove', function (PostSerializer $serializer, Post $post) {
|
|
||||||
return (bool) $serializer->getActor()->can('approvePosts', $post->discussion);
|
|
||||||
}),
|
|
||||||
|
|
||||||
new Extend\Locales(__DIR__.'/locale'),
|
new Extend\Locales(__DIR__.'/locale'),
|
||||||
|
|
||||||
@@ -63,8 +62,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 e={n:r=>{var s=r&&r.__esModule?()=>r.default:()=>r;return e.d(s,{a:s}),s},d:(r,s)=>{for(var o in s)e.o(s,o)&&!e.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:s[o]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};(()=>{"use strict";e.r(r),e.d(r,{extend:()=>i});const s=flarum.reg.get("core","common/extend"),o=flarum.reg.get("core","admin/app");var a=e.n(o);const t=flarum.reg.get("core","common/extenders"),i=[(new(e.n(t)().Admin)).permission((()=>({icon:"fas fa-check",label:a().translator.trans("flarum-approval.admin.permissions.start_discussions_without_approval_label"),permission:"discussion.startWithoutApproval"})),"start",95).permission((()=>({icon:"fas fa-check",label:a().translator.trans("flarum-approval.admin.permissions.reply_without_approval_label"),permission:"discussion.replyWithoutApproval"})),"reply",95).permission((()=>({icon:"fas fa-check",label:a().translator.trans("flarum-approval.admin.permissions.approve_posts_label"),permission:"discussion.approvePosts"})),"moderate",65)];a().initializers.add("flarum-approval",(()=>{(0,s.extend)(a(),"getRequiredPermissions",(function(e,r){"discussion.startWithoutApproval"===r&&e.push("startDiscussion"),"discussion.replyWithoutApproval"===r&&e.push("discussion.reply")}))}))})(),module.exports=r})();
|
||||||
//# 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,qDCL9D,MAAM,EAA+BC,OAAOC,IAAIV,IAAI,OAAQ,iBCAtD,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,a,aCA5D,MAAM,EAA+BS,OAAOC,IAAIV,IAAI,OAAQ,oBCE5D,IAAgB,I,MAAI,WAAeW,YAAW,KAAM,CAClDC,KAAM,eACNC,MAAO,eAAeC,MAAM,8EAC5BH,WAAY,qCACV,QAAS,IAAIA,YAAW,KAAM,CAChCC,KAAM,eACNC,MAAO,eAAeC,MAAM,kEAC5BH,WAAY,qCACV,QAAS,IAAIA,YAAW,KAAM,CAChCC,KAAM,eACNC,MAAO,eAAeC,MAAM,yDAC5BH,WAAY,6BACV,WAAY,KCXhB,iBAAiBI,IAAI,mBAAmB,MACtC,IAAAC,QAAO,IAAK,0BAA0B,SAAUC,EAAUN,GACrC,oCAAfA,GACFM,EAASC,KAAK,mBAEG,oCAAfP,GACFM,EAASC,KAAK,mBAElB,GAAE,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/external root \"flarum.reg.get('core', 'common/extenders')\"","webpack://@flarum/approval/./src/admin/extend.tsx","webpack://@flarum/approval/./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', 'common/extend');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'admin/app');","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.reg.get('core', 'common/extenders');","import Extend from 'flarum/common/extenders';\nimport app from 'flarum/admin/app';\nexport default [new Extend.Admin().permission(() => ({\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).permission(() => ({\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).permission(() => ({\n icon: 'fas fa-check',\n label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),\n permission: 'discussion.approvePosts'\n}), 'moderate', 65)];","import { extend } from 'flarum/common/extend';\nimport app from 'flarum/admin/app';\nexport { default as extend } from './extend';\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});"],"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","permission","icon","label","trans","add","extend","required","push"],"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 t={n:o=>{var r=o&&o.__esModule?()=>o.default:()=>o;return t.d(r,{a:r}),r},d:(o,r)=>{for(var e in r)t.o(r,e)&&!t.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:r[e]})},o:(t,o)=>Object.prototype.hasOwnProperty.call(t,o)};(()=>{"use strict";const o=flarum.reg.get("core","common/extend"),r=flarum.reg.get("core","forum/app");var e=t.n(r);const a=flarum.reg.get("core","common/models/Discussion");var n=t.n(a);const p=flarum.reg.get("core","common/models/Post");var s=t.n(p);const i=flarum.reg.get("core","common/components/Badge");var c=t.n(i);const u=flarum.reg.get("core","forum/components/DiscussionListItem");var l=t.n(u);const d=flarum.reg.get("core","forum/components/Post");var v=t.n(d);const f=flarum.reg.get("core","forum/components/CommentPost");var g=t.n(f);const A=flarum.reg.get("core","common/components/Button");var h=t.n(A);const b=flarum.reg.get("core","forum/utils/PostControls");var y=t.n(b);e().initializers.add("flarum-approval",(()=>{n().prototype.isApproved=n().attribute("isApproved"),(0,o.extend)(n().prototype,"badges",(function(t){this.isApproved()||t.has("hidden")||t.add("awaitingApproval",m(c(),{type:"awaitingApproval",icon:"fas fa-gavel",label:e().translator.trans("flarum-approval.forum.badge.awaiting_approval_tooltip")}))})),s().prototype.isApproved=s().attribute("isApproved"),s().prototype.canApprove=s().attribute("canApprove"),(0,o.extend)(l().prototype,"elementAttrs",(function(t){this.attrs.discussion.isApproved()||(t.className+=" DiscussionListItem--unapproved")})),(0,o.extend)(v().prototype,"elementAttrs",(function(t){this.attrs.post.isApproved()||(t.className+=" Post--unapproved")})),(0,o.extend)(g().prototype,"headerItems",(function(t){this.attrs.post.isApproved()||this.attrs.post.isHidden()||t.add("unapproved",e().translator.trans("flarum-approval.forum.post.awaiting_approval_text"))})),(0,o.override)(v().prototype,"flagReason",(function(t,o){return"approval"===o.type()?e().translator.trans("flarum-approval.forum.post.awaiting_approval_text"):t(o)})),(0,o.extend)(y(),"destructiveControls",(function(t,o){!o.isApproved()&&o.canApprove()&&t.add("approve",m(h(),{icon:"fas fa-check",onclick:y().approveAction.bind(o)},e().translator.trans("flarum-approval.forum.post_controls.approve_button")),10)})),y().approveAction=function(){this.save({isApproved:!0}),1===this.number()&&this.discussion().pushAttributes({isApproved:!0})}}),-10)})(),module.exports={}})();
|
||||||
//# 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
@@ -5,8 +5,8 @@
|
|||||||
"prettier": "@flarum/prettier-config",
|
"prettier": "@flarum/prettier-config",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"flarum-webpack-config": "^2.0.0",
|
"flarum-webpack-config": "^3.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"
|
||||||
},
|
},
|
||||||
|
@@ -1,43 +1,33 @@
|
|||||||
import { extend } from 'flarum/common/extend';
|
import Extend from 'flarum/common/extenders';
|
||||||
import app from 'flarum/admin/app';
|
import app from 'flarum/admin/app';
|
||||||
|
|
||||||
app.initializers.add('flarum-approval', () => {
|
export default [
|
||||||
extend(app, 'getRequiredPermissions', function (required, permission) {
|
new Extend.Admin()
|
||||||
if (permission === 'discussion.startWithoutApproval') {
|
.permission(
|
||||||
required.push('startDiscussion');
|
() => ({
|
||||||
}
|
|
||||||
if (permission === 'discussion.replyWithoutApproval') {
|
|
||||||
required.push('discussion.reply');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.extensionData
|
|
||||||
.for('flarum-approval')
|
|
||||||
.registerPermission(
|
|
||||||
{
|
|
||||||
icon: 'fas fa-check',
|
icon: 'fas fa-check',
|
||||||
label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'),
|
label: app.translator.trans('flarum-approval.admin.permissions.start_discussions_without_approval_label'),
|
||||||
permission: 'discussion.startWithoutApproval',
|
permission: 'discussion.startWithoutApproval',
|
||||||
},
|
}),
|
||||||
'start',
|
'start',
|
||||||
95
|
95
|
||||||
)
|
)
|
||||||
.registerPermission(
|
.permission(
|
||||||
{
|
() => ({
|
||||||
icon: 'fas fa-check',
|
icon: 'fas fa-check',
|
||||||
label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'),
|
label: app.translator.trans('flarum-approval.admin.permissions.reply_without_approval_label'),
|
||||||
permission: 'discussion.replyWithoutApproval',
|
permission: 'discussion.replyWithoutApproval',
|
||||||
},
|
}),
|
||||||
'reply',
|
'reply',
|
||||||
95
|
95
|
||||||
)
|
)
|
||||||
.registerPermission(
|
.permission(
|
||||||
{
|
() => ({
|
||||||
icon: 'fas fa-check',
|
icon: 'fas fa-check',
|
||||||
label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),
|
label: app.translator.trans('flarum-approval.admin.permissions.approve_posts_label'),
|
||||||
permission: 'discussion.approvePosts',
|
permission: 'discussion.approvePosts',
|
||||||
},
|
}),
|
||||||
'moderate',
|
'moderate',
|
||||||
65
|
65
|
||||||
);
|
),
|
||||||
});
|
];
|
15
extensions/approval/js/src/admin/index.ts
Normal file
15
extensions/approval/js/src/admin/index.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { extend } from 'flarum/common/extend';
|
||||||
|
import app from 'flarum/admin/app';
|
||||||
|
|
||||||
|
export { default as extend } from './extend';
|
||||||
|
|
||||||
|
app.initializers.add('flarum-approval', () => {
|
||||||
|
extend(app, 'getRequiredPermissions', function (required, permission) {
|
||||||
|
if (permission === 'discussion.startWithoutApproval') {
|
||||||
|
required.push('startDiscussion');
|
||||||
|
}
|
||||||
|
if (permission === 'discussion.replyWithoutApproval') {
|
||||||
|
required.push('discussion.reply');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
15
extensions/approval/js/tsconfig.json
Normal file
15
extensions/approval/js/tsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
// Use Flarum's tsconfig as a starting point
|
||||||
|
"extends": "flarum-tsconfig",
|
||||||
|
// This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
|
||||||
|
// and also tells your Typescript server to read core's global typings for
|
||||||
|
// access to `dayjs` and `$` in the global namespace.
|
||||||
|
"include": ["src/**/*", "../../../*/*/js/dist-typings/@types/**/*", "@types/**/*"],
|
||||||
|
"compilerOptions": {
|
||||||
|
// This will output typings to `dist-typings`
|
||||||
|
"declarationDir": "./dist-typings",
|
||||||
|
"paths": {
|
||||||
|
"flarum/*": ["../../../framework/core/js/dist-typings/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
29
extensions/approval/src/Api/PostResourceFields.php
Normal file
29
extensions/approval/src/Api/PostResourceFields.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?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\Api;
|
||||||
|
|
||||||
|
use Flarum\Api\Context;
|
||||||
|
use Flarum\Api\Schema;
|
||||||
|
use Flarum\Post\Post;
|
||||||
|
|
||||||
|
class PostResourceFields
|
||||||
|
{
|
||||||
|
public function __invoke(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Schema\Boolean::make('isApproved')
|
||||||
|
->writable(fn (Post $post, Context $context) => $context->getActor()->can('approve', $post))
|
||||||
|
// set by the ApproveContent listener.
|
||||||
|
->set(fn () => null),
|
||||||
|
Schema\Boolean::make('canApprove')
|
||||||
|
->get(fn (Post $post, Context $context) => $context->getActor()->can('approvePosts', $post->discussion)),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@@ -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,35 +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(...));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function approvePost(Saving $event)
|
/**
|
||||||
|
* @throws PermissionDeniedException
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
|
||||||
$post->raise(new PostWasApproved($post, $event->actor));
|
if (! $approvingSilently) {
|
||||||
|
$post->raise(new PostWasApproved($post, $event->actor));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,7 @@ use Flarum\Approval\Event\PostWasApproved;
|
|||||||
|
|
||||||
class UpdateDiscussionAfterPostApproval
|
class UpdateDiscussionAfterPostApproval
|
||||||
{
|
{
|
||||||
public function handle(PostWasApproved $event)
|
public function handle(PostWasApproved $event): void
|
||||||
{
|
{
|
||||||
$post = $event->post;
|
$post = $event->post;
|
||||||
$discussion = $post->discussion;
|
$discussion = $post->discussion;
|
||||||
@@ -22,7 +22,7 @@ class UpdateDiscussionAfterPostApproval
|
|||||||
$discussion->refreshCommentCount();
|
$discussion->refreshCommentCount();
|
||||||
$discussion->refreshLastPost();
|
$discussion->refreshLastPost();
|
||||||
|
|
||||||
if ($post->number == 1) {
|
if ($post->number === 1) {
|
||||||
$discussion->is_approved = true;
|
$discussion->is_approved = true;
|
||||||
|
|
||||||
$discussion->afterSave(function () use ($user) {
|
$discussion->afterSave(function () use ($user) {
|
||||||
@@ -36,5 +36,10 @@ class UpdateDiscussionAfterPostApproval
|
|||||||
$user->refreshCommentCount();
|
$user->refreshCommentCount();
|
||||||
$user->save();
|
$user->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($post->user) {
|
||||||
|
$post->user->refreshCommentCount();
|
||||||
|
$post->user->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,19 +10,23 @@
|
|||||||
namespace Flarum\Approval\Tests\integration;
|
namespace Flarum\Approval\Tests\integration;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
|
use Flarum\Discussion\Discussion;
|
||||||
|
use Flarum\Group\Group;
|
||||||
|
use Flarum\Post\Post;
|
||||||
|
use Flarum\User\User;
|
||||||
|
|
||||||
trait InteractsWithUnapprovedContent
|
trait InteractsWithUnapprovedContent
|
||||||
{
|
{
|
||||||
protected function prepareUnapprovedDatabaseContent()
|
protected function prepareUnapprovedDatabaseContent()
|
||||||
{
|
{
|
||||||
$this->prepareDatabase([
|
$this->prepareDatabase([
|
||||||
'users' => [
|
User::class => [
|
||||||
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||||
$this->normalUser(),
|
$this->normalUser(),
|
||||||
['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1],
|
['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1],
|
||||||
['id' => 4, 'username' => 'luceos', 'email' => 'luceos@machine.local', 'is_email_confirmed' => 1],
|
['id' => 4, 'username' => 'luceos', 'email' => 'luceos@machine.local', 'is_email_confirmed' => 1],
|
||||||
],
|
],
|
||||||
'discussions' => [
|
Discussion::class => [
|
||||||
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 1, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 1, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
||||||
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 2, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 2, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
||||||
['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 3, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 3, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
||||||
@@ -31,7 +35,7 @@ trait InteractsWithUnapprovedContent
|
|||||||
['id' => 6, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 6, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
['id' => 6, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 6, 'comment_count' => 1, 'is_approved' => 0, 'is_private' => 1],
|
||||||
['id' => 7, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 7, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
['id' => 7, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 7, 'comment_count' => 1, 'is_approved' => 1, 'is_private' => 0],
|
||||||
],
|
],
|
||||||
'posts' => [
|
Post::class => [
|
||||||
['id' => 1, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
['id' => 1, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||||
['id' => 2, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
['id' => 2, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||||
['id' => 3, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
['id' => 3, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||||
@@ -45,7 +49,7 @@ trait InteractsWithUnapprovedContent
|
|||||||
['id' => 10, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 4],
|
['id' => 10, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 4],
|
||||||
['id' => 11, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 1, 'is_approved' => 0, 'number' => 5],
|
['id' => 11, 'discussion_id' => 7, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 1, 'is_approved' => 0, 'number' => 5],
|
||||||
],
|
],
|
||||||
'groups' => [
|
Group::class => [
|
||||||
['id' => 4, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0]
|
['id' => 4, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0]
|
||||||
],
|
],
|
||||||
'group_user' => [
|
'group_user' => [
|
||||||
@@ -60,7 +64,7 @@ trait InteractsWithUnapprovedContent
|
|||||||
/**
|
/**
|
||||||
* null: Guest, 2: Normal User.
|
* null: Guest, 2: Normal User.
|
||||||
*/
|
*/
|
||||||
public function unallowedUsers(): array
|
public static function unallowedUsers(): array
|
||||||
{
|
{
|
||||||
return [[null], [2]];
|
return [[null], [2]];
|
||||||
}
|
}
|
||||||
@@ -68,7 +72,7 @@ trait InteractsWithUnapprovedContent
|
|||||||
/**
|
/**
|
||||||
* 1: Admin, 3: Permission Given, 4: Discussions Author.
|
* 1: Admin, 3: Permission Given, 4: Discussions Author.
|
||||||
*/
|
*/
|
||||||
public function allowedUsers(): array
|
public static function allowedUsers(): array
|
||||||
{
|
{
|
||||||
return [[1], [3], [4]];
|
return [[1], [3], [4]];
|
||||||
}
|
}
|
||||||
|
122
extensions/approval/tests/integration/api/ApprovePostsTest.php
Normal file
122
extensions/approval/tests/integration/api/ApprovePostsTest.php
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Flarum.
|
||||||
|
*
|
||||||
|
* For detailed copyright and license information, please view the
|
||||||
|
* LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Approval\Tests\integration\api;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Flarum\Approval\Tests\integration\InteractsWithUnapprovedContent;
|
||||||
|
use Flarum\Discussion\Discussion;
|
||||||
|
use Flarum\Group\Group;
|
||||||
|
use Flarum\Post\Post;
|
||||||
|
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||||
|
use Flarum\Testing\integration\TestCase;
|
||||||
|
use Flarum\User\User;
|
||||||
|
use PHPUnit\Framework\Attributes\Test;
|
||||||
|
|
||||||
|
class ApprovePostsTest extends TestCase
|
||||||
|
{
|
||||||
|
use RetrievesAuthorizedUsers;
|
||||||
|
use InteractsWithUnapprovedContent;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->extension('flarum-approval');
|
||||||
|
|
||||||
|
$this->prepareDatabase([
|
||||||
|
User::class => [
|
||||||
|
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||||
|
$this->normalUser(),
|
||||||
|
['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1],
|
||||||
|
['id' => 4, 'username' => 'luceos', 'email' => 'luceos@machine.local', 'is_email_confirmed' => 1],
|
||||||
|
],
|
||||||
|
Discussion::class => [
|
||||||
|
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 1, 'comment_count' => 1, 'is_approved' => 1],
|
||||||
|
],
|
||||||
|
Post::class => [
|
||||||
|
['id' => 1, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'hidden_at' => null, 'is_approved' => 1, 'number' => 1],
|
||||||
|
['id' => 2, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'hidden_at' => null, 'is_approved' => 1, 'number' => 2],
|
||||||
|
['id' => 3, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'hidden_at' => null, 'is_approved' => 0, 'number' => 3],
|
||||||
|
['id' => 4, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'hidden_at' => Carbon::now(), 'is_approved' => 1, 'number' => 4],
|
||||||
|
['id' => 5, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'hidden_at' => null, 'is_approved' => 0, 'number' => 5],
|
||||||
|
],
|
||||||
|
Group::class => [
|
||||||
|
['id' => 4, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0],
|
||||||
|
['id' => 5, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0],
|
||||||
|
],
|
||||||
|
'group_user' => [
|
||||||
|
['user_id' => 3, 'group_id' => 4],
|
||||||
|
],
|
||||||
|
'group_permission' => [
|
||||||
|
['group_id' => 4, 'permission' => 'discussion.approvePosts'],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Test]
|
||||||
|
public function can_approve_unapproved_post()
|
||||||
|
{
|
||||||
|
$response = $this->send(
|
||||||
|
$this->request('PATCH', '/api/posts/3', [
|
||||||
|
'authenticatedAs' => 3,
|
||||||
|
'json' => [
|
||||||
|
'data' => [
|
||||||
|
'attributes' => [
|
||||||
|
'isApproved' => true
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode(), $response->getBody()->getContents());
|
||||||
|
$this->assertEquals(1, $this->database()->table('posts')->where('id', 3)->where('is_approved', 1)->count());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Test]
|
||||||
|
public function cannot_approve_post_without_permission()
|
||||||
|
{
|
||||||
|
$response = $this->send(
|
||||||
|
$this->request('PATCH', '/api/posts/3', [
|
||||||
|
'authenticatedAs' => 4,
|
||||||
|
'json' => [
|
||||||
|
'data' => [
|
||||||
|
'attributes' => [
|
||||||
|
'isApproved' => true
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(403, $response->getStatusCode(), $response->getBody()->getContents());
|
||||||
|
$this->assertEquals(0, $this->database()->table('posts')->where('id', 3)->where('is_approved', 1)->count());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Test]
|
||||||
|
public function hiding_post_silently_approves_it()
|
||||||
|
{
|
||||||
|
$response = $this->send(
|
||||||
|
$this->request('PATCH', '/api/posts/5', [
|
||||||
|
'authenticatedAs' => 3,
|
||||||
|
'json' => [
|
||||||
|
'data' => [
|
||||||
|
'attributes' => [
|
||||||
|
'isHidden' => true
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertEquals(200, $response->getStatusCode(), $response->getBody()->getContents());
|
||||||
|
$this->assertEquals(1, $this->database()->table('posts')->where('id', 5)->where('is_approved', 1)->count());
|
||||||
|
}
|
||||||
|
}
|
155
extensions/approval/tests/integration/api/CreatePostsTest.php
Normal file
155
extensions/approval/tests/integration/api/CreatePostsTest.php
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Flarum.
|
||||||
|
*
|
||||||
|
* For detailed copyright and license information, please view the
|
||||||
|
* LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Flarum\Approval\Tests\integration\api;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Flarum\Approval\Tests\integration\InteractsWithUnapprovedContent;
|
||||||
|
use Flarum\Discussion\Discussion;
|
||||||
|
use Flarum\Group\Group;
|
||||||
|
use Flarum\Post\Post;
|
||||||
|
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||||
|
use Flarum\Testing\integration\TestCase;
|
||||||
|
use Flarum\User\User;
|
||||||
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
|
use PHPUnit\Framework\Attributes\Test;
|
||||||
|
|
||||||
|
class CreatePostsTest extends TestCase
|
||||||
|
{
|
||||||
|
use RetrievesAuthorizedUsers;
|
||||||
|
use InteractsWithUnapprovedContent;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->extension('flarum-flags', 'flarum-approval');
|
||||||
|
|
||||||
|
$this->prepareDatabase([
|
||||||
|
User::class => [
|
||||||
|
['id' => 1, 'username' => 'Muralf', 'email' => 'muralf@machine.local', 'is_email_confirmed' => 1],
|
||||||
|
$this->normalUser(),
|
||||||
|
['id' => 3, 'username' => 'acme', 'email' => 'acme@machine.local', 'is_email_confirmed' => 1],
|
||||||
|
['id' => 4, 'username' => 'luceos', 'email' => 'luceos@machine.local', 'is_email_confirmed' => 1],
|
||||||
|
],
|
||||||
|
Discussion::class => [
|
||||||
|
['id' => 1, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 1, 'comment_count' => 1, 'is_approved' => 1],
|
||||||
|
['id' => 2, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 2, 'comment_count' => 1, 'is_approved' => 0],
|
||||||
|
['id' => 3, 'title' => __CLASS__, 'created_at' => Carbon::now(), 'last_posted_at' => Carbon::now(), 'user_id' => 4, 'first_post_id' => 3, 'comment_count' => 1, 'is_approved' => 0],
|
||||||
|
],
|
||||||
|
Post::class => [
|
||||||
|
['id' => 1, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||||
|
['id' => 2, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 2],
|
||||||
|
['id' => 3, 'discussion_id' => 1, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 3],
|
||||||
|
['id' => 4, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||||
|
['id' => 5, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 2],
|
||||||
|
['id' => 6, 'discussion_id' => 2, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 3],
|
||||||
|
['id' => 7, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 1],
|
||||||
|
['id' => 8, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 1, 'number' => 2],
|
||||||
|
['id' => 9, 'discussion_id' => 3, 'user_id' => 4, 'type' => 'comment', 'content' => '<t><p>Text</p></t>', 'is_private' => 0, 'is_approved' => 0, 'number' => 3],
|
||||||
|
],
|
||||||
|
Group::class => [
|
||||||
|
['id' => 4, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0],
|
||||||
|
['id' => 5, 'name_singular' => 'Acme', 'name_plural' => 'Acme', 'is_hidden' => 0],
|
||||||
|
],
|
||||||
|
'group_user' => [
|
||||||
|
['user_id' => 3, 'group_id' => 4],
|
||||||
|
['user_id' => 2, 'group_id' => 5],
|
||||||
|
],
|
||||||
|
'group_permission' => [
|
||||||
|
['group_id' => 4, 'permission' => 'discussion.startWithoutApproval'],
|
||||||
|
['group_id' => 5, 'permission' => 'discussion.replyWithoutApproval'],
|
||||||
|
['group_id' => Group::MEMBER_ID, 'permission' => 'postWithoutThrottle'],
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Test]
|
||||||
|
#[DataProvider('startDiscussionDataProvider')]
|
||||||
|
public function can_start_discussion_without_approval_when_allowed(int $authenticatedAs, bool $allowed)
|
||||||
|
{
|
||||||
|
$this->database()->table('group_permission')->where('group_id', Group::MEMBER_ID)->where('permission', 'discussion.startWithoutApproval')->delete();
|
||||||
|
|
||||||
|
$response = $this->send(
|
||||||
|
$this->request('POST', '/api/discussions', [
|
||||||
|
'authenticatedAs' => $authenticatedAs,
|
||||||
|
'json' => [
|
||||||
|
'data' => [
|
||||||
|
'type' => 'discussions',
|
||||||
|
'attributes' => [
|
||||||
|
'title' => 'This is a new discussion',
|
||||||
|
'content' => 'This is a new discussion',
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
$body = $response->getBody()->getContents();
|
||||||
|
$json = json_decode($body, true);
|
||||||
|
|
||||||
|
$this->assertEquals(201, $response->getStatusCode(), $body);
|
||||||
|
$this->assertEquals($allowed ? 1 : 0, $this->database()->table('discussions')->where('id', $json['data']['id'])->value('is_approved'));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Test]
|
||||||
|
#[DataProvider('replyToDiscussionDataProvider')]
|
||||||
|
public function can_reply_without_approval_when_allowed(?int $authenticatedAs, bool $allowed)
|
||||||
|
{
|
||||||
|
$this->database()->table('group_permission')->where('group_id', Group::MEMBER_ID)->where('permission', 'discussion.replyWithoutApproval')->delete();
|
||||||
|
|
||||||
|
$response = $this->send(
|
||||||
|
$this->request('POST', '/api/posts', [
|
||||||
|
'authenticatedAs' => $authenticatedAs,
|
||||||
|
'json' => [
|
||||||
|
'data' => [
|
||||||
|
'type' => 'posts',
|
||||||
|
'attributes' => [
|
||||||
|
'content' => 'This is a new reply',
|
||||||
|
],
|
||||||
|
'relationships' => [
|
||||||
|
'discussion' => [
|
||||||
|
'data' => [
|
||||||
|
'type' => 'discussions',
|
||||||
|
'id' => 1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
$body = $response->getBody()->getContents();
|
||||||
|
$json = json_decode($body, true);
|
||||||
|
|
||||||
|
$this->assertEquals(201, $response->getStatusCode(), $body);
|
||||||
|
$this->assertEquals($allowed ? 1 : 0, $this->database()->table('posts')->where('id', $json['data']['id'])->value('is_approved'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function startDiscussionDataProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'Admin' => [1, true],
|
||||||
|
'User without permission' => [2, false],
|
||||||
|
'Permission Given' => [3, true],
|
||||||
|
'Another user without permission' => [4, false],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function replyToDiscussionDataProvider(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'Admin' => [1, true],
|
||||||
|
'User without permission' => [3, false],
|
||||||
|
'Permission Given' => [2, true],
|
||||||
|
'Another user without permission' => [4, false],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
@@ -13,6 +13,8 @@ use Flarum\Approval\Tests\integration\InteractsWithUnapprovedContent;
|
|||||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||||
use Flarum\Testing\integration\TestCase;
|
use Flarum\Testing\integration\TestCase;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
|
use PHPUnit\Framework\Attributes\Test;
|
||||||
|
|
||||||
class ListDiscussionsTest extends TestCase
|
class ListDiscussionsTest extends TestCase
|
||||||
{
|
{
|
||||||
@@ -28,10 +30,8 @@ class ListDiscussionsTest extends TestCase
|
|||||||
$this->prepareUnapprovedDatabaseContent();
|
$this->prepareUnapprovedDatabaseContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[Test]
|
||||||
* @dataProvider unallowedUsers
|
#[DataProvider('unallowedUsers')]
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs)
|
public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs)
|
||||||
{
|
{
|
||||||
$response = $this->send(
|
$response = $this->send(
|
||||||
@@ -44,10 +44,8 @@ class ListDiscussionsTest extends TestCase
|
|||||||
$this->assertEqualsCanonicalizing([1, 4, 5, 7], Arr::pluck($body['data'], 'id'));
|
$this->assertEqualsCanonicalizing([1, 4, 5, 7], Arr::pluck($body['data'], 'id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[Test]
|
||||||
* @dataProvider allowedUsers
|
#[DataProvider('allowedUsers')]
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs)
|
public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs)
|
||||||
{
|
{
|
||||||
$response = $this->send(
|
$response = $this->send(
|
||||||
|
@@ -13,6 +13,8 @@ use Flarum\Approval\Tests\integration\InteractsWithUnapprovedContent;
|
|||||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||||
use Flarum\Testing\integration\TestCase;
|
use Flarum\Testing\integration\TestCase;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
|
use PHPUnit\Framework\Attributes\Test;
|
||||||
|
|
||||||
class ListPostsTest extends TestCase
|
class ListPostsTest extends TestCase
|
||||||
{
|
{
|
||||||
@@ -28,10 +30,8 @@ class ListPostsTest extends TestCase
|
|||||||
$this->prepareUnapprovedDatabaseContent();
|
$this->prepareUnapprovedDatabaseContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[Test]
|
||||||
* @dataProvider unallowedUsers
|
#[DataProvider('unallowedUsers')]
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs)
|
public function can_only_see_approved_if_not_allowed_to_approve(?int $authenticatedAs)
|
||||||
{
|
{
|
||||||
$response = $this->send(
|
$response = $this->send(
|
||||||
@@ -50,10 +50,8 @@ class ListPostsTest extends TestCase
|
|||||||
$this->assertEqualsCanonicalizing([7, 8, 10], Arr::pluck($body['data'], 'id'));
|
$this->assertEqualsCanonicalizing([7, 8, 10], Arr::pluck($body['data'], 'id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[Test]
|
||||||
* @dataProvider allowedUsers
|
#[DataProvider('allowedUsers')]
|
||||||
* @test
|
|
||||||
*/
|
|
||||||
public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs)
|
public function can_see_unapproved_if_allowed_to_approve(int $authenticatedAs)
|
||||||
{
|
{
|
||||||
$response = $this->send(
|
$response = $this->send(
|
||||||
|
@@ -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();
|
||||||
|
@@ -1,21 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit
|
<phpunit
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
backupStaticAttributes="false"
|
cacheDirectory=".phpunit.cache"
|
||||||
|
backupStaticProperties="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="true"
|
processIsolation="true"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
|
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
|
||||||
>
|
>
|
||||||
<coverage processUncoveredFiles="true">
|
<source>
|
||||||
<include>
|
<include>
|
||||||
<directory suffix=".php">../src/</directory>
|
<directory suffix=".php">../src/</directory>
|
||||||
</include>
|
</include>
|
||||||
</coverage>
|
</source>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Flarum Integration Tests">
|
<testsuite name="Flarum Integration Tests">
|
||||||
<directory suffix="Test.php">./integration</directory>
|
<directory suffix="Test.php">./integration</directory>
|
||||||
|
@@ -1,27 +1,23 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<phpunit
|
<phpunit
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
xsi:noNamespaceSchemaLocation="../../../vendor/phpunit/phpunit/phpunit.xsd"
|
||||||
backupGlobals="false"
|
backupGlobals="false"
|
||||||
backupStaticAttributes="false"
|
cacheDirectory=".phpunit.cache"
|
||||||
|
backupStaticProperties="false"
|
||||||
colors="true"
|
colors="true"
|
||||||
convertErrorsToExceptions="true"
|
|
||||||
convertNoticesToExceptions="true"
|
|
||||||
convertWarningsToExceptions="true"
|
|
||||||
processIsolation="false"
|
processIsolation="false"
|
||||||
stopOnFailure="false"
|
stopOnFailure="false"
|
||||||
|
bootstrap="../../../php-packages/testing/bootstrap/monorepo.php"
|
||||||
>
|
>
|
||||||
<coverage processUncoveredFiles="true">
|
<source>
|
||||||
<include>
|
<include>
|
||||||
<directory suffix=".php">../src/</directory>
|
<directory suffix=".php">../src/</directory>
|
||||||
</include>
|
</include>
|
||||||
</coverage>
|
</source>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Flarum Unit Tests">
|
<testsuite name="Flarum Unit Tests">
|
||||||
<directory suffix="Test.php">./unit</directory>
|
<directory suffix="Test.php">./unit</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
<listeners>
|
|
||||||
<listener class="\Mockery\Adapter\Phpunit\TestListener" />
|
|
||||||
</listeners>
|
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
1
extensions/bbcode/.gitignore
vendored
1
extensions/bbcode/.gitignore
vendored
@@ -4,6 +4,7 @@ composer.phar
|
|||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
tests/.phpunit.cache
|
||||||
tests/.phpunit.result.cache
|
tests/.phpunit.result.cache
|
||||||
/tests/integration/tmp
|
/tests/integration/tmp
|
||||||
.vagrant
|
.vagrant
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation)
|
Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation)
|
||||||
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
|
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
@@ -19,11 +19,16 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.6"
|
"flarum/core": "^2.0.0-beta.2"
|
||||||
|
},
|
||||||
|
"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;
|
||||||
|
}
|
||||||
|
}
|
1
extensions/embed/.gitignore
vendored
1
extensions/embed/.gitignore
vendored
@@ -4,6 +4,7 @@ composer.phar
|
|||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
tests/.phpunit.cache
|
||||||
tests/.phpunit.result.cache
|
tests/.phpunit.result.cache
|
||||||
/tests/integration/tmp
|
/tests/integration/tmp
|
||||||
.vagrant
|
.vagrant
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation)
|
Copyright (c) 2019-2024 Stichting Flarum (Flarum Foundation)
|
||||||
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
|
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"flarum/core": "^1.6"
|
"flarum/core": "^2.0.0-beta.2"
|
||||||
},
|
},
|
||||||
"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
@@ -8,8 +8,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"flarum-webpack-config": "^2.0.0",
|
"flarum-webpack-config": "^3.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user