1
0
mirror of https://github.com/flarum/core.git synced 2025-08-13 03:44:32 +02:00

Compare commits

..

96 Commits

Author SHA1 Message Date
StyleCI Bot
d5bcc7fcbd Apply fixes from StyleCI 2022-06-15 13:23:08 +00:00
Daniël Klabbers
6be8d3dd17 wip 2022-06-07 21:20:56 +02:00
flarum-bot
b7332895db Bundled output for commit 0a3f449f9e
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-06-02 12:44:15 +00:00
Sami Mazouz
0a3f449f9e fix: post mentions with deleted author not rendering (#3432) 2022-06-02 13:38:24 +01:00
naxvog
df1bdd2ad8 chore: point Font Awesome icons link to v5 (#3447)
Update Font Awesome link to represent to currently used major version in order to avoid confusion when choosing icons
2022-06-02 13:34:42 +01:00
flarum-bot
8e2a99c1eb Bundled output for commit e45547c649
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-06-02 01:47:22 +00:00
David Wheatley
e45547c649 docs: ItemList set methods throw errors when keys are not present 2022-06-02 02:43:15 +01:00
Sami Mazouz
29362ed924 fix: empty suspension message uses email template expecting one (#3433) 2022-05-26 18:52:19 +01:00
Sami Mazouz
eb4bac3b8f fix: settings extender working only with first instances (#3439)
* test: settings extender works not only with first extender instance
* fix: settings extender working only with first instances
2022-05-24 17:55:05 +01:00
flarum-bot
584884a3c9 Bundled output for commit 96ead2a4df
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-05-20 19:36:54 +00:00
Ian Morland
96ead2a4df Add priorities to UserCard (#3436) 2022-05-20 20:32:25 +01:00
flarum-bot
556f10ddd8 Bundled output for commit a79e2c20fe
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-05-20 19:06:33 +00:00
Sami Mazouz
a79e2c20fe fix: dropdown show results search button hidden while loading results (#3431) 2022-05-20 20:02:04 +01:00
Sami Mazouz
89b194034b fix: nickname regex validation not working (#3430)
* test: regex validation for nickname on registration
* fix: nickname regex validation not working
* test: regex validation works with valid inputs
2022-05-20 14:04:14 +01:00
flarum-bot
01c54b13c8 Bundled output for commit 24c8c65aa5
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-05-19 23:53:18 +00:00
David Wheatley
24c8c65aa5 fix(typings): treat ColorPreview settings component type as specific string, not generic 2022-05-20 00:48:44 +01:00
David Wheatley
17de76f326 docs: add 1.2.1 to changelog and fix 1.3.0 diff link 2022-05-16 19:44:17 +01:00
Ngô Quốc Đạt
d3008d1e62 docs: correct links to documentation (#3426) 2022-05-16 18:49:59 +01:00
Daniël Klabbers
471947dfa7 chore: prefix markdown change with extension name 2022-05-16 10:34:28 +02:00
flarum-bot
2f506f1b24 Bundled output for commit 81cf6047f9
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-05-13 21:15:00 +00:00
David Wheatley
81cf6047f9 fix: call abstract Notification methods with fallback
Only call Notification methods if they are defined, falling back to `undefined` if not through the use of the optional chaining operator.
2022-05-13 23:08:29 +02:00
Daniël Klabbers
57d3c9a99a chore: simplify container binding
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
2022-05-13 21:22:22 +02:00
Daniël Klabbers
999b345db1 chore: simplify container resolving of settings
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
2022-05-13 21:22:22 +02:00
Daniël Klabbers
5e2f952fe6 fix: update test to reflect changes to slug transliteration 2022-05-13 21:22:22 +02:00
Daniël Klabbers
899b931b89 chore: add tests 2022-05-13 21:22:22 +02:00
StyleCI Bot
0431f15ac0 Apply fixes from StyleCI 2022-05-13 21:22:22 +02:00
Daniël Klabbers
6c57470b13 fix: slug generation uses actor locale instead of forum default 2022-05-13 21:22:22 +02:00
flarum-bot
6ca2ebc437 Bundled output for commit dd915c126c
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-05-12 20:14:55 +00:00
Sami Mazouz
dd915c126c fix(regression): PostStreamState loadCount static member (#3420) 2022-05-12 21:11:13 +01:00
Daniël Klabbers
62ffe5ffdf chore: add missing contribution for markdown menu support in admin area 2022-05-12 13:23:04 +02:00
Daniël Klabbers
592039c483 update constraint to v1.3 2022-05-10 16:28:35 +02:00
Daniël Klabbers
2f64f023b2 chore: fix version constant for v1.3 2022-05-10 16:09:48 +02:00
Daniël Klabbers
316a2067b6 fix link, tnx @bartvb 2022-05-10 12:30:19 +02:00
Alexander Skvortsov
de8d0d1d37 chore: use proper repo for core 2022-05-10 00:42:16 -04:00
Alexander Skvortsov
aea1a4cf63 chore: use proper branches for monorepo remotes 2022-05-09 14:26:00 -04:00
flarum-bot
7f5593021d Bundled output for commit f9ae7cd67f
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-05-09 16:01:25 +00:00
David Wheatley
f9ae7cd67f fix: incorrect tooltip docs for tooltipVisible attr (#3411) 2022-05-09 11:56:56 -04:00
Daniël Klabbers
843a613cda fix changelog for the framework 2022-05-09 16:14:57 +02:00
SychO9
da83e0c1a0 fix(a11y): Tag selection modal input visibility 2022-05-09 10:07:24 +02:00
SychO9
903026a7e4 fix: Composer discussion title not visible with certain colors 2022-05-09 10:06:52 +02:00
Sami Mazouz
1954d0383e fix: first posts having NULL as value for number column (#3414)
* fix: first posts having `NULL` as value for `number` column
* chore: add note about raw db function `IFNULL`
2022-05-08 23:21:11 +01:00
Daniël Klabbers
2e89ba3c94 chore: Allow installing monorepo through composer for dev purposes
This is as close as we're gonna get to a good solution for now.
2022-04-30 20:00:27 +01:00
Sami Mazouz
b14c0780d2 chore: fix package manager tests (#3407) 2022-04-25 13:31:16 +01:00
Sami Mazouz
d465fd27bc chore: reflect our issue tracking protocol in issue templates. (#3401) 2022-04-24 16:31:09 -04:00
Alexander Skvortsov
ffc9f9f5a4 fix(core): don't pass null to functions where that's deprecated (#3405)
Should fix remaining PHP 8.1 deprecation warnings/
2022-04-24 16:26:18 -04:00
flarum-bot
290bc19922 Bundled output for commit 863a8ddfff
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-04-23 14:26:23 +00:00
Alexander Skvortsov
863a8ddfff fix: don't duplicate path in URL to post on subdirectory installs. (#3354)
`baseUrl` includes the path portion of the url, as does `basePath`, which is included in `app.route.x` function outputs. The `baseOrigin` (with no path component at all) should be used instead.
2022-04-23 10:23:03 -04:00
flarum-bot
b8df3863d1 Bundled output for commit 4cb15501a2
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-04-21 22:20:19 +00:00
Alexander Skvortsov
4cb15501a2 fix(tags): TagDiscussionModal don't go to null tag (#3404)
If the tag we are trying to select/highlight is undefined, we should not run the scroll animation.
2022-04-21 18:03:41 -04:00
flarum-bot
42602a099f Bundled output for commit be2da3e12f
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-04-19 20:19:26 +00:00
Sami Mazouz
be2da3e12f fix: PHP 8.1 deprecation warnings (#3384) 2022-04-19 21:14:52 +01:00
flarum-bot
09bed537b3 Bundled output for commit fb717db57c
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-04-16 10:34:07 +00:00
Sami Mazouz
fb717db57c fix: slug transliteration assuming the language is always en (#3387)
* fix: transliteration assuming the language is always `en`
* test: transliteration works with forum locale
2022-04-16 11:31:23 +01:00
flarum-bot
cca97f32c6 Bundled output for commit c658eb10f4
Includes transpiled JS/TS.

[skip ci]
2022-04-14 15:21:36 +00:00
David Sevilla Martin
c658eb10f4 feat(emoji): support emoji 14 & unicode 14 (#3378) 2022-04-14 10:49:47 -04:00
flarum-bot
f667faa1bd Bundled output for commit 542cc42538
Includes transpiled JS/TS.

[skip ci]
2022-04-13 15:33:52 +00:00
Ian Morland
542cc42538 feat: export utils/isSafariMobile (#3389) 2022-04-13 16:31:05 +01:00
flarum-bot
518b39610e Bundled output for commit 6de1ea0194
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-04-09 22:06:48 +00:00
Sami Mazouz
6de1ea0194 fix: languages with combining characters cannot be searched (#3385)
* test: searching other types of languages
* fix: languages with combining characters cannot be searched
* test: can search in discussion titles
2022-04-09 23:04:15 +01:00
flarum-bot
b5e5ae8c4c Bundled output for commit b0fa795cc9
Includes transpiled JS/TS.

[skip ci]
2022-04-07 16:56:27 +00:00
Ian Morland
b0fa795cc9 fix: extensions not being able to use the renderer without context (#3382) 2022-04-07 17:53:37 +01:00
flarum-bot
c944fd0029 Bundled output for commit 98e607a704
Includes transpiled JS/TS.

[skip ci]
2022-04-06 15:56:16 +00:00
Sami Mazouz
98e607a704 fix: extension listeners added before core listeners (#3373) 2022-04-06 16:53:21 +01:00
flarum-bot
9a0bdf9a04 Bundled output for commit 431ba30434
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-04-06 15:51:49 +00:00
Alexander Skvortsov
431ba30434 fix: dont ignore optional dependencies on disabled extensions. (#3352)
There is a check in the ExtensionManager::resolveExtensionOrder function that ignores optional dependencies on extensions that don't exist in the system. This is sufficient for resolution purposes.

The filter removed in this PR would ignore optional dependencies on non-enabled extensions, so when such an extension was enabled, dependency resolution would run incorrectly.
2022-04-06 11:48:52 -04:00
flarum-bot
45aba446b3 Bundled output for commit 9f7c5defaa
Includes transpiled JS/TS.

[skip ci]
2022-04-05 14:41:10 +00:00
David Wheatley
9f7c5defaa fix: notification timestamp mismatch in specific configurations (#3379)
When app's PHP server's timezone is not set to UTC, which would normally be done by Flarum's bootstrapping process, this call to Carbon would return a different timestamp to other calls elsewhere in Flarum, causing issues with notifications seemingly being delivered too early/late rather than at the actual time they were triggered.
2022-04-05 15:38:05 +01:00
flarum-bot
2541349c68 Bundled output for commit 1d27f62c15
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-04-04 15:51:15 +00:00
Ian Morland
1d27f62c15 feat: add discussion sortmap to container binding (#3377) 2022-04-04 11:48:28 -04:00
flarum-bot
9d9594a098 Bundled output for commit 7c3da27fb3
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-04-03 21:37:31 +00:00
David Wheatley
7c3da27fb3 chore: don't track .yarn-integrity in git (#3374) 2022-04-03 17:35:07 -04:00
flarum-bot
402ace2070 Bundled output for commit ca7055f5d0
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-04-03 21:20:28 +00:00
Sami Mazouz
ca7055f5d0 feat: Graceful frontend extension initialization failure (#3349) 2022-04-03 22:17:57 +01:00
flarum-bot
4dfbaa3271 Bundled output for commit cd8ed6cf66
Includes transpiled JS/TS.

[skip ci]
2022-04-03 21:17:26 +00:00
David Sevilla Martin
cd8ed6cf66 fix(subscriptions): filter followed discussions when searching (#3376)
Fixes #3375
2022-04-03 17:14:56 -04:00
flarum-bot
cf8359daa4 Bundled output for commit 803f4cc792
Includes transpiled JS/TS.

[skip ci]
2022-04-03 17:30:09 +00:00
David Wheatley
803f4cc792 feat: allow multiple children to be passed to ConfirmDocumentUnload component (#3372) 2022-04-03 18:27:53 +01:00
flarum-bot
a7dd0b2b61 Bundled output for commit 00b9151864
Includes transpiled JS/TS.

[skip ci]
2022-03-31 06:49:02 +00:00
Alexander Skvortsov
00b9151864 feat: deprecate discussion post_number_index field. 2022-03-31 08:46:20 +02:00
Alexander Skvortsov
e25c53c00f fix: canonicalize comparisons in Posts ListTest
That doesn't matter since there's no default sort for posts in the backend.
2022-03-31 08:46:20 +02:00
Daniël Klabbers
6839c9436f missed another prefix for tests 2022-03-31 08:46:20 +02:00
StyleCI Bot
3ae113b897 Apply fixes from StyleCI
[ci skip] [skip ci]
2022-03-31 08:46:20 +02:00
Daniël Klabbers
6a65993ea5 fix prefix failing in tests 2022-03-31 08:46:20 +02:00
StyleCI Bot
65dd37278b Apply fixes from StyleCI
[ci skip] [skip ci]
2022-03-31 08:46:20 +02:00
Daniël Klabbers
e429558d0e possibly fixes the issue with post number calculation 2022-03-31 08:46:20 +02:00
flarum-bot
105481a181 Bundled output for commit b95b3646d3
Includes transpiled JS/TS.

[skip ci]
2022-03-28 20:49:53 +00:00
David Wheatley
b95b3646d3 a11y: use feed aria role for DiscussionList (#3359)
* a11y: use `feed` aria role for DiscussionList

* a11y: add aria set info roles, move feed roles to more appropriate element
2022-03-28 21:47:20 +01:00
flarum-bot
b64003cba5 Bundled output for commit 46f8cf4628
Includes transpiled JS/TS.

[skip ci]
2022-03-23 17:37:18 +00:00
Sami Mazouz
46f8cf4628 fix: Post--by-start-user class not working (#3356) 2022-03-23 18:21:01 +01:00
flarum-bot
6df4101bae Bundled output for commit a595665bfb
Includes transpiled JS/TS.

[skip ci]
2022-03-23 15:45:44 +00:00
Alexander Skvortsov
a595665bfb fix: Assorted Typing Fixes (#3348)
With all the commits below, we resolve all outstanding typing issues in the repo, and CI jobs run green.

* fix: Convert DashboardPage and DashboardWidget to TypeScript

* fix: fix type errors in package manager ext

* fix: Convert Post component to TypeScript

* fix: avatar typings should accept null user

* fix: convert Notification component to TypeScript

* fix: properly use `typeof` in ForumApplication

* feat: make Notification content attr generic

* chore: format Notification component

* fix: Convert DiscussionRenamedNotification to TypeScript

* fix(pusher) move shims to a location where they get applied

* fix(pusher): fix some typing errors

* fix(akismet): fix some typing issues

* chore: update core dist typings

* chore(pusher): format

* fix: anchorScroll should accept string selectors

* fix: more accurately represent ApiQueryParamsPlural

* fix: convert PostStreamState to TypeScript

* chore(core): rebuild typings

* feat: allow extending app.routes

* fix: more flexible typings for highlight.ts

* fix: use primitive `number` type for Discussion typings

* fix: convert DiscussionListItem to TypeScript

* chore: rebuild core typings

* fix: final pusher type fixes

* feat: start tags TypeScript conversion

* fix: require-dev tags in pusher for CI TypeScript purposes.

* chore(core): format

* chore(tags): build dist typings

* feat(pusher): use dist types from tags.

* feat: convert flags to TypeScript

* chore(flags): generate dist typings

* fix(akismet): last type errors

* chore: update .yarn-integrity

* chore: partially run flarum-cli audit infra --fix

The tsconfig changes from that command are ignored, since we don't yet support "replacable sections" that would let us add custom config.

* chore: use type imports

* fix: broader gitattributes

* chore: run flarum-cli audit infra --monorepo --fix

* feat: make `app.data` typings extensible

* chore(core): format

* chore: boost tags TypeScript coverage

* fix(tags): further increase type coverage.
2022-03-23 11:43:14 -04:00
flarum-bot
4ecd9a9b2f Bundled output for commit 5e82ded8c3
Includes transpiled JS/TS.

[skip ci]
2022-03-12 00:14:54 +00:00
Alexander Skvortsov
5e82ded8c3 feat: use yarn workspaces 2022-03-11 19:12:11 -05:00
Alexander Skvortsov
524540cb41 chore: use yarn v1 in extensions/core 2022-03-11 19:12:11 -05:00
Alexander Skvortsov
f2910d8763 chore: add version to core/ext package.json
This is necessary for yarn workspaces to work.
2022-03-11 19:12:11 -05:00
StyleCI Bot
a2eba3e978 Apply fixes from StyleCI
[ci skip] [skip ci]
2022-03-11 23:11:35 +00:00
383 changed files with 2888 additions and 3920 deletions

20
.gitattributes vendored Normal file
View File

@@ -0,0 +1,20 @@
**/.gitattributes export-ignore
**/.gitignore export-ignore
**/.gitmodules export-ignore
**/.github export-ignore
**/.travis export-ignore
**/.travis.yml export-ignore
**/.editorconfig export-ignore
**/.styleci.yml export-ignore
**/phpunit.xml export-ignore
**/tests export-ignore
**/js/dist/**/* -diff
**/js/dist/**/* linguist-generated
**/js/dist-typings/**/* -diff
**/js/dist-typings/**/* linguist-generated
**/js/yarn.lock -diff
**/js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -1,26 +1,7 @@
---
name: "🚀 Feature Request"
about: "I have a suggestion (and may want to implement it!)"
about: "If you have a suggestion please head over to our forum!"
---
<!--
IMPORTANT: Feature requests on this GitHub issue tracker are only accepted in case they have been approved by a core developer or contain extensive argumentation and directions for implementation. For all other feature requests, ideas and feedback please post in the Flarum Community: https://discuss.flarum.org/t/feedback.
-->
## Feature Request
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. eg. I have an issue when [...]
**Describe the solution you'd like**
A detailed description of your proposed solution. Include:
- How the feature would work/behave
- Any potential drawbacks
- Maybe a screenshot, design, or example code
**Justify why this feature belongs in Flarum's core, rather than in a third-party extension**
Consider who this change will be useful to  most Flarum forums, or just a few?
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
We primarily use GitHub as a bug tracker and issue tracker for items we are sure to tackle in the near future. For feature requests, ideas and feedback please post in the Flarum Community: https://discuss.flarum.org/t/proposals. Feature requests are added to GitHub only when they have been accepted by the development team and implementation details have been laid out.

View File

@@ -4,7 +4,7 @@ about: "If you have a question, please check out our forum or Discord!"
---
We primarily use GitHub as an issue tracker; for usage and support questions, please check out these resources below. Thanks!
We primarily use GitHub as a bug tracker and issue tracker for items we are sure to tackle in the near future; for usage and support questions, please check out these resources below. Thanks!
* Flarum Community: https://discuss.flarum.org/
* Discord Chat: https://flarum.org/discord/

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/akismet
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/approval
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./framework/core
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/embed
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/emoji
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -12,11 +12,12 @@ jobs:
with:
enable_bundlewatch: false
enable_prettier: true
enable_typescript: false
enable_typescript: true
frontend_directory: ./extensions/flags/js
backend_directory: ./extensions/flags
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/likes
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/lock
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/markdown
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/mentions
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/nicknames
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -0,0 +1,15 @@
name: Package Manager PHP
on: [workflow_dispatch, push, pull_request]
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
# This will break your current script.
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
jobs:
run:
uses: flarum/.github/.github/workflows/REUSABLE_backend.yml@main
with:
enable_backend_testing: true
backend_directory: ./extensions/package-manager

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/package-manager
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/pusher
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/statistics
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/sticky
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/subscriptions
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -18,5 +18,6 @@ jobs:
backend_directory: ./extensions/suspend
js_package_manager: yarn
main_git_branch: main
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -12,7 +12,7 @@ jobs:
with:
enable_bundlewatch: false
enable_prettier: false
enable_typescript: false
enable_typescript: true
frontend_directory: ./extensions/tags/js
backend_directory: ./extensions/tags

4
.gitignore vendored
View File

@@ -1 +1,3 @@
node_modules
node_modules
vendor
composer.lock

File diff suppressed because it is too large Load Diff

182
composer.json Normal file
View File

@@ -0,0 +1,182 @@
{
"name": "flarum/framework",
"description": "Delightfully simple forum software.",
"keywords": [
"forum",
"discussion"
],
"homepage": "https://flarum.org/",
"license": "MIT",
"authors": [
{
"name": "Flarum",
"email": "info@flarum.org",
"homepage": "https://flarum.org/team"
}
],
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/flarum"
},
{
"type": "github",
"url": "https://github.com/sponsors/flarum"
},
{
"type": "other",
"url": "https://flarum.org/donate"
}
],
"support": {
"issues": "https://github.com/flarum/core/issues",
"source": "https://github.com/flarum/core",
"docs": "https://docs.flarum.org",
"forum": "https://discuss.flarum.org",
"chat": "https://flarum.org/chat"
},
"autoload": {
"psr-4": {
"Flarum\\": "framework/core/src",
"Flarum\\Akismet\\": "extensions/akismet/src",
"Flarum\\Approval\\": "extensions/approval/src",
"Flarum\\Flags\\": "extensions/flags/src",
"Flarum\\Likes\\": "extensions/likes/src",
"Flarum\\Lock\\": "extensions/lock/src",
"Flarum\\Mentions\\": "extensions/mentions/src",
"Flarum\\Nicknames\\": "extensions/nicknames/src",
"Flarum\\PackageManager\\": "extensions/package-manager/src",
"Flarum\\Pusher\\": "extensions/pusher/src",
"Flarum\\Statistics\\": "extensions/statistics/src",
"Flarum\\Sticky\\": "extensions/sticky/src",
"Flarum\\Subscriptions\\": "extensions/subscriptions/src",
"Flarum\\Suspend\\": "extensions/suspend/src",
"Flarum\\Tags\\": "extensions/tags/src",
"Flarum\\PHPStan\\": "php-packages/phpstan/src",
"Flarum\\Testing\\": "php-packages/testing/src"
},
"files": [
"framework/core/src/helpers.php"
]
},
"replace": {
"flarum/core": "self.version",
"flarum/akismet": "self.version",
"flarum/approval": "self.version",
"flarum/bbcode": "self.version",
"flarum/embed": "self.version",
"flarum/emoji": "self.version",
"flarum/flags": "self.version",
"flarum/lang-english": "self.version",
"flarum/likes": "self.version",
"flarum/lock": "self.version",
"flarum/markdown": "self.version",
"flarum/mentions": "self.version",
"flarum/nicknames": "self.version",
"flarum/package-manager": "self.version",
"flarum/pusher": "self.version",
"flarum/statistics": "self.version",
"flarum/sticky": "self.version",
"flarum/subscriptions": "self.version",
"flarum/suspend": "self.version",
"flarum/tags": "self.version",
"flarum/phpstan": "self.version",
"flarum/testing": "self.version"
},
"require": {
"ext-json": "*",
"php": ">=7.3",
"axy/sourcemap": "^0.1.4",
"components/font-awesome": "^5.14.0",
"composer/composer": "^2.0",
"dflydev/fig-cookies": "^3.0.0",
"doctrine/dbal": "^2.7",
"dragonmantank/cron-expression": "^3.1.0",
"franzl/whoops-middleware": "^2.0.0",
"guzzlehttp/guzzle": "^7.4",
"illuminate/bus": "^8.0",
"illuminate/cache": "^8.0",
"illuminate/config": "^8.0",
"illuminate/console": "^8.0",
"illuminate/container": "^8.0",
"illuminate/contracts": "^8.0",
"illuminate/database": "^8.0",
"illuminate/events": "^8.0",
"illuminate/filesystem": "^8.0",
"illuminate/hashing": "^8.0",
"illuminate/mail": "^8.0",
"illuminate/queue": "^8.0",
"illuminate/session": "^8.0",
"illuminate/support": "^8.0",
"illuminate/validation": "^8.0",
"illuminate/view": "^8.0",
"intervention/image": "2.5.* || ^2.6.1",
"laminas/laminas-diactoros": "^2.4.1",
"laminas/laminas-httphandlerrunner": "^1.2.0",
"laminas/laminas-stratigility": "^3.2.2",
"league/flysystem": "^1.0.11",
"matthiasmullie/minify": "^1.3",
"middlewares/base-path": "^2.0.1",
"middlewares/base-path-router": "^2.0.1",
"middlewares/request-handler": "^2.0.1",
"monolog/monolog": "^1.16.0",
"nesbot/carbon": "^2.0",
"nikic/fast-route": "^0.6",
"psr/http-message": "^1.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"pusher/pusher-php-server": "^2.2",
"s9e/text-formatter": "^2.3.6",
"symfony/config": "^5.2.2",
"symfony/console": "^5.2.2",
"symfony/event-dispatcher": "^5.2.2",
"symfony/mime": "^5.2.0",
"symfony/polyfill-intl-messageformatter": "^1.22.0",
"symfony/translation": "^5.1.5",
"symfony/yaml": "^5.2.2",
"tobscure/json-api": "^0.3.0",
"wikimedia/less.php": "^3.0"
},
"require-dev": {
"mockery/mockery": "^1.4",
"phpunit/phpunit": "^9.0",
"phpstan/phpstan-php-parser": "^1.0",
"phpstan/phpstan": "^1.2"
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"flarum-subextensions": [
"extensions/akismet",
"extensions/approval",
"extensions/bbcode",
"extensions/embed",
"extensions/emoji",
"extensions/flags",
"extensions/lang-english",
"extensions/likes",
"extensions/lock",
"extensions/markdown",
"extensions/mentions",
"extensions/nicknames",
"extensions/package-manager",
"extensions/pusher",
"extensions/statistics",
"extensions/sticky",
"extensions/subscriptions",
"extensions/suspend",
"extensions/tags"
],
"branch-alias": {
"dev-main": "1.x-dev"
},
"phpstan": {
"includes": [
"extension.neon"
]
}
}
}

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2",
"flarum/core": "^1.3",
"flarum/approval": "^1.2",
"guzzlehttp/guzzle": "^7.4"
},

View File

@@ -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 u=t.n(s);a().initializers.add("flarum-akismet",(function(){(0,o.extend)(m(),"destructiveControls",(function(t,e){if(t.has("approve")){var o=e.flags();o&&o.some((function(t){return"akismet"===t.type()}))&&(t.get("approve").children=a().translator.trans("flarum-akismet.forum.post.not_spam_button"))}})),(0,o.override)(u().prototype,"flagReason",(function(t,e){return"akismet"===e.type()?a().translator.trans("flarum-akismet.forum.post.akismet_flagged_text"):t(e)}))}))})(),module.exports=e})();
(()=>{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})();
//# sourceMappingURL=forum.js.map

View File

@@ -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,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,gC,aCQxDC,IAAAA,aAAAA,IAAqB,kBAAkB,YACrCC,EAAAA,EAAAA,QAAOC,IAAc,uBAAuB,SAAUC,EAAiBC,GACrE,GAAID,EAAME,IAAI,WAAY,CACxB,IAAMC,EAAQF,EAAKE,QAEfA,GAASA,EAAMC,MAAK,SAACC,GAAD,MAA0B,YAAhBA,EAAKC,YACrCN,EAAMf,IAAI,WAAWsB,SAAWV,IAAAA,WAAAA,MAAqB,mDAK3DW,EAAAA,EAAAA,UAASC,IAAAA,UAAuB,cAAc,SAAUC,EAAUL,GAChE,MAAoB,YAAhBA,EAAKC,OACAT,IAAAA,WAAAA,MAAqB,kDAGvBa,EAASL,U","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/akismet/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\n\nimport PostControls from 'flarum/forum/utils/PostControls';\nimport CommentPost from 'flarum/forum/components/CommentPost';\nimport ItemList from 'flarum/common/utils/ItemList';\nimport Post from 'flarum/common/models/Post';\n\napp.initializers.add('flarum-akismet', () => {\n extend(PostControls, 'destructiveControls', function (items: ItemList, post: Post) {\n if (items.has('approve')) {\n const flags = post.flags();\n\n if (flags && flags.some((flag) => flag.type() === 'akismet')) {\n items.get('approve').children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');\n }\n }\n });\n\n override(CommentPost.prototype, 'flagReason', function (original, flag) {\n if (flag.type() === 'akismet') {\n return app.translator.trans('flarum-akismet.forum.post.akismet_flagged_text');\n }\n\n return original(flag);\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","app","extend","PostControls","items","post","has","flags","some","flag","type","children","override","CommentPost","original"],"sourceRoot":""}
{"version":3,"file":"forum.js","mappings":"MACA,IAAIA,EAAsB,CCA1BA,EAAyBC,IACxB,IAAIC,EAASD,GAAUA,EAAOE,WAC7B,IAAOF,EAAiB,QACxB,IAAM,EAEP,OADAD,EAAoBI,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRF,EAAwB,CAACM,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXP,EAAoBS,EAAEF,EAAYC,KAASR,EAAoBS,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3ER,EAAwB,CAACc,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFf,EAAyBM,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,+BCLvD,MAAM,EAA+BC,OAAOC,KAAKC,OAAO,iBCAlD,EAA+BF,OAAOC,KAAKC,OAAO,a,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,4B,aCAxD,MAAM,EAA+BF,OAAOC,KAAKC,OAAO,gC,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,WAAuB,CAC7D,IAAMC,EAAcP,EAAMf,IAAI,WAC1BsB,GAAsC,iBAAhBA,GAA4B,aAAcA,IAClEA,EAAYC,SAAWX,IAAAA,WAAAA,MAAqB,oDAMpDY,EAAAA,EAAAA,UAASC,IAAAA,UAAuB,cAAc,SAAUC,EAAUN,GAChE,MAAoB,YAAhBA,EAAKC,OACAT,IAAAA,WAAAA,MAAqB,kDAGvBc,EAASN,U","sources":["webpack://@flarum/akismet/webpack/bootstrap","webpack://@flarum/akismet/webpack/runtime/compat get default export","webpack://@flarum/akismet/webpack/runtime/define property getters","webpack://@flarum/akismet/webpack/runtime/hasOwnProperty shorthand","webpack://@flarum/akismet/webpack/runtime/make namespace object","webpack://@flarum/akismet/external root \"flarum.core.compat['common/extend']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/app']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/utils/PostControls']\"","webpack://@flarum/akismet/external root \"flarum.core.compat['forum/components/CommentPost']\"","webpack://@flarum/akismet/./src/forum/index.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/utils/PostControls'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/CommentPost'];","import { extend, override } from 'flarum/common/extend';\nimport app from 'flarum/forum/app';\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":""}

View File

@@ -12,7 +12,7 @@
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
"check-typings-coverage": "typescript-coverage-report",
"clean-typings": "npx rimraf dist-typings && mkdir dist-typings",
"build-typings": "yarn run clean-typings && [ -e src/@types ] && cp -r src/@types dist-typings/@types && tsc && yarn run post-build-typings",
"build-typings": "yarn run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && yarn run post-build-typings",
"post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'"
},
"devDependencies": {

View File

@@ -1,18 +1,22 @@
import { extend, override } from 'flarum/common/extend';
import app from 'flarum/forum/app';
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 ItemList from 'flarum/common/utils/ItemList';
import Post from 'flarum/common/models/Post';
import type Mithril from 'mithril';
app.initializers.add('flarum-akismet', () => {
extend(PostControls, 'destructiveControls', function (items: ItemList, post: Post) {
extend(PostControls, 'destructiveControls', function (items: ItemList<Mithril.Children>, post: Post) {
if (items.has('approve')) {
const flags = post.flags();
if (flags && flags.some((flag) => flag.type() === 'akismet')) {
items.get('approve').children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');
if (flags && flags.some((flag) => flag?.type() === 'akismet')) {
const approveItem = items.get('approve');
if (approveItem && typeof approveItem === 'object' && 'children' in approveItem) {
approveItem.children = app.translator.trans('flarum-akismet.forum.post.not_spam_button');
}
}
}
});

View File

@@ -4,13 +4,14 @@
// This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
// and also tells your Typescript server to read core's global typings for
// access to `dayjs` and `$` in the global namespace.
"include": ["src/**/*", "../vendor/flarum/core/js/dist-typings/@types/**/*", "@types/**/*"],
"include": ["src/**/*", "../vendor/*/*/js/dist-typings/@types/**/*", "@types/**/*"],
"compilerOptions": {
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"baseUrl": ".",
"paths": {
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"]
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"],
"flarum/flags/*": ["../vendor/flarum/flags/js/dist-typings/*"]
}
}
}

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2",
"flarum/core": "^1.3",
"flarum/flags": "^1.2"
},
"autoload": {

View File

@@ -24,7 +24,7 @@ class UnapproveNewContent
$post = $event->post;
if (! $post->exists) {
$ability = $post->discussion->post_number_index == 0 ? 'startWithoutApproval' : 'replyWithoutApproval';
$ability = $post->discussion->first_post_id === null ? 'startWithoutApproval' : 'replyWithoutApproval';
if ($event->actor->can($ability, $post->discussion)) {
if ($post->is_approved === null) {

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"extra": {
"branch-alias": {

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"autoload": {
"psr-4": {

2
extensions/embed/js/dist/forum.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"extra": {
"branch-alias": {

2
extensions/emoji/js/dist/forum.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -4,18 +4,18 @@
"version": "0.0.0",
"prettier": "@flarum/prettier-config",
"dependencies": {
"simple-emoji-map": "^0.4.1",
"twemoji": "^13.1.0"
"simple-emoji-map": "^0.5.1",
"twemoji": "^14.0.2"
},
"devDependencies": {
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1",
"@flarum/prettier-config": "^1.0.0",
"flarum-tsconfig": "^1.0.2",
"flarum-webpack-config": "^2.0.0",
"prettier": "^2.5.1",
"typescript": "^4.5.4",
"typescript-coverage-report": "^0.6.1"
"typescript-coverage-report": "^0.6.1",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1"
},
"scripts": {
"dev": "webpack --mode development --watch",

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"autoload": {
"psr-4": {
@@ -49,7 +49,7 @@
"gitConf": true,
"githubActions": true,
"prettier": true,
"typescript": false,
"typescript": true,
"bundlewatch": false,
"backendTesting": true,
"editorConfig": true,

22
extensions/flags/js/dist-typings/@types/shims.d.ts generated vendored Normal file
View File

@@ -0,0 +1,22 @@
import Flag from '../forum/models/Flag';
import FlagListState from '../forum/states/FlagListState';
import Mithril from 'mithril';
declare module 'flarum/common/models/Post' {
export default interface Post {
flags: () => false | (Flag | undefined)[];
canFlag: () => boolean;
}
}
declare module 'flarum/forum/ForumApplication' {
export default interface ForumApplication {
flags: FlagListState;
}
}
declare module 'flarum/forum/components/Post' {
export default interface Post {
flagReason: (flag: Flag) => Mithril.Children;
}
}

1
extensions/flags/js/dist-typings/admin/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1 @@
export default function _default(): void;

View File

@@ -0,0 +1 @@
export default function _default(): void;

View File

@@ -0,0 +1 @@
export default function _default(): void;

19
extensions/flags/js/dist-typings/forum/compat.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
declare var _default: {
'flags/addFlagsToPosts': typeof addFlagsToPosts;
'flags/addFlagControl': typeof addFlagControl;
'flags/addFlagsDropdown': typeof addFlagsDropdown;
'flags/models/Flag': typeof Flag;
'flags/components/FlagList': typeof FlagList;
'flags/components/FlagPostModal': typeof FlagPostModal;
'flags/components/FlagsPage': typeof FlagsPage;
'flags/components/FlagsDropdown': typeof FlagsDropdown;
};
export default _default;
import addFlagsToPosts from "./addFlagsToPosts";
import addFlagControl from "./addFlagControl";
import addFlagsDropdown from "./addFlagsDropdown";
import Flag from "./models/Flag";
import FlagList from "./components/FlagList";
import FlagPostModal from "./components/FlagPostModal";
import FlagsPage from "./components/FlagsPage";
import FlagsDropdown from "./components/FlagsDropdown";

View File

@@ -0,0 +1,5 @@
export default class FlagList {
oninit(vnode: any): void;
state: any;
view(): JSX.Element;
}

View File

@@ -0,0 +1,12 @@
export default class FlagPostModal {
oninit(vnode: any): void;
success: boolean | undefined;
reason: any;
reasonDetail: any;
className(): string;
title(): any;
content(): JSX.Element;
flagReasons(): any;
onsubmit(e: any): void;
loading: boolean | undefined;
}

View File

@@ -0,0 +1,7 @@
export default class FlagsDropdown {
static initAttrs(attrs: any): void;
getMenu(): JSX.Element;
goToRoute(): void;
getUnreadCount(): any;
getNewCount(): any;
}

View File

@@ -0,0 +1,9 @@
/**
* The `FlagsPage` component shows the flags list. It is only
* used on mobile devices where the flags dropdown is within the drawer.
*/
export default class FlagsPage {
oninit(vnode: any): void;
bodyClass: string | undefined;
view(): JSX.Element;
}

1
extensions/flags/js/dist-typings/forum/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

View File

@@ -0,0 +1,9 @@
import Model from 'flarum/common/Model';
export default class Flag extends Model {
type(): any;
reason(): any;
reasonDetail(): any;
createdAt(): any;
post(): any;
user(): any;
}

View File

@@ -0,0 +1,16 @@
export default class FlagListState {
constructor(app: any);
app: any;
/**
* Whether or not the flags are loading.
*
* @type {Boolean}
*/
loading: boolean;
/**
* Load flags into the application's cache if they haven't already
* been loaded.
*/
load(): void;
cache: any;
}

2
extensions/flags/js/dist/admin.js generated vendored
View File

@@ -1,2 +1,2 @@
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=24)}({24:function(e,t,r){"use strict";r.r(t);var n=r(5),a=r.n(n);a.a.initializers.add("flarum-flags",(function(){a.a.extensionData.for("flarum-flags").registerSetting({setting:"flarum-flags.guidelines_url",type:"text",label:a.a.translator.trans("flarum-flags.admin.settings.guidelines_url_label")},15).registerSetting({setting:"flarum-flags.can_flag_own",type:"boolean",label:a.a.translator.trans("flarum-flags.admin.settings.flag_own_posts_label")}).registerPermission({icon:"fas fa-flag",label:a.a.translator.trans("flarum-flags.admin.permissions.view_flags_label"),permission:"discussion.viewFlags"},"moderate",65).registerPermission({icon:"fas fa-flag",label:a.a.translator.trans("flarum-flags.admin.permissions.flag_posts_label"),permission:"discussion.flagPosts"},"reply",65)}))},5:function(e,t){e.exports=flarum.core.compat["admin/app"]}});
(()=>{var e={n:a=>{var s=a&&a.__esModule?()=>a.default:()=>a;return e.d(s,{a:s}),s},d:(a,s)=>{for(var l in s)e.o(s,l)&&!e.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:s[l]})},o:(e,a)=>Object.prototype.hasOwnProperty.call(e,a),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},a={};(()=>{"use strict";e.r(a);const s=flarum.core.compat["admin/app"];var l=e.n(s);l().initializers.add("flarum-flags",(function(){l().extensionData.for("flarum-flags").registerSetting({setting:"flarum-flags.guidelines_url",type:"text",label:l().translator.trans("flarum-flags.admin.settings.guidelines_url_label")},15).registerSetting({setting:"flarum-flags.can_flag_own",type:"boolean",label:l().translator.trans("flarum-flags.admin.settings.flag_own_posts_label")}).registerPermission({icon:"fas fa-flag",label:l().translator.trans("flarum-flags.admin.permissions.view_flags_label"),permission:"discussion.viewFlags"},"moderate",65).registerPermission({icon:"fas fa-flag",label:l().translator.trans("flarum-flags.admin.permissions.flag_posts_label"),permission:"discussion.flagPosts"},"reply",65)}))})(),module.exports=a})();
//# sourceMappingURL=admin.js.map

File diff suppressed because one or more lines are too long

2
extensions/flags/js/dist/forum.js generated vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -3,12 +3,8 @@
"name": "@flarum/flags",
"version": "0.0.0",
"prettier": "@flarum/prettier-config",
"dependencies": {
"@flarum/prettier-config": "^1.0.0",
"flarum-webpack-config": "^1.0.0",
"flarum-tsconfig": "^1.0.2"
},
"devDependencies": {
"@types/mithril": "^2.0.8",
"prettier": "^2.5.1",
"flarum-webpack-config": "^2.0.0",
"webpack": "^5.65.0",
@@ -25,8 +21,9 @@
"format-check": "prettier --check src",
"analyze": "cross-env ANALYZER=true yarn run build",
"clean-typings": "npx rimraf dist-typings && mkdir dist-typings",
"build-typings": "npm run clean-typings && cp -r src/@types dist-typings/@types && tsc",
"build-typings": "yarn run clean-typings && ([ -e src/@types ] && cp -r src/@types dist-typings/@types || true) && tsc && yarn run post-build-typings",
"check-typings": "tsc --noEmit --emitDeclarationOnly false",
"check-typings-coverage": "typescript-coverage-report"
"check-typings-coverage": "typescript-coverage-report",
"post-build-typings": "find dist-typings -type f -name '*.d.ts' -print0 | xargs -0 sed -i 's,../src/@types,@types,g'"
}
}

View File

@@ -0,0 +1,22 @@
import Flag from '../forum/models/Flag';
import FlagListState from '../forum/states/FlagListState';
import Mithril from 'mithril';
declare module 'flarum/common/models/Post' {
export default interface Post {
flags: () => false | (Flag | undefined)[];
canFlag: () => boolean;
}
}
declare module 'flarum/forum/ForumApplication' {
export default interface ForumApplication {
flags: FlagListState;
}
}
declare module 'flarum/forum/components/Post' {
export default interface Post {
flagReason: (flag: Flag) => Mithril.Children;
}
}

View File

@@ -9,8 +9,8 @@ import addFlagsDropdown from './addFlagsDropdown';
import addFlagsToPosts from './addFlagsToPosts';
app.initializers.add('flarum-flags', () => {
app.store.models.posts.prototype.flags = Model.hasMany('flags');
app.store.models.posts.prototype.canFlag = Model.attribute('canFlag');
Post.prototype.flags = Model.hasMany<Flag>('flags');
Post.prototype.canFlag = Model.attribute<boolean>('canFlag');
app.store.models.flags = Flag;
@@ -26,5 +26,6 @@ app.initializers.add('flarum-flags', () => {
// Expose compat API
import flagsCompat from './compat';
import { compat } from '@flarum/core/forum';
import Post from 'flarum/common/models/Post';
Object.assign(compat, flagsCompat);

View File

@@ -1,15 +0,0 @@
import Model from 'flarum/common/Model';
class Flag extends Model {}
Object.assign(Flag.prototype, {
type: Model.attribute('type'),
reason: Model.attribute('reason'),
reasonDetail: Model.attribute('reasonDetail'),
createdAt: Model.attribute('createdAt', Model.transformDate),
post: Model.hasOne('post'),
user: Model.hasOne('user'),
});
export default Flag;

View File

@@ -0,0 +1,25 @@
import Model from 'flarum/common/Model';
import type Post from 'flarum/common/models/Post';
import type User from 'flarum/common/models/User';
export default class Flag extends Model {
type() {
return Model.attribute<string>('type').call(this);
}
reason() {
return Model.attribute<string | null>('reason').call(this);
}
reasonDetail() {
return Model.attribute<string | null>('reasonDetail').call(this);
}
createdAt() {
return Model.attribute('createdAt', Model.transformDate).call(this);
}
post() {
return Model.hasOne<Post>('post').call(this);
}
user() {
return Model.hasOne<User | null>('user').call(this);
}
}

View File

@@ -0,0 +1,17 @@
{
// 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/**/*", "../vendor/*/*/js/dist-typings/@types/**/*", "@types/**/*"],
"compilerOptions": {
// This will output typings to `dist-typings`
"declarationDir": "./dist-typings",
"baseUrl": ".",
"paths": {
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"],
"@flarum/core/*": ["../vendor/flarum/core/js/dist-typings/*"]
}
}
}

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -7,7 +7,7 @@
],
"license": "MIT",
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"extra": {
"branch-alias": {

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"autoload": {
"psr-4": {

File diff suppressed because one or more lines are too long

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"autoload": {
"psr-4": {

File diff suppressed because one or more lines are too long

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"extra": {
"branch-alias": {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"autoload": {
"psr-4": {

File diff suppressed because one or more lines are too long

View File

@@ -125,10 +125,13 @@ class ConfigureMentions
{
$post = CommentPost::find($tag->getAttribute('id'));
if ($post && $post->user) {
if ($post) {
$tag->setAttribute('discussionid', (int) $post->discussion_id);
$tag->setAttribute('number', (int) $post->number);
$tag->setAttribute('displayname', $post->user->display_name);
if ($post->user) {
$tag->setAttribute('displayname', $post->user->display_name);
}
return true;
}

View File

@@ -45,7 +45,7 @@ class FormatUserMentions
public function __invoke(Renderer $renderer, $context, string $xml)
{
return Utils::replaceAttributes($xml, 'USERMENTION', function ($attributes) use ($context) {
$user = (isset($context->getRelations()['mentionsUsers']) || $context instanceof Post)
$user = (($context && isset($context->getRelations()['mentionsUsers'])) || $context instanceof Post)
? $context->mentionsUsers->find($attributes['id'])
: User::find($attributes['id']);

View File

@@ -51,7 +51,7 @@ class UnparseUserMentions
protected function updateUserMentionTags($context, string $xml): string
{
return Utils::replaceAttributes($xml, 'USERMENTION', function ($attributes) use ($context) {
$user = (isset($context->getRelations()['mentionsUsers']) || $context instanceof Post)
$user = (($context && isset($context->getRelations()['mentionsUsers'])) || $context instanceof Post)
? $context->mentionsUsers->find($attributes['id'])
: User::find($attributes['id']);

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -19,7 +19,7 @@
}
],
"require": {
"flarum/core": "^1.2"
"flarum/core": "^1.3"
},
"autoload": {
"psr-4": {

File diff suppressed because one or more lines are too long

View File

@@ -40,7 +40,7 @@ class AddNicknameValidation
function ($attribute, $value, $fail) {
$regex = $this->settings->get('flarum-nicknames.regex');
if ($regex && ! preg_match_all("/$regex/", $value)) {
$this->translator->trans('flarum-nicknames.api.invalid_nickname_message');
$fail($this->translator->trans('flarum-nicknames.api.invalid_nickname_message'));
}
},
'min:'.$this->settings->get('flarum-nicknames.min'),

View File

@@ -74,4 +74,48 @@ class RegisterTest extends TestCase
$this->assertEquals(403, $response->getStatusCode());
}
/**
* @test
*/
public function cant_register_with_nickname_if_invalid_regex()
{
$this->setting('flarum-nicknames.set_on_registration', true);
$this->setting('flarum-nicknames.regex', '^[A-z]+$');
$response = $this->send(
$this->request('POST', '/register', [
'json' => [
'nickname' => '007',
'username' => 'test',
'password' => 'too-obscure',
'email' => 'test@machine.local',
]
])
);
$this->assertEquals(422, $response->getStatusCode());
}
/**
* @test
*/
public function can_register_with_nickname_if_valid_regex()
{
$this->setting('flarum-nicknames.set_on_registration', true);
$this->setting('flarum-nicknames.regex', '^[A-z]+$');
$response = $this->send(
$this->request('POST', '/register', [
'json' => [
'nickname' => 'Acme',
'username' => 'test',
'password' => 'too-obscure',
'email' => 'test@machine.local',
]
])
);
$this->assertEquals(201, $response->getStatusCode());
}
}

View File

@@ -1,19 +0,0 @@
.gitattributes export-ignore
.gitignore export-ignore
.gitmodules export-ignore
.github export-ignore
.travis export-ignore
.travis.yml export-ignore
.editorconfig export-ignore
.styleci.yml export-ignore
phpunit.xml export-ignore
tests export-ignore
js/dist/* -diff
js/dist/* linguist-generated
js/dist-typings/* linguist-generated
js/yarn.lock -diff
js/package-lock.json -diff
* text=auto eol=lf

View File

@@ -23,7 +23,7 @@
},
"require": {
"flarum/core": "^1.0.0",
"composer/composer": "^2.0"
"composer/composer": "^2.3"
},
"require-dev": {
"flarum/testing": "^1.0.0",
@@ -86,7 +86,7 @@
"test:integration": "phpunit -c tests/phpunit.integration.xml",
"test:setup": [
"@php tests/integration/setup.php",
"cd $FLARUM_TEST_TMP_DIR_LOCAL && composer install"
"cd ${FLARUM_TEST_TMP_DIR_LOCAL:-${FLARUM_TEST_TMP_DIR:-./tests/integration/tmp}} && composer install"
]
},
"scripts-descriptions": {

View File

@@ -1,4 +1,3 @@
/// <reference path="../../../vendor/flarum/core/js/src/common/translator-icu-rich.d.ts" />
import Mithril from 'mithril';
import Modal, { IInternalModalAttrs } from 'flarum/common/components/Modal';
export interface WhyNotModalAttrs extends IInternalModalAttrs {
@@ -8,7 +7,7 @@ export default class WhyNotModal<Attrs extends WhyNotModalAttrs = WhyNotModalAtt
loading: boolean;
whyNot: string | null;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
title(): any;
oncreate(vnode: Mithril.VnodeDOM<Attrs, this>): void;
content(): JSX.Element;
requestWhyNot(): void;

Some files were not shown because too many files have changed in this diff Show More