mirror of
https://github.com/flarum/core.git
synced 2025-08-13 20:04:24 +02:00
Compare commits
12 Commits
sm/priorit
...
v1.7.0
Author | SHA1 | Date | |
---|---|---|---|
|
b66fe5dd5f | ||
|
7d79895ae0 | ||
|
3ab4529232 | ||
|
360a2ba1d8 | ||
|
eaa4063fef | ||
|
72d277bd45 | ||
|
28e3ccfde6 | ||
|
3f864bafc8 | ||
|
3af0481f30 | ||
|
1761660c98 | ||
|
8ddb0feb09 | ||
|
fa30f4f250 |
59
CHANGELOG.md
59
CHANGELOG.md
@@ -1,6 +1,63 @@
|
||||
# Changelog
|
||||
|
||||
# [v1.6.3](https://github.com/flarum/framework/compare/v1.6.2...v1.6.3)
|
||||
## [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).
|
||||
|
@@ -19,8 +19,8 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6",
|
||||
"flarum/approval": "^1.2"
|
||||
"flarum/core": "^1.7",
|
||||
"flarum/approval": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
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 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 s=t.n(n);const l=flarum.core.compat["forum/components/Post"];var u=t.n(l);a().initializers.add("flarum-akismet",(function(){(0,o.extend)(s(),"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)(u().prototype,"flagReason",(function(t,e){return"akismet"===e.type()?a().translator.trans("flarum-akismet.forum.post.akismet_flagged_text"):t(e)}))}))})(),module.exports=e})();
|
||||
//# sourceMappingURL=forum.js.map
|
2
extensions/akismet/js/dist/forum.js.map
generated
vendored
2
extensions/akismet/js/dist/forum.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,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,GAAI,MAAsB,aAAb,MAAJA,OAAI,EAAJA,EAAMC,OAAoB,IAAG,CAC7D,IAAMC,EAAcP,EAAMf,IAAI,WAC1BsB,GAAsC,iBAAhBA,GAA4B,aAAcA,IAClEA,EAAYC,SAAWX,IAAAA,WAAAA,MAAqB,6CAEhD,CACF,CACF,KAEAY,EAAAA,EAAAA,UAASC,IAAAA,UAAuB,cAAc,SAAUC,EAAUN,GAChE,MAAoB,YAAhBA,EAAKC,OACAT,IAAAA,WAAAA,MAAqB,kDAGvBc,EAASN,EAClB,GACF,G","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/akismet/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport type Post from 'flarum/common/models/Post';\nimport type ItemList from 'flarum/common/utils/ItemList';\n\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport type Mithril from 'mithril';\n\napp.initializers.add('flarum-akismet', () => {\n extend(PostControls, 'destructiveControls', function (items: ItemList<Mithril.Children>, post: Post) {\n if (items.has('approve')) {\n const flags = post.flags();\n\n if (flags && flags.some((flag) => flag?.type() === 'akismet')) {\n const approveItem = items.get('approve');\n if (approveItem && typeof approveItem === 'object' && 'children' in approveItem) {\n approveItem.children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');\n }\n }\n }\n });\n\n override(CommentPost.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'akismet') {\n return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');\n }\n\n return original(flag);\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","extend","PostControls","items","post","has","flags","some","flag","type","approveItem","children","override","CommentPost","original"],"sourceRoot":""}
|
||||
{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,ECLdF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDR,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,GAAO,G,+BCL9D,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,yB,aCSxDC,IAAAA,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,GAAI,MAAsB,aAAb,MAAJA,OAAI,EAAJA,EAAMC,OAAoB,IAAG,CAC7D,IAAMC,EAAcP,EAAMf,IAAI,WAC1BsB,GAAsC,iBAAhBA,GAA4B,aAAcA,IAClEA,EAAYC,SAAWX,IAAAA,WAAAA,MAAqB,6CAEhD,CACF,CACF,KAEAY,EAAAA,EAAAA,UAASC,IAAAA,UAAyB,cAAc,SAAUC,EAAUN,GAClE,MAAoB,YAAhBA,EAAKC,OACAT,IAAAA,WAAAA,MAAqB,kDAGvBc,EAASN,EAClB,GACF,G","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/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/Post']\"","webpack://@flarum/akismet/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/Post'];","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\nimport type Post from 'flarum/common/models/Post';\nimport type ItemList from 'flarum/common/utils/ItemList';\n\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport PostComponent from 'flarum/forum/components/Post';\nimport type Mithril from 'mithril';\n\napp.initializers.add('flarum-akismet', () => {\n extend(PostControls, 'destructiveControls', function (items: ItemList<Mithril.Children>, post: Post) {\n if (items.has('approve')) {\n const flags = post.flags();\n\n if (flags && flags.some((flag) => flag?.type() === 'akismet')) {\n const approveItem = items.get('approve');\n if (approveItem && typeof approveItem === 'object' && 'children' in approveItem) {\n approveItem.children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');\n }\n }\n }\n });\n\n override(PostComponent.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'akismet') {\n return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');\n }\n\n return original(flag);\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","extend","PostControls","items","post","has","flags","some","flag","type","approveItem","children","override","PostComponent","original"],"sourceRoot":""}
|
@@ -4,7 +4,7 @@ import type Post from 'flarum/common/models/Post';
|
||||
import type ItemList from 'flarum/common/utils/ItemList';
|
||||
|
||||
import PostControls from 'flarum/forum/utils/PostControls';
|
||||
import CommentPost from 'flarum/forum/components/CommentPost';
|
||||
import PostComponent from 'flarum/forum/components/Post';
|
||||
import type Mithril from 'mithril';
|
||||
|
||||
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') {
|
||||
return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');
|
||||
}
|
||||
|
@@ -19,8 +19,8 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6",
|
||||
"flarum/flags": "^1.2"
|
||||
"flarum/core": "^1.7",
|
||||
"flarum/flags": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6.3"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6",
|
||||
"flarum/core": "^1.7",
|
||||
"pusher/pusher-php-server": "^2.2"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6.3"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
@@ -19,7 +19,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"flarum/core": "^1.6"
|
||||
"flarum/core": "^1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
2
extensions/tags/js/dist/forum.js
generated
vendored
2
extensions/tags/js/dist/forum.js
generated
vendored
File diff suppressed because one or more lines are too long
2
extensions/tags/js/dist/forum.js.map
generated
vendored
2
extensions/tags/js/dist/forum.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@ export default class TagHero extends Component {
|
||||
|
||||
return (
|
||||
<header
|
||||
className={classList('Hero', 'TagHero', { 'TagHero--colored': color }, textContrastClass(color))}
|
||||
className={classList('Hero', 'TagHero', { 'TagHero--colored': color, [textContrastClass(color)]: color })}
|
||||
style={color ? { '--hero-bg': color } : ''}
|
||||
>
|
||||
<div className="container">
|
||||
|
@@ -36,7 +36,7 @@
|
||||
"chat": "https://flarum.org/chat"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.3",
|
||||
"php": ">=7.3 || ^8.0",
|
||||
"components/font-awesome": "^5.14.0",
|
||||
"dflydev/fig-cookies": "^3.0.0",
|
||||
"doctrine/dbal": "^2.7",
|
||||
@@ -88,8 +88,7 @@
|
||||
"wikimedia/less.php": "^3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"flarum/testing": "^1.0.0",
|
||||
"symfony/var-dumper": "^6.0"
|
||||
"flarum/testing": "^1.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
2
framework/core/js/dist/admin.js
generated
vendored
2
framework/core/js/dist/admin.js
generated
vendored
File diff suppressed because one or more lines are too long
2
framework/core/js/dist/admin.js.map
generated
vendored
2
framework/core/js/dist/admin.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
framework/core/js/dist/forum.js
generated
vendored
2
framework/core/js/dist/forum.js
generated
vendored
File diff suppressed because one or more lines are too long
2
framework/core/js/dist/forum.js.map
generated
vendored
2
framework/core/js/dist/forum.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -39,6 +39,6 @@ export default class LinkButton extends Button {
|
||||
* @return {boolean}
|
||||
*/
|
||||
static isActive(attrs) {
|
||||
return typeof attrs.active !== 'undefined' ? attrs.active : m.route.get() === attrs.href;
|
||||
return typeof attrs.active !== 'undefined' ? attrs.active : m.route.get()?.split('?')[0] === attrs.href?.split('?')[0];
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@
|
||||
--yiq-threshold: 108;
|
||||
}
|
||||
& when (@config-dark-mode = false) {
|
||||
--yiq-threshold: 138;
|
||||
--yiq-threshold: 150;
|
||||
}
|
||||
|
||||
// ---------------------------------
|
||||
|
@@ -18,6 +18,7 @@ core:
|
||||
custom_footer_text: => core.ref.custom_footer_text
|
||||
custom_header_heading: Custom Header
|
||||
custom_header_text: => core.ref.custom_header_text
|
||||
custom_styles_cannot_use_less_features: "The @import and data-uri features are not allowed in custom LESS."
|
||||
custom_styles_heading: Custom Styles
|
||||
custom_styles_text: Customize your forum's appearance by adding your own Less/CSS code to be applied on top of Flarum's default styles.
|
||||
dark_mode_label: Dark Mode
|
||||
|
@@ -99,7 +99,7 @@ return function (RouteCollection $map, RouteHandlerFactory $route) {
|
||||
$map->delete(
|
||||
'/users/{id}',
|
||||
'users.delete',
|
||||
$route->toController(Controller\DeleteAccessTokenController::class)
|
||||
$route->toController(Controller\DeleteUserController::class)
|
||||
);
|
||||
|
||||
// Upload avatar
|
||||
|
@@ -30,9 +30,8 @@ class FulltextGambit implements GambitInterface
|
||||
$query = $search->getQuery();
|
||||
$grammar = $query->getGrammar();
|
||||
|
||||
// We give discussion title search score a higher weight than post.
|
||||
$discussionSubquery = Discussion::select('id')
|
||||
->selectRaw('MATCH('.$grammar->wrap('discussions.title').') AGAINST (?)*1.5 as score', [$bit])
|
||||
->selectRaw('NULL as score')
|
||||
->selectRaw('first_post_id as most_relevant_post_id')
|
||||
->whereRaw('MATCH('.$grammar->wrap('discussions.title').') AGAINST (? IN BOOLEAN MODE)', [$bit]);
|
||||
|
||||
@@ -62,7 +61,8 @@ class FulltextGambit implements GambitInterface
|
||||
->groupBy('discussions.id')
|
||||
->addBinding($subquery->getBindings(), 'join');
|
||||
|
||||
$search->setDefaultSort(function ($query) {
|
||||
$search->setDefaultSort(function ($query) use ($grammar, $bit) {
|
||||
$query->orderByRaw('MATCH('.$grammar->wrap('discussions.title').') AGAINST (?) desc', [$bit]);
|
||||
$query->orderBy('posts_ft.score', 'desc');
|
||||
});
|
||||
|
||||
|
@@ -21,6 +21,7 @@ use Illuminate\Filesystem\FilesystemAdapter;
|
||||
use League\Flysystem\Adapter\NullAdapter;
|
||||
use League\Flysystem\Filesystem;
|
||||
use Less_Exception_Parser;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -61,6 +62,15 @@ class ValidateCustomLess
|
||||
return;
|
||||
}
|
||||
|
||||
// Restrict what features can be used in custom LESS
|
||||
if (isset($event->settings['custom_less']) && preg_match('/@import|data-uri\s*\(/i', $event->settings['custom_less'])) {
|
||||
$translator = $this->container->make(TranslatorInterface::class);
|
||||
|
||||
throw new ValidationException([
|
||||
'custom_less' => $translator->trans('core.admin.appearance.custom_styles_cannot_use_less_features')
|
||||
]);
|
||||
}
|
||||
|
||||
// We haven't saved the settings yet, but we want to trial a full
|
||||
// recompile of the CSS to see if this custom LESS will break
|
||||
// anything. In order to do that, we will temporarily override the
|
||||
|
@@ -21,7 +21,7 @@ class Application
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const VERSION = '1.7.0-dev';
|
||||
const VERSION = '1.7.0';
|
||||
|
||||
/**
|
||||
* The IoC container for the Flarum application.
|
||||
|
@@ -36,19 +36,17 @@ class ListWithFulltextSearchTest extends TestCase
|
||||
['id' => 3, 'title' => 'not in title either', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 4, 'title' => 'not in title or text', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 5, 'title' => 'తెలుగు', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 6, 'title' => '支持中文吗 acme', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 7, 'title' => 'add "acme for life" module!', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
['id' => 6, 'title' => '支持中文吗', 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'comment_count' => 1],
|
||||
]);
|
||||
|
||||
$this->database()->table('posts')->insert([
|
||||
['id' => 1, 'discussion_id' => 1, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>not in text</p></t>'],
|
||||
['id' => 2, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>lightsail in text</p></t>'],
|
||||
['id' => 3, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>another lightsail for discussion 2! acme for life</p></t>'],
|
||||
['id' => 3, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>another lightsail for discussion 2!</p></t>'],
|
||||
['id' => 4, 'discussion_id' => 3, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>just one lightsail for discussion 3.</p></t>'],
|
||||
['id' => 5, 'discussion_id' => 4, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>not in title or text (acme)</p></t>'],
|
||||
['id' => 5, 'discussion_id' => 4, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>not in title or text</p></t>'],
|
||||
['id' => 6, 'discussion_id' => 4, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>తెలుగు</p></t>'],
|
||||
['id' => 7, 'discussion_id' => 2, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>支持中文吗</p></t>'],
|
||||
['id' => 8, 'discussion_id' => 5, 'created_at' => Carbon::now()->toDateTimeString(), 'user_id' => 1, 'type' => 'comment', 'content' => '<t><p>some lorem ipsum acme dolor sit amet life kor for</p></t>'],
|
||||
]);
|
||||
|
||||
// We need to call these again, since we rolled back the transaction started by `::app()`.
|
||||
@@ -89,27 +87,6 @@ class ListWithFulltextSearchTest extends TestCase
|
||||
$this->assertEqualsCanonicalizing(['2', '1', '3'], $ids, 'IDs do not match');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function search_prioritizes_title_search_score_over_post()
|
||||
{
|
||||
$response = $this->send(
|
||||
$this->request('GET', '/api/discussions')
|
||||
->withQueryParams([
|
||||
'filter' => ['q' => 'acme for life'],
|
||||
'include' => 'mostRelevantPost',
|
||||
])
|
||||
);
|
||||
|
||||
$data = json_decode($response->getBody()->getContents(), true);
|
||||
$ids = array_map(function ($row) {
|
||||
return $row['id'];
|
||||
}, $data['data']);
|
||||
|
||||
$this->assertEquals(['7', '2', '5', '6', '4'], $ids, 'IDs do not match');
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
89
framework/core/tests/integration/api/users/DeleteTest.php
Normal file
89
framework/core/tests/integration/api/users/DeleteTest.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?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 integration\api\users;
|
||||
|
||||
use Flarum\Testing\integration\RetrievesAuthorizedUsers;
|
||||
use Flarum\Testing\integration\TestCase;
|
||||
use Flarum\User\User;
|
||||
|
||||
class DeleteTest extends TestCase
|
||||
{
|
||||
use RetrievesAuthorizedUsers;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->prepareDatabase([
|
||||
'users' => [
|
||||
$this->normalUser(),
|
||||
['id' => 3, 'username' => 'ken', 'is_email_confirmed' => 1],
|
||||
],
|
||||
'group_user' => [
|
||||
['group_id' => 3, 'user_id' => 2],
|
||||
['group_id' => 3, 'user_id' => 3],
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider authorizedUsersProvider
|
||||
* @test
|
||||
*/
|
||||
public function can_delete_user(int $actorId, int $userId)
|
||||
{
|
||||
$this->database()->table('group_permission')->insert([
|
||||
'permission' => 'user.delete',
|
||||
'group_id' => 3,
|
||||
]);
|
||||
|
||||
$response = $this->send(
|
||||
$this->request('DELETE', "/api/users/$userId", [
|
||||
'authenticatedAs' => $actorId,
|
||||
])
|
||||
);
|
||||
|
||||
$this->assertEquals(204, $response->getStatusCode());
|
||||
$this->assertNull(User::find($userId));
|
||||
}
|
||||
|
||||
public function authorizedUsersProvider()
|
||||
{
|
||||
return [
|
||||
'admin can delete user' => [1, 2],
|
||||
'user with permission can delete self' => [2, 2],
|
||||
'user with permission can delete other users' => [2, 3],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider unauthorizedUsersProvider
|
||||
* @test
|
||||
*/
|
||||
public function cannot_delete_user(int $actorId, int $userId)
|
||||
{
|
||||
$response = $this->send(
|
||||
$this->request('DELETE', "/api/users/$userId", [
|
||||
'authenticatedAs' => $actorId,
|
||||
])
|
||||
);
|
||||
|
||||
$this->assertEquals(403, $response->getStatusCode());
|
||||
$this->assertNotNull(User::find($userId));
|
||||
}
|
||||
|
||||
public function unauthorizedUsersProvider()
|
||||
{
|
||||
return [
|
||||
'user without permission cannot delete self' => [2, 2],
|
||||
'user without permission cannot delete other users' => [2, 3],
|
||||
];
|
||||
}
|
||||
}
|
@@ -74,43 +74,43 @@ class GroupSearchTest extends TestCase
|
||||
]);
|
||||
|
||||
$response = $this->createRequest(['admin'], 2);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(1, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents->included, json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents->included[0]->id);
|
||||
$this->assertCount(1, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents['included'], json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents['included'][0]['id']);
|
||||
|
||||
$response = $this->createRequest(['mod'], 2);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(0, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertObjectNotHasAttribute('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
$this->assertCount(0, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertArrayNotHasKey('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
|
||||
$response = $this->createRequest(['admins'], 2);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(1, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents->included, json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents->included[0]->id);
|
||||
$this->assertCount(1, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents['included'], json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents['included'][0]['id']);
|
||||
|
||||
$response = $this->createRequest(['mods'], 2);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(0, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertObjectNotHasAttribute('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
$this->assertCount(0, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertArrayNotHasKey('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
|
||||
$response = $this->createRequest(['1'], 2);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(1, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents->included, json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents->included[0]->id);
|
||||
$this->assertCount(1, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents['included'], json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents['included'][0]['id']);
|
||||
|
||||
$response = $this->createRequest(['4'], 2);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(0, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertObjectNotHasAttribute('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
$this->assertCount(0, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertArrayNotHasKey('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,10 +126,10 @@ class GroupSearchTest extends TestCase
|
||||
|
||||
$this->createHiddenUser();
|
||||
$response = $this->createRequest(['99'], 2);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(0, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertObjectNotHasAttribute('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
$this->assertCount(0, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertArrayNotHasKey('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,13 +144,13 @@ class GroupSearchTest extends TestCase
|
||||
]);
|
||||
$this->createMultipleUsersAndGroups();
|
||||
$response = $this->createRequest(['1', '4', '5', '6', '99'], 2);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$this->assertCount(4, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertCount(4, $responseBodyContents->included, json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents->included[0]->id);
|
||||
$this->assertEquals(4, $responseBodyContents->included[1]->id);
|
||||
$this->assertEquals(5, $responseBodyContents->included[2]->id);
|
||||
$this->assertEquals(6, $responseBodyContents->included[3]->id);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
$this->assertCount(4, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertCount(4, $responseBodyContents['included'], json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents['included'][0]['id']);
|
||||
$this->assertEquals(4, $responseBodyContents['included'][1]['id']);
|
||||
$this->assertEquals(5, $responseBodyContents['included'][2]['id']);
|
||||
$this->assertEquals(6, $responseBodyContents['included'][3]['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,43 +159,43 @@ class GroupSearchTest extends TestCase
|
||||
public function admin_gets_correct_results_group()
|
||||
{
|
||||
$response = $this->createRequest(['admin'], 1);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(1, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents->included, json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents->included[0]->id);
|
||||
$this->assertCount(1, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents['included'], json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents['included'][0]['id']);
|
||||
|
||||
$response = $this->createRequest(['mod'], 1);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(0, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertObjectNotHasAttribute('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
$this->assertCount(0, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertArrayNotHasKey('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
|
||||
$response = $this->createRequest(['admins'], 1);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(1, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents->included, json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents->included[0]->id);
|
||||
$this->assertCount(1, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents['included'], json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents['included'][0]['id']);
|
||||
|
||||
$response = $this->createRequest(['mods'], 1);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(0, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertObjectNotHasAttribute('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
$this->assertCount(0, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertArrayNotHasKey('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
|
||||
$response = $this->createRequest(['1'], 1);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(1, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents->included, json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents->included[0]->id);
|
||||
$this->assertCount(1, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents['included'], json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents['included'][0]['id']);
|
||||
|
||||
$response = $this->createRequest(['4'], 1);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(0, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertObjectNotHasAttribute('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
$this->assertCount(0, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertArrayNotHasKey('included', $responseBodyContents, json_encode($responseBodyContents));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,11 +205,11 @@ class GroupSearchTest extends TestCase
|
||||
{
|
||||
$this->createHiddenUser();
|
||||
$response = $this->createRequest(['99'], 1);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
$this->assertCount(1, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents->included, json_encode($responseBodyContents));
|
||||
$this->assertEquals(99, $responseBodyContents->included[0]->id);
|
||||
$this->assertCount(1, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertCount(1, $responseBodyContents['included'], json_encode($responseBodyContents));
|
||||
$this->assertEquals(99, $responseBodyContents['included'][0]['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,14 +220,14 @@ class GroupSearchTest extends TestCase
|
||||
$this->createMultipleUsersAndGroups();
|
||||
$this->createHiddenUser();
|
||||
$response = $this->createRequest(['1', '4', '5', '6', '99'], 1);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents());
|
||||
$this->assertCount(5, $responseBodyContents->data, json_encode($responseBodyContents));
|
||||
$this->assertCount(5, $responseBodyContents->included, json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents->included[0]->id);
|
||||
$this->assertEquals(99, $responseBodyContents->included[1]->id);
|
||||
$this->assertEquals(4, $responseBodyContents->included[2]->id);
|
||||
$this->assertEquals(5, $responseBodyContents->included[3]->id);
|
||||
$this->assertEquals(6, $responseBodyContents->included[4]->id);
|
||||
$responseBodyContents = json_decode($response->getBody()->getContents(), true);
|
||||
$this->assertCount(5, $responseBodyContents['data'], json_encode($responseBodyContents));
|
||||
$this->assertCount(5, $responseBodyContents['included'], json_encode($responseBodyContents));
|
||||
$this->assertEquals(1, $responseBodyContents['included'][0]['id']);
|
||||
$this->assertEquals(99, $responseBodyContents['included'][1]['id']);
|
||||
$this->assertEquals(4, $responseBodyContents['included'][2]['id']);
|
||||
$this->assertEquals(5, $responseBodyContents['included'][3]['id']);
|
||||
$this->assertEquals(6, $responseBodyContents['included'][4]['id']);
|
||||
}
|
||||
|
||||
private function createRequest(array $group, int $userId = null)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@flarum/jest-config",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "Jest config for Flarum.",
|
||||
"main": "index.cjs",
|
||||
"author": "Flarum Team",
|
||||
@@ -9,6 +9,7 @@
|
||||
"prettier": "@flarum/prettier-config",
|
||||
"dependencies": {
|
||||
"@types/jest": "^29.2.2",
|
||||
"flarum-webpack-config": "^2.0.1",
|
||||
"flat": "^5.0.2",
|
||||
"jest": "^29.3.1",
|
||||
"jest-environment-jsdom": "^29.3.1",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flarum-webpack-config",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"description": "Webpack config for Flarum JS and TS transpilation.",
|
||||
"main": "index.js",
|
||||
"author": "Flarum Team",
|
||||
|
@@ -6,5 +6,7 @@
|
||||
"extensions/*/js",
|
||||
"js-packages/*"
|
||||
],
|
||||
"scripts": {}
|
||||
"scripts": {
|
||||
"audit-fix": "npx yarn-audit-fix"
|
||||
}
|
||||
}
|
||||
|
12
yarn.lock
12
yarn.lock
@@ -3475,9 +3475,9 @@ json-schema-traverse@^0.4.1:
|
||||
integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
|
||||
|
||||
json5@^2.1.2, json5@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
|
||||
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
|
||||
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
|
||||
|
||||
jsonfile@^4.0.0:
|
||||
version "4.0.0"
|
||||
@@ -3539,9 +3539,9 @@ loader-runner@^4.2.0:
|
||||
integrity sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==
|
||||
|
||||
loader-utils@^2.0.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.3.tgz#d4b15b8504c63d1fc3f2ade52d41bc8459d6ede1"
|
||||
integrity sha512-THWqIsn8QRnvLl0shHYVBN9syumU8pYWEHPTmkiVGd+7K5eFNVSY6AJhRvgGF70gg1Dz+l/k8WicvFCxdEs60A==
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c"
|
||||
integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==
|
||||
dependencies:
|
||||
big.js "^5.2.2"
|
||||
emojis-list "^3.0.0"
|
||||
|
Reference in New Issue
Block a user