1
0
mirror of https://github.com/flarum/core.git synced 2025-08-12 03:14:33 +02:00

Compare commits

...

1275 Commits

Author SHA1 Message Date
flarum-bot
5c901cfba8 Bundled output for commit be1b5713fa
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-03-10 01:00:54 +00:00
David Sevilla Martin
be1b5713fa Replace ColorPreviewInput preview box with 'color' input (#3271) 2022-03-09 19:56:25 -05:00
Ian Morland
5045254c9f fix: unread filter gambit does not return results when > 999 read discussions for a user (#3295) 2022-03-09 15:41:04 -05:00
flarum-bot
9b302a1029 Bundled output for commit 97dfb50f17
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-02-22 14:06:00 +00:00
Clark Winkelmann
97dfb50f17 Fix permission check in edit modal
Previously was checking ability to edit own user instead of user selected in modal
2022-02-22 15:01:30 +01:00
Clark Winkelmann
6a940cd34f Fix pinned pane broken after discussion creation
The pane would appear but the page content would not shift to the right because the hasPane className would be missing
2022-02-22 15:01:02 +01:00
Clark Winkelmann
edd93dad77 Fix active search jumping to last item during loading 2022-02-22 15:00:14 +01:00
flarum-bot
2d18d37ba9 Bundled output for commit b58b3e2224
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-02-21 18:35:03 +00:00
David Wheatley
b58b3e2224 fix: don't submit form when search clear button clicked (#3260) 2022-02-21 19:31:03 +01:00
David Wheatley
2c902c6563 fix: overlap in minimized composer 2022-02-21 11:45:12 +01:00
David Wheatley
a38dc889e9 fix: composer header overlap with controls 2022-02-21 11:45:12 +01:00
flarum-bot
851907b88c Bundled output for commit dfa3b47cf3
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-02-09 23:18:18 +00:00
Alexander Skvortsov
dfa3b47cf3 fix: refer to bundled dist-typing types instead of src ones
This ensures that extensions referring to core's built dist typings don't try to pull from core's src code.
2022-02-09 18:13:32 -05:00
Alexander Skvortsov
289ea49cc7 chore: make translator / rich translator typings available to exts 2022-02-09 18:13:32 -05:00
flarum-bot
d769ee2b7b Bundled output for commit 6e3051b36a
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-02-09 21:02:11 +00:00
David Wheatley
6e3051b36a fix: sort posts by number instead of creation datetime (#3282)
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2022-02-09 20:58:11 +00:00
flarum-bot
c622070366 Bundled output for commit 21d3e33613
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-02-06 02:17:08 +00:00
David Wheatley
21d3e33613 chore: remove call to console.log 2022-02-06 02:12:52 +00:00
flarum-bot
b0d9f10280 Bundled output for commit d192185d13
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-01-30 22:49:44 +00:00
Alexander Skvortsov
d192185d13 chore: regenerate yarn.lock 2022-01-30 17:45:35 -05:00
Alexander Skvortsov
6dba5c8e67 chore: drop unnecessary ci script 2022-01-30 17:38:05 -05:00
Alexander Skvortsov
34c753040c chore: flarum-cli audit infra --fix 2022-01-27 16:45:10 -05:00
flarum-bot
7c4992c401 Bundled output for commit a7254773dd
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-01-24 04:31:39 +00:00
Alexander Skvortsov
a7254773dd chore: bump rich text ICU Message formatter
This fixes https://discuss.flarum.org/d/29914-utf-encoding-error-in-title/6
2022-01-23 23:24:51 -05:00
Daniël Klabbers
1217b11896 Update Application.php
update constant for next version
2022-01-20 14:20:36 +01:00
Daniël Klabbers
7a22527b72 update changelog 2022-01-20 13:56:05 +01:00
Daniël Klabbers
bd4d53323c fixing error in tests for missing timezone 2022-01-20 13:42:26 +01:00
Daniel Klabbers
ad69cf84fe Release v1.2 2022-01-20 12:55:30 +01:00
flarum-bot
aa77df46ee Bundled output for commit 19e48617f0
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-01-20 09:33:26 +00:00
Alexander Skvortsov
19e48617f0 chore: bump rich icu message formatter 2022-01-20 04:27:39 -05:00
Alexander Skvortsov
d8b83cc372 fix: build typings script 2022-01-20 04:24:32 -05:00
Alexander Skvortsov
a04b420295 fix: typings generation script 2022-01-20 04:12:32 -05:00
flarum-bot
5f4b5c0841 Bundled output for commit beae75dab3
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-01-20 08:25:20 +00:00
Alexander Skvortsov
beae75dab3 chore: fl-dev audit infra --fix 2022-01-20 03:19:22 -05:00
flarum-bot
e304cf7cb5 Bundled output for commit 9f87674626
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-01-18 18:38:18 +00:00
Alexander Skvortsov
9f87674626 chore: bump @askvortsov/rich-icu-message-formatter (#3264)
Fixes https://github.com/flarum/core/issues/3259
2022-01-18 13:32:30 -05:00
flarum-bot
54329d0827 Bundled output for commit a7aad46068
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-01-14 05:30:33 +00:00
David Wheatley
a7aad46068 fix: mark near as optional in discussion route (#3257) 2022-01-14 00:25:29 -05:00
flarum-bot
7551a14ae5 Bundled output for commit f4c29db182
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-01-09 04:01:27 +00:00
Alexander Skvortsov
f4c29db182 fix: Allow outside click on modal focus trap
Without this, alerts triggered while a modal is open can't be dismissed.
2022-01-08 22:55:48 -05:00
Alexander Skvortsov
a291134da1 fix: don't spellcheck custom LESS
This should stop browsers from "correcting" code, and from converting regular quotes to "smart" quotes.
2022-01-08 22:55:48 -05:00
flarum-bot
c702f5e228 Bundled output for commit 749e7e34f7
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-01-09 00:24:36 +00:00
Alexander Skvortsov
749e7e34f7 Fix frontend branch name 2022-01-08 19:18:02 -05:00
Alexander Skvortsov
67821d95bd fix: Ensure user not false in post component
If no information about a relation exists, it will return false, not undefined. Therefore, the nullsafe operator is not enough to avoid issues here.
2022-01-08 18:26:51 -05:00
StyleCI Bot
aa44677df3 Apply fixes from StyleCI
[ci skip] [skip ci]
2022-01-06 02:47:52 +00:00
Alexander Skvortsov
3978efa533 LogDriver should work in debug mode 2022-01-05 21:47:33 -05:00
Alexander Skvortsov
687e1e2789 Use proper log level depending on debug mode 2022-01-05 21:45:27 -05:00
Alexander Skvortsov
7cec4d1f42 Format 2022-01-04 21:13:42 -05:00
Alexander Skvortsov
fbe1a48bec Fix echo statements not showing up in debug modals or console trace
This was accidentially introduced in the recent Application permissions refactor, where `formattedError`was changed to always be a string array.
2022-01-04 21:13:15 -05:00
David Wheatley
17a8d2c9d8 docs: add missing 1.1.1 changelog
This was present on the 1.1.1 branch, but not `master`.
2022-01-04 15:19:21 +00:00
Alexander Skvortsov
85ee80659d fix: broken post/discussion soft delete (#3249)
* FIx broken post/discussion soft delete

Before the Model typescript rewrite, `pushAttributes` supported including relationship objects, which is hacky but incorrect behavior. With the rewrite, this functionality was broken.

This PR deprecates the functionality, adds a deprecated BC layer with a debug warning, and removes instances of incorrect usage.

* Update js/src/common/Model.ts

Co-authored-by: David Wheatley <hi@davwheat.dev>

* Update js/src/common/Model.ts

Co-authored-by: David Wheatley <hi@davwheat.dev>

* chore: format

Co-authored-by: David Wheatley <hi@davwheat.dev>
2022-01-04 13:26:46 +00:00
Alexander Skvortsov
af77214967 Apply flarum-cli audit fix (#3248) 2022-01-03 16:57:09 -05:00
Alexander Skvortsov
7c3b51fec0 Use v1.0.0 of backend testing properly (#3247) 2022-01-03 16:04:17 -05:00
Sami Mazouz
ed3ea05c1a fix: Until reply renaming permission of discussions broken in php 8 (#3243)
* test: `until reply` rename discussion ability
* fix: `Until reply` renaming of discussions broken in php 8
2021-12-31 20:19:26 +01:00
flarum-bot
9fd6e5d0a2 Bundled output for commit 2541cdec94
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-29 09:43:23 +00:00
David Wheatley
2541cdec94 fix: prevent unwarranted a11y warnings on custom Button subclasses (#3238)
* fix: prevent unwarranted a11y warnings on UploadImageButton

* chore: format

* refactor

* fix: remove attr
2021-12-29 10:37:58 +01:00
David Wheatley
8fac735be0 fix: error in funding composer.json block bricks frontend (#3239)
* fix: error in funding `composer.json` block bricks frontend

* simplify

* Apply fixes from StyleCI

[ci skip] [skip ci]

Co-authored-by: luceos <luceos@users.noreply.github.com>
2021-12-29 03:25:03 +01:00
flarum-bot
53c3d13047 Bundled output for commit 993500aae4
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-28 20:13:43 +00:00
David Wheatley
993500aae4 fix(a11y): fix a11y warning in alert, and other a11y fixes (#3237)
* fix(a11y): fix a11y warning in alert, and other a11y fixes

* chore: correct import

* chore: use `class`
2021-12-28 21:08:34 +01:00
flarum-bot
0e9c169e06 Bundled output for commit 94f9e7f9de
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-28 19:56:55 +00:00
David Wheatley
94f9e7f9de fix: don't fire deprecation warnings for Mithril-originating action (#3236)
* fix: don't fire deprecation warnings for Mithril-originating actions

* Add comment
2021-12-28 20:51:13 +01:00
flarum-bot
4b25b90b48 Bundled output for commit a4fbf16eef
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-28 19:40:54 +00:00
David Wheatley
a4fbf16eef fix: mark render method in RouteResolver as optional (#3235) 2021-12-28 20:36:11 +01:00
David Wheatley
809620750f perf: include request info in first accesstoken touch (#3233) 2021-12-28 10:17:11 +01:00
flarum-bot
066cf02b88 Bundled output for commit cff672424b
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-28 01:30:26 +00:00
Alexander Skvortsov
cff672424b Merge pull request #3228 from flarum/as/v1.2_frontend_fixes
Some v1.2 frontend fixes
2021-12-27 20:24:53 -05:00
David Wheatley
2e94e31bb6 perf: only update last time when current value outdated (#3230)
* perf: only update last seen time when current > 120s ago

* perf: only update `last_activity_at` every 2 mins

* docs: add comment

* fix: add missing param

* test: add tests

* tests: attempt tests fix

* fix(tests): call `$this->app()`

* chore: extract hard-coded values out to private consts

* chore: increase diff

* Apply suggestions from code review
2021-12-28 00:39:42 +01:00
Alexander Skvortsov
b7f2fe2429 Fix consecutive shows of same modal with different attrs
We need to specify a unique key for each modal so that the modals are fully destroyed and recreated. For instance, this fixes the signup modal being empty with OAuth register flows.
2021-12-27 18:28:11 -05:00
flarum-bot
64dab138c4 Bundled output for commit 206aa227f2
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-27 23:18:49 +00:00
Alexander Skvortsov
a55b61e058 Use translations for page titles in frontend
This gives more flexibility for customization, and allows overriding title structure via translations / linguist.
2021-12-27 18:15:12 -05:00
Alexander Skvortsov
206aa227f2 Only retain scroll position if coming from discussion (#3229)
Fixes https://discuss.flarum.org/d/29596-make-tag-hero-visible/8.

If a user has just switched from one tag to another, they want to see the entire new discussion list, and information about which tag that discussion list corresponds to. There's no good reason to not display the hero header when switching tags.
2021-12-27 18:13:29 -05:00
flarum-bot
e926758060 Bundled output for commit ad8ac4e342
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-27 20:37:36 +00:00
David Wheatley
ad8ac4e342 fix: posts tab on users page broken 2021-12-27 21:32:04 +01:00
flarum-bot
2e5cd6f5c3 Bundled output for commit d5cd0bd339
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-27 19:59:19 +00:00
David Wheatley
d5cd0bd339 fix: returning null breaking CommentPosts 2021-12-27 20:54:00 +01:00
flarum-bot
09d1e289de Bundled output for commit d65deeccb5
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-27 19:09:19 +00:00
David Wheatley
d65deeccb5 chore: maintenance pre-1.2 release (#3213)
* chore: bump js dependencies

* chore: bump Yarn to 3.1.1

* chore: re-patch TS binary

* chore: don't show diffs for yarn lockfile
2021-12-27 19:04:42 +00:00
flarum-bot
3d62a6af27 Bundled output for commit d268894e61
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-27 19:02:33 +00:00
David Wheatley
d268894e61 chore: 1.2 JS clean-up (#3214)
* fix: `extend.ts` TS error

* docs: fix incorrect JS docblocks

* chore: simplify some code

* chore: remove usages of prefixed JS function

* chore: consistent empty return types

* chore: format

* fix: typing errors

* chore: remove unneeded `@public` docblock modifiers

* Apply suggestions from code review

* Update js/src/forum/utils/slidable.js

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2021-12-27 18:58:18 +00:00
Alexander Skvortsov
d89031f057 Fix drawer focus trap making login form unclickable on mobile
Adding `clickOutsideDeactivates` seems to fix the issue, contrary to what the focus-trap documentation implies about it being unnecessary.
2021-12-26 22:45:58 -05:00
Alexander Skvortsov
0c95d28e94 Fix Search error when user can't search
If there are no search sources, HTML for the Search component won't be rendered, so trying to attach listeners to it will likely error.

In this PR, we don't attach such listeners/logic if there are no sources. We also stop asserting that sources is defined to help avoid other similar issues in the future.
2021-12-26 20:04:48 -05:00
flarum-bot
4df72e5ac6 Bundled output for commit a2f417e9c5
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-26 06:29:40 +00:00
David Wheatley
a2f417e9c5 fix: incorrect return type on pushPayload (#3226) 2021-12-26 01:25:16 -05:00
flarum-bot
dc661bf144 Bundled output for commit 7a27f494c6
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-22 18:58:42 +00:00
David Wheatley
7a27f494c6 fix: hide WelcomeHero when content is empty (#3219) 2021-12-22 13:54:21 -05:00
Sebastian Kessler
edde6be301 docs: fix broken contribution link in README; add screenshot (#3211) 2021-12-20 14:55:25 -05:00
flarum-bot
96fdaac3ef Bundled output for commit e57655553f
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-20 16:32:17 +00:00
David Wheatley
e57655553f fix: breaking change in Search component - renaming of state property (#3212)
* fix: breaking change in search component's public api

* fix: add setter

* feat: add deprecation warning helper

This reduces bundle size as a result of deprecation warning in our JS, as well as maintaining a consistent format across warnings.

* feat: fire deprecation warning on usage of `Search.state`

* chore: use consistent deprecation warning across core

* fix: `/pull` not `/issue`

* chore: format
2021-12-20 16:28:28 +00:00
David Wheatley
a1cc456f3a fix(postmeta): use app baseUrl instead of location.origin (#3216) 2021-12-20 16:25:04 +00:00
David Wheatley
4ad961c972 feat: allow replacing of blade template namespaces via extender (#3167)
* feat: allow replacing of blade template namespaces

* wip: add `prependNamespace` support

* test: add replace namespace test

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix: add missing property

* test: add prepend test

* fix: add view namespaces before resolving

Allows `replaceNamespace()` extender to actually remove old routes.

* test: make replace test ensure that replaced view does not exist

* docs: update docblock

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix: missing `\` before class

* fix: change test view namespace

* chore: simplify test

* Remove replace namespace code

We only really need prepend.

* chore: rename extender

* ci: add override test

* Apply fixes from StyleCI

[ci skip] [skip ci]

* fix(tests): add `trim` call

* revert: 3d46ead14b

Co-authored-by: luceos <luceos@users.noreply.github.com>
2021-12-20 09:56:48 +01:00
flarum-bot
7d9fe8e06b Bundled output for commit a36f98d1fc
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-16 08:36:25 +00:00
Sami Mazouz
a36f98d1fc fix: Add a11y labels to auth modal inputs (#3207) 2021-12-16 09:30:34 +01:00
flarum-bot
5befaa6886 Bundled output for commit 726661fe8c
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-15 15:53:25 +00:00
David Wheatley
726661fe8c fix: replace throw with debug warning to fix breaking change (#3206)
* fix: replace throw with debug warning to fix breaking change

* Add link back to PR in warning

* fix: add missing `return null` for `!allowUnregistered` code path

* Clean up message -- move more info to PR comment

* Add setTimeout to delay call debug warning call until after `app.forum` is defined

* Add backticks around data type
2021-12-15 10:48:46 -05:00
flarum-bot
b8b9f69820 Bundled output for commit c9a8543554
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-14 22:16:16 +00:00
Ian Morland
c9a8543554 feat: extract notification primaryControl items to an ItemList (#3204) 2021-12-14 22:11:48 +00:00
Ian Morland
6136ce8d8c feat: Add events for Notification read / read all (#3203) 2021-12-14 15:38:50 -05:00
David Wheatley
11fd012f70 feat: add Less custom function extender, is-extension-enabled function (#3190)
Co-authored-by: luceos <luceos@users.noreply.github.com>
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
2021-12-14 19:25:39 +00:00
Ian Morland
25dc26bac6 Only update notifications that are not already marked as read (#3202) 2021-12-14 19:24:30 +01:00
flarum-bot
10c6694087 Bundled output for commit c88a3e7e89
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-14 17:10:20 +00:00
Alexander Skvortsov
c88a3e7e89 Merge pull request #2961 from the-turk/style-st
Improve selected text stylization
2021-12-14 12:06:22 -05:00
flarum-bot
f7e4413d96 Bundled output for commit e54c5b0924
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-14 03:11:57 +00:00
Alexander Skvortsov
e54c5b0924 Merge pull request #3196 from flarum/as/finish-typing
Finish typing, enable error on TypeScript check failure
2021-12-13 22:07:39 -05:00
Alexander Skvortsov
cbbb574e37 Format and Type Import Cleanup
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-12-13 22:04:36 -05:00
Alexander Skvortsov
4444357563 Error in GH actions on type failures 2021-12-13 20:20:35 -05:00
Alexander Skvortsov
55dd8f17f3 Fix typing errors with app.modal.show
Unfortunately TypeScript doesn't support higher-kinded types, so we can't write this in a type-safe way.
2021-12-13 20:20:35 -05:00
Alexander Skvortsov
718e01165a Slightly improve AlertManagerState show typing
`typeof Alert` is more correct than `Alert`, since we're accepting classes not instances.
2021-12-13 20:20:35 -05:00
Alexander Skvortsov
311e858c2b VnodeElementTag must be either a string or a class.
Unfortunately, TypeScript only supports strings and classes for JSX tags.
Therefore, our type definition should only allow for those two types.
see https://github.com/microsoft/TypeScript/issues/14789#issuecomment-412247771
2021-12-13 20:20:34 -05:00
Alexander Skvortsov
b13bc70339 Format VnodeElementTag fix 2021-12-13 20:20:34 -05:00
Alexander Skvortsov
a90140928c Modal typescript cleanup and conversions 2021-12-13 20:20:34 -05:00
Alexander Skvortsov
162c60e763 alertAttrs can be null 2021-12-13 20:20:34 -05:00
Alexander Skvortsov
174345cf22 Fix LoadingModal attr typings 2021-12-13 20:20:34 -05:00
Alexander Skvortsov
fe9cec0787 Allow any Mithril Children where appropriate 2021-12-13 20:20:33 -05:00
Alexander Skvortsov
1bdfe0112c extractText from translations where strings expected 2021-12-13 20:20:33 -05:00
Alexander Skvortsov
cc69211977 Fix import of mithril for VnodeElementTag usage 2021-12-13 20:20:33 -05:00
Alexander Skvortsov
02a57bfa8e Don't assume app.session.user is present 2021-12-13 20:20:33 -05:00
flarum-bot
0d45f2a881 Bundled output for commit 6c46fc4228
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-14 00:01:04 +00:00
Alexander Skvortsov
6c46fc4228 Merge pull request #3197 from flarum/as/permission-grid-fixes
Permission grid fixes
2021-12-13 18:56:11 -05:00
Alexander Skvortsov
1567ab0cb8 Return undefined => return null 2021-12-13 18:55:25 -05:00
flarum-bot
2554b9e774 Bundled output for commit b77f13b7c6
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-13 21:35:24 +00:00
Alexander Skvortsov
b77f13b7c6 Merge pull request #3200 from flarum/as/1_2_assorted_frontend_patches
A few frontend fixes for v1.2
2021-12-13 16:31:18 -05:00
Alexander Skvortsov
080442d085 Sync with v2.1 of markdown-toolbar-element 2021-12-13 16:03:34 -05:00
Hasan Özbey
fb82afa97f improve selected text stylization 2021-12-13 15:14:23 -05:00
Alexander Skvortsov
508be96f15 Don't throw errors for undefined relationships 2021-12-13 15:07:30 -05:00
Alexander Skvortsov
364575b3f0 Make sure this.data.attributes is initialized.
`Object.assign` is not type-safe, and does ensure that the property being assigned to is not undefined.
2021-12-13 12:34:51 -05:00
Sami Mazouz
c7791b63f7 perf: Allow loading relations in other discussion endpoints (#3191) 2021-12-13 11:34:26 +01:00
flarum-bot
dc48e2327b Bundled output for commit 6b7dfaa598
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-13 07:03:23 +00:00
Alexander Skvortsov
4ade45e67a Don't lazy draw permissions dropdown
It is already lazy drawn, see 23a70affa6/js/src/admin/components/PermissionDropdown.js (L63-L63)
2021-12-13 02:00:06 -05:00
Alexander Skvortsov
46893a9749 PermissionGrid fixes
Fixes https://github.com/flarum/core/issues/3169#issuecomment-979470794

- Restore wrapping `scope.render` results in a table cell tag. This was accidentially introduced in 924815b6e1, and caused the issue linked above
- Rename the `SettingDropdown` attr `key` to `setting` in order to avoid naming clashes with Mithril vnode keys. `key` still works, but is deprecated.
2021-12-13 02:00:06 -05:00
Alexander Skvortsov
6b7dfaa598 Format 2021-12-13 01:58:47 -05:00
Alexander Skvortsov
d0c160923d Fix listItems to unbrick admin extension pages
https://github.com/flarum/core/pull/3176 accidentially stopped adding a `key` attribute to wrappers of non-vnode inputs. This resulted in "all or no vnodes must have keys" errors.
2021-12-13 01:34:05 -05:00
flarum-bot
c2ec848744 Bundled output for commit 187b5c6f0b
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-13 01:41:29 +00:00
Alexander Skvortsov
187b5c6f0b Merge pull request #3174 from flarum/as/models-typing
Typescript for models
2021-12-12 20:37:32 -05:00
Ian Morland
bd8ebb00a0 feat: Allow switching the ImageManager driver (#3195) 2021-12-12 22:34:10 +01:00
Alexander Skvortsov
f26ad3e32d Minor typefixes, fomat 2021-12-12 15:46:46 -05:00
Alexander Skvortsov
4759395186 Post's discussion should always be present 2021-12-12 15:39:45 -05:00
Alexander Skvortsov
a2c8407dd4 params arguments for id-based app.store.find should be optional 2021-12-12 15:39:28 -05:00
Alexander Skvortsov
306b3a9e8b Type-safe session instantiation 2021-12-12 15:39:06 -05:00
Alexander Skvortsov
4444e7c788 Rename Discussion, User files to allow jsx 2021-12-12 15:18:37 -05:00
Alexander Skvortsov
4bd5bc87ee Update js/src/common/models/User.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-12-12 15:18:37 -05:00
Alexander Skvortsov
528c964d94 Update js/src/common/models/User.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-12-12 15:18:36 -05:00
Alexander Skvortsov
3bca30121b Update js/src/common/models/Discussion.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-12-12 15:18:36 -05:00
Alexander Skvortsov
53180a38ac Update js/src/common/Store.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-12-12 15:18:36 -05:00
Alexander Skvortsov
d82073c3a9 Update js/src/common/Model.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-12-12 15:18:36 -05:00
Alexander Skvortsov
44efff342d Update js/src/common/Model.ts
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-12-12 15:18:36 -05:00
Alexander Skvortsov
0bdb018ad4 Add meta to ApiPayload interfaces 2021-12-12 15:18:35 -05:00
Alexander Skvortsov
b0504597da Review changes, make Model.store non-nullable, include meta in APIPayload signatures 2021-12-12 15:18:35 -05:00
Alexander Skvortsov
b85aa403cc Remove unnecessary nonnull assertions 2021-12-12 15:18:35 -05:00
Alexander Skvortsov
ab2620147a Drop unnecessary JSDocs 2021-12-12 15:18:35 -05:00
Alexander Skvortsov
09a55258a0 format 2021-12-12 15:18:34 -05:00
Alexander Skvortsov
3a8d640dab Clean up model nullability 2021-12-12 15:18:34 -05:00
Alexander Skvortsov
bbc9143404 Convert models to TS 2021-12-12 15:18:34 -05:00
flarum-bot
7be0c02ba1 Bundled output for commit 580be37eb4
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-12 19:55:47 +00:00
Alexander Skvortsov
580be37eb4 listItems typing fix (#3176)
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-12-12 14:51:05 -05:00
Ian Morland
0e00196d8e Make SlugManager available to blade template (#3194)
* Make SlugManager available to blade template

* Use
2021-12-12 20:40:38 +01:00
flarum-bot
a57ef5a3d5 Bundled output for commit 325b9afca6
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-12 19:35:29 +00:00
Ian Morland
325b9afca6 fix: getPlainContent causes external content to be fetched (#3193) 2021-12-12 14:30:56 -05:00
flarum-bot
1a420828aa Bundled output for commit 57b413ada5
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-11 17:37:26 +00:00
Alexander Skvortsov
57b413ada5 Split up application error handling (#3184)
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-12-11 12:32:51 -05:00
flarum-bot
326b787130 Bundled output for commit 0f2824e0f4
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-07 18:55:28 +00:00
Rafał Całka
0f2824e0f4 Make StatusWidget tools extensible (#3189) 2021-12-07 13:50:40 -05:00
Daniël Klabbers
7bab6eddf6 Use revision versioner to allow custom asset versioning (#3183) 2021-12-06 12:49:21 -05:00
flarum-bot
b7a9911ffb Bundled output for commit c219699024
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-06 17:07:57 +00:00
David Wheatley
c219699024 fix: clicking three dots on post opens all dropdowns in .Post-actions (#3185) 2021-12-06 18:03:07 +01:00
Alexander Skvortsov
dcc9868129 Centralize pagination/canonical meta URL generation in Document (#3077)
* Centralize pagination/canonical meta URL generation in Document

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Use translations for title template

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Dont add translator to title driver interface

It's an implementation detail, and can be made available on specific implementations as needed.

Co-authored-by: Alexander Skvortsov <askvortsov1@users.noreply.github.com>
2021-12-03 13:31:50 -05:00
flarum-bot
02f351001c Bundled output for commit 6a909386b2
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-02 16:21:19 +00:00
Ian Morland
6a909386b2 Move colorItems to ItemList (#3186) 2021-12-02 11:16:50 -05:00
flarum-bot
17d25ba4ce Bundled output for commit c7662a320f
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-01 22:10:25 +00:00
Alexander Skvortsov
c7662a320f Fix app.route initialization
The first argument being an object breaks the forum, since a function can work in `Object.assign` if it is the first argument.
2021-12-01 17:05:57 -05:00
flarum-bot
5a9f60d250 Bundled output for commit c522657212
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-01 20:21:28 +00:00
Alexander Skvortsov
c522657212 Improve avatar upload experience (#3181)
Fixes https://github.com/flarum/core/issues/3055

- On the frontend, accept only image types as a hint to the OS file picker.
- On the backend, add more robust validation to ensure only valid images make it through. This isn't necessary for security, but results in less confusing error mesages.
2021-12-01 15:16:45 -05:00
flarum-bot
2b87f10738 Bundled output for commit 29c290e78f
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-12-01 16:32:02 +00:00
Alexander Skvortsov
29c290e78f Convert routes to Typescript (#3177) 2021-12-01 11:27:19 -05:00
flarum-bot
38c3ccd6be Bundled output for commit 71cb8c378f
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-26 22:30:49 +00:00
Alexander Skvortsov
71cb8c378f Add typing files for our translator libraries (#3175) 2021-11-26 17:26:37 -05:00
flarum-bot
94370375a5 Bundled output for commit afbf5f4905
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-23 22:58:48 +00:00
David Wheatley
afbf5f4905 fix: incorrect typings for Modal hide() method (#3180)
* fix: incorrect typings for `hide()`

* fix: swap to arrow calling of hide handler
2021-11-23 22:54:26 +00:00
David Sevilla Martin
aa0b68bc8d Convert some common classes/utils to TS (#2929)
* Convert common/Session

* Update common/states/AlertManagerState

* Convert common/utils/extractText

Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-11-23 17:51:04 -05:00
flarum-bot
1832fb090d Bundled output for commit 94c4f266e3
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-23 21:43:22 +00:00
David Sevilla Martin
94c4f266e3 feat: remove color validation in appearance admin page & add color indicator (#3140)
* Remove color validation in basics admin page & add color indicator

* Create ColorInput common component

* Revert 'formGroupAttrs' addition

* Rename component CSS classes

* Fix input type in ColorInput from AdminPage#buildSettingComponent

* Rename component to ColorPreviewInput, remove aliases in admin & export in compat

* Remove leftovers from rebase on master

* feat: add global type definition for a vnode element tag

* fix(a11y): add aria roles to color input

* chore: use new type

* chore: format

Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-11-23 21:38:46 +00:00
flarum-bot
c96fa49853 Bundled output for commit a203469109
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-23 13:06:36 +00:00
Sami Mazouz
a203469109 fix: Modal typings complicate inheritance (#3178) 2021-11-23 14:02:14 +01:00
David Wheatley
86d23a5de2 chore: use @php in Blade templates (#3172)
* chore: remove comment

* chore: use `@php` in blade templates

* chore: use `@php` in blade templates
2021-11-23 12:55:36 +00:00
David Wheatley
bb817d9a90 fix(a11y): show post action items when focus is within the post (#3173)
* fix: show post action items when focus is within the post

* fix: add missing `&`
2021-11-21 20:25:00 +00:00
flarum-bot
9117747d41 Bundled output for commit eaf1b86785
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-21 19:49:09 +00:00
David Wheatley
eaf1b86785 fix(a11y): add focus traps to modals and nav drawer (#3018)
* Add focus trap util

* Add focus trap to Modals

Fixes #2663

* Split tab press into `onTab` handler

* Remove deprecated code

* Use requestAnimationFrame instead of setTimeout

* Reduce code duplication

* Implement focus trap in nav drawer

Fixes #2665

* Hide drawer when window is resized to be bigger

Fixes issue where focus trap would remain on the drawer when it is
just the app header, if the drawer was opened then the window was
made larger.

* Simplify conditional function calls

* Fix modal focus trap

* Remove debug code

* Simplify resize handler conditional statements

* Add info about reasoning of resize handler

* Prefer native JS methods over jQuery

* Update conditional function call to handle `undefined`

* Expose screen sizes as CSS custom properties

* Use `window.matchMedia` rather than resize handler

* Fix spelling error

Co-authored-by: David Sevilla Martin <me@datitisev.me>

* Remove breaking change

Co-authored-by: David Sevilla Martin <me@datitisev.me>
2021-11-21 19:44:31 +00:00
flarum-bot
b2c83debb3 Bundled output for commit d82ae27231
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-19 17:46:08 +00:00
Sami Mazouz
d82ae27231 fix: Post--by-actor not showing when comparing user instances as discussion.user() is not loaded (#3170) 2021-11-19 18:41:13 +01:00
Alexander Skvortsov
7242b18ff0 Fix test cases for SetSettingsController 2021-11-16 16:54:23 -05:00
Alexander Skvortsov
f53a81bc18 Apply fixes from StyleCI
[ci skip] [skip ci]
2021-11-16 21:50:53 +00:00
Alexander Skvortsov
7c12e2c464 Add integration tests for settings API endpoint 2021-11-16 16:48:09 -05:00
flarum-bot
34e0ab6100 Bundled output for commit 390caa51db
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-16 20:55:56 +00:00
Alexander Skvortsov
390caa51db Fix minor typing error on UserListPage 2021-11-16 15:50:54 -05:00
Alexander Skvortsov
924815b6e1 Extension permission typings, fix glitch with extension permissions grid 2021-11-16 15:49:42 -05:00
Alexander Skvortsov
9b639e09f2 Fix errors on 20X responses with no body
`''` is not json-parsable, so  in that case we return null. This was the behavior prior to bac0e594ee
2021-11-16 13:34:28 -05:00
Daniël Klabbers
09fdd4cb6d fix: allow queue restarting (#3166)
By injecting the cache store into the queue, we allow queues to be
restarted using php flarum queue:restart and similar events dispatched
from within Laravelish classes.
2021-11-16 10:46:31 -05:00
flarum-bot
b4a44f70d9 Bundled output for commit c120f28d42
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-16 14:09:23 +00:00
Ian Morland
c120f28d42 Add priority order to discussion controls (#3165) 2021-11-16 15:04:54 +01:00
Garrett Grimm
5993c647a5 fix: enforce 65k character limit for setting values (#3162)
* Enforce 65k limit when attempting to store setting values.

* Add space for style.

* Move setting validation into Saving event listener.

* Use consistent var names

* remove extra space

* Move settings validation into separate class.

* Remove unused class.

* Remove extra line.

* Move ValidateCustomLess to SettingsServiceProvider.  Use existing convention for validator.

* Update src/Settings/SettingsValidator.php

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>

* Revert moving of ValidateCustomLess logic.  Allow for attribute specific setting validation rules.

* Style fixes.

* Style fixes.

* Style fixes.

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2021-11-12 18:43:57 +00:00
flarum-bot
359e9f6cbb Bundled output for commit d72b8b8d8e
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-12 00:58:35 +00:00
Alexander Skvortsov
d72b8b8d8e Fix some typing errors 2021-11-11 19:53:44 -05:00
flarum-bot
312ff057f8 Bundled output for commit 9b9ca53b81
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-11 20:59:55 +00:00
Garrett Grimm
9b9ca53b81 Add 'Close' & 'Back' aria-label attributes to buttons. (#3161)
* Add aria-label attributes to close buttons in nav, welcome hero, modal close.
* Replace title with aria-label in nav back button.
2021-11-11 15:55:46 -05:00
Garrett Grimm
4ffc26a13a Adjust boolean check of is_email_confirmed to suppress extraneous user activation events (#3163) 2021-11-11 15:51:47 -05:00
flarum-bot
5f110f73e7 Bundled output for commit cab2e797eb
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-11 20:05:26 +00:00
David Wheatley
cab2e797eb Rewrite ItemList; update ItemList typings (#3005)
* Improve typings for ItemList

* Add new `.replace()` syntax

* Update JSDoc

* Add missing `T` type

* Fix typo

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>

* Allow choice to not set `itemName` property when calling `toArray`

* Make `ItemList.items` read-only

* Modify `.replace()`; add `.changePriority()`

* Complete rename

* Update JSDoc

* Add `.toObject()` method; deprecate `.items`

* Rewrite `.toArray()` to use Proxy instead of modifying the item content

- Fixes #3030
- Fixes issue where setting `itemName` property could result in errors depending on the object type (e.g. proxies)
- Fixes unneeded duplication of item list
- Add option to disable setting `itemName` property on primitives

* Simplify condition

* Remove debug code

* Make proxying function protected instead of private

* Update a usage of ItemList as an example

* Make `itemName` property read-only

* Use correct capitalisation of `object`

* Invert `toArray` parameter function

* Simplify isEmpty check

* Update ItemList.ts

* Fix `merge()`

* Remove extra JSDoc comment

* Use `._items` directly for merging

* Rename methods: `replace` -> `set`; `changePriority` -> `setPriority`

This more closely matches our existing method names (`get()`)

* Change `items` getter

* Simplify proxying

* Update URL to source function

* Update compat

* Various changes to toObject

* Remove `Item.key`

* Make item content proxy method private

* Enforce merge typings

* Update TSDoc comments to use `{@link}` for references to methods

* Correct references to deprecated `.replace` method

* Throw error when setting content/priority of non-existent items

* Remove intermediary variable

* Update TSDoc block

* Update js/src/@types/global.d.ts

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2021-11-11 20:01:10 +00:00
flarum-bot
ec5214f714 Bundled output for commit bac0e594ee
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-11 19:21:56 +00:00
Alexander Skvortsov
bac0e594ee Add typechecks, typescript coverage GH action, fix many type errors (#3136) 2021-11-11 14:17:22 -05:00
David Wheatley
563d40d7da chore: migrate fully to Yarn (#3155)
* chore: migrate to Yarn package manager

* chore: bump deps, move `expose-loader` to correct deps section

* fix: remove package from old typescript shim

* feat: use Yarn Plug'n'Play

* chore: keep `node_modules` ignored for people who choose to use npm anyway

* Revert "feat: use Yarn Plug'n'Play"

This reverts commit 9781c8c8d5.
2021-11-10 20:10:25 +00:00
Daniel Klabbers
bfd81a83cf fix(logs): assign INFO scope to correct argument
Argument for INFO (constant value 200) was assigned to
maxfiles argument incorrectly.
2021-11-09 14:48:53 +01:00
flarum-bot
833c7540a3 Bundled output for commit ad2cef70d2
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-09 03:35:53 +00:00
David Wheatley
ad2cef70d2 chore: better typings for DiscussionListState (#3132) 2021-11-08 22:33:52 -05:00
flarum-bot
541684ee2a Bundled output for commit ec730d2615
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-08 23:55:13 +00:00
David Wheatley
ec730d2615 feat: allow use of any tag in listItems helper (#3147)
* feat: allow use of any tag in `listItems` helper

* fix: fix missing optional chaining

* chore: use more optional chaining

* fix: various typings errors

* chore: replace `Vnode[]` with `Children`
2021-11-08 23:52:47 +00:00
Sami Mazouz
f9f398b532 feat: Use an extensible document title driver implementation (#3109)
* feat: Use an extensible document title driver implementation
* chore: Add todo to use DI in 2.0
2021-11-08 23:15:32 +01:00
flarum-bot
4c61687833 Bundled output for commit b90001d98c
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-08 21:54:19 +00:00
David Sevilla Martin
b90001d98c Convert extend util to TypeScript (#2928)
* Allow using file extension in core compat imports

Necessary for extend imports to have proper typings as we also have an unrelated extend/index.js file

* Add .ts file extension to extend imports for typings

* Fix changes to proxifyCompat regex breaking non-core import paths

* Move utility types to global types

Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-11-08 16:52:13 -05:00
flarum-bot
6aad961545 Bundled output for commit e797276606
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-08 21:35:22 +00:00
Alexander Skvortsov
e797276606 Use calculated offset when loading page in PaginatedListState (#3159) 2021-11-08 16:33:07 -05:00
flarum-bot
8e52ec373e Bundled output for commit 0957cca9e2
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-08 18:42:22 +00:00
Garrett Grimm
0957cca9e2 Add aria-label attribute to navigation drawer button. (#3157)
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-11-08 13:40:17 -05:00
flarum-bot
2daee924c5 Bundled output for commit 8c47b197f0
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-04 21:40:48 +00:00
David Wheatley
8c47b197f0 fix: Component.component argument typings (#3148) 2021-11-04 21:38:50 +00:00
Sami Mazouz
809df29d29 feat: Declare & Use CSS Custom Properties (#3146) 2021-11-04 22:34:18 +01:00
flarum-bot
26bf5d350b Bundled output for commit 6eb05cfbad
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-03 23:23:42 +00:00
David Wheatley
6eb05cfbad chore: replace for ... in with Array.reduce (#3149) 2021-11-03 23:21:47 +00:00
Clark Winkelmann
8a69c890e7 Fix post policy for PHP 8 (#3145)
* Add tests to verify post policy works as intended
* Fix "reply" post edit setting not working on PHP 8

Fixes #3144
2021-11-01 16:38:21 -04:00
flarum-bot
9e1b05a358 Bundled output for commit 497dccee56
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-11-01 15:18:09 +00:00
David Sevilla Martin
497dccee56 Pass null/falsy values through Model.getIdentifier (#3131)
* Pass null/falsy values through Model.getIdentifier

* Add explicit if-return
2021-11-01 11:16:01 -04:00
Sami Mazouz
d8e7aa54b4 feat: Allow registering settings as Less config vars through Settings Extender (#3011)
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2021-11-01 15:41:19 +01:00
Sami Mazouz
2b163025d6 feat: Create loadWhere relations extender (#3116) 2021-11-01 10:45:02 +01:00
flarum-bot
7b80d3932d Bundled output for commit c44cf42e2c
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-31 20:20:31 +00:00
Dan Wallis
c44cf42e2c Deprecate unused evented utility (#3125) 2021-10-31 16:18:44 -04:00
Sami Mazouz
fcf23ee8d5 feat: Default Settings Extender (#3127)
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2021-10-31 21:09:06 +01:00
flarum-bot
7b2adf3b96 Bundled output for commit cb6405110c
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-31 18:23:34 +00:00
Alexander Skvortsov
cb6405110c Support, update to webpack 5 (#3135) 2021-10-31 14:21:17 -04:00
flarum-bot
89dfad5f38 Bundled output for commit 1e595e752a
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-30 23:18:37 +00:00
David Sevilla Martin
1e595e752a Add textarea setting type to AdminPage#buildSettingComponent (#3141) 2021-10-30 19:16:21 -04:00
flarum-bot
a6f660236f Bundled output for commit f260bd7efe
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-30 23:15:48 +00:00
David Sevilla Martin
f260bd7efe Switch to constructor MIN_SEARCH_LENGTH in Search component (#3130) 2021-10-30 19:13:43 -04:00
flarum-bot
823c337c1e Bundled output for commit f8232b9c1b
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-30 22:46:26 +00:00
David Wheatley
f8232b9c1b chore: rewrite frontend application files to Typescript (#3006)
* Rename files

* Rewrite common Application to TS

* Improve DefaultResolver typings

* Convert mapRoutes to TS

* Fix incorrect JSDoc type

* Add missing default value

* Add debug button string to localisations

* WIP Forum application TS rewrite

* Use union and intersection to remove property duplication

* Address some review comments

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>

* Address some review comments

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>

* Fix build error

* Address some review comments

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>

* Add `type` import qualifier

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2021-10-30 23:44:27 +01:00
flarum-bot
45927f1068 Bundled output for commit 7db2d0f697
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-30 22:31:34 +00:00
David Wheatley
7db2d0f697 chore: rewrite ModalManager and state to Typescript (#3007)
* Rewrite ModalManagerState into Typescript

- Fixes `attrs` parameter being marked as required
- Add `isModalOpen` method

* Rewrite ModalManager into Typescript

* Fix incorrect type

* Continue modal rewrite

* Update attr typings

* Fix correctly cast `this.constructor` calls

* Cast to bool

* Don't extend ModalAttrs by Record

* Prevent missing abstract methods in child Modals from bricking frontend

* Add missing `app` import

* Address review comment

Co-authored-by: David Sevilla Martin <6401250+datitisev@users.noreply.github.com>

Co-authored-by: David Sevilla Martin <6401250+datitisev@users.noreply.github.com>
2021-10-31 00:29:10 +02:00
David Wheatley
a0a06973c0 chore: rewrite SubtreeRetainer into Typescript (#3137)
* chore: rewrite SubtreeRetainer in Typescript

* chore: mark attributes as protected
2021-10-31 00:28:30 +02:00
flarum-bot
6ba385eea6 Bundled output for commit 70588959eb
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-29 22:39:58 +00:00
David Sevilla Martin
70588959eb fix: remove 'typeof' in 'typeof this' from AdminPage#buildSettingComponent params (#3142) 2021-10-30 00:37:41 +02:00
flarum-bot
8c3d92c427 Bundled output for commit acf16fdf2e
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-29 18:33:41 +00:00
Sami Mazouz
acf16fdf2e chore: Minor Readme CSS code tidy up (#3138) 2021-10-29 19:31:15 +01:00
David Wheatley
a1b5ef5154 fix: issue with CSS styles when in-between whole pixel values for viewport width (#3139)
* fix: issue with CSS styles when in-between whole pixel values for viewport width

Fixes #2915

* chore: add explanatory comment

* fix: add missing slash
2021-10-29 18:57:53 +01:00
flarum-bot
02c2df681d Bundled output for commit 2000727e94
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-29 17:35:09 +00:00
Alexander Skvortsov
2000727e94 Better post loading support (#3100)
Needed for https://github.com/flarum/core/issues/3043.

Some posts are loaded dynamically, and won't be immediately available. In this case, we show a loading indicator instead of displaying content. In this PR:

- We redraw post content if loading state has chnaged
- We show a loading indicator while loading
2021-10-29 13:32:30 -04:00
flarum-bot
33841d1e25 Bundled output for commit 28ead83b04
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-28 01:59:00 +00:00
Ian Morland
28ead83b04 Add README documentation to ExtensionPage (#3094)
Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
2021-10-27 21:56:56 -04:00
flarum-bot
247ace2f04 Bundled output for commit e0b6190733
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-27 21:01:48 +00:00
David Wheatley
e0b6190733 [A11Y] Improve accessibility for discussion reply count on post stream (#3090)
* Add class to remove all UA styles from a button

* Improve classList utilisation

* Simplify JSX

* Use classlist instead of concatenation

* Fix reply count focusable when not acting as a button

* Add SR only class

* Add new reply count translations

* Use cleaner translations

* Remove unused import

* Add missing new line

* Delete Accessibility.less

* Use existing `.visually-hidden` class

* Format

* Fix locale formatting
2021-10-27 22:59:17 +02:00
flarum-bot
f66a7ef7cc Bundled output for commit e550b15cea
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-27 20:44:05 +00:00
Alexander Skvortsov
e550b15cea Bump ICU MessageFormat (#3122)
This uses `Intl.PluralRules` for plural rules, and fixes a security vulnerability allowing JS injection through translation arguments.
2021-10-27 16:41:49 -04:00
flarum-bot
db6c8b8774 Bundled output for commit 4982efed3a
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-27 20:17:11 +00:00
David Wheatley
4982efed3a chore: bump JS dependencies (#3134) 2021-10-27 16:14:26 -04:00
David Wheatley
57d91b2d87 Revert "chore: better typings for DiscussionListState"
This reverts commit e9b3d3d313.
2021-10-27 17:17:24 +02:00
David Wheatley
e9b3d3d313 chore: better typings for DiscussionListState 2021-10-27 17:17:01 +02:00
Alexander Skvortsov
6200ffef9b Hide webkit search button (#3128) 2021-10-27 09:28:40 -04:00
flarum-bot
5e84490fd0 Bundled output for commit 2b0d55632e
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-26 21:35:14 +00:00
Alexander Skvortsov
2b0d55632e ExtensionPage: rename "Uninstall" to "Purge" (#3123)
https://i.imgur.com/aOOkqhk.png
2021-10-26 17:32:39 -04:00
Alexander Skvortsov
f7a78d85e3 Pass IP address to API Client pipeline (#3124)
The `ProcessIp` middleware won't run twice as that's in the global middleware stack, which the API client doesn't go through.
2021-10-26 17:11:40 -04:00
Sami Mazouz
972411673f fix: Use laravel validator to replace avatar validation error params (#2946) 2021-10-26 14:45:27 +01:00
flarum-bot
7ebf535b25 Bundled output for commit a661376d16
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-25 21:37:01 +00:00
Alexander Skvortsov
a661376d16 Catch errors when uploading white avatar (#3119) 2021-10-25 17:34:39 -04:00
MatusMak
5a1bf08d3f #2492 - Groups filtering & retrieve single endpoint (#3084)
Fixes #2492

* Added api/groups/{id} endpoint for retrieving a single group by its id
* Fixed GroupRepository incorrectly opening query to User instead of Group model
* Added filtering & paging abilities to GET api/groups endpoint
* Added test for sorting for GET api/groups endpoint

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2021-10-25 11:48:25 -04:00
flarum-bot
a9b1a518a2 Bundled output for commit 9416b1c150
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-25 05:47:17 +00:00
Clark Winkelmann
9416b1c150 Fix mail settings select component never being used (#3120) 2021-10-25 01:44:46 -04:00
Alexander Skvortsov
87f67744a8 Throw error if required route params missing (#3118)
Co-authored-by: Daniël Klabbers <daniel@klabbers.email>
Co-authored-by: luceos <luceos@users.noreply.github.com>
Co-authored-by: David Wheatley <hi@davwheat.dev>
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
2021-10-23 14:05:47 -04:00
SychO9
4add23a984 chore: Update version constant to 1.2.0-dev 2021-10-18 21:04:07 +01:00
flarum-bot
c52c0987fb Bundled output for commit 60f0ef0bd5
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-14 18:33:00 +00:00
Alexander Skvortsov
60f0ef0bd5 Handle post rendering errors to avoid bricking (#3061)
Whether it's due to corrupted content, missing tags, caching issues, or other assorted reasons, post content can't be rendered. Currently, this results in an exception that crashes the entire forum and is hard to debug. Instead, we should log the error and show an indicator message that rendering has failed.

Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-10-14 14:30:18 -04:00
flarum-bot
82d67919bb Bundled output for commit 713d95eb36
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-14 13:43:57 +00:00
Sami Mazouz
713d95eb36 fix: import app from common app instead (#3104)
Introduced in #3099
2021-10-14 14:41:22 +01:00
flarum-bot
d053bb5496 Bundled output for commit 05121b928a
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-13 18:58:05 +00:00
David Sevilla Martin
05121b928a Lazy draw dropdowns to improve performance (#2925) 2021-10-13 14:55:32 -04:00
Fransiscus Rolanda Malau
0a7e885eab Add missing autocomplete attributes to input fields (#3088)
* Add missing autocomplete attributes to input fields
* Add autocomplete attributes to password fields
* Attribute should use new-password
2021-10-13 14:53:35 -04:00
Maarten Bicknese
a65488000c Disallow dashes in database prefix (#3089)
As a temporary fix it has been requested to disallow dashes in the database prefix. The installation process fails when the prefix does include a dash.

#3022
2021-10-13 14:52:53 -04:00
Wouter
4146a4c578 Added new translations for the user editing modal (#3093) 2021-10-13 14:52:17 -04:00
flarum-bot
3f2e25b35f Bundled output for commit 2a86c25297
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-13 18:51:06 +00:00
Braunson Yager
2a86c25297 Added ES6 local support for formatNumber helper as per #2951 (#3099) 2021-10-13 14:48:37 -04:00
Sergiy Petrov
919c543cbc Test against php 8.1 (#3102) 2021-10-13 14:48:03 -04:00
Alexander Skvortsov
99112429f9 Release v1.1.0 2021-10-11 21:19:05 -04:00
Daniël Klabbers
b4772e5399 [huntr] adding cache control headers to the admin area (#3097)
This PR forces the `Cache-Control: no-store, max-age=0` header to the response in the Admin Area. This forces cache to be ignored upon browsing back and forth between pages using the browser controls. Although absolutely no fail safe, it should provide better protection against serving cached pages once an admin has signed out.
2021-10-07 18:34:22 -04:00
flarum-bot
2b47e90827 Bundled output for commit 1c2465b2da
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-10-07 03:33:54 +00:00
Alexander Skvortsov
1c2465b2da Support filter params in discussion list state
https://github.com/flarum/core/pull/3068 accidentially broke the user discussions page, as up until this commit, `DiscussionListState`didn't accept any filter params.
2021-10-06 23:30:32 -04:00
Alexander Skvortsov
a6717ee981 Remove .html on all docs urls
Now that Flarum docs have been moved to docusaurus, URLs no longer end with `.html`.

Closes https://github.com/flarum/core/issues/3092
2021-10-05 10:13:19 -04:00
flarum-bot
450ab61620 Bundled output for commit e2f01c040b
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-09-29 15:32:51 +00:00
Sami Mazouz
e2f01c040b fix: Anchors should not have type="button" (#3086) 2021-09-29 11:30:31 -04:00
Sami Mazouz
1d15cff9ca Filter composer icon array to only valid values (#3080) 2021-09-25 18:35:27 +01:00
David Wheatley
88724bb4cb performance(frontend): Preload FontAwesome, JS and CSS (#3057)
* Add preloads support to Document class

* Add frontend extender for asset preloading

* Provide default preloads for FontAwesome

* Add tests for preload extender and default preloads

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Fix typo

* Fix two more typos 🙃

* Preload core JS and CSS

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Reorder preloads

* Remove singular preloads method

* Use filesystem disk driver for getting FA font paths

* Update test to use full URL

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Address review comment

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Fix typo

* Apply fixes from StyleCI

[ci skip] [skip ci]

* Correct callback wrapping

* Update src/Extend/Frontend.php

Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>

* Update src/Extend/Frontend.php

Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>

* Update src/Extend/Frontend.php

* Fix preload extender logic

* Convert base FontAwesome preloads into a Singleton

* Apply fixes from StyleCI

[ci skip] [skip ci]

Co-authored-by: luceos <luceos@users.noreply.github.com>
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
2021-09-20 23:12:09 +01:00
Alexander Skvortsov
1637b90531 Add determinsm to extension order resolution (#3076)
By sorting alphabetically by extension ID before applying topological sort, we ensure that a given set of extensions will always be booted in the same order. This will make it easier to replicate issues caused by complex extension dependencies.
2021-09-20 11:40:00 -04:00
flarum-bot
245d0d2550 Bundled output for commit 5dd48e1b86
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-09-20 15:08:49 +00:00
David Wheatley
5dd48e1b86 [A11Y] Accessibility improvements for the Search component (#3017)
* Remove deprecated code

* Accessibility improvements for Search component
2021-09-20 16:06:15 +01:00
Sami Mazouz
c1a8c6c190 fix: Sanitise integer query parameters (#3064) 2021-09-17 20:50:11 +01:00
David Wheatley
c10a30bae9 [A11Y] Adds missing focus rings back to control elements (#3016)
* Remove the stuff that removes critical accessibility features

* Remove no outline from basic blade layout

* Remove focus outline from FormControls
2021-09-13 23:47:13 +01:00
flarum-bot
b0bc021034 Bundled output for commit 1b193196da
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-09-11 08:26:35 +00:00
Rafael Horvat
1b193196da Use author filter parameter instead of q with gambit to get a user's discussions on the DiscussionsUserPage (#3068) 2021-09-11 09:24:15 +01:00
Sami Mazouz
f56fc11af9 [1.x] Theme Extender to Allow overriding LESS files (#3008)
This PR introduces the ability to just override a LESS file's contents through an extender.
This is mainly useful for theme development, as there are times in extensively customized themes where overriding the actual file makes a huge difference vs overriding CSS styles which can turn into a maintenance hell real fast.

Overriding styles is more tedious than overriding files. When you're designing an element, you would normally rather start from a blank canvas, than a styled element. With an already styled element you have to first override and undo the styles you do not wish to have, only then can you start shaping it, but even then you'd always end up constantly undoing default styles. This mostly applies for more advanced themes. (example: 851c55516d/less/forum/DiscussionList.less)
2021-09-10 13:45:18 -04:00
flarum-bot
ebdc232b11 Bundled output for commit eb0dd1f0d0
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-09-06 00:46:37 +00:00
David Sevilla Martín
eb0dd1f0d0 Add extra error handling for avatar file size & large payload (#3042)
* Add extra error handling for avatar file size & large payload

* Change error message to return 'upload failure' on most errors instead of 'no file' message
2021-09-05 20:43:59 -04:00
Sami Mazouz
1aa61f1f01 fix: Unable to use permission grid dropdowns due to z-index mistake (#3065)
The one I had suggested here: https://github.com/flarum/core/pull/2887#pullrequestreview-690047538
2021-09-05 18:29:18 +01:00
Sami Mazouz
e8153ccc79 feat: NoJs Admin View (#3059)
Adds a nojs blade template to be able to enable/disable extensions when one of them misbehaves.
2021-08-31 09:08:27 +01:00
Alexander Skvortsov
55d8af44a2 Move SECURITY.md file to central org repo 2021-08-30 15:43:52 -04:00
Alexander Skvortsov
4de5ad94f0 Use central FUNDING file 2021-08-30 15:42:07 -04:00
Alexander Skvortsov
735583397c Move PR template to central repo 2021-08-30 15:41:18 -04:00
Alexander Skvortsov
da94488f7b Update lastSeenAt when authenticating via API (#3058)
Fixes https://github.com/flarum/core/issues/3025, title says it all.
2021-08-27 14:02:03 -04:00
Ian Morland
581d9517db Pass filter params to getApiDocument (#3037)
* Pass filter params to getApiDocument

* Set filters directly
2021-08-26 10:47:34 +01:00
flarum-bot
3db724e0b3 Bundled output for commit 71073b064a
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-26 09:35:55 +00:00
Rafael Horvat
71073b064a Allow adding page parameters to PaginatedListState, like limit. (#2935) 2021-08-26 10:33:22 +01:00
flarum-bot
d82c093c0f Bundled output for commit c2a0cf8d04
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-25 17:35:41 +00:00
Sami Mazouz
c2a0cf8d04 fix: Extension admin page erroring out (#3054)
Extension admin pages are currently not working because of a JS error.
The settings record is never defined but directly used, it used to be defined as an empty object in oninit.
2021-08-25 13:33:19 -04:00
SychO9
1b77df12b6 Merge remote-tracking branch 'upstream/1.0.5' 2021-08-25 17:00:45 +01:00
Sami Mazouz
d333d0b0e6 perf: Allow eager loading posts relations of GET discussion endpoint (#3048) 2021-08-23 20:33:21 +01:00
flarum-bot
6defca5a6d Bundled output for commit 0a2b28ebe0
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-23 01:02:28 +00:00
David Wheatley
0a2b28ebe0 Rewrite AdminPage abstract component into Typescript (#2996)
* Rewrite AdminPage.js into Typescript

* Export more interfaces and types

* Use Stream type

* Update js/src/admin/components/AdminPage.tsx

Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>

* Move `HTMLInputTypes` type to global declarations

* Add missing app import

* Export options interface

* Remove unused method

* Add random element ID generator

* Add attrs for Page component

Full rewrite needed later

* Provide correct attrs

* Add missing a11y attributes for help text and labels

* Update TSDoc comment

* Allow Children to be passed for label/help text

* Extract setting types to arrays

* Make Page class abstract; fix incorrect Component generic call

* Mark AdminPage as abstract

* Mark `content` as abstract

* Revert "Move `HTMLInputTypes` type to global declarations"

This reverts commit c900cb3f6d.

* Restore TSDoc on HTMLInputTypes type

* Fix typo

Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
2021-08-23 01:59:50 +01:00
flarum-bot
6c64837247 Bundled output for commit 66aaa862fd
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-22 22:48:43 +00:00
David Wheatley
66aaa862fd fix: reference to undefined variable discussion 2021-08-22 23:46:34 +01:00
flarum-bot
1ab35d89ac Bundled output for commit 3cf19dd2ea
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-22 19:40:36 +00:00
David Wheatley
3cf19dd2ea Rewrite Button to Typescript (#2984)
* Rename Button file

* Convert to TS

* Add debug warning helper

Fires `console.warn`, but only when the forum is in debug mode. Can help to inform extension developers of possible issues with their JS code.

* Simplify button content template

* Rewrite Button component

- Prefer `aria-label` over `title`
- Don't duplicate button content to `title` attribute
- Warn in debug mode if button has no accessible content
- Use modern JS/TS syntax (`||=`, spread, etc)

* Update to work with new Button component

* Update warning

Co-authored-by: Matt Kilgore <tankerkiller125@gmail.com>

* Fire warning in `oncreate`

* Format

* Make Button have extensible Attributes type via generics

* Update args type

* Update js/src/common/components/Button.tsx

Co-authored-by: Matt Kilgore <tankerkiller125@gmail.com>
Co-authored-by: David Sevilla Martin <me@datitisev.me>
Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
2021-08-22 20:38:01 +01:00
flarum-bot
01082a44ea Bundled output for commit aba6836bdd
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-21 22:36:48 +00:00
Clark Winkelmann
aba6836bdd Replace username with display name in more places (#3040)
* Replace username with display name in more places

* More readable spread operator and translator user magic
2021-08-21 23:34:34 +01:00
Sami Mazouz
af89b23f67 CSS Code Housekeeping (#3026)
* refactor: Avatar classes refactor
* refactor: Badge classes refactor
* chore: Remove commented dead code
* chore: Remove SignUpModal dead CSS code
Flarum seem to have had some kind of user display in the sign up modal 
on successful sign up, which no longer exists.

https://github.com/flarum/core/blob/v0.1.0-beta/js/forum/src/components/SignUpModal.js#L111
* chore: Deprecate unneeded vendor mixins
* chore: Normalize property values format
Co-authored-by: David Wheatley <hi@davwheat.dev>
* chore: Remove @-webkit-keyframes
* chore: Combine animation properties
* chore: Avoid `all` for transition
* chore: translate3d is no longer necessary for hardware acceleration
* fix: Lost cursor pointer to normalize update
* chore: Use CSS variables for more things
* chore: Remove unecessary overspecification
Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-08-21 19:34:07 +01:00
Sami Mazouz
b5620e0549 Throw a validation error on ico favicons. (#2949) 2021-08-21 16:14:33 +01:00
David Sevilla Martín
57eb621885 Move email confirmation to POST request (#3038)
* Add blade view to confirm email flow, move actual confirmation to POST request

* Apply fixes from StyleCI

[ci skip] [skip ci]

Co-authored-by: datitisev <datitisev@users.noreply.github.com>
2021-08-21 16:13:57 +01:00
flarum-bot
c2ec36b2e2 Bundled output for commit 656cc35a0d
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-21 07:56:13 +00:00
David Wheatley
656cc35a0d Use ItemList for DiscussionPage content (#3004)
* Use ItemList for DiscussionPage content

* Don't import Mithril
2021-08-21 09:53:56 +02:00
flarum-bot
b8754c7d7d Bundled output for commit 7f2e6543ed
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-19 09:17:15 +00:00
David Wheatley
7f2e6543ed Add typings for class component state attribute (#2995)
* Add `state` typings to class components
2021-08-19 10:14:50 +01:00
flarum-bot
cc29cf3e10 Bundled output for commit 2831ce226c
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-19 09:13:22 +00:00
David Wheatley
2831ce226c Fix global typings for extensions (#2992)
* Fix global typings for extensions

* Deprecate global `app` typings

See https://github.com/flarum/core/issues/2857#issuecomment-889841326

* Add `app` export for common namespace

* Add missing `app` imports within core

* Add missing `app` imports to JS files

* Fix incorrect import

* Fix admin file importing forum `app`

* Add `flarum` global variable

* Format

* Update JSDoc comment

* Update JSDoc comment

Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>

* Fix frontend JS error

* Empty commit

Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
2021-08-19 10:10:40 +01:00
David Wheatley
8fe2332f98 Remove format hook on commit; update CI to only build with valid formatting (#3032)
* Remove format hook on commit

We all hate it. Let's remove it.
2021-08-19 01:53:39 +01:00
flarum-bot
e05ccf9f62 Bundled output for commit 83529e23de
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-16 09:57:55 +00:00
David Wheatley
83529e23de [A11Y] Make checkboxes focusable (#3014)
* Add extra feature to a11y focusring mixin

* Add visually hidden CSS class and mixin

* Visually hide checkboxes (keep in focus/a11y tree)

* Place checkbox focus ring around display element

* Improve mobile checkbox/switch accessibility
2021-08-16 11:56:10 +02:00
flarum-bot
51ce89b61f Bundled output for commit ef20e29b20
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-16 09:19:44 +00:00
Sami Mazouz
ef20e29b20 [1.x] Custom Colorising with CSS Custom Properties (#3001)
* Start of conversion to CSS variables
* Use variable for Badge colors
* Use variable for avatar bg
* Use variable for user card bg
* Use css variables for hero
* Use css variables for buttons
* Use css variables for sidenav links
* Cleaner style attr

Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-08-16 10:17:48 +01:00
flarum-bot
5798c4b355 Bundled output for commit afc1a1bbbe
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-15 18:56:32 +00:00
David Wheatley
afc1a1bbbe [A11Y] Explicitly state aria-hidden value; hide icons from screenreaders (#3027)
* Set explicit `aria-hidden` value
* Hide icons from screen-readers
2021-08-15 20:54:50 +02:00
Sami Mazouz
cbf4b9c0b4 Fix NotificationGrid Design (#3028)
Updating normalizer messed with it
https://github.com/flarum/core/pull/3015/files
2021-08-15 19:08:05 +01:00
David Wheatley
b88b530c7e Adds missing defaults for display name driver and User slug driver (#2971) 2021-08-15 16:38:43 +01:00
flarum-bot
c8b514106a Bundled output for commit 634dfc69f3
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-14 23:22:33 +00:00
Ornanovitch
634dfc69f3 Permission Grid: stick the headers to handle a lot of tags (#2887)
* sticky thead th & tbody th, adapt PermissionPage and PermissionGrid layout

* adjust height size

* cleanup

* cleanup with some SychO9's recommendation

* remove the `thead th` `first-child` "protection"
2021-08-15 00:21:08 +01:00
flarum-bot
2a83022727 Bundled output for commit b32496d30c
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-13 22:24:28 +00:00
Hasan Özbey
b32496d30c don't show excerpt if there are no plain content (#2964)
for https://github.com/flarum/core/issues/2942
2021-08-13 23:22:56 +01:00
David Wheatley
d8c112088d Update Normalize.css 2021-08-12 17:46:08 +02:00
Pierre Schmitz
f1ba5e7b70 Limit height of code blocks (#3012)
* Limit height of code blocks

Users often post lengthy code or configuration listings which makes following the actual discussion difficult. Therefore we limit a code block by half a screen while still being able to scroll through the code listing itself.

* Define a minimal code block height for small screens

* Add max-height compatibility for browsers that don't support `max()`

See https://caniuse.com/css-math-functions

* Less has a built-in `max` function, so we need to escape this value

Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-08-11 20:28:02 +01:00
flarum-bot
2dd9e17568 Bundled output for commit 13d302b650
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-08-10 13:54:32 +00:00
Ornanovitch
13d302b650 make user.editGroups depending on viewHiddenGroups (#2880)
should resolve #2610
2021-08-10 14:52:34 +01:00
luceos
9490b3dc32 Apply fixes from StyleCI
[ci skip] [skip ci]
2021-07-31 12:34:23 +02:00
Daniel Klabbers
a26f279e0f use construct binding for ioc dependencies 2021-07-31 12:34:23 +02:00
luceos
ef3d4ca018 Apply fixes from StyleCI
[ci skip] [skip ci]
2021-07-31 12:34:23 +02:00
Daniel Klabbers
c449ea211a added mysql version, queue and mail driver 2021-07-31 12:34:23 +02:00
David Wheatley
ce824b0ccf Use organization Prettier config (#2967)
* Use organization Prettier config

* Bump version to 1.0.0

* Update workflow

* Use npm ci and package.json script
2021-07-30 12:18:20 +01:00
flarum-bot
34803f4b43 Bundled output for commit 81e6b17f83
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-07-26 11:04:48 +00:00
SychO9
81e6b17f83 npm run format 2021-07-26 13:03:09 +02:00
David Wheatley
f949b0a28e Remove class from text input 2021-07-26 13:03:09 +02:00
David Wheatley
66064ca9be Remove class from Mail Select setting component 2021-07-26 13:03:09 +02:00
David Wheatley
f9fc78a10d Prevent class attrs overriding default Select classes 2021-07-26 13:03:09 +02:00
David
e195ca27a8 Fix Select-based setting breaking admin pages 2021-07-26 13:03:09 +02:00
Daniël Klabbers
61624d1533 Update composer.json 2021-07-26 13:02:33 +02:00
Sami Mazouz
d31690e7f5 Avoid intervention/image 2.6.0 2021-07-26 13:02:33 +02:00
Sami Mazouz
2bed1d8038 Revert "Avoid using intervention/image 2.6.0"
This reverts commit 8a7fd66919.
2021-07-26 13:02:33 +02:00
Sami Mazouz
0ce6a1ea9a Revert "Use wildcard for constraint instead"
This reverts commit 4bcfc5078c.
2021-07-26 13:02:33 +02:00
Sami Mazouz
4bcfc5078c Use wildcard for constraint instead
Co-authored-by: Daniël Klabbers <luceos@users.noreply.github.com>
2021-07-21 10:41:53 +02:00
SychO9
8a7fd66919 Avoid using intervention/image 2.6.0 2021-07-21 10:41:53 +02:00
flarum-bot
ac0e98e721 Bundled output for commit 5a1948c4fc
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-07-14 14:15:44 +00:00
David Wheatley
5a1948c4fc Add fix for broken type hinting on class components (#2962) 2021-07-14 15:13:57 +01:00
flarum-bot
9ff1a42396 Bundled output for commit 3130e3de5e
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-07-13 12:44:21 +00:00
David Wheatley
3130e3de5e Allow extra attrs provided to <Select> to be passed through to the DOM element (#2959)
* Allow extra attrs provided to `<Select>` to be passed through to the DOM element

* Allow direct passing attrs to the Select wrapper

* Format
2021-07-13 13:42:46 +01:00
David Wheatley
da20d75e3c Hide post footer when empty (#2926)
* Add `Post-footer--empty` class if the post footer contains no items

* Hide post footer when it has class `Post-footer--empty`

* Swap to `:empty` pseudoselector

* Prefer ternary operator

* Fix typo
2021-07-13 13:42:19 +01:00
Daniel Klabbers
7a0df21c5a prevent a couple of cycles by not resolving the excluded middleware on each middleware items 2021-07-13 00:44:27 +02:00
Daniel Klabbers
7d4d3d977b fixes internal clients use of session
With remember from cookie, in certain edge cases, the middleware would
try to load a session which hasn't been instantiated as this middleware
is excluded for the client. Excluding the remember from cookie
middleware will resolve this as authentication is done using the
RequestUtil and ActorReference regardlessly.
2021-07-13 00:32:13 +02:00
David Wheatley
408bb38cc0 Update code block styling to match HLJS 11's new styles (#2909) 2021-07-09 10:04:12 +01:00
flarum-bot
b7cb1e8d36 Bundled output for commit 42dabea81f
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-07-05 15:37:15 +00:00
Lucas Henrique
42dabea81f Move Day.js plugin types import to global typings (#2954) 2021-07-05 16:35:37 +01:00
Daniel Klabbers
a077ae9ca3 set version constant for 1.0.5-dev 2021-06-28 12:26:15 +02:00
Daniel Klabbers
17e9bccc15 changelog for v1.0.4 2021-06-28 12:22:48 +02:00
Ian Morland
4a5b84d2e7 Remove LIKE and raw from viewUserList rename 2021-06-28 11:58:23 +02:00
Ian Morland
557fc2cd39 Include updating of scoped tag permissions
Addresses https://github.com/flarum/core/issues/2924

The rename `viewDiscussions` migration introduced for Flarum 1.0 does not take tag scoped permissions into account
e92c267cde/migrations/2021_05_10_000000_rename_permissions.php (L17)

This adds a new migration to additionally rename `tagX.viewDiscussions` to `tagX.viewForum`

Tested locally on an upgrade from core `beta.16` to `1.0.3`
2021-06-28 11:58:23 +02:00
Daniel Klabbers
e92c267cde update version constant for the next release 2021-06-22 23:38:47 +02:00
Daniel Klabbers
f959a69530 changelog entry for laravel filesystem issue 2021-06-22 23:15:25 +02:00
Daniel Klabbers
4e246779f4 changelog so far for 1.0.3 2021-06-22 23:15:25 +02:00
Daniel Klabbers
5b0f5aeaa0 updated foundation version 2021-06-22 23:15:25 +02:00
Daniel Klabbers
6e92af8b00 Fixes issue with Laravel 8.48 filesystem changes
The FilesystemManager has changed to also allow to override
the config while resolving a filesystem.

This PR adds the argument and applies it if provided.
2021-06-22 23:07:41 +02:00
flarum-bot
1cf9491fe6 Bundled output for commit 3fcc7bd3b9
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-06-21 22:16:28 +00:00
ctml91
3fcc7bd3b9 use display name for avatar color gen 2021-06-22 00:14:37 +02:00
Daniel Klabbers
4acff91f80 allows replacing maintenance mode handler using ioc 2021-06-22 00:10:41 +02:00
Daniël Klabbers
a0152ffb18 Dw/huntr fix path traversal (#2931)
* Fix Huntr vuln with possible directory traversal
* Use `active_url` in Laravel validator
2021-06-21 10:14:15 +02:00
David Wheatley
d1e38558c5 Fix image avatar alignment in notifications (#2906) 2021-06-11 12:13:57 +01:00
Daniël Klabbers
0cca808275 minor improvements to the security policy 2021-06-10 21:56:30 +02:00
Daniël Klabbers
5ee5f82e3d huntr.dev as first point for security vuln (#2918)
* huntr.dev as first point for security vuln

* add badge for huntr.dev
2021-06-10 16:26:40 +02:00
Daniël Klabbers
9077fef5b2 clean up of composer.json, added funding and more support links 2021-06-08 01:58:37 +02:00
Daniël Klabbers
93cebec0be remove tidelift, we stopped doing that 2021-06-08 01:54:11 +02:00
Daniël Klabbers
a4a81c0ec2 Remove [forum] prefix in some mails
fixes #2515
2021-06-08 01:28:04 +02:00
David Wheatley
50dcfdb2a6 Mark typings as generated code (#2886) 2021-06-07 13:12:43 +01:00
flarum-bot
8149397850 Bundled output for commit 1ced907e52
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-06-06 01:50:56 +00:00
David Wheatley
1ced907e52 npm audit fix 2021-06-06 02:47:58 +01:00
David Wheatley
17c5a40740 Update changelog 2021-06-06 02:44:32 +01:00
David Wheatley
440bed81b8 Fix XSS vulnerability 2021-06-06 02:41:48 +01:00
David Wheatley
eeb8fe1443 Update version constant to 1.0.2 2021-06-06 02:09:03 +01:00
Daniel Klabbers
11b1ab5932 update version constant for 1.0.2-dev 2021-06-02 09:10:01 +02:00
Daniel Klabbers
6f34c43dc1 v1.0.1 changelog and constant 2021-06-02 09:05:36 +02:00
luceos
8ced9eef45 Apply fixes from StyleCI
[ci skip] [skip ci]
2021-05-31 14:08:49 +00:00
Daniel Klabbers
8af52153e4 ref #2890, no longer using process and dump 2021-05-31 16:08:15 +02:00
Daniel Klabbers
2c5e5f13dd Revert "Revert "Squash core migrations (#2842)""
This reverts commit 16f3ae9d1e.
2021-05-31 15:49:20 +02:00
Daniel Klabbers
1bbfea4aa3 updated version constraint string 2021-05-29 22:42:28 +02:00
Daniel Klabbers
16f3ae9d1e Revert "Squash core migrations (#2842)"
This reverts commit 6ecca9565a.
2021-05-29 22:38:25 +02:00
Daniel Klabbers
a976a2118a changelog and version constraint fix for flarum/testing 2021-05-25 23:01:54 +02:00
Daniël Klabbers
9cecbe407f Version constant for 1.0.0 (#2885) 2021-05-25 15:00:21 +02:00
Alexander Skvortsov
b3de5157fe Apply fixes from StyleCI
[ci skip] [skip ci]
2021-05-18 07:08:50 +00:00
Alexander Skvortsov
188dc98c4a Fix onOneServer, withoutOverlapping console scheduling options
Flarum doesn't fully use Laravel's cache system, but rather
creates and binds a single cache store.
See \Flarum\Foundation\InstalledSite::registerCache
Since certain config options (e.g. withoutOverlapping, onOneServer)
need the cache, we must override the cache factory we give to the scheduling
mutexes so it returns our single custom cache.
2021-05-18 03:08:32 -04:00
flarum-bot
bcc4545ce7 Bundled output for commit 9ee3cd6a18
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-05-18 05:39:33 +00:00
Alexander Skvortsov
9ee3cd6a18 Fix insertText
In dd8323ee36, insertText was modified from the original to work with reply mentioning. This was done due to a misunderstanding of the API: the selection range isn't the selection to replace, but rather the final selection state after replacing the *current* selection with the text. This commit restores the original, correct implementation of insertText and instead adjusts the `insertBetween`method of BasicEditorDriver to set selection state before executing `insertText`.

Fixes https://github.com/flarum/core/issues/2877
2021-05-18 01:37:19 -04:00
Alexander Skvortsov
a5182a1454 Fix filesystem wrong method call
The proper method is `exists`, not `has`.
2021-05-17 18:04:08 -04:00
Daniel Klabbers
be7581c432 fix missing import of container for resolving the queue connection from ioc 2021-05-17 21:13:30 +02:00
flarum-bot
e855c49824 Bundled output for commit e010cbc319
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-05-17 00:29:54 +00:00
David Wheatley
e010cbc319 Fix Badge className not being correctly set
Fixes group icons on Admin permissions page
2021-05-17 01:27:30 +01:00
David Wheatley
70f0c5b728 Update copyright date (#2863) 2021-05-16 19:10:33 -04:00
flarum-bot
1a34b85250 Bundled output for commit 1b8c77d034
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-05-16 23:04:41 +00:00
SychO9
1b8c77d034 Remove Beta leftover warning code 2021-05-17 00:02:21 +01:00
Alexander Skvortsov
07b1a974cf Bump composer reqs for 1.0.0 2021-05-16 18:27:36 -04:00
flarum-bot
54319c0466 Bundled output for commit 9040e62c0e
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-05-16 00:14:08 +00:00
Alexander Skvortsov
9040e62c0e Drop JS copyright blocks 2021-05-15 20:11:38 -04:00
flarum-bot
763bd7d244 Bundled output for commit 9b76c8f611
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-05-15 23:09:46 +00:00
Alexander Skvortsov
9b76c8f611 Merge pull request #2867 from flarum/as/1.0-qa-fixes
Assorted 1.0 QA fixes
2021-05-15 19:07:41 -04:00
Alexander Skvortsov
fede3f9fc7 Fix glitchy group editing
Currently, when groups are edited, the new groups flicker, but the UI soon reverts to the old groups. This is because the returned API response has the old group values. This, in turn, is because we eager load groups, and when we sync the new group relation, that doesn't update the groups saved in memory. By unsetting the relation, we make sure the right groups are returned (and also available to the GroupsChanged event).

See https://github.com/flarum/core/issues/2514
2021-05-15 02:30:03 -04:00
Alexander Skvortsov
9eb74fdc8a Fix CustomFooterModal Appearance
The textarea in the CustomFooterModal was much larger than in the other appearance page modals, and did not use a monospaced font. Turns out the other 2 were explicitly specified in the less. This commit adds a class that can be applied to all these modals for simpler maintenance.

Fixes https://github.com/flarum/core/issues/2865
2021-05-14 21:36:06 -04:00
Alexander Skvortsov
05dda5b083 Fix KeyboardNavigatable
In b2d053f686, I tried to be clever and create a new KeyboardNavigatable object as a return value for `when`. My approach to cloning was incorrect, and caused the util to break entirely.

My original intent for having this "clone"-based behavior is that a single KeyboardNavigatable instance could be created with multiple listeners, and then "cloned" like this with different "activators" registered via "then" calls. In hindsight, this change introduces more issues than it solves: outside of just not working, the cloned "KeyboardNavigatable" instances have shared internal state (the set of callbacks), and each has write access to this internal state. This is a recipe for unpredictable behavior and confusing bugs, so best to keep things simple for now, and maybe introduce more functional behavior in later releases.

Fixes https://github.com/flarum/QualityAssurance/issues/25
2021-05-14 21:21:58 -04:00
Alexander Skvortsov
d1e987a240 Fix 0s in notification dropdown
By casting the length int to a bool, if there are no badges, we don't display a  0. It seems that mithril will render integers, but not booleans.

Fixes https://github.com/flarum/QualityAssurance/issues/28
2021-05-14 21:08:48 -04:00
Alexander Skvortsov
8ffeac4315 NotificationListState separate content method
This fixes an error where an empty notification list wouldn't show the "empty" text.

It also simplifies flow of logic and breaks the component up a bit for readability.
2021-05-14 21:04:26 -04:00
David Wheatley
dd3c203827 Update copyright year 2021-05-15 00:45:09 +01:00
flarum-bot
fc06c76e2c Bundled output for commit 13d341e014
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-05-14 22:37:39 +00:00
Sami Mazouz
13d341e014 Use slugs for user pages (#2864) 2021-05-14 23:35:50 +01:00
Alexander Skvortsov
1d5d0688aa Fix "add numbered list" styleSelectedText action
Looks like I missed the `numberedLines` function used by the `orderedList` function in dd8323ee36
2021-05-14 18:35:11 -04:00
Sami Mazouz
1a19856c0c Fix version update page (#2862)
* Binding closures only get the container instance as argument
2021-05-14 16:10:05 +01:00
SychO9
0236e1529e Update Application version constant to 1.0.0-dev 2021-05-13 22:19:01 +01:00
flarum-bot
947613a7e2 Bundled output for commit 88df26d722
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-05-13 19:58:41 +00:00
Christian Lopez
88df26d722 Replace removed hasDiscussions method from DiscussionListPane (#2860) 2021-05-13 15:56:55 -04:00
Sami Mazouz
7bceda976b Backend cleanup (#2859)
* Extender docblocks cleanup
* Excplicit type hinting in extenders
* Bring method under constructor
* Mark some classes and methods as internal
* Remove beta references

Co-authored-by: Clark Winkelmann <clark.winkelmann@gmail.com>
2021-05-13 15:26:24 +01:00
flarum-bot
e3f506817b Bundled output for commit 422525a9bb
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-05-13 00:03:24 +00:00
Alexander Skvortsov
422525a9bb hasDiscussions method of DiscussionListState has been removed 2021-05-12 19:41:28 -04:00
flarum-bot
c3a684c7ed Bundled output for commit 3537f76eab
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2021-05-12 23:29:46 +00:00
David Wheatley
3537f76eab Update core to use new Webpack config, flarum-tsconfig, and build action (#2856)
* Update core to use new Webpack and TSConfig

* Bump webpack dep

* Update JS build action

* Copy custom `.d.ts` files to `dist-typings` folder on typings compile

* Run workflow against action v2

This allows us to have a moving tag, like first party actions have.

* Remove bundle analyzer from core

* Use webpack config 0.1.0-beta.16.2

* Add note about checking flarum-tsconfig
2021-05-13 00:28:17 +01:00
flarum-bot
c37c4f46da Bundled output for commit 42eacd616c
Includes transpiled JS/TS.

[skip ci]
2021-05-12 23:12:10 +00:00
Alexander Skvortsov
42eacd616c Use proper attrs for viewForum and searchUsers 2021-05-12 18:49:11 -04:00
flarum-bot
875f8eb530 Bundled output for commit 9dca657edf [skip ci] 2021-05-12 22:19:45 +00:00
David Wheatley
9dca657edf Fix formatting error in Tooltip.tsx
Prettier is acting differently on different systems.
2021-05-12 23:14:50 +01:00
flarum-bot
d7648102a9 Bundled output for commit bba6485eff [skip ci] 2021-05-12 03:57:28 +00:00
Alexander Skvortsov
bba6485eff Tooltip formatting fix 2021-05-11 23:55:52 -04:00
Alexander Skvortsov
2075c7319f Typehint event in console scheduling test case 2021-05-11 23:55:34 -04:00
flarum-bot
92e1d0843c Bundled output for commit 4e0fdb4c77 [skip ci] 2021-05-11 23:15:50 +00:00
David Sevilla Martín
4e0fdb4c77 Create abstract PaginatedListState for DiscussionList and others (#2781) 2021-05-11 19:14:26 -04:00
flarum-bot
9a26b2bef4 Bundled output for commit d64750b3eb [skip ci] 2021-05-11 19:17:04 +00:00
Alexander Skvortsov
d64750b3eb Rename viewDiscussions => viewForum, viewUserList => searchUsers (#2854)
This naming is clearer as to the intended effect. Changes include:

- A migration to rename all permissions
- Updating the seed migration to use the original naming from the start
- Replacing usage of the old names with new names in code
- Throwing warnings when the old names are used.
2021-05-11 15:15:27 -04:00
flarum-bot
06f63a2087 Bundled output for commit b2d053f686 [skip ci] 2021-05-11 02:31:32 +00:00
Alexander Skvortsov
b2d053f686 Search frontend cleanup (#2849)
- Convert KeyboardNavigatable to TypeScript, as that is used internally here.
- Convert search sources to TypeScript
- Convert Search component to TypeScript
- Convert Search States to Typescript
- Add `getInitialSearch` to `SearchState`
- Fix search disappearing on page reload / direct link
2021-05-10 22:30:04 -04:00
David Sevilla Martín
765bd59965 Improve discussion page canonical URL (#2853)
* Switch to ?page= discussion page canonical URL & fix no-JS pagination buttons
2021-05-10 19:20:47 -04:00
Alexander Skvortsov
6ecca9565a Squash core migrations (#2842)
Data migrations (seed default groups, seed default permissions) are deliberately excluded.
This also allows us to remove a lot of now unnecessary public API from the migrator and migration repository.
2021-05-10 18:05:01 -04:00
flarum-bot
a28009f24b Bundled output for commit 7f596db09b [skip ci] 2021-05-10 21:56:41 +00:00
Alexander Skvortsov
7f596db09b Some minor JS cleanup (#2846)
- Change index files to ts
- Remove deprecated EditUserModal from forum compat
- Remove b14-specific error
- Remove transChoice method (ICU should be used instead)
- Translator to TypeScript
- Small JS => TS cleanup
* Trivial js => ts change

Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-05-10 17:54:58 -04:00
Alexander Skvortsov
dd8323ee36 Use github markdown utils in core, support key handlers (#2826)
This simplifies the markdown extension and allows BBCode to use these features.
It also allows undoing stuff like inserting replies/mentions
2021-05-10 17:53:32 -04:00
Alexander Skvortsov
104a31ba30 Run API Client requests through middleware (#2783)
- Add integration tests for login and registration
- Use URL instead of controller
- Add fluent API
- Allow setting parent request, user, session
2021-05-10 17:41:38 -04:00
flarum-bot
b0a26eb78c Bundled output for commit f9e8424620 [skip ci] 2021-05-10 20:07:59 +00:00
David Wheatley
f9e8424620 Add tooltip component (#2843)
* Add Tooltip component to common

Will be used to provide backwards compatibility when we switch to CSS tooltips.

All other methods of creating tooltips are deprecated and this component-based method should be used instead.

* Modify direct child instead of using container element

Instead of using a container to house the tooltip, we'll now modify the
first direct child of the Tooltip component.

The Tooltip component will ensure that:
- children are passed to it
- only one child is present
- that child is an actual HTML Element and not a text node, or similar
- that child is currently present in the DOM

Only after all of the above are satisfied, will the tooltip be created
on that element. We store a reference to the DOM node that the tooltip
should be created on, then use this to perform tooltip actions via
jQuery. If this element gets changes (e.g. the tooltip content is
updated to another element) then the tooltip will be recreated.

If any of the first 3 requirements are not satisfied, an error will
be thrown to alert the developer to their misuse of this component.

To make this work, we do need to overwrite the title attribute of
the element with the tooltip, but this is the only solution other than
specifying `title` as an option when making the tooltip, but this is
not accessible by screenreaders unless they simulate a hover on the
element.

* Add warning about component overwriting `title` attr

* Update previous uses of Tooltip component
2021-05-10 21:06:40 +01:00
flarum-bot
9bfb7f978d Bundled output for commit d4e3254395 [skip ci] 2021-05-09 22:10:56 +00:00
Alexander Skvortsov
d4e3254395 Use all Mithril lifecycle stubs (#2847) 2021-05-09 18:09:45 -04:00
David Wheatley
ceb567779e Remove spin.js, bump some dependencies (#2848) 2021-05-09 18:09:29 -04:00
flarum-bot
2e0d494bec Bundled output for commit 6d9bb709c7 [skip ci] 2021-05-09 21:35:04 +00:00
David Wheatley
6d9bb709c7 Fix typo in LoadingIndicator docblock 2021-05-09 22:33:33 +01:00
flarum-bot
915351baec Bundled output for commit 707889abc8 [skip ci] 2021-05-09 21:23:38 +00:00
David Wheatley
707889abc8 Fix required selector argument to Component.$() (#2844) 2021-05-09 17:22:22 -04:00
flarum-bot
2cd1c2964a Bundled output for commit 8a451e0bfc [skip ci] 2021-05-07 16:31:01 +00:00
Alexander Skvortsov
8a451e0bfc Fix exception in bootExtensions
Frontend extenders exist in a weird state of limbo, where they are technically defined, but aren't used or tested at all. In da5db714c2, we shifted from passing `extension.extend` to `flattenDeep` to calling `flat` on `extension.extend`. If an extension doesn't define extenders (as is the case for most extensions), the change breaks the forum. All we do here is add a null check.
2021-05-07 12:29:10 -04:00
flarum-bot
0b9ad5425c Bundled output for commit da5db714c2 [skip ci] 2021-05-05 23:29:41 +00:00
David Wheatley
da5db714c2 Remove lodash from core (#2827)
* Remove `lodash-es` dependency

* Replace `escapeRegExp` with home-made util

* Replace `throttle` with `throttle-debounce` library

* Use native browser methods for `deepFlatten`

We need a polyfill for iOS 11 and below. I think using a native method with this polyfill is better than having our own function instead, even if the bundle size is ~150B more.

* Save a few bytes in `escapeRegExp`

* Fix typo in comment

* Undo import re-organisation

* Use spread instead of slice

* Use smaller Array.flat polyfill from MDN

* Export new utils in `compat.js`
2021-05-06 00:28:22 +01:00
flarum-bot
d4a2357a32 Bundled output for commit 588a9f952f [skip ci] 2021-05-05 14:47:48 +00:00
David Wheatley
588a9f952f Remove unneeded delete (#2835) 2021-05-05 15:46:23 +01:00
Alexander Skvortsov
66233ce818 Remove unused variable 2021-05-04 18:15:05 -04:00
Alexander Skvortsov
7d4bd8a845 Centralize permission caching (#2832) 2021-05-04 13:56:14 -04:00
David Wheatley
3a6b8847f1 Mark JS dist folder as generated code (#2828)
This excludes it from the repo's language stats and are suppressed in Linguist diffs.

See: https://github.com/github/linguist/blob/master/docs/overrides.md#generated-code
2021-05-04 18:13:42 +01:00
Robert Korulczyk
2ffec2ee71 Update validation.yml. (#2829)
source: https://github.com/laravel/laravel/blob/v8.5.16/resources/lang/en/validation.php
2021-05-03 19:47:18 -04:00
Matt Kilgore
7eea2476ca Harden Headers (#2721)
* Basic security headers

* Remove XSS Header (not relevent)

* Fix config name

* Use Arr::get()

* Add tests

* Re-fix the StoreConfig step for fresh installs

Co-authored-by: luceos <luceos@users.noreply.github.com>
Co-authored-by: Alexander Skvortsov <askvortsov1@users.noreply.github.com>
2021-05-03 12:42:06 -04:00
Alexander Skvortsov
9711af42ae Apply fixes from StyleCI
[ci skip] [skip ci]
2021-05-03 05:36:06 +00:00
Alexander Skvortsov
d12d52918b Use latest version of settings package
This allows us to get rid of hacks for configuring settings and config
2021-05-03 01:35:46 -04:00
flarum-bot
ad92d11cf9 Bundled output for commit 3ca035f9aa [skip ci] 2021-05-02 16:14:09 +00:00
David Wheatley
3ca035f9aa Revamp notifications stylesheet (grid and flex) (#2822) 2021-05-02 17:13:04 +01:00
flarum-bot
bbff3a2748 Bundled output for commit f5cd5f202f [skip ci] 2021-05-02 10:38:26 +00:00
David Wheatley
f5cd5f202f Allow multiple methods to be provided to extend and override 2021-05-02 11:37:19 +01:00
flarum-bot
a78cbf644c Bundled output for commit 2de47a8656 [skip ci] 2021-04-30 17:00:49 +00:00
Alexander Skvortsov
2de47a8656 Fix package-lock
b45519974a accidentially commited a package-lock with symlinks, breaking the JS build process
2021-04-30 12:59:33 -04:00
Alexander Skvortsov
b45519974a Switch to ICU MessageFormat (#2759) 2021-04-30 12:44:39 -04:00
Alexander Skvortsov
edaf45d133 Remove unnecessary laravel config (#2796) 2021-04-30 00:31:19 +02:00
Matt Kilgore
6b9e991082 Move Powered By Header to headers config (#2777)
* Move Powered By Header to headers config
* Use Arr::get()
2021-04-30 00:30:01 +02:00
David Wheatley
8a431dc3cc [A11Y] Add focus ring mixin to restore ring to elements which no longer have it (#2814)
* Add focus ring mixin

These mixins allow us to restore default browser focus rings on elements which no longer have them.

* Add info about custom outline styles; use `#private` namespace and fix mixin name

I just learned that Less has namespaces! https://lesscss.org/features/#mixins-feature-namespaces
2021-04-29 22:10:17 +01:00
David Wheatley
91b1d9029e LESS should be capitalised as Less
See http://lesscss.org/
2021-04-29 22:07:46 +01:00
Daniël Klabbers
e337c10bb8 Revision compiler revised (#2805)
- revisions now use <asset>.<type>?v=<revision> instead of <asset>-<revision>.<type>- remove deprecated filename for revision method
- reconsider use of cache differentiator and implement something that
prevents recompiling css every single time
- allow force recompilation
2021-04-29 16:49:36 -04:00
Daniël Klabbers
e0258d2708 error handling when extending flarum from extensions fails (#2740) 2021-04-29 16:17:41 -04:00
Daniël Klabbers
fcb5778705 fixed container bindings use of container (#2807) 2021-04-29 15:33:51 -04:00
Sami Mazouz
40b47de9e1 Remove ExtensionPage CSS over-specification (#2792) 2021-04-29 16:31:37 +01:00
Daniël Klabbers
deadd67691 clarify callable arguments for password checker (#2812) 2021-04-29 10:19:06 -04:00
flarum-bot
c119731e65 Bundled output for commit 2b7e7f3ff4 [skip ci] 2021-04-26 16:15:37 +00:00
Sami Mazouz
2b7e7f3ff4 Fix class naming (#2811) 2021-04-26 17:14:22 +01:00
flarum-bot
f4acb2c5db Bundled output for commit f9779284e4 [skip ci] 2021-04-22 22:37:03 +00:00
David Wheatley
f9779284e4 Add users list to admin dashboard (#2626)
* Commit initial WIP code

* Fix squashed grid on mobile

* Add pagination support; rename to userList

* Improve grid sizing

* Improve grid row shading

* Move EditUserModal to common

* Add link to profile page in grid

* Use Less styling vars

* Move EditUserModal translations to lib

* Add edit user button to grid

* Fix incorrect profile link priority

* Update profile link translation key

* Add priorities to other columns

* Add group badges to grid

* Add username to profile link tooltip

* Organise imports

* Use variable for header border bottom color

* Fix broken export

* Add total user count to API payload's metadata

* Add new metadata to ApiPayload type

* Implement correct page number

* Remove debug code

* Use function to get the total pages

This allows us to use the raw count elsewhere in the component (pssst... check the next commit!)

* Center profile link in column

* Add profile link header

* Show total users above table

* Use ItemList's itemName property for column data attributes

* Add user email column, hidden by default

This column is hidden by default using a placeholder email and blur filter. These are then removed when the visibility toggle is pressed.

This prevents any over-the-shoulder accidental data leakage, as emails are classed as PII under GDPR.

* Fix incorrect tooltip translation keys

* Add extra padding between email and visibility toggle button

* Prevent selection of blurred email

* Fix incorrect icon state for email toggle

* Update API response type to include metadata (for now)

* Increase number of users per page to 50

* Update compat files with new locations

* Format

* Add @deprecated notices for forum compat export

* Use AdminPayload for user count instead of supplying as REST API metadata

* Make nav look less squashed using bottom margin

* Suppress TS warning

* StyleCI fixes

* Fix TS error

* Update based on review comments

* Rename user list -> users

* Rename internal instances of user_list to users

* Fix formatting

* Use CSS custom properties for the table column count

* Use .Button--icon instead of custom style

* Make fake email more realistic length

* Add a11y attributes

* Use padding bottom instead of margin bottom for page spacing

* Make compatible with new CSS LoadingIndicator

I won't let it break here! :P

* Integrate profile link into username column

* Don't force columns to be 300px

This made the grid look very bloated and intimidating -- lets instead increase the padding between items and make it only the width it needs to be.

* Center edit user button in column

* Increase spacing between email and visibility toggle button

* Rename `statistics` to `modelStatistics` in Admin payload

This prevents any possible conflicts with core and `flarum/statistics`. We might want to consider migrating the stats extension to extend this object in the future.

* Update comments, fix TS error

* Various translation key changes

* Change gmail.com -> example.com

* Stretch 'edit user' button to entire cell size

* Update translations

* Is the YAML formatted right this time? 🙈

* Remove email placeholder

Fixes an issue where the table would jump if an email was unhidden that was longer than the placeholder.

* Re-order lib translations

* Clicking blurred email now unblurs

* Correct header class

* Improve edit user button centring

* Improve vertical row item centering

* Fix incorrect column length in aria attribute

* Use .Button--text!
2021-04-22 23:35:42 +01:00
flarum-bot
43d6b3104d Bundled output for commit 33bd99d376 [skip ci] 2021-04-21 11:27:23 +00:00
David Wheatley
33bd99d376 Fix uses of loading spinner (#2797)
* Update Loading Indicator

- Fix mistake in LoadingIndicator Less
- Middle align the loading indicator when inline
- Fix Loading Indicator not correctly accepting container class names
- Add inline and block attributes

* Fix loading indicator in composer

* Fix loading indicator on notification list

* Fix loading indicator on discussion page

* Fix loading indicator on button

* Update more uses of loading indicator

* Fix loading indicator in Search box

* Fix AvatarEditor loading spinner

* Set default spinner props

* Replace "tiny" with "small" in Less

* Improve spinner vertical centring in buttons

* Reduce size specificity

* Use single attribute for block/inline

* Use new display attribute

* Use classes for different sizes

* Use `display=block` by default
2021-04-21 12:26:09 +01:00
Alexander Skvortsov
eb4b18a979 Combine search tests
#b62debf031f1d3aec9cb5e92d9df54cb8ab3a3b1 and #b6f0b01307884b11388eff1ae2d814b7f57715aa
 both added/improved searching tests, but did so in separate files. As a result, the tests did not consider each other, and when both were merged, started failing. This commit combines the tests into one file that tests both order and search in titles.
2021-04-20 19:16:59 -04:00
Sami Mazouz
b62debf031 Add user id slug driver (#2787) 2021-04-20 23:52:53 +01:00
Alexander Skvortsov
1f2411e15e Fix searching titles in discussions (#2698)
* Fix searching titles in discussions

* Apply fixes from StyleCI

* Fix tests

* Distinct by discussion ID

* Replace distinct with groupBy

Co-authored-by: Alexander Skvortsov <askvortsov1@users.noreply.github.com>
2021-04-20 18:52:14 -04:00
flarum-bot
d99df936b1 Bundled output for commit 9716a15c31 [skip ci] 2021-04-20 16:26:39 +00:00
David Wheatley
9716a15c31 Add accessibility attributes to loading spinner (#2799) 2021-04-20 17:25:23 +01:00
Alexander Skvortsov
5e2340bf10 Fix registering custom searchers, allow searchers without fulltext (#2755) 2021-04-19 16:59:53 -04:00
Alexander Skvortsov
c84939b19c Filesystem Extender and Tests (#2732) 2021-04-19 16:25:08 -04:00
Alexander Skvortsov
4974c91481 Asset Publish Command (#2731) 2021-04-19 15:51:28 -04:00
Alexander Skvortsov
f67149bb06 Use Laravel filesystem interface for assets and avatars (#2729)
* WIP: Use Laravel filesystem interface where possible
* Drop vendorFilesystem
* Support getting URL of cloud-based logo and favicon
* FilesystemAdapter should always be cloud
* Get base avatar URL from filesystem adapter
* Restore deleted getAsset method

Co-authored-by: Alexander Skvortsov <askvortsov1@users.noreply.github.com>
2021-04-19 21:11:03 +02:00
Alexander Skvortsov
a2d77d7b81 Rename relevant migration so it runs again (#2793) 2021-04-19 14:14:07 -04:00
flarum-bot
da4264c8a3 Bundled output for commit 0f9526ba9f [skip ci] 2021-04-19 14:37:25 +00:00
Alexander Skvortsov
0f9526ba9f Adjust search height on resize (#2775)
Identified as a potential issue in https://github.com/flarum/core/pull/2650

When typing, the keyboard generally obstructs half the screen. However, when the keyboard is closed, search results don't expand to take up full space.
2021-04-19 10:36:04 -04:00
Alexander Skvortsov
e77365f32f Add id to migrations table (#2794) 2021-04-19 10:35:21 -04:00
Alexander Skvortsov
c7c456cb3e Remove unused container argument 2021-04-18 17:20:14 -04:00
Alexander Skvortsov
fb51fb4e6d Drop session from user class (#2790)
This was originally introduced in 3612ca7aca, but has not seen usage, since usually when the session needs to be modified, the request is available.

It causes issues with certain queue drivers, as it can't be serialized.

It's also not entirely accurate, as a user can have multiple sessions at once. Therefore, a given session is a property of the request, not of the user.

The reason this causes issues in the Queue is that when a Job has payload that consists User(s), the Queue will try to serialize that. Serializing the User object will require serializing the session too; this causes a Serialization of Closure is not allowed error, see image.

One can circumvent that in many ways, the most obvious one is adding a __sleep and __wakeup implementation in the User class (or the session handler). But as we aren't really using the session on the User model anywhere in core, bundled or most community extensions it is best to simply detach this from the user.
2021-04-16 15:53:05 -04:00
Sami Mazouz
5b7d364b87 Update laravel docs references to 8.x (#2788) 2021-04-16 13:26:15 +01:00
Sami Mazouz
39a6106854 Add unparse to Formatter extender (#2780) 2021-04-14 11:34:49 +01:00
Sami Mazouz
9e3699ea47 Access request actor in error handler (#2410)
* Add an ActorReference class to store the actor `$request->getAttribute('actorReference')->getActor()`
* Add a middleware to inject the actor reference
* Deprecate `$request->getAttribute('actor')`
2021-04-12 18:42:22 +01:00
Alexander Skvortsov
b6f0b01307 Fix relevance sort (#2773)
- Adds a field to QueryCriteria that determines whether the sort provided is the controller's default sort
- Set this field to true iff sort not in query params. Default it to false
- Override $sort if a new default sort has been set on search state, and the param is true.
- Add tests!
2021-04-11 22:21:56 -04:00
Sami Mazouz
548f1321f1 Require unique route names (#2771) 2021-04-10 20:38:25 +01:00
flarum-bot
e376cf2079 Bundled output for commit 286027ff27 [skip ci] 2021-04-10 14:45:12 +00:00
David Wheatley
286027ff27 Push lockfile from Linux to fix missing chokidar 2021-04-10 14:39:05 +00:00
David Wheatley
e52b769ceb Add option to build with Webpack Bundle Analyzer (#2708)
* Add option to build with webpack bundle analyzer

* Bump npm to v7 as recommended in actions/setup-node#213

* Workaround for npm/cli#558

* Add missing dep
2021-04-10 15:00:48 +01:00
Adam Hosker
b1f166d82a Remove MyISAM Requirement (#2442)
- Remove Database Engine Default of InnoDB
- Remove Hard Coded MyISAM requirement
2021-04-09 08:13:47 -04:00
flarum-bot
63675c81d6 Bundled output for commit f76524a5de [skip ci] 2021-04-08 23:43:36 +00:00
David Wheatley
f76524a5de Replace spin.js with a CSS-only loading spinner (#2764)
* Create CSS only loading indicator

* Core mods to fix Loading Indicator usage

* Remove extra whitespace

* Attrs interface extends ComponentAttrs and is exported

* Add doc block about custom styling
2021-04-09 00:42:32 +01:00
David Wheatley
c006931798 Cache npm cache between JS build runs (#2710) 2021-04-08 20:29:37 +01:00
flarum-bot
a5ec39b5cf Bundled output for commit c75db75efe [skip ci] 2021-04-08 11:36:26 +00:00
David Wheatley
c75db75efe Bump dependencies, add missing typing libraries (#2753)
* Bump dependencies and add missing typing libraries

* Fix expose-loader breaking changes

* Expose jQuery using its own typings instead of ours

* Extend jQuery typings with our own custom $.fn helpers

* Use jQuery typings for Component's `this.$` attribute

* Format webpack config file

* Use Spin.js 3.1.0
2021-04-08 12:35:10 +01:00
David Wheatley
300dadff60 Add code scanning workflow to identify common issues (#2744)
* Add code scanning workflow to identify common issues

* Don't run CodeQL if the only changes in a push/PR are .less or .md files

* Change cron

* Change workflow name to include language

* Make indents consistent with other workflows
2021-04-08 12:15:27 +01:00
Alexander Skvortsov
94d69fe15f Introduce RequestUtil to encapsulate getting/setting actor on requests(#2449) 2021-04-07 23:33:05 -04:00
Alexander Skvortsov
da598db376 Allow configuring default enabled extensions as part of installation (#2757)
This is needed for the testing library
2021-04-07 22:47:54 -04:00
Alexander Skvortsov
d31e0573f8 Don't fail silently on cache clear (#2756) 2021-04-07 22:13:08 -04:00
Sami Mazouz
2968341f77 Fix a missed getRouteData() (#2774) 2021-04-07 20:08:21 -04:00
flarum-bot
9839370701 Bundled output for commit 40dc6d0feb [skip ci] 2021-04-07 22:26:04 +00:00
Alexander Skvortsov
40dc6d0feb Preloaded API document Improvements (#2754)
* Invalidate preloadedApiDocument if URL has changed
* Revert to using `getRouteData()[0]`
2021-04-07 23:25:01 +01:00
flarum-bot
945f6478b5 Bundled output for commit 69a10c97be [skip ci] 2021-04-07 18:31:38 +00:00
David Wheatley
69a10c97be Merge "Remove unneeded vendor prefixes" (#2766) 2021-04-07 19:30:15 +01:00
Daniël Klabbers
0074f0c984 Removes duplication of cache clearing (#2738) 2021-04-07 17:29:32 +01:00
David Wheatley
19465fb522 Fix missing vendor prefix on post scrubber; move styles to Less 2021-04-05 23:19:52 +01:00
David Wheatley
0fe7723a7f Remove unneeded vendor prefixes 2021-04-05 20:27:47 +00:00
flarum-bot
fbe2813378 Bundled output for commit 4b69a35260 [skip ci] 2021-04-05 15:28:37 +00:00
David Wheatley
4b69a35260 Replace classList with clsx library (#2760) 2021-04-05 16:27:16 +01:00
Alexander Skvortsov
5e8155e1cc Remove unnecessary and imperceptible fade (#2685)
This concern was raised in https://discuss.flarum.org/d/26422-idearequest-make-header-background-color-match-exact-value-from-config.
2021-04-04 01:49:31 +01:00
flarum-bot
0f0f2b6d4e Bundled output for commit 3dae397c65 [skip ci] 2021-04-03 02:16:32 +00:00
David Wheatley
3dae397c65 Merge "Small Admin Patches" (#2739) from flarum/ck/adminux-patch2 into master
- Fixes #2736
- Fixes #2728
2021-04-03 03:14:41 +01:00
David Wheatley
7025a7f5e0 Pin GitHub Actions at specific tags and commits (#2748)
* Pin 3rd party action

* Pin GitHub-maintained actions to tag

* Bump Bundlewatch Node.js to v14 LTS

I have no clue what my thought process was when creating this workflow
initially. Thrown this in here as it's a minor change and it's silly to
make a PR just to update this number, in my opinion.
2021-04-03 01:00:26 +01:00
flarum-bot
12f6b1b375 Bundled output for commit 2de57af7c8 [skip ci] 2021-03-30 00:20:26 +00:00
David Sevilla Martin
2de57af7c8 Move forum & admin app declarations to separate files 2021-03-29 20:19:15 -04:00
Sami Mazouz
1c4817a0b3 Eager loading extender (#2724)
* Eager loading extender
* Add tests for the eager loading extender
2021-03-25 15:36:39 +01:00
KyrneDev
0eefbf0374 Help on redraw 2021-03-24 17:30:13 -10:00
KyrneDev
90c0bc410e Null name/desc breaks search fix 2021-03-24 17:29:54 -10:00
Sami Mazouz
d642fb531c Improve ApiSerializer tests (#2733)
The ApiSerializerTest was added before the ApiController extender, so I used a workaround at the time to check for the existence of the relationships on the serializer.
2021-03-23 17:33:51 -04:00
Alexander Skvortsov
706eaeda41 Use anonymous class for FakeApp (#2725)
It's a better implementation than declaring a second class in the same file, which can confuse IDEs. Furthermore, FakeApp shouldn't be used outside this file.
2021-03-22 19:00:36 +01:00
Sami Mazouz
3cc18c1da2 Eager load ListPostsController needed relations (#2717)
* Eager load ListPostsController needed relations
* Add comment explaining the reason for eagerloading
2021-03-22 09:54:18 +01:00
Alexander Skvortsov
8dd57ffed2 Include task scheduler in core 2021-03-19 18:01:38 -04:00
Alexander Skvortsov
d29495203b Move laravel helpers back in, deprecate perpetually 2021-03-19 18:01:38 -04:00
flarum-bot
783c563305 Bundled output for commit 908d087e00 [skip ci] 2021-03-19 18:14:58 +00:00
Alexander Skvortsov
908d087e00 Remove deprecated code from beta 16 (#2705) 2021-03-19 19:13:50 +01:00
sl-kr
374189d48e Refactor AccountActivationMailer and SendConfirmationEmailController (#2493)
* Add AccountActivationMailerTrait and use in AccountActivationMailer and SendConfirmationEmailController
* Remove prefix

Co-authored-by: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com>
2021-03-19 18:06:41 +01:00
flarum-bot
fe8dda6fd0 Bundled output for commit cd9ee48af6 [skip ci] 2021-03-18 22:04:58 +00:00
David Wheatley
cd9ee48af6 [A11Y] Add aria-label and landmark role to search input (#2669)
* Adds role="search" to Search container
* Add aria-label to search input

See this page for more info:
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/Search_role
2021-03-18 23:03:01 +01:00
flarum-bot
2e9078a7cf Bundled output for commit 0cc12aed95 [skip ci] 2021-03-18 21:39:56 +00:00
David Wheatley
0cc12aed95 [A11Y] Fix nav drawer being focusable when off-screen on small viewports (#2666)
* Fix nav drawer being focusable when off-screen on small viewports

Fixes #2565

* Implement review suggestions

* Format
2021-03-18 22:38:32 +01:00
David Wheatley
59fdd7628a Speed up JS linting (#2709)
* Install Prettier only, instead of all deps

* Allow running on workflow dispatch

Allows manually triggered CI runs by org members

* Update Node to latest LTS; update step descriptions
2021-03-18 21:14:10 +00:00
David Wheatley
298f6c39f2 Add bundlewatch to track bundle size changes in PRs (#2695)
(Below steps already performed, but kept for future reference.)

Head here to get auth ID: https://service.bundlewatch.io/setup-github
Create repo secret called `BUNDLEWATCH_GITHUB_TOKEN` with the token inside
2021-03-17 14:54:42 +00:00
Alexander Skvortsov
233b97329c Drop the generate:migration command (#2686)
Core source code should contain things necessary for core to run. Development tooling like this belongs in external packages, like the upcoming Flarum CLI.
2021-03-16 12:41:07 -04:00
flarum-bot
1b5b143930 Bundled output for commit 0d139e6133 [skip ci] 2021-03-16 14:52:59 +00:00
David Wheatley
0d139e6133 [A11Y] Add aria-label to dropdown toggles (#2668)
Implement custom accessible dropdown toggle labels for forum components

Making the a11y label more specific to the specific action it performs is critical for good UX with assistive technologies.
2021-03-16 10:50:36 -04:00
Ian Morland
0e6a60bd5b Canonical URL: use UrlGenerator in place of extracting the url from request (#2674) 2021-03-15 21:43:59 -04:00
flarum-bot
6e4c75eba6 Bundled output for commit 386f3d3db1 [skip ci] 2021-03-16 01:43:29 +00:00
David Sevilla Martín
386f3d3db1 Fix Stream function code being shown when renaming discussion (#2693) 2021-03-15 21:42:22 -04:00
Alexander Skvortsov
9fffb8ec1a L8 requires constructor arguments to PhpEngine 2021-03-15 12:48:47 -04:00
Daniel Klabbers
92e590f1ab Release v0.1.0-beta.16 constant updated 2021-03-15 16:21:21 +01:00
Daniel Klabbers
098908cb4a Release v0.1.0-beta.16 2021-03-15 16:09:23 +01:00
Sami Mazouz
901846d0cf Beta 16 Changelog (#2687)
* Beta 16 Changelog

* Review tweaks

* Consistent letter casing

* IOS -> iOS

* Removed accidentally added F

* Csrf -> CSRF

Co-authored-by: David Wheatley <hi@davwheat.dev>
2021-03-15 14:55:47 +01:00
Daniel Klabbers
5a3aefb76c npm audit fix 2021-03-15 13:25:12 +01:00
Alexander Skvortsov
cf2a636e81 Apply GetModelIsPrivate BC mode to CommentPost, not Post 2021-03-13 17:16:18 -05:00
Alexander Skvortsov
a8ba510655 Fix ModelPrivate docblocks 2021-03-13 17:15:50 -05:00
Alexander Skvortsov
9c3b6c596f Merge pull request #2684 from flarum/as/filter-mutator-consistency
Make filter mutator API consistent with search mutator API.
2021-03-13 17:01:33 -05:00
Alexander Skvortsov
2310d782a3 Fix Index content, only use search when applicable. 2021-03-12 15:30:36 -05:00
Alexander Skvortsov
e9642250ae Provide active filters to filter state 2021-03-12 15:30:14 -05:00
flarum-bot
a6dd545dbc Bundled output for commit a64c39835a [skip ci] 2021-03-12 05:35:57 +00:00
Alexander Skvortsov
a64c39835a Fix shaky composer on safari mobile
When the composer is opened while scrolled to the absolute bottom of the page (via hitting the "reply" button, `window.scrollTop` has a value of ~600px greater than it should. This doesn't seem to be the composer element's height (which appears to be 0 at the time). This incorrect scrollTop positions the composer off screen, which causes Safari to freak out and shake the element violently as it tries to scroll to the cursor (which is now off screen).

We can get around this by calculating scrollTop ourselves.

Fixes https://github.com/flarum/core/issues/2683
2021-03-12 00:23:37 -05:00
Alexander Skvortsov
db0d8e89c7 Make filter mutator API consistent with search mutator API.
This is inline with the docblock for the Filter extender, and is much more sensible.
2021-03-11 23:12:49 -05:00
flarum-bot
4e126708e9 Bundled output for commit b88a7cb33b [skip ci] 2021-03-09 03:46:55 +00:00
Alexander Skvortsov
b88a7cb33b Search: dont adjust height if not rendered 2021-03-08 22:45:39 -05:00
flarum-bot
a2f52c09fd Bundled output for commit 30017eef09 [skip ci] 2021-03-08 21:31:49 +00:00
Alexander Skvortsov
30017eef09 Send username as author filter value instead of id.
For consistency with the Discussion AuthorFilterGambit, this should be sent usernames, not numerical ids.
2021-03-08 16:29:48 -05:00
flarum-bot
d0ffa26b0b Bundled output for commit 612a57c466 [skip ci] 2021-03-08 21:25:06 +00:00
Alexander Skvortsov
612a57c466 Use new author key for filtering posts
Fixes https://github.com/flarum/core/issues/2671
2021-03-08 16:21:36 -05:00
Alexander Skvortsov
91e8b56961 Add deprecated "user" filter for posts
In the filterer refactor for ListPostsController, the filter key was changed to `author` for consistency with the AuthorFilterGambit used in discussions. This commit adds a deprecated `user` filter back in for a release to allow for a graceful transition
2021-03-08 16:20:26 -05:00
flarum-bot
ba9665e9db Bundled output for commit 8eea0985a4 [skip ci] 2021-03-07 22:37:00 +00:00
Alexander Skvortsov
8eea0985a4 Split JSDoc directives to separate lines. 2021-03-07 17:35:58 -05:00
flarum-bot
1bcb9d3ea1 Bundled output for commit 2c3e1f9923 [skip ci] 2021-03-07 21:33:50 +00:00
Alexander Skvortsov
2c3e1f9923 Use flarum/testing for test infrastructure (#2545) 2021-03-07 16:32:41 -05:00
Sami Mazouz
bc607e089e Eagerload some needed relations in ListDiscussionsController (#2639) 2021-03-07 16:32:23 -05:00
Sami Mazouz
91d5d9c176 Use absolute positioning for the Composer on Safari (#2660) 2021-03-07 16:31:46 -05:00
Alexander Skvortsov
3aa118ab94 Fix search box out of screen (#2650)
Programatically set search results max height
2021-03-07 16:31:23 -05:00
Daniël Klabbers
4b0ad6972d added optional powered-by header (#2618) 2021-03-05 10:05:13 -05:00
Daniël Klabbers
84ded0ce50 Laravel components v8 (#2576)
- update actions ci
- include json for 4 spaces tab
- provide output int for process code exit
- adhere to parent type hint of builder
- mailer instance now needs a name, multiple can be instantiated
- getOriginal now uses mutators in the model
- Temporarily loosen MailableInterface requirements. This avoids an immediate BC break for classes in extensions that implement this interface.
- Temporarily provide (and autoload) old symfony translator interface
- make queue exception handler compatible with the contract of L8
- Update phpunit schema for newer version
- Update phpunit assert calls for newer version
2021-03-05 09:43:35 -05:00
Sami Mazouz
725863a6e2 Move TextEditor styles to common (#2661)
Now that TextEditor js component is shared, it only makes sense to also 
have its styles shared
2021-03-05 08:14:19 -05:00
Alexander Skvortsov
c81f629b0b Rename app to container (#2609)
* Rename `app` helper to `resolve`, deprecate old version
* Rename $this->app to $this->container in service providers

We no longer couple Flarum\Foundation\Application to the Laravel container; instead, we use the container separately. Changing our naming to reflect that will make things clearer.
2021-03-04 22:14:48 -05:00
flarum-bot
15cbe4daaa Bundled output for commit ddac07d991 [skip ci] 2021-03-04 21:52:50 +00:00
Alexander Skvortsov
ddac07d991 Move TextEditor to common (#2649) 2021-03-04 16:51:34 -05:00
Clark Winkelmann
08ba2599d7 Refactor Access Tokens (#2651)
- Make session token-based instead of user-based
- Clear current session access tokens on logout
- Introduce increment ID so we can show tokens to moderators in the future without exposing secrets
- Switch to type classes to manage the different token types. New implementation fixes #2075
- Drop ability to customize lifetime per-token
- Add developer access keys that don't expire. These must be created from the database for now
- Add title in preparation for the developer token UI
- Add IP and user agent logging
- Delete all non-remember tokens in migration
2021-03-04 16:50:38 -05:00
Blake Payne
8eef7230e9 Updated GroupFilterGambit to prevent hidden groups being visible wher… (#2657)
Updated GroupFilterGambit to prevent hidden groups being visible where they shouldn't be and to ensure that only the selected groups are returned on a search. Fixes #2559
2021-03-04 10:08:12 -05:00
flarum-bot
a61f9e7328 Bundled output for commit a65e1de641 [skip ci] 2021-03-03 23:52:04 +00:00
daniellesniak
a65e1de641 Convert common helpers to Typescript (#2541) 2021-03-03 18:50:54 -05:00
Alexander Skvortsov
bed3207798 Fix CI (#2654) 2021-03-03 08:48:03 -05:00
Alexander Skvortsov
fc73d47e4c Deprecate event helper (#2608) 2021-03-02 16:21:30 -05:00
Clark Winkelmann
6e01c47c11 Restrict who can use the lastSeenAt user sort (#2634) 2021-03-02 09:59:14 -05:00
Alexander Skvortsov
a9526917b8 Query Namespace (#2645)
Move shared classes in search and filter namespaces to a new query namespace
2021-03-02 09:57:40 -05:00
Clark Winkelmann
e37fdef709 Hide boot error (#2633)
Completely redact boot error unless debug mode or display_errors is enabled. Attempt to use Flarum log file when possible. Fixes #2290
2021-03-02 09:57:06 -05:00
flarum-bot
56d7796c47 Bundled output for commit b7379bf91b [skip ci] 2021-03-01 22:27:09 +00:00
Charlie
b7379bf91b Simplify Extension Categories (#2604) 2021-03-01 17:25:55 -05:00
Emamul Khan
7fa22a131f clear cache files from storage/views (#2648)
Co-authored-by: Emamul Khan <emamul.khan@oxid-esales.com>
2021-03-01 13:45:19 -08:00
flarum-bot
f0c6050654 Bundled output for commit 9627eb73f1 [skip ci] 2021-03-01 20:53:52 +00:00
Matt Kilgore
9627eb73f1 User edit permission tightening (#2620)
- Split user edit permision into edit attributes, edit credentials, and edit groups
- Only Admins can edit Admin Credentials
- Only Admins can Promote/Demote to/from Admin
2021-03-01 15:52:29 -05:00
Alexander Skvortsov
d0adb244da Fix missing PostRepository argument
This was accidentially removed in 458a5cc6be
2021-03-01 00:30:04 -05:00
Alexander Skvortsov
458a5cc6be Use filterer for ListPostsController (#2479) 2021-02-28 14:06:07 -05:00
Sami Mazouz
ea840ba594 Allow overriding routes (#2577) 2021-02-28 14:01:30 -05:00
flarum-bot
ea291508ab Bundled output for commit 7d79912d36 [skip ci] 2021-02-26 21:18:01 +00:00
Alexander Skvortsov
7d79912d36 Editor Driver Abstraction (#2594)
This will allow drop-in replacements of the editor with a more advanced WYSIWYG solution such as ProseMirror
2021-02-26 16:17:05 -05:00
Sami Mazouz
67306a9d34 Fix keyboard on small mobile screens hiding composer (#2631) 2021-02-26 16:07:29 -05:00
Matt Kilgore
8cc207b139 Centralized IP Handler (#2624) 2021-02-25 20:08:52 -05:00
Alexander Skvortsov
023871ef86 Search Filter Split, Use Same Controller (#2454) 2021-02-24 11:17:40 -05:00
Alexander Skvortsov
1c578a83e4 Recalculate enabled extensions and their dependencies if some listed in settings aren't installed (#2629) 2021-02-23 17:57:53 -05:00
flarum-bot
454c525cb2 Bundled output for commit 49009d268f [skip ci] 2021-02-23 19:23:05 +00:00
Alexander Skvortsov
49009d268f NotificationList: Fix load on mobile
Followup to https://github.com/flarum/core/pull/2524.

In that PR, we fixed infinite scroll for the panel, but accidentially used document.body. Since scrollTop on body is (almost always) 0, this means that new pages of notifications were loaded on every scroll, which quickly becomes overwhelming. Instead, we can use `document.documentElement` for getting scrollTop, which results in the expected behavior.
2021-02-23 14:21:18 -05:00
Daniël Klabbers
ef2d6a65f4 Update composer.json (#2625)
update authors
2021-02-23 10:32:03 +01:00
Alexander Skvortsov
509adf228a Refactor password checker, add extender (#2176) 2021-02-22 17:08:36 -05:00
Alexander Skvortsov
fa10d794a4 Optional Dependencies (#2579)
* Add and calculate optional dependencies
* Add extension dependency resolver (Kahn's algorithm), plus unit tests
* Resolve extension dependency on enable/disable
2021-02-21 13:49:33 -05:00
Alexander Skvortsov
40ede179cd Adminux Patch Translations (#2616) 2021-02-19 16:12:11 -05:00
KyrneDev
0ed71ed581 Adminux locale 2021-02-19 13:03:26 -08:00
KyrneDev
dc75ebad00 Adminux locale 2021-02-19 13:02:42 -08:00
flarum-bot
900711687f Bundled output for commit 71ccdc00e6 [skip ci] 2021-02-18 23:46:54 +00:00
Charlie
71ccdc00e6 AdminUX Patch and Admin Page (#2593)
* AdminPage

* More fixes

* Settings Modal Drop

* Translation and docblock

* settingS

* Convert Fieldset to JSX

* info -> headerInfo, className

* Overflow fixes

* MailPage

* Admin Less

* Basics Page

* Changes

* Cleanup

* Permission Page

* Add padding
2021-02-18 15:45:43 -08:00
Robert Korulczyk
c4ebebe48e Move locale files from language pack to core (#2408) 2021-02-17 16:23:13 -05:00
flarum-bot
56d8301b2d Bundled output for commit 09076e005b [skip ci] 2021-02-17 15:37:58 +00:00
Alexander Skvortsov
09076e005b Various iOS scroll improvements (#2548)
* Don't update scrubber while post pages loading

This alleviates the scrubber bouncing around when scrolling up on iOS

* Throttle loadMore loadPrevious

Throttle loadMore and loadPrevious functions to alleviate skipping over pages and pages of posts during one scroll. This sometimes happens on iOS
2021-02-17 10:36:30 -05:00
Billy Wilcosky
73a8efaec2 Update DiscussionListItem.less to fix double tap on mobile (#2607)
Adds a rule to the discussion list less file which targets touch devices whose primary way of interacting does not include a mouse / ability to hover. For those devices the toggle button is hidden which fixes the double tap issue.
2021-02-17 08:51:09 -05:00
flarum-bot
cdeb229396 Bundled output for commit 122a99b51e [skip ci] 2021-02-16 22:49:29 +00:00
Charlie
122a99b51e Don't push bidi function to DOM (#2602) 2021-02-16 17:48:16 -05:00
Alexander Skvortsov
e7aed89e8f Broader support for callables in ContainerUtil (#2596)
It can be very annoying if we want to use something like boolval, but have to define an entire anonymous function to pass it in. This PR adds support for tpassing it in directly as a string, like is posible with User::registerPreference.
2021-02-10 14:51:31 -05:00
flarum-bot
a1254bc21a Bundled output for commit 03231b2931 [skip ci] 2021-02-10 19:23:42 +00:00
Wadim Kalmykov
03231b2931 PostStream: Fix minor load more issue (#2388) 2021-02-10 14:22:26 -05:00
flarum-bot
a2901cef23 Bundled output for commit 95b021a839 [skip ci] 2021-02-10 18:55:13 +00:00
Ian Morland
95b021a839 Add user badges to post preview #1765 (#2555) 2021-02-10 13:53:59 -05:00
Alexander Skvortsov
76d6442557 Simple Flarum Search Extender and tests (#2483) 2021-02-10 09:59:23 -05:00
flarum-bot
5df22e92ae Bundled output for commit 7306d8ef13 [skip ci] 2021-02-10 14:11:35 +00:00
Alexander Skvortsov
7306d8ef13 Export DiscussionListPane in compat
We forgot to do this in beta 14 when introducing the component.

Fixes https://github.com/flarum/core/issues/2591
2021-02-10 09:09:58 -05:00
Sami Mazouz
0595aba76a Rename ApiSerializer's mutate to attributes (#2578) 2021-02-05 13:21:36 -05:00
Alexander Skvortsov
8366ec720e Deprecate GetModelIsPrivate, replace with extender (#2587) 2021-02-04 10:56:10 -05:00
David Wheatley
17f15e36eb Correct non-existent cursor value (disallowed -> not-allowed) (#2585) 2021-02-01 08:58:41 -05:00
flarum-bot
ac249e5b07 Bundled output for commit e13772075c [skip ci] 2021-01-30 22:46:26 +00:00
David Sevilla Martín
e13772075c Navigate to dashboard page if extension ID not found (#2584) 2021-01-30 17:45:20 -05:00
flarum-bot
0fa33439d7 Bundled output for commit a4880453a4 [skip ci] 2021-01-30 22:44:46 +00:00
David Sevilla Martín
a4880453a4 Set this.changingState back to false in ExtensionPage if an error occurs (#2558) 2021-01-30 17:43:28 -05:00
Daniël Klabbers
964f827ee5 Fixes model visibility (#2580)
Model Visibility extender does not take into consideration missing
dependencies. For instance flarum/tags adds a policy on the Flag model
from flarum/flags. But because flarum/flags might as well not be
installed we need to check for the existence of that model. Otherwise
the exception is thrown or flarum fails to boot.
2021-01-29 08:13:16 -05:00
David Sevilla Martín
843daf633d Use extension names instead of IDs when erroring on enable/disable reqs (#2563) 2021-01-28 19:41:04 -05:00
David Sevilla Martín
930fcf9250 Make disabled extension dot a red border instead of red background (#2562) 2021-01-27 08:04:19 -05:00
flarum-bot
9bb4423dd7 Bundled output for commit 9347b12b47 [skip ci] 2021-01-27 05:04:48 +00:00
Alexander Skvortsov
9347b12b47 BasicsPage: fix "show language selector" default
Since some boolean settings might be stored as string "0" or "1", the previous system no longer works, and it always sets the switch to true. The "no setting" check has been changed to reference `undefined`, so now the switch will only be defaulted to `true` if the setting truly hasn't been set.

Fixes https://github.com/flarum/core/issues/2574
2021-01-27 00:03:30 -05:00
Daniël Klabbers
65b5c2043c PHP 8 support, cookie unit tests (#2507) 2021-01-26 17:53:28 -05:00
flarum-bot
08f72e7135 Bundled output for commit 26c4e492fe [skip ci] 2021-01-26 01:54:28 +00:00
Alexander Skvortsov
26c4e492fe Remove unused variable 2021-01-25 20:53:07 -05:00
Alexander Skvortsov
00913d5b0b ChangeEmailModal: dismiss alert on new request
Removing old errors at the beginning of the next request, rather than at the end of the next successful request, makes it clearer that any new errors are caused by the new inputs.

See https://github.com/flarum/core/pull/2467#issuecomment-749832787
2021-01-25 20:52:21 -05:00
flarum-bot
1851d1678e Bundled output for commit 14dc46e226 [skip ci] 2021-01-24 19:06:21 +00:00
David Wheatley
14dc46e226 Add missing a11y attributes (#2564) 2021-01-24 14:05:14 -05:00
flarum-bot
be163412ab Bundled output for commit 92d5c716be [skip ci] 2021-01-24 17:13:48 +00:00
Alexander Skvortsov
92d5c716be Fix notification panel infinite scroll (#2524)
Improves calculations for determining whether we are at the bottom of the notifications panel (which would trigger infinite scroll). This should be particularly effective in fixing issues on smaller screens.
2021-01-24 12:12:42 -05:00
Alexander Skvortsov
e42df50d31 Merge pull request #2557 from flarum/as/remove-deprecated
Remove deprecated PHP events, bootstrap.php fallback
2021-01-23 16:52:38 -05:00
Alexander Skvortsov
203a6456ee Remove deprecated bootstrap.php support
See https://github.com/flarum/core/issues/1557
2021-01-23 16:48:29 -05:00
Alexander Skvortsov
40b918e139 Remove deprecated API events 2021-01-23 16:48:22 -05:00
flarum-bot
f8eea5b7c7 Bundled output for commit b50d806534 [skip ci] 2021-01-23 21:44:56 +00:00
daniellesniak
b50d806534 Convert highlight helper to Typescript (#2532) 2021-01-23 16:43:40 -05:00
Alexander Skvortsov
cbcf83ed3b Remove deprecated formatting events 2021-01-20 16:25:32 -05:00
Alexander Skvortsov
3394ff31e9 Remove deprecated UserPreferences event 2021-01-20 15:23:56 -05:00
Alexander Skvortsov
86d39fb003 Remove deprecated floodgate 2021-01-20 15:23:30 -05:00
Alexander Skvortsov
bbb7679417 Remove deprecated notification events 2021-01-20 15:23:30 -05:00
Alexander Skvortsov
46248f601d Remove deprecated validation events 2021-01-20 15:23:30 -05:00
Alexander Skvortsov
a68e2b27a4 Remove deprecated post types event 2021-01-20 15:22:28 -05:00
Alexander Skvortsov
e2335e867d Remove deprecated policy and visibility scoping events 2021-01-20 15:21:30 -05:00
Alexander Skvortsov
a10da427ff Remove deprecated CSRF wildcard path match 2021-01-20 12:01:52 -05:00
flarum-bot
4561f56fb9 Bundled output for commit fae79ea910 [skip ci] 2021-01-19 22:40:14 +00:00
Alexander Skvortsov
fae79ea910 Bring m.attrs.bidi in as a util
We previously used the tobscure/m.attrs.bidi github repo, but that repo was recently taken offline. We decided to integrate it as a util instead of publishing it as a separate package since we seem to be the only project using it, and adopting it into a new project requires barneycarroll/mattr, which does not seem to be used anywhere.

The code added here was taken from https://github.com/askvortsov1/m.attrs.bidi, a fork (without changes) of the tobscure repo. Support for alternative module systems and ways of registering bidi were removed, and the file was formatted in compliance with our prettier config.
2021-01-19 17:30:03 -05:00
Alexander Skvortsov
9493e6230d NotificationTest: Rely on adminUser from installation 2021-01-19 17:05:53 -05:00
Sami Mazouz
927ea4eec5 Add Notification extender beforeSending method (#2533) 2021-01-19 14:40:19 -05:00
Alexander Skvortsov
89e821e70f Policies: treat true as allow, and false as deny (#2534) 2021-01-18 18:28:48 -05:00
Alexander Skvortsov
9b2d7856d1 Add subscribe method to event extender (#2535)
Historically, extensions using subscribers has caused problems because subscribers were constructed/applied at extension boot. This caused some classes (e.g. UrlGenerator) to be resolved early, breaking parts of Flarum. For this reason, subscriber support wasn't included in the initial version of the Event extender.

However, updating extensions has shown that there is a legitimate use case for subscribers in organizing clean code; for instance, core's own `DiscussionMetadataUpdater`.

This commit introduces support for subscribers, but only applies them after the app has booted, which avoids the early resolution issues. Since event listeners/subscribers are only intended to be used with domain events, which would never be dispatched during app boot, the late activation of subscribers should not cause issue.
2021-01-15 20:33:29 -05:00
flarum-bot
f93ec1b3b8 Bundled output for commit 2e3197d510 [skip ci] 2021-01-13 22:50:31 +00:00
Wadim Kalmykov
2e3197d510 Fix DiscussionListPane jumping around (#2402)
Ensure that scroll position is retained between page changes, so if navigating via the sidebar, you don't need to re-scroll down every time.
2021-01-13 17:49:26 -05:00
Alexander Skvortsov
85210ff6a1 Merge pull request #2304 from flarum/fl/tests-in-transaction
Run Backend Tests in Transactions
2021-01-12 21:26:59 -05:00
Alexander Skvortsov
e5f277e640 Apply fixes from StyleCI
[ci skip] [skip ci]
2021-01-09 00:36:07 -05:00
Alexander Skvortsov
4bac667dfd Fix fulltext search tests
Under InnoDB, database entries created in transactions are not processed by fulltext indexes until the transaction is committed. To work around this, cases that test fulltext search have been split off into a separate class that adds and removes seed discussions/posts outside of transactions during setUp/tearDown.
2021-01-09 00:35:55 -05:00
Alexander Skvortsov
6771b3e3b7 Tests: purge settings cache
Some tests need to change settings, but since MemoryCacheSettingsRepository caches settings in-memory, those changes aren't reflected. The new `purgeSettingsCache` removes it from the container, eliminating that cache.

For UserTest, we also need to regenerate the display name driver, since that's set statically on boot, before we'll get a change to clear the settings cache.
2021-01-09 00:35:55 -05:00
Alexander Skvortsov
fd79a14cac Tests: Add missing instantiation of data 2021-01-09 00:35:55 -05:00
Alexander Skvortsov
c1aa1455d3 Tests: Comply with default permissions
Before transactions, each test class would need to explicitly state starting state for permissions, which made the initial permission configuration somewhat arbitrary. Now, we might as well use the initial state of the default installation.

One of the User show_test tests has been commented out until
2021-01-09 00:35:55 -05:00
Alexander Skvortsov
ae280016e7 Tests: remove prepDb workaround
Previously, the `prepareDatabase` method would directly modify the database, booting the app in the process. This would prevent any extenders from being applied, since `->extend()` has no effect once the app is booted.

Since the new implementation of `prepareDatabase` simply registers seed data to be applied during app boot, the workaround of sticking this seed data into `prepDb` is no longer necessary, and seed data common to all test cases in a class can be provided in `setUp`.

When needed, app boot is explicitly triggered in individual test cases by calling `$this->app()`.
2021-01-09 00:35:55 -05:00
Alexander Skvortsov
0a8816938a Add @inheritDoc to all setUp and tearDown methods 2021-01-09 00:35:55 -05:00
Franz Liedke
008ec95505 Boot app explicitly to run seeds in time 2021-01-09 00:35:47 -05:00
Alexander Skvortsov
925628c208 Add vscode config to gitignore 2021-01-07 23:27:32 -05:00
Alexander Skvortsov
aae83c4fbc Fix deleting posts/discussions by deleted user (#2521)
Making the $user argument nullable prevents this unnecessary exception, and doesn't introduce any issues since we check that $user exists as part of the method.
2021-01-07 17:46:14 -05:00
Franz Liedke
cacc8b4945 Tests: Always start transaction before seeding 2021-01-07 17:34:13 -05:00
Franz Liedke
31765388c1 Tests: Stop using Eloquent models for seeding data 2021-01-07 17:34:13 -05:00
Franz Liedke
a08fd3e475 Tests: Rely on admin user, groups, permissions from test setup script 2021-01-07 17:34:06 -05:00
flarum-bot
d4b2d89da0 Bundled output for commit 9b27b0d9d7 [skip ci] 2021-01-07 15:26:14 +00:00
Sami Mazouz
9b27b0d9d7 Fix composer header hidden by mobile browser (#2279) 2021-01-07 10:25:12 -05:00
Franz Liedke
a47187462d Tests: DB tables no longer need to be truncated 2021-01-05 22:48:09 -05:00
Franz Liedke
843a149b80 Run integration tests in a transaction 2021-01-05 22:47:19 -05:00
Alexander Skvortsov
94381dca62 Fix IOS scroll menu bug (#2527)
Fixes https://github.com/flarum/core/issues/1959

These transform lines are known to cause issues on iOS, and were added to hack around chrome issues that have since been fixed upstream.
2021-01-05 19:40:11 -05:00
Sami Mazouz
a2d5dd3397 Add default value to Settings extender (#2495) 2021-01-05 01:28:25 -05:00
Daniël Klabbers
f8edc2d827 npm audit fix 2020-12-20 20:55:51 +01:00
flarum-bot
62235a16ca Bundled output for commit 36c55e8f69 [skip ci] 2020-12-20 17:15:07 +00:00
Sami Mazouz
36c55e8f69 Add ExtensionPermissionGrid to compat (#2501) 2020-12-20 12:14:00 -05:00
Daniël Klabbers
859f014539 beta 15 changelog and version constant 2020-12-18 20:02:22 +01:00
Daniël Klabbers
06e1d21331 Fixes validation failures of avatars that are jpg/jpeg (#2497)
Due to a commit by @fabpot in october, the mimetypes symfony class
now re-orders the shortened mimetypes that are returned when looking
up based on header mimetype. Our validator uses the first key, pops
the prefix off and then matches against our hardcoded array.

I've added a constraint to symfony/mime ^5.2.0 which ships with this change.
This constraint is fully compatible with our current lineup. In addition
I changed the hardcoded array to use the first entry from symfony mime types
now `jpg` instead of `jpeg`.
2020-12-16 13:53:17 -05:00
flarum-bot
fd5de6929e Bundled output for commit 84b1666b24 [skip ci] 2020-12-15 22:50:49 +00:00
Alexander Skvortsov
84b1666b24 Support multiple callback-based settings per-extension 2020-12-15 17:49:24 -05:00
Alexander Skvortsov
0c61fcc61c Clarify that request argument of render callbacks for Formatter must be either nullable or omitted 2020-12-14 17:20:35 -05:00
Alexander Skvortsov
8e25bcb68f Deprecate CheckingForFlooding
This should have been done earlier as part of the ThrottleApi PR
2020-12-14 17:12:05 -05:00
flarum-bot
fad783547c Bundled output for commit 210a6b3e25 [skip ci] 2020-12-14 19:07:44 +00:00
Alexander Skvortsov
210a6b3e25 Fix scroll on long discussions
- Anchor scroll when inserting post placeholders
- Indicate that pages are loading at start of `loadPage`, which allows `onscroll` to not request that multiple pages be loaded at the same time

These changes are particularly applicable to firefox, where previously, dozens of posts could be skipped at a time if scroll up was held while at the top of the viewport.
2020-12-14 14:06:32 -05:00
Ian Morland
73409184b9 Fix wrong namespace in docblock (#2494) 2020-12-12 15:36:25 -05:00
Alexander Skvortsov
afe038699e Fix composer json attribute path to links override section 2020-12-08 19:29:59 -05:00
Sami Mazouz
649851d356 Remove header bottom border (#2489) 2020-12-08 19:15:14 -05:00
Alexander Skvortsov
d1dfa758e4 Policy Extender and Tests (#2461)
Policy application has also been refactored, so that policies return one of `allow`, `deny`, `forceAllow`, `forceDeny`. The result of a set of policies is no longer the first non-null result, but rather the highest priority result (forceDeny > forceAllow > deny > allow, so if a single forceDeny is present, that beats out all other returned results). This removes order in which extensions boot as a factor.
2020-12-08 19:10:06 -05:00
Alexander Skvortsov
8901073d12 Model Visibility Scoping Extender and Tests (#2460) 2020-12-07 20:02:46 -05:00
flarum-bot
e0437d237a Bundled output for commit 07a43f52b4 [skip ci] 2020-12-07 20:15:49 +00:00
Charlie
07a43f52b4 AdminUX Overhaul Small Patches (#2468) 2020-12-07 15:14:22 -05:00
flarum-bot
9e9118fa0d Bundled output for commit 4679448300 [skip ci] 2020-12-07 18:35:10 +00:00
Matt Kilgore
4679448300 Slug Driver Support (#2456)
- Support slug drivers for core's sluggable models, easily extends to other models
- Add automated testing for affected single-model API routes
- Fix nickname selection UI
- Serialize slugs as `slug` attribute
- Make min search length a constant
2020-12-07 13:33:42 -05:00
flarum-bot
ef4bf8128e Bundled output for commit 67a2aac635 [skip ci] 2020-12-07 18:26:51 +00:00
David Sevilla Martín
67a2aac635 Replace forum and admin global compat exports with a Proxy to allow namespace use (#2488) 2020-12-07 13:25:24 -05:00
Sami Mazouz
51a97fb12e ApiController Extender and Tests (#2451) 2020-12-06 15:07:48 -05:00
Sami Mazouz
056d420c7b Pass callback wrapper parameters by reference (#2485)
Because invokable class objects are not directly called and instead it's the callback wrapper that calls these objects, it's currently not possible to receive arguments by reference on an invokable class.

To fix this we pass the arguments by reference by default when calling the object in the callback wrapper.
2020-12-06 14:58:45 -05:00
Sami Mazouz
cfa533ebd6 Add Settings Extender (#2452) 2020-12-04 17:20:06 -05:00
Alexander Skvortsov
eed407812f User Preferences Extender and Tests (#2463) 2020-12-04 15:45:08 -05:00
Daniël Klabbers
641619e820 Fixes issue with the worker defaulting to the illuminate queue manager (#2481)
We are instantiating our own queue handling factory which returns the
flarum.queue.connection binding no matter what. The queue Worker and
other queue related code rely on this manager to get its thing going.
Therefor we need to re-use our own factory everywhere, including in
the worker.
2020-12-02 13:19:25 -05:00
Alexander Skvortsov
984f751c71 Use process isolation for integration tests 2020-12-01 19:33:24 -05:00
flarum-bot
8830e9dd09 Bundled output for commit fe41bc1fdc [skip ci] 2020-12-01 16:22:59 +00:00
Alexander Skvortsov
fe41bc1fdc Remove Deprecated Beta14 Code (#2428) 2020-12-01 11:21:28 -05:00
Nina Pypchenko
5a763050a6 DRY up image uploading code (#2477) 2020-12-01 10:42:05 -05:00
Sami Mazouz
8c813bc340 ApiSerializer Extender (#2438) 2020-11-30 19:24:50 -05:00
flarum-bot
f67dee0a9e Bundled output for commit f968420216 [skip ci] 2020-11-30 19:02:41 +00:00
Alexander Skvortsov
f968420216 Don't use browser scroll restore in DiscussionPage (#2476)
Although native browser scroll restorations have become quite powerful, it interferes with Flarum's PostStream, so if we're on a DiscussionPage, we use manual scroll restoration.
2020-11-30 14:01:08 -05:00
flarum-bot
d5e124b4a2 Bundled output for commit 09e2736cbc [skip ci] 2020-11-29 23:34:50 +00:00
Alexander Skvortsov
09e2736cbc Fix goToIndex to visible end
In the PostStream, `this.visibleEnd` represents the index of the last post + 1, but `loadNearIndex` treated it as if it was the index of the last post. This means that executing `goToIndex` on the post stream's current `this.visiblePost` didn't load new posts, and as a result, the requested scrolling did not occur.
2020-11-29 18:33:29 -05:00
flarum-bot
ddb3d3edb0 Bundled output for commit 28d56f5fc8 [skip ci] 2020-11-29 22:47:21 +00:00
Alexander Skvortsov
28d56f5fc8 Merge pull request #2465 from flarum/0.1.0-beta.14.1 2020-11-29 17:45:58 -05:00
Alexander Skvortsov
9b4012bbb5 Reset dist js 2020-11-29 17:41:16 -05:00
Alexander Skvortsov
1a5e4d454e Move floodgate to middleware, add extender + integration tests (#2170) 2020-11-29 17:13:22 -05:00
sl-kr
387b4fd315 update a user's comment count if deleting a discussion (#2472) 2020-11-29 17:11:05 -05:00
flarum-bot
66482c2815 Bundled output for commit 277a5c3fac [skip ci] 2020-11-26 22:54:38 +00:00
Mohammad Reza
277a5c3fac Clear error alerts in change email modal on success (#2467) 2020-11-26 17:53:38 -05:00
Nina Pypchenko
286d8dec5b Update tsconfig file to include .tsx files (#2457) 2020-11-26 12:00:13 -05:00
flarum-bot
e1c61a0e85 Bundled output for commit 102e76b084 [skip ci] 2020-11-26 06:56:10 +00:00
Alexander Skvortsov
102e76b084 Defer clearing discussion list on discussion start
This prevents an edge case where `app.discussions` is considered empty while the new page is loading, and as a result, the side pane isn't set as "enabled". Then, if the pane has previously been pinned, when the page loads and the side pane appears, it covers up part of the discussion page.

Fixes https://github.com/flarum/core/issues/2471
2020-11-26 01:54:28 -05:00
flarum-bot
d09d4bc507 Bundled output for commit c3989cc952 [skip ci] 2020-11-24 17:46:02 +00:00
Charlie
c3989cc952 AdminUX Overhaul (#2409)
- Extensions now have their own pages
- The API for extensions to register permissions and settings has been overhauled via the `flarum/admin/utils/ExtensionData` util
- An extension grid has been added as a widget to the Dashboard page
2020-11-24 12:44:40 -05:00
flarum-bot
9cb9097b24 Bundled output for commit 571a835be0 [skip ci] 2020-11-14 22:23:04 +00:00
Wadim Kalmykov
571a835be0 Fix mobile PostStream top scroll adjustment & remove App:before (#2385)
- remove App:before so we can use #app-navigation to access the mobile header
- fix mobile postStream scroll top margin adjustment
2020-11-14 17:21:38 -05:00
Alexander Skvortsov
0c95774333 Refactor Route Resolving and Dispatch (#2425)
- Split DispatchRoute. This allows us to run middleware after we figure out which route we're on, but before we actually execute the controller for that route.
- By making the route name explicitly available to middlewares, applications like CSRF and floodgate can set patterns based on route names instead of the path, which is an implementation detail.
- Support using route name match for CSRF extender, deprecate path match
2020-11-10 12:52:12 -05:00
Nina Pypchenko
67741c7a6f Make checkbox switch component background stand out in modals (#2443) 2020-11-09 20:54:21 -05:00
Alexander Skvortsov
f5cfec15e3 Add missing import 2020-11-08 21:49:11 -05:00
Alexander Skvortsov
47d2eee9ce Fix Callables for Extenders (#2423)
- Standardize signatures and variable names for extenders that take callbacks
- Adjust model extender docblock to clarify that default calue can't be an invokable class.
- Make invokable classes provided to Model->relationship
- Add integration tests to ensure Model->relationship and User->groupProcessor extenders accept callbacks
- Extract code for wrapping callbacks into central util
2020-11-08 21:36:38 -05:00
Nina Pypchenko
c10cc92deb Improved Permissions Error Messages for Initial Install (#2435)
- Made the wording of the error more generic
- Added link to the relevant section in the installation guide

Resolves #2327.
2020-11-07 14:48:11 -05:00
Sami Mazouz
529d2edcaf Add Service Provider Extender (#2437) 2020-11-06 13:30:10 -05:00
Sami Mazouz
f0e77a5789 Add Notification Channel Extender (#2432) 2020-11-05 12:09:06 -05:00
Alexander Skvortsov
87c258b2f8 Refactor and improve formatter extender (#2098)
- Deprecated all events involved with Formatter
- Refactor ->configure() method on extender not to use events
- Add extender methods for ->render() and ->parse()
- Add integration tests
2020-11-03 13:05:33 -05:00
Alexander Skvortsov
cee87848fe Added post extender with type method, deprecated ConfigurePostTypes (#2101) 2020-11-03 10:43:49 -05:00
Daniël Klabbers
967cd0e3ca update version constant for beta 14.1 2020-11-02 13:53:20 +01:00
Daniël Klabbers
b79152b977 bundled output for js changes beta 14.1 2020-11-02 11:53:27 +01:00
Daniël Klabbers
ace624db66 changelog for v0.1.0-beta.14.1 2020-11-02 11:51:24 +01:00
Alexander Skvortsov
5842dd1200 Validator extender (#2102)
Added validator extender, integration tests, and deprecated related Validating event
2020-11-01 11:31:16 -05:00
Sami Mazouz
b311512502 Add Notification Type Extender and Tests (#2424) 2020-10-31 17:17:14 -04:00
Alexander Skvortsov
9b9f2c4bb7 Fix exiting composer while in fullscreen mode. 2020-10-30 20:44:52 -04:00
flarum-bot
0b2a5fa5b8 Bundled output for commit 52e45aacad [skip ci] 2020-10-31 00:28:56 +00:00
Lucas Henrique
52e45aacad Convert common time helpers to Typescript (#2391) 2020-10-30 20:27:40 -04:00
Alexander Skvortsov
8b1de457bf Fix broken page title logic on subpath installs
The base path needs to be accounted for when calculating whether we're on the default route.
2020-10-30 14:18:09 -04:00
Alexander Skvortsov
21c2a4b2a4 Updater should show on any subpath, like installer (#2426) 2020-10-30 13:28:20 -04:00
flarum-bot
12c03dc4e1 Bundled output for commit d2927cfdb9 [skip ci] 2020-10-29 16:54:36 +00:00
Alexander Skvortsov
d2927cfdb9 Ensure scripts provided by textformatter are run (#2415) 2020-10-29 12:53:23 -04:00
Daniël Klabbers
24b7a21507 Update Symfony components to v4 (#2407)
This matches the Symfony dependencies of our laravel dependencies.
2020-10-27 17:12:36 -04:00
flarum-bot
c9a04fe009 Bundled output for commit bd7fa11b5a [skip ci] 2020-10-25 17:36:51 +00:00
Alexander Skvortsov
bd7fa11b5a Export SuperTextarea util in compat 2020-10-25 13:35:15 -04:00
Daniël Klabbers
7055f6d941 update version constant 2020-10-20 16:34:54 +02:00
Alexander Skvortsov
f765001f06 Update email 2020-10-20 10:32:24 -04:00
Daniël Klabbers
683739a617 changelog v0.1.0-beta.14 and added core developer @askvortsov1 2020-10-20 16:24:43 +02:00
flarum-bot
69b7fe8d01 Bundled output for commit 1936b9117d [skip ci] 2020-10-17 17:43:39 +00:00
Alexander Skvortsov
1936b9117d Page Scroll Cleanup (#2396)
- Reintroduce cancellable scroll top on page change
- IndexPage: rely on browser to retain scroll position on page reload
- Remove obsolete browser hack
- Fix broken selector
- When on mobile, only retain scroll for IndexPage if we're coming from a discussion
- Move app.cache.scrollTop save into `onbeforeremove` so we make sure to do it before DOM is detached
2020-10-17 13:42:33 -04:00
flarum-bot
d53eeded44 Bundled output for commit 0650788e7c [skip ci] 2020-10-16 20:32:13 +00:00
Alexander Skvortsov
0650788e7c Fix scolling to first post via m.route.set
The default first post number is '1', so we scroll to that if we're calling `m.route.set` without a `near` parameter, as that means we're scrolling to the top.

This was present in beta 13's implementation, but accidentially omitted in 988b6c9.

We also remove unnecessary typecasting for simpler logic and increased consistency with beta 13.
2020-10-16 16:30:27 -04:00
flarum-bot
6a77184611 Bundled output for commit a8b36cb76d [skip ci] 2020-10-16 20:05:15 +00:00
Alexander Skvortsov
a8b36cb76d Fix check for going between discussion pages.
The current implementation for checking whether we are on a discussion page, and going to a discussion page, checks the route we are going to. This is problematic, because the route resolver represents the route being considered, not the route we are currently on. So, if we are currently using a DiscussionPageResolver, we must be going to a route handled by DiscussionPage. Instead, we need to check the route that we are currently on, which is done via `app.current.matches(DiscussionPage)`.
2020-10-16 16:03:32 -04:00
flarum-bot
5cd14d594b Bundled output for commit f4ad9d2d5a [skip ci] 2020-10-16 16:07:09 +00:00
Alexander Skvortsov
f4ad9d2d5a Fix scrolling to reply via 'reply' as near parameter 2020-10-16 12:04:45 -04:00
Alexander Skvortsov
d409484abf Notification: fix wrong external attr for Link 2020-10-16 11:53:45 -04:00
flarum-bot
1fc24635f6 Bundled output for commit ff7ac0b322 [skip ci] 2020-10-16 05:26:03 +00:00
Alexander Skvortsov
ff7ac0b322 Fix PostStream loadRange doesn't return all posts (#2384)
- Also, ensure that posts are ordered by creation timestamp
2020-10-16 01:24:45 -04:00
Wadim Kalmykov
d460aaa3ad order posts by creation date 2020-10-16 01:20:54 -04:00
Wadim Kalmykov
7634a766cb Fix loadRange doesn't return all posts 2020-10-16 01:20:54 -04:00
flarum-bot
e5f53b93a6 Bundled output for commit a38c92d409 [skip ci] 2020-10-16 01:59:56 +00:00
Alexander Skvortsov
a38c92d409 Fix broken import 2020-10-15 21:58:18 -04:00
Alexander Skvortsov
3da655a62f Rename resolver to resolvers for consistency 2020-10-15 21:26:34 -04:00
flarum-bot
46c3124b0b Bundled output for commit e6f59b834f [skip ci] 2020-10-15 22:20:11 +00:00
Alexander Skvortsov
e6f59b834f Default force attr to true on LinkButton
This retains beta 13 behavior.
2020-10-15 18:18:51 -04:00
Alexander Skvortsov
9f5737eb93 Fix routeName attr not being passed into pages 2020-10-15 18:14:20 -04:00
flarum-bot
35cb5b20a0 Bundled output for commit 988b6c9023 [skip ci] 2020-10-15 22:02:46 +00:00
Alexander Skvortsov
988b6c9023 Allow extensions to use route resolvers (#2275)
- mapRoutes: don't wrap components in resolvers if they are already resolvers
- Extract defaultResolver into its own class
- Allow either route resolver instances, or components with an optional resolverClass which should accept the component and route name in its constructor.
- Introduce a resolver for DiscussionPage, so that routing from one post to another on the same discussion triggers a scroll instead of rerendering
2020-10-15 18:01:17 -04:00
flarum-bot
c1d91be2f4 Bundled output for commit f534398645 [skip ci] 2020-10-15 21:47:33 +00:00
Alexander Skvortsov
f534398645 Fix PostStream Reply Scroll (#2366)
- Add an index to reply placeholder so we can scroll to it directly when replying.
- Stop pretending that the currently broken `bottom` scroll functionality works, and explicitly call it `reply` scrolling to be clearer
- Directly get target from state
- Explicitly scroll to placeholder on reply
- Clean up scrollToItem code a bit
- Account for edge case where index is undefined when scrolling to post

Co-authored-by: Wadim Kalmykov <36057469+w-4@users.noreply.github.com>
2020-10-15 17:46:02 -04:00
flarum-bot
cd05ec6589 Bundled output for commit 78be6e2194 [skip ci] 2020-10-15 21:41:56 +00:00
Wadim Kalmykov
78be6e2194 Fix lifecyle method workarounds (#2378)
Essentially, whenever a route is loaded, we add a key to that component. If the key changes, the page completely rerenders. Switching between different routes handled by the same key triggers those rerenders.
2020-10-15 17:40:25 -04:00
flarum-bot
eb498a0a9f Bundled output for commit ac42a5900d [skip ci] 2020-10-15 21:36:46 +00:00
Wadim Kalmykov
ac42a5900d Make PostStreamScrubber work for Posts that have top margin (#2369)
Also fixes incorrect page count when scrolling to bottom (https://github.com/flarum/core/issues/1897)
2020-10-15 17:35:22 -04:00
Alexander Skvortsov
543b136f7c Refactor PostStream animations (#2364)
- If the fadeIn animation is specified on the PostStream class itself, any time we add/remove another animation, it will redo fadeIn. To avoid this, we move fadeIn into it's own css class, which is applied, and then immediately removed after the animation is completed to ensure it only runs once.
- The "fix" for flashItem was actually broken, as it resulted in 'flash' never being removed, so we never went back to .PostStream's fadeIn. We adjust flashItem to ensure that '.flash' is removed. We also remove 'fadeIn' in case it hasn't yet been removed in oncreate.
2020-10-15 17:34:35 -04:00
flarum-bot
8546fb734f Bundled output for commit 20b9455f04 [skip ci] 2020-10-15 18:32:09 +00:00
Wadim Kalmykov
20b9455f04 make scroll listener passive (#2387)
see: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
2020-10-15 14:30:32 -04:00
Wadim Kalmykov
008f1da539 Make header and navigation components redraw after page components (#2390)
Make header and navigation components redraw after page components. Page components manipulate the header (state), but the header redraws before the page on route change. By changing the mount order, we change also the redraw order.
2020-10-15 14:29:42 -04:00
flarum-bot
a3bd431503 Bundled output for commit 6da81a71a4 [skip ci] 2020-10-14 09:39:52 +00:00
Daniël Klabbers
6da81a71a4 npm audit security vulnerabilities patched 2020-10-14 10:11:34 +02:00
flarum-bot
a48d38614b Bundled output for commit 7358437c59 [skip ci] 2020-10-11 21:27:54 +00:00
Sami Mazouz
7358437c59 Fix MarkRead Mobile Gesture (#2383) 2020-10-11 17:26:32 -04:00
flarum-bot
08ec274a24 Bundled output for commit d45478564f [skip ci] 2020-10-09 23:28:51 +00:00
Alexander Skvortsov
d45478564f Fix handling of non-409 errors in ExtensionsPage
If the error isn't a 409, we'll want to re-throw the error so it'll be handled by the default system (showing an alert).

For simplicity, we can also move 409-handling logic out of setTimeout.

Finally, we adjust the timeout to 300 milliseconds to match the modal transition animation length.
2020-10-09 19:27:07 -04:00
flarum-bot
8296ffe8c9 Bundled output for commit 1d2f0ca407 [skip ci] 2020-10-09 23:07:06 +00:00
Alexander Skvortsov
1d2f0ca407 Header UI fixes (#2371)
* Revert "Fix header contents moving when opening modal (#2131)"
* Fix header contents moving when modal opened/closed.

Conditionally apply the navbar-fixed-top class only when needed, so that we can take advantage of it without always having the navbar in position:fixed, as was done in the previous solution. That resulted in a clash with custom headers.

* Show header on refresh of scrolled page

Due to some magic in Mithril 0.1's context:retain flag, some DOM elements were cached across page reloads. Since that has been eliminated, if we refresh the page and we are scrolled down, the "affix" class which makes the header fixed (and as a result, visible) isn't applied until the first scroll. We fix this by running ScrollListener.update() immediately to set initial navbar state.
2020-10-09 19:05:53 -04:00
Wadim Kalmykov
bb69c3bd57 Reduce modal hide timeout (#2367) 2020-10-09 19:04:53 -04:00
Daniël Klabbers
2b1581875a Fixes the queue for beta 14 (#2363)
- rewrite the queue handling for illuminate 6+
- implement missing maintenance mode callable for queue Worker
- Ensure we resolve append the queue commands once the queue bindings are loaded
- Override WorkCommand because it needs the maintenance flag. It tries to use
the isDownForMaintenance method from the Container assuming it is a Laravel
Application. Circumvented this issue by resolving our Config from IOC instead.
2020-10-09 16:06:28 -04:00
Sami Mazouz
a0c36a015b Use @control-bg for Slidable content (#2381) 2020-10-09 14:37:47 -04:00
flarum-bot
656409794c Bundled output for commit 245f3c6846 [skip ci] 2020-10-07 20:25:22 +00:00
Alexander Skvortsov
245f3c6846 DiscussionPage: call onNewRoute properly
When on a discussion page, the URL changing doesn't always mean we've moved to a different page. In our custom rerender logic, we only want to call `this.onNewRoute()` if the page has actually changed.
2020-10-07 16:22:41 -04:00
Alexander Skvortsov
962b49567c Restore stricter email validation
In v5.8, Laravel expanded email validation logic to closer match the RFC. This, however, allows emails that aren't conventional (for example, emails lacking a TLD). This commit changes Flarum's UserValidator to use the `email:filter` validator, which uses PHP's filter_var, and is the pre-5.8 behavior.

See https://laravel.com/docs/5.8/validation#rule-email
2020-10-07 15:33:57 -04:00
flarum-bot
12498b7620 Bundled output for commit 84f7d29d8c [skip ci] 2020-10-07 18:11:32 +00:00
Alexander Skvortsov
84f7d29d8c Slight PostStream scrubber improvement
After we scroll to a post, we redraw to render post content.  We then update the scrubber again so its height is accurate. This commit moves that update to AFTER our adjustment of scroll position, so that scrubber height is based on actual post heights. This fixes some subtle scrubber glitches.
2020-10-07 14:09:53 -04:00
Daniël Klabbers
561e8c6b6a Add test for model object argument in callable for attribute defaults 2020-10-07 11:38:52 +02:00
Daniël Klabbers
ad9917f0d6 Allows callables for default model attribute to gain access
to the current model in order to calculate the value needed.
2020-10-07 11:26:58 +02:00
Daniël Klabbers
6977c24dd8 improve deprecated message for b15 2020-10-07 10:23:46 +02:00
flarum-bot
d1b72429ac Bundled output for commit 63692f12c5 [skip ci] 2020-10-06 15:53:21 +00:00
Wadim Kalmykov
63692f12c5 SubtreeRetainer: fix onbeforeupdate needsRebuild (#2365) 2020-10-06 11:52:05 -04:00
flarum-bot
441ccec8e7 Bundled output for commit 414b0ff6d3 [skip ci] 2020-10-06 00:52:30 +00:00
Alexander Skvortsov
414b0ff6d3 Update mithril request docs link 2020-10-05 20:50:15 -04:00
flarum-bot
2ff0e1efcb Bundled output for commit 8c46b37a6f [skip ci] 2020-10-05 22:07:23 +00:00
Lucas Henrique
8c46b37a6f Convert icon helper to Typescript (#2360) 2020-10-05 18:06:08 -04:00
flarum-bot
9be629cfcc Bundled output for commit df9be1b063 [skip ci] 2020-10-05 20:26:46 +00:00
Alexander Skvortsov
df9be1b063 Move drawer hide and modal close into onNewRoute
Let's stay consistent with previous behavior, and run these on "internal route change" (same component handles different route) as well as on initial render of a page component.
2020-10-05 16:25:23 -04:00
Alexander Skvortsov
97c36f2f7d Use Symfony TranslatorInterface for tests
This seems to be a leftover change missed in https://github.com/flarum/core/pull/2243
2020-10-05 16:02:12 -04:00
flarum-bot
13efd02085 Bundled output for commit 0b44c48433 [skip ci] 2020-10-05 18:41:55 +00:00
Alexander Skvortsov
0b44c48433 Catch promise reject when not logged in on reply 2020-10-05 14:40:33 -04:00
flarum-bot
b562072471 Bundled output for commit 718445cb0c [skip ci] 2020-10-05 14:56:45 +00:00
Wadim Kalmykov
718445cb0c call parent onremove (#2362) 2020-10-05 10:55:14 -04:00
Abhishek Verma
c6f2ff0c80 Fixed Broken Badges in ReadMe.md (#2358) 2020-10-04 16:11:39 -04:00
flarum-bot
67962f48e5 Bundled output for commit f8a0d9459a [skip ci] 2020-10-03 22:48:56 +00:00
Alexander Skvortsov
f8a0d9459a Fix email confirmation alert
Currently, the controls are on a new line due to the container div. We want to wrap ALL children of the alert, including the controls, in the container div.

We need to split it into a separate class so that we can add modify the alert vnode AFTER the alert component's `view` logic has been applied.
2020-10-03 18:47:27 -04:00
David Sevilla Martín
27d562f3fc Remove Mithril namespace export from shims.d.ts (#2347)
From using PhpStorm to try and see if the autocomplete works properly, it appears as it doesn't. The intention was to not have to import Mithril every time we wanted to type something with Mithril.*, but that doesn't seem to be possible - and it's not a big deal anyway
2020-10-02 19:34:06 -04:00
flarum-bot
17a7155f60 Bundled output for commit 4cdce71d65 [skip ci] 2020-10-02 23:06:45 +00:00
Alexander Skvortsov
4cdce71d65 Eliminate temporary BC layers from rewrite
During the frontend rewrite, we introduced mithril patches for a `route` attr, and for `m.stream`. Later, we decided not to go that route, but not to remove the patches yet to avoid breaking extensions while we were finalizing the replacements. We can now remove these.

Other BC layers are for things from before beta 14, so those remain in place.
2020-10-02 19:05:26 -04:00
flarum-bot
eb03f51c4f Bundled output for commit d695d96e00 [skip ci] 2020-10-02 22:50:48 +00:00
Alexander Skvortsov
d695d96e00 Various TypeScript improvements (#2309)
- Use Mithril.Attributes as base for ComponentAttrs, remove =any from class signature for Component
- Convert Alert to TypeScript, introduce AlertAttrs interface
- Convert AlertManagerState to TypeScript, add overload signatures for `show`, introduce AlertState interface for stored Alerts.
- Set ComponentAttrs as default T for Component
- Make attrs in AlertAttrs optional
- Add AlertIdentifier interface, simplify show type signature
- Remove mithril patch shim, as all patches onto m are now deprecated
- Use Mithril.Static for shim
2020-10-02 18:49:40 -04:00
flarum-bot
dc4884485a Bundled output for commit 40548d7c61 [skip ci] 2020-10-02 22:05:01 +00:00
Wadim Kalmykov
40548d7c61 Improve DiscussionListState refresh method (#2322)
- Ensure that the discussion list is cleared before it is updated with fetched results
- Rename `clear` to `deferClear`, improve documentation to make its purpose clearer.
2020-10-02 18:03:44 -04:00
flarum-bot
60714b7ac4 Bundled output for commit 84d14f485a [skip ci] 2020-10-02 21:55:59 +00:00
Alexander Skvortsov
84d14f485a Basic Extension Dependency Support (#2188)
- Don't enable an extension if its dependencies are not enabled
- Don't disable an extension if its dependencies are not disabled
2020-10-02 17:54:28 -04:00
flarum-bot
0a6c5217c1 Bundled output for commit 44a96a82ef [skip ci] 2020-10-02 21:11:38 +00:00
Alexander Skvortsov
44a96a82ef Minor improvements to onNewRoute (#2328)
- Call onNewRoute when page changed with same component in DiscussionPage and UserPage

- Make app.previous and app.current changed in onNewRoute, not in oninit. This way, when the route is changed, but still handled by the same component, a new PageState object will still be created.
2020-10-02 17:10:38 -04:00
flarum-bot
0b3fe10516 Bundled output for commit 5ecb74fb59 [skip ci] 2020-10-02 20:58:06 +00:00
Alexander Skvortsov
5ecb74fb59 Use Link component for links instead of mithril route patch (#2315)
This new component now also supports external links.
2020-10-02 16:56:40 -04:00
flarum-bot
b66d16e44b Bundled output for commit a013d647e0 [skip ci] 2020-10-02 15:15:05 +00:00
Alexander Skvortsov
a013d647e0 Adjust PostStreamScrubber height after scroll (#2333) 2020-10-02 11:13:55 -04:00
Alexander Skvortsov
20b99bcab1 Ensure that modal hide animates (#2332)
We want to return a promise in``onbeforeremove` with arbitrary loading time to ensure that the animateHide animation has time to complete.
2020-10-02 11:12:49 -04:00
flarum-bot
8325b6eed8 Bundled output for commit f9704f9153 [skip ci] 2020-10-01 18:52:08 +00:00
Alexander Skvortsov
f9704f9153 Fix multiple scrolls to same post in PostStream (#2264)
While more pleasant from an FSM standpoint, comparing the current targetPost to the previous one does not work if goToNumber is called twice in a row for the same post. For instance, if a user clicks the mentions link to a post twice, the post stream breaks.
2020-10-01 14:50:54 -04:00
flarum-bot
09a39d5d95 Bundled output for commit a26f01e49c [skip ci] 2020-10-01 01:03:05 +00:00
Alexander Skvortsov
a26f01e49c Use custom event on ALL SuperTextEditor actions 2020-09-30 21:01:24 -04:00
Sami Mazouz
6d826e5b30 Right align discussion controls dropdown on slidable item (#2330) 2020-09-30 16:53:50 -04:00
flarum-bot
f38605b387 Bundled output for commit 93f8ce78b3 [skip ci] 2020-09-30 20:34:47 +00:00
Alexander Skvortsov
93f8ce78b3 Improve PostStreamState.viewingEnd()
In some cases, such as if we've stickied a post, an event post
may have been added / removed.This means that `this.visibleEnd`
and`this.count()` will be out of sync by 1 post, but we are still
"viewing the end" of the post stream, so we should still reload
all posts up until the last one.
2020-09-30 16:33:10 -04:00
Daniël Klabbers
a001736298 Mark keys for Config required only with InstalledSite (#2323)
* use fallback on url to prevent errors in cli during install. The value of the fallback doesn't actually matter, we just need something.
2020-09-30 15:38:19 -04:00
Daniël Klabbers
86d4bf0214 Fix for a bug that would delete the new revision of less/js in case the filenames match. 2020-09-30 09:26:32 +02:00
Daniël Klabbers
c7b67b922b Allow easier overriding of js compiler (#2318) 2020-09-29 19:03:51 -04:00
flarum-bot
3b63d774d3 Bundled output for commit 86f7550bec [skip ci] 2020-09-29 22:42:20 +00:00
Alexander Skvortsov
86f7550bec Merge pull request #2314 from flarum/as/modal-fix
Frontend Rewrite Followup Modal Fixes
2020-09-29 18:41:03 -04:00
Alexander Skvortsov
9d1a87a4c4 Rename onshow and onhide
animateShow and animateHide are more descriptive
2020-09-29 18:37:56 -04:00
Alexander Skvortsov
a2263b8538 Return on animateShow if already loaded 2020-09-29 18:37:56 -04:00
Alexander Skvortsov
1ac09dbc4d Pass ModalManagerState into Modal instances instead of calling the global. 2020-09-29 18:37:56 -04:00
Alexander Skvortsov
be8fe44f0b Ensure that readyCallback is called on modals opened from other modals 2020-09-29 18:37:56 -04:00
Alexander Skvortsov
b7593bc6a8 Prevent hide animation when opening modal from other modal 2020-09-29 18:37:56 -04:00
Alexander Skvortsov
7fc0963e3c Revert "Fix opening modals from other modals. (#2263)"
This reverts commit 5b157f0adb.
2020-09-29 18:37:56 -04:00
flarum-bot
30f3056f70 Bundled output for commit ed23d7d4e7 [skip ci] 2020-09-29 22:35:50 +00:00
Alexander Skvortsov
ed23d7d4e7 Merge pull request #2299 from flarum/as/poststream_improvements
[Frontend Rewrite] PostStream Improvements
2020-09-29 18:34:16 -04:00
Franz Liedke
1e9f7b7d52 README: Update badge to truly show latest release
Refs #2311.
2020-09-29 23:23:37 +02:00
Abolade Eniseyin
08540fd1db Update logo and badges in README (#2311)
Fixes #2296.
2020-09-29 23:22:51 +02:00
flarum-bot
74fa7122ca Bundled output for commit 4b2d20cd85 [skip ci] 2020-09-29 20:56:44 +00:00
Wadim Kalmykov
4b2d20cd85 fix clear search (#2325) 2020-09-29 16:55:26 -04:00
flarum-bot
077eaaa2f9 Bundled output for commit 6668e75019 [skip ci] 2020-09-28 23:18:39 +00:00
Sami Mazouz
6668e75019 Fix mobile controls gesture on discussion deletion/restoration (#2324)
Because the Slidable class was always added on creation, it was lost every time the class list changed (in this case when the discussion was hidden/unhidden which added/removed DiscussionListItem--hidden class). So by determining the Slidable class's presence in elementAttrs() method, it guarantees it always properly set.
2020-09-28 19:07:05 -04:00
Wadim Kalmykov
d6511e0df5 Improve developer experience by forcing LF line endings (#2321) 2020-09-28 14:04:08 -04:00
Alexander Skvortsov
efd68df13a Pass a translator instance to getEmailSubject on MailableInterface (#2244)
* Pass a translator instance to getMailSubject (breaking change)

* Temporarily comment out getEmailSubject to avoid BC breaks
2020-09-28 00:04:28 -04:00
flarum-bot
f1360a1394 Bundled output for commit cc875f3e95 [skip ci] 2020-09-28 03:51:00 +00:00
Alexander Skvortsov
cc875f3e95 Put m.stream in flarum/utils/stream (#2316) 2020-09-27 23:49:33 -04:00
Franz Liedke
6860b24b70 Use reserved TLD for default dev hostname
See https://jdebp.eu/FGA/dns-use-domain-names-that-you-own.html.
2020-09-27 22:55:46 +02:00
flarum-bot
65766a8386 Bundled output for commit c53509d7d0 [skip ci] 2020-09-27 02:14:07 +00:00
Alexander Skvortsov
c53509d7d0 Add warnings to Mithril 2 BC layer (#2313) 2020-09-26 22:12:43 -04:00
Alexander Skvortsov
4c3e1e2625 Fixed noAnimation: previously, the opposite of what was requested happened 2020-09-25 16:02:39 -04:00
Alexander Skvortsov
6508e64f55 DiscussionPage: only set this.discussion after the initial set of posts has loaded, this results in a slightly smoother initial load. 2020-09-25 15:54:54 -04:00
Alexander Skvortsov
963c27ed60 Provide location data to scrubber earlier to avoid unnecessary and confusing scrubber animation on page load. 2020-09-25 15:52:18 -04:00
Alexander Skvortsov
304f05be36 Don't animate the initial Scrubber placement 2020-09-25 15:43:41 -04:00
Alexander Skvortsov
82af307280 Restore fadeIn to 400ms (#2312)
This is the jQuery fadeIn default, which we were relying on before this animation was changed to pure CSS.
2020-09-25 21:15:24 +02:00
Alexander Skvortsov
50cbb7be5c Merge pull request #2271 from flarum/fl/laravel-updates-config
This extracts another real class for dealing with the configuration options stored in `config.php`. The idea is to reduce the scope of the `Application` class and make it easier to inject exactly what's needed (rather than an array, which is complicated, or the bloated `Application` class).
2020-09-25 11:22:53 -04:00
Franz Liedke
9ea57e6329 Use Config class for data from config.php 2020-09-25 11:10:52 +02:00
Franz Liedke
6639678fb2 Inject/use new config class where applicable 2020-09-25 10:58:53 +02:00
Franz Liedke
f869999011 Add a helper class for managing low-level config 2020-09-25 10:58:52 +02:00
flarum-bot
f885cebdc5 Bundled output for commit 54ff6e720c [skip ci] 2020-09-25 02:32:11 +00:00
Alexander Skvortsov
54ff6e720c Add in BC layer for props, initProps, m.withAttr, and m.prop (#2310) 2020-09-24 22:30:55 -04:00
Daniël Klabbers
aea8a3ff1f Changes methods and properties from private to protected (#2308)
The goal of this PR is to offer increased flexibility for integrators and
custom solutions in skeleton modifications.
2020-09-24 14:30:16 -04:00
Alexander Skvortsov
cc48e9ab22 Replace $app->url() with url-generated link to index (#2302) 2020-09-24 11:30:57 -04:00
Alexander Skvortsov
6d38de9c8f Revert https://github.com/flarum/core/pull/1536 (#2305) 2020-09-24 11:30:27 -04:00
flarum-bot
87634449c0 Bundled output for commit b00ca4ef29 [skip ci] 2020-09-24 04:09:18 +00:00
Matteo Contrini
b00ca4ef29 Fix comment for the time gap feature in PostStream (#2294)
The time interval for the time gap feature is 4 days and not 4 hours.
2020-09-24 00:08:12 -04:00
flarum-bot
fd0f0cdf8b Bundled output for commit 5b157f0adb [skip ci] 2020-09-24 03:13:43 +00:00
Alexander Skvortsov
5b157f0adb Fix opening modals from other modals. (#2263)
While seemingly correct, an onremove method in Modal that triggers animateHide is problematic, because if one modal is opened from another, the one currently open will be removed from the DOM, triggering animateHide, and closing the new modal.

To compensate, an onupdate method now closes a modal if one is open but shouldn't be; this supports the functionality of the old method when the modal is closed not from the modal instance itself (e.g. app.modal.close())

This is not ideal, but necessary. We should consider eventually expanding the modal system to support showing multiple modals at the same time (stacked over each other). Then, we can move this back to individual modals.
2020-09-23 23:12:22 -04:00
Alexander Skvortsov
dc8b203037 Only call updateScrubberValues onupdate when necessary
When the page is scrolled, goToIndex is called, or the page is loaded,
various listeners result in the scrubber being updated with a new
position and values. However, if goToNumber is called, the scrubber
will not be updated. Accordingly, we add logic to the scrubber's
onupdate to update itself, but only when needed, as indicated by this

This saves us a LOT of unnecessary calls, and makes scrubber movement smoother.
2020-09-23 23:06:25 -04:00
Alexander Skvortsov
db71f8bf68 Execute oncreate scrubber update after loadPromise has completed
This way, we ensure that the initial position (and data) of the scrubber is correct. Otherwise, we get blank dates / incorrect location.
2020-09-23 23:06:20 -04:00
Alexander Skvortsov
a004b8e057 Fix $(...).offset() is undefined on some scrolls. 2020-09-23 23:06:14 -04:00
flarum-bot
1ff4076f2a Bundled output for commit 6e9db779cd [skip ci] 2020-09-24 03:06:06 +00:00
Alexander Skvortsov
6e9db779cd Fix double fadein for post stream (#2300) 2020-09-23 23:04:56 -04:00
flarum-bot
f4449e962d Bundled output for commit 71f3379fcc [skip ci] 2020-09-24 02:41:41 +00:00
David Sevilla Martín
71f3379fcc Mithril 2 update (#2255)
* Update frontend to Mithril 2

- Update Mithril version to v2.0.4
- Add Typescript typings for Mithril
- Rename "props" to "attrs"; "initProps" to "initAttrs"; "m.prop" to "m.stream"; "m.withAttr" to "utils/withAttr".
- Use Mithril 2's new lifecycle hooks
- SubtreeRetainer has been rewritten to be more useful for the new system
- Utils for forcing page re-initializations have been added (force attr in links, setRouteWithForcedRefresh util)
- Other mechanical changes, following the upgrade guide
- Remove some of the custom stuff in our Component base class
- Introduce "fragments" for non-components that control their own DOM
- Remove Mithril patches, introduce a few new ones (route attrs in <a>; 
- Redesign AlertManagerState `show` with 3 overloads: `show(children)`, `show(attrs, children)`, `show(componentClass, attrs, children)`
- The `affixedSidebar` util has been replaced with an `AffixedSidebar` component

Challenges:
- `children` and `tag` are now reserved, and can not be used as attr names
- Behavior of links to current page changed in Mithril. If moving to a page that is handled by the same component, the page component WILL NOT be re-initialized by default. Additional code to keep track of the current url is needed (See IndexPage, DiscussionPage, and UserPage for examples)
- Native Promise rejections are shown on console when not handled
- Instances of components can no longer be stored. The state pattern should be used instead.

Refs #1821.

Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
Co-authored-by: Matthew Kilgore <tankerkiller125@gmail.com>
Co-authored-by: Franz Liedke <franz@develophp.org>
2020-09-23 22:40:37 -04:00
Alexander Skvortsov
1321b8cc28 Revert "Use lifecycle interface for frontend extender (#2211)" (#2301)
This reverts commit 3117d2ad7a.
2020-09-23 00:21:45 -04:00
flarum-bot
fa0ff204dd Bundled output for commit 872e3bdc92 [skip ci] 2020-09-18 19:33:18 +00:00
Alexander Skvortsov
872e3bdc92 Add missing exports to compat 2020-09-18 21:31:35 +02:00
Alexander Skvortsov
79f9012694 Fix Post-actions being on top of Post Controls Dropdown
- This was accidentially introduced when an explicit z-index was added to reply-actions to prevent Post-footer from covering it
- Here, we revert that zindex, while making Post-footer inline-block to stop it from covering everything. We also set height=0 to stop implicitly added height
2020-09-18 15:33:01 +02:00
Wadim Kalmykov
633cc14d09 Fix issue where posts API doesn't return the right amount of posts (#2291) 2020-09-17 23:59:34 -04:00
Alexander Skvortsov
c6e85ef330 Allow upper case TLS and SSL for SMTP encryption (#2289) 2020-09-12 17:43:06 -04:00
phanlyhuynh
3f8432a589 Fix SMTP username and password shouldn't be required (#2287) 2020-09-06 15:12:03 -04:00
flarum-bot
96c95f2b6a Bundled output for commit 8e3e8826f9 [skip ci] 2020-09-04 17:00:30 +00:00
Franz Liedke
8e3e8826f9 app.composer.show: Trigger synchronous redraw
This is needed to have access to the newly created SuperTextarea
instance (app.composer.editor) directly after calling show().

Discovered when making ext-mentions work with the Composer state
changes. As far as I could reconstruct, a synchronous redraw was also
triggered in this situation before the changes in #2161.
2020-09-04 18:58:40 +02:00
Johannes Nilsson
384edfa52b Remove unwanted semicolon in assets files (#2280) 2020-08-31 23:52:37 -04:00
Franz Liedke
f939d164b7 Make queue error handler compatible with Laravel 6 (#2270) 2020-08-27 22:41:36 -04:00
flarum-bot
ebbef75cfb Bundled output for commit 2caa5cf19c [skip ci] 2020-08-28 02:41:03 +00:00
fengkx
2caa5cf19c fix: escape regexp from query (#2273)
* fix: escape regexp from query
2020-08-27 22:39:49 -04:00
Alexander Skvortsov
fe718a1490 Bump fontawesome version to ^5.14.0 (#2274) 2020-08-27 23:01:57 +02:00
flarum-bot
beb03b7771 Bundled output for commit 97186e6086 [skip ci] 2020-08-25 14:54:57 +00:00
Karan Sanjeev
97186e6086 Added an empty alt attribute to avatar's img tag (#2269)
fixes #2256
2020-08-25 10:53:44 -04:00
flarum-bot
47f3ee0ce2 Bundled output for commit a9eb14889e [skip ci] 2020-08-16 20:36:13 +00:00
Matteo Contrini
a9eb14889e Fix number abbreviation when the number is n-thousand (#2261)
This commit fixes the method `abbreviateNumber` so that it behaves as stated in the JSDoc.

Previously, an input of `1234` would have produced `1K`. With this change, the output will be `1.2K`.
2020-08-16 16:35:05 -04:00
flarum-bot
5e5a5294c3 Bundled output for commit c39b6a6d2f [skip ci] 2020-08-16 20:34:13 +00:00
Franz Liedke
c39b6a6d2f Extract a few changes from the Mithril 2 upgrade (#2262)
* Fix closing the composer with ESC key

Regression from #2161.

* Remove obsolete method

Regression from #2162.

* Mark method as protected

* Fade in posts in post stream using CSS

This also avoids a double-fade from the JavaScript code, which was
probably introduced in #2160.

* Fix fadeIn for post stream items

Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
2020-08-16 16:32:59 -04:00
一枚小猿
22bf03d872 Fix less build error. (#2252) 2020-08-15 20:21:06 -04:00
flarum-bot
a2f3534bf7 Bundled output for commit 6953d93c6d [skip ci] 2020-08-08 18:47:16 +00:00
Alexander Skvortsov
6953d93c6d Extract PostStream state (#2160)
Co-authored-by: Franz Liedke <franz@develophp.org>
2020-08-08 14:45:54 -04:00
dependabot[bot]
f9c9b5d5e4 Bump elliptic from 6.5.2 to 6.5.3 in /js (#2251)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-31 01:08:39 +02:00
Alexander Skvortsov
8a73cc522e Fix optional parameters in url generator (#2246)
* Fix route collection getting wrong path when optional parameters present, add unit tests
2020-07-28 20:51:14 -04:00
Franz Liedke
db83003eb5 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-07-27 19:42:23 +00:00
Franz Liedke
4dc4dc624e Merge pull request #2243 from flarum/fl/2055-l6-translator
Upgrade to Laravel 6, finally!
2020-07-27 21:42:01 +02:00
flarum-bot
ad42058a8a Bundled output for commit 5e465f6051 [skip ci] 2020-07-24 22:18:35 +00:00
Alexander Skvortsov
5e465f6051 Extract Composer state (#2161)
Like previous "state PRs", this moves app-wide logic relating to
our "composer" widget to its own "state" class, which can be
referenced and called from all parts of the app. This lets us
avoid storing component instances, which we cannot do any longer
once we update to Mithril v2.

This was not as trivial as some of the other state changes, as we
tried to separate DOM effects (e.g. animations) from actual state
changes (e.g. minimizing or opening the composer).

New features:

- A new `app.screen()` method returns the current responsive screen
  mode. This lets us check what breakpoint we're on in JS land  
  without hardcoding / duplicating the actual breakpoints from CSS.
- A new `SuperTextarea` util exposes useful methods for directly
  interacting with and manipulating the text contents of e.g. our
  post editor.
- A new `ConfirmDocumentUnload` wrapper component encapsulates the
  logic for asking the user for confirmation when trying to close
  the browser window or navigating to another page. This is used in
  the composer to prevent accidentally losing unsaved post content.

There is still potential for future cleanups, but we finally want   
to unblock the Mithril update, so these will have to wait:

- Composer height change logic is very DOM-based, so should maybe
  not sit in the state.
- I would love to experiment with using composition rather than
  inheritance for the `ComposerBody` subclasses.
2020-07-25 00:17:25 +02:00
flarum-bot
62a2e8463d Bundled output for commit 0098c64ebf [skip ci] 2020-07-24 21:53:31 +00:00
Franz Liedke
0098c64ebf Fix an irrelevant export name :P 2020-07-24 23:51:44 +02:00
Franz Liedke
2b5939d538 Simplify a few unnecessary Arr::get() calls 2020-07-24 22:56:31 +02:00
Alexander Skvortsov
2431df5602 Revert "Fixes wrong IP address when using a reverse proxy (#2236)" (#2242)
This reverts commit 451a557532 pending further discussion of https://github.com/flarum/core/pull/2236#issuecomment-663645583
2020-07-24 14:19:10 -04:00
flarum-bot
264ff67304 Bundled output for commit c08a56e9d8 [skip ci] 2020-07-24 17:03:04 +00:00
Alexander Skvortsov
c08a56e9d8 Notifications Dropdown: Remove init method that doesn't do anything (cleanup) 2020-07-24 13:01:45 -04:00
Alexander Skvortsov
4ee6d6fd88 Revert "Inject Url Generator and Translator Interface into notification mailer (#2169)"
This was actually already present and functional, so adding additional code for it
is unnecessary.

This reverts commit e627616750.
2020-07-24 12:44:59 -04:00
Franz Liedke
9c09fe8465 Update to Laravel 6, finally!
Fixes #2055.
2020-07-24 17:34:40 +02:00
Franz Liedke
b46d5e67a3 Make Translator compatible with Laravel 6
It's contract will change in Laravel 6. We extend from Symfony's
translator, but need to be compatible with that from Laravel in
order to use its validation package.

References:
- https://laravel.com/docs/6.x/upgrade#trans-and-trans-choice
- 8557dc56b1 (diff-88bc04a1548d09aa6250d902d1ac2b4c)
2020-07-24 17:32:50 +02:00
Franz Liedke
7fd23ff950 Inject Symfony translator contract, not Laravel's
The Laravel changes with v6, and our translator is primarily an
implementation of the Symfony contract.
2020-07-24 17:31:46 +02:00
Franz Liedke
e4077ab4ad Replace a few forgotten obsolete helpers
- Apparently, I forgot that `array_flatten` comes from Laravel. :)
- When I did this previously, I did not search the views directory.
2020-07-24 17:28:56 +02:00
Franz Liedke
3b39c212e0 Explicitly bundle Carbon library
We have used this transitive dependency (via illuminate/support)
for a while, so let's make this explicit.

Incidentally, we now also explicitly require version 2.x - the
previous 1.x branch will no longer be supported after the
upcoming upgrade to Laravel 6.

Refs #2055.
2020-07-24 16:46:33 +02:00
Franz Liedke
bca833d3f1 Remove Mandrill mail driver
This is in preparation for the upcoming upgrade to Laravel 6,
which dropped this driver.

Refs #2055.
2020-07-24 16:39:28 +02:00
Jake Esser
451a557532 Fixes wrong IP address when using a reverse proxy (#2236)
Added reverse proxy support to preserve forwarded IPs
2020-07-22 08:55:44 -04:00
Alexander Skvortsov
eaac78650f Deprecate AssertPermissionTrait (#2044) 2020-07-17 15:16:15 +02:00
Franz Liedke
2b3dec2be1 Fix deprecation and removal date 2020-07-17 12:19:48 +02:00
Alexander Skvortsov
37ebeb5705 User Extender (prepareGroups functionality) (#2110) 2020-07-17 12:18:35 +02:00
Franz Liedke
71abac0323 Rename view extender
As discussed in my initial review, it seems unlikely that we need
the ability to remove (or otherwise modify) namespaces again.
Therefore, it seems more consistent with other extenders to go
for a "View" extender with a "namespace" method.

Sorry for the back and forth. ;)

Refs #1891, #2134.
2020-07-17 12:05:49 +02:00
Franz Liedke
7e3d71a0a0 View extender: Do not resolve factory
Not all requests need this factory, so there is no need to
instantiate one and load the required files.

Refs #1891, #2134.
2020-07-17 12:05:38 +02:00
Alexander Skvortsov
b5e891df30 View Extender (add namespace) (#2134) 2020-07-17 11:59:00 +02:00
Alexander Skvortsov
3117d2ad7a Use lifecycle interface for frontend extender (#2211) 2020-07-17 11:49:52 +02:00
dependabot[bot]
1ce0b926b6 Bump lodash from 4.17.15 to 4.17.19 in /js (#2235)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-17 10:47:28 +02:00
flarum-bot
24b16f9d7c Bundled output for commit bd40353bcc [skip ci] 2020-07-10 13:42:33 +00:00
Franz Liedke
bd40353bcc Merge pull request #2207 from flarum/ds/typescript-conversion
Convert several files in `common/utils` to TypeScript
2020-07-10 15:41:14 +02:00
David Sevilla Martin
455327cca1 convert: common/utils/stringToColor 2020-07-10 14:13:33 +02:00
David Sevilla Martin
20baa93ca7 convert: common/utils/string 2020-07-10 14:13:33 +02:00
David Sevilla Martin
4f34e326ef convert: common/utils/RequestError 2020-07-10 14:13:33 +02:00
David Sevilla Martin
521cefbc2d convert: common/utils/liveHumanTimes
This file isn't used anywhere. We should be calling it at some point. It has existed for 5 years.

Renamed function because it makes more sense for name to match file name (not that it matters when building)
2020-07-10 14:13:32 +02:00
David Sevilla Martin
dc738d68dc convert: common/utils/abbreviateNumber 2020-07-10 14:13:32 +02:00
David Sevilla Martin
286af7084b convert: common/utils/extract 2020-07-10 14:13:31 +02:00
David Sevilla Martin
4869baea74 convert: common/utils/ItemList 2020-07-10 14:13:31 +02:00
David Sevilla Martin
24a48310ff convert: common/utils/humanTime 2020-07-10 14:05:09 +02:00
David Sevilla Martin
bdb759c558 convert: common/utils/formatNumber 2020-07-10 14:05:07 +02:00
Matt Kilgore
36eb5cc5fb Add port on Url to BaseUrl Test (#2226)
Added Urls with ports to the BaseUrl Test
2020-07-10 12:17:12 +02:00
David Sevilla Martín
d189272473 Initial TypeScript infrastructure (#2206)
This allows us to get started with converting all Flarum JavaScript code to TypeScript.
In addition, we will have time to experiment to find the best Webpack configuration before integrating into flarum-webpack-config.

See flarum/flarum-webpack-config#3.
2020-07-03 14:47:44 +02:00
flarum-bot
7d48c24dda Bundled output for commit 5786f1a10b [skip ci] 2020-07-03 05:17:34 +00:00
Alexander Skvortsov
5786f1a10b Fix discussions user page (#2225)
* Fixed up discussions user page, improve discussion list state signature
2020-07-03 01:16:08 -04:00
flarum-bot
b4421e1cce Bundled output for commit 359b4ab5a3 [skip ci] 2020-07-02 22:33:46 +00:00
Clark Winkelmann
359b4ab5a3 Fix user card issue by reverting to original behavior (#2224)
* Fix user card issue by reverting to original behavior
2020-07-02 18:32:41 -04:00
Alexander Skvortsov
8a686911ff Don't create user bio column on new installations (#2215) 2020-07-01 17:31:52 -04:00
Alexander Skvortsov
0b5a9a2fe6 Make scrubber handle have transparent background (#2222) 2020-07-01 17:07:13 -04:00
flarum-bot
50a9f7ce86 Bundled output for commit 8dd5420405 [skip ci] 2020-07-01 00:34:15 +00:00
David Sevilla Martín
8dd5420405 Switch from 'moment' to 'dayjs' (#2219)
* Switch from 'moment' to 'dayjs'

* Use humanize code from duration plugin (without actual plugin) for time lapsed events
2020-06-30 20:33:00 -04:00
flarum-bot
640cc0989b Bundled output for commit 44376cef61 [skip ci] 2020-07-01 00:00:24 +00:00
Alexander Skvortsov
44376cef61 Extract ModalManagerState from ModalManager (#2162) 2020-06-30 19:59:16 -04:00
flarum-bot
4f181c84fc Bundled output for commit ea9d601338 [skip ci] 2020-06-30 22:08:06 +00:00
Alexander Skvortsov
ea9d601338 Extract AlertManagerState from AlertManager (#2163) 2020-06-30 18:06:59 -04:00
Alexander Skvortsov
aaebd3581f Fix: Use proper variable for display name drivers in user extender 2020-06-29 19:32:08 -04:00
flarum-bot
e2c416903e Bundled output for commit e81159249f [skip ci] 2020-06-28 17:45:26 +00:00
Alexander Skvortsov
e81159249f Add check to register state of '0' as false for checkboxes (#2210)
* Add check to register state of '0' as false for checkboxes
* Add comment explaining state === '0'
2020-06-28 13:44:14 -04:00
flarum-bot
d93cf4a574 Bundled output for commit a33fbbf814 [skip ci] 2020-06-27 18:20:09 +00:00
Alexander Skvortsov
a33fbbf814 Add index page title, add mechanism to clear title from defaultRoute. (#2047)
* Add "All Descriptions title to index

* Added system to clear custom title if we're on the default route
2020-06-27 14:18:49 -04:00
flarum-bot
0c645a6c15 Bundled output for commit b44b79eba9 [skip ci] 2020-06-26 16:25:45 +00:00
Franz Liedke
b44b79eba9 Fix typo and update outdated doc block 2020-06-26 18:23:56 +02:00
flarum-bot
93398b738b Bundled output for commit 7816b61bfb [skip ci] 2020-06-26 14:08:35 +00:00
Franz Liedke
7816b61bfb Remove documentation for obsolete component prop 2020-06-26 16:06:56 +02:00
Franz Liedke
7dc3a194c3 Expose a method for clearing notification list
Needed for pusher extension.

Refs #2185.
2020-06-26 15:10:41 +02:00
flarum-bot
cea7824b57 Bundled output for commit 088eb0c4f2 [skip ci] 2020-06-26 12:32:40 +00:00
Franz Liedke
088eb0c4f2 Move DiscussionListState to correct folder 2020-06-26 12:52:33 +02:00
Franz Liedke
2ba67b021f Expose state classes via compat
This way, they can be extended by extensions.
2020-06-26 12:50:43 +02:00
flarum-bot
92791a253d Bundled output for commit 138c784a50 [skip ci] 2020-06-24 00:51:55 +00:00
David Sevilla Martín
138c784a50 Call liveHumanTimes() to update ago times every 10s (#2208)
This file has existed for 5 years, yet it was never used.
2020-06-23 20:50:57 -04:00
flarum-bot
bb567e5278 Bundled output for commit cf4f2f283e [skip ci] 2020-06-20 14:19:53 +00:00
w-4
cf4f2f283e Fix discussion unreadCount could be higher than commentCount (#2195)
* Fix discussion unreadCount being higher than commentCount if posts have been deleted
2020-06-20 10:18:26 -04:00
flarum-bot
ed01f389a8 Bundled output for commit 71e313e677 [skip ci] 2020-06-19 21:42:28 +00:00
Alexander Skvortsov
71e313e677 Clean up app.current, app.previous in JS (#2156)
- Encapsulate app.current, app.previous in PageState objects
- Reorganize Page classes to use one central base class in common

Co-authored-by: Franz Liedke <franz@develophp.org>
2020-06-19 17:41:26 -04:00
Franz Liedke
88366fe8af Clean up usages / deprecate path helpers (#2155)
* Write source map without creating temp file

Less I/O, and one less place where we access the global path helpers.

* Drop useless app_path() helper

This was probably taken straight from Laravel. There is no equivalent
concept in Flarum, so this should be safe to remove.

* Deprecate global path helpers

Developers using these helpers can inject the `Paths` class instead.

* Stop storing paths as strings in container

* Avoid using path helpers from Application class

* Deprecate path helpers from Application class

* Avoid using public_path() in prerequisite check

a) The comparison was already outdated, as a different path was passed.
b) We're trying to get rid of these global helpers.
2020-06-19 16:16:03 -04:00
flarum-bot
b82504b4b1 Bundled output for commit 898d68d9f3 [skip ci] 2020-06-19 00:30:16 +00:00
Franz Liedke
898d68d9f3 Remove leftover property
Refs #2150.
2020-06-19 02:27:01 +02:00
flarum-bot
69f0172b92 Bundled output for commit 62fe9db732 [skip ci] 2020-06-19 00:11:51 +00:00
Alexander Skvortsov
62fe9db732 Don't store PostUser instance in CommentPost (#2184)
* Don't save component state in CommentPost
2020-06-18 20:10:25 -04:00
flarum-bot
ed566cd18f Bundled output for commit 5c1663d8f1 [skip ci] 2020-06-18 23:54:42 +00:00
Alexander Skvortsov
5c1663d8f1 Move Discussion List State into its own class (#2150)
Extract discussion list state
2020-06-18 19:53:40 -04:00
flarum-bot
c5d3b058ba Bundled output for commit 4a804dbbbc [skip ci] 2020-06-18 22:48:18 +00:00
Alexander Skvortsov
4a804dbbbc Remove app.search instance, cache app.cache.searched (#2151)
* Moved search state logic into search state
2020-06-18 18:47:01 -04:00
flarum-bot
f4afb006ed Bundled output for commit 646b35374d [skip ci] 2020-06-18 21:29:07 +00:00
Alexander Skvortsov
646b35374d Don't store checkbox instances in NotificationGrid (#2183)
* Don't store checkbox states in NotificaitonGrid, use props for loading in Checkbox and Switch, replace preferenceSaver with internal management of loading state
2020-06-18 17:28:05 -04:00
flarum-bot
4fc06336df Bundled output for commit 65f2d5fb75 [skip ci] 2020-06-18 21:09:49 +00:00
Alexander Skvortsov
65f2d5fb75 Extract NotificationList state (#2185)
* Extract NotificationList state
2020-06-18 17:08:06 -04:00
Alexander Skvortsov
5bca4fda9d Return the proper error code when wrong password when changing email (#2171) 2020-06-17 20:43:04 -04:00
Clark Winkelmann
b87c7189cc Remove BioChanged event which is no longer used since beta 8 (#2196) 2020-06-15 00:21:06 -04:00
Clark Winkelmann
17c239388a Fix AvatarChanged event (#2197)
* Fix AvatarChanged event not being dispatched when changing avatar
Also fix the uploader to trigger the event only once
2020-06-15 00:20:24 -04:00
Alexander Skvortsov
4da2994d1f Group Gambit Improvements (#2192)
* - Add ID to fields searched in group gambit
- Use joins instead of looping in group gambit
* Add visibility scoping to group gambit
* call IDs userIds
* If group identifier is numerical, treat it as an ID
2020-06-08 17:35:24 -04:00
Matt Kilgore
293e2251ca Fixes #2157, Explicitly set SameSite value for cookies (#2159)
* Fixes #2157, Explicitly set SameSite value for cookies by making samesite a config option in config.php. Also contains an update for the cookie library dependency
2020-06-03 22:53:30 -04:00
flarum-bot
3b1f5ca07b Bundled output for commit d1750fecc0 [skip ci] 2020-05-31 02:50:39 +00:00
Alexander Skvortsov
d1750fecc0 Send Test Mail Feature (#2023)
- Add UI, backend for sending test emails
- Change mail settings endpoint to /api/mail/settings
2020-05-30 22:49:36 -04:00
flarum-bot
63242edeb3 Bundled output for commit 0aed3764c4 [skip ci] 2020-05-31 02:29:29 +00:00
Hasan Özbey
0aed3764c4 Scroll to edited post or inform the user (#2108)
* scroll to edit or inform the user
2020-05-30 22:28:08 -04:00
Alexander Skvortsov
7b1269207e Get rid of Laravel Gate contract (#2181)
* Get rid of unnecessary uses of gate

* Move gate off of Laravel's gate contract
2020-05-28 18:00:44 -04:00
Sami Mazouz
bab084a75f Fix Paths test failing on Windows (#2187)
* Fix directory separator for windows os

* Change Paths to use a forward slash instead
2020-05-28 12:42:54 -04:00
Alexander Skvortsov
3c87f800dd Instances of models should not matter when checking permissions (#2186) 2020-05-27 12:22:08 -04:00
Matt Kilgore
26256c436f Fix installer removing URL port (#2182)
* Fix installer removing URL port
2020-05-25 14:35:22 +02:00
Franz Liedke
63397bb466 Allow manipulating error handler through extender
By giving each middleware a name, they can now be replaced or moved
around using the Middleware extender.

Fixes #2115.
2020-05-24 08:47:26 +02:00
w-4
4b6864534b Fix header contents moving when opening modal (#2131)
* add navbar-fixed-top css class

* App-header position:fixed
2020-05-23 14:41:54 -04:00
Franz Liedke
c4f4f218bf Tests: Actually accept multiple extenders
We did pass multiple extenders to this method in the tests for the
`Model` extender - now this actually has the desired effect.
2020-05-23 02:00:25 +02:00
Franz Liedke
4866e7d9ba Stop using app() helper in tests 2020-05-23 01:56:21 +02:00
Sami Mazouz
d6acf28fcb Add z-index rule as part of fixing replies dropdown menu width (#2178) 2020-05-22 18:50:39 -04:00
Alexander Skvortsov
e627616750 Inject Url Generator and Translator Interface into notification mailer (#2169) 2020-05-22 18:10:31 -04:00
flarum-bot
bbd815a9ab Bundled output for commit acf4e9c80d [skip ci] 2020-05-20 00:53:05 +00:00
Alexander Skvortsov
acf4e9c80d Removed excess Widget class in favor of DashboardWidget (#2164) 2020-05-19 20:52:07 -04:00
flarum-bot
1bb5f99a27 Bundled output for commit b0822df759 [skip ci] 2020-05-19 22:46:59 +00:00
Alexander Skvortsov
b0822df759 Use drivers for display names, add display name extender (#2174)
* Deprecate GetDisplayName event

* Add interface for display name driver

* Add username driver as default

* Add code to register supported drivers / used driver as singletons

* Configured User class to use new driver-based system for display names

* Add extender for adding display name driver

* Add integration test for user display name driver

* Add frontend UI for selecting display name driver
2020-05-19 18:45:56 -04:00
flarum-bot
998e32c208 Bundled output for commit f89f114fad [skip ci] 2020-05-16 00:11:53 +00:00
julakali
f89f114fad Don't use body as tooltip container, allow notification area overflow (#2166)
* Don't use body as tooltip container, allow notification area overflow

Badge tooltips are using container: 'body', so they can overflow the
notification area. When the user navigates back while a badge tooltip is
showing, the tooltip remains visible.
This commit removes the body container attribute and instead allows the
notificationDropDown to overflow, so badge tooltips aren't cut off.
Instead, this adds overflow: hidden to NotificationList.
Fixes #2118.

* Remove newline
2020-05-15 20:10:40 -04:00
flarum-bot
9b936d4baa Bundled output for commit 7e661df15d [skip ci] 2020-05-12 16:24:38 +00:00
David Sevilla Martín
7e661df15d Some improvements to request error handling and modal error formatting (#1929)
* Use decodeURI instead of unescape & don't close modals

* Add comment

* Don't use a try/catch, clean up the group log code

* Remove double negative

* Format; fix issues from rebasing
2020-05-12 12:23:13 -04:00
Franz Liedke
b7355db2b7 Merge pull request #2154 from flarum/fl/2055-l58
Upgrade to Laravel 5.8
2020-05-12 15:20:01 +02:00
Franz Liedke
5dc9451c21 Fix notification query with DB prefix
This was fixed in https://github.com/laravel/framework/pull/28400.
See commit 7f1048352d.
2020-05-09 14:45:57 +02:00
Franz Liedke
220c8c66b0 Fix signature of HandleErrors middleware
In Laravel 5.8, the `Container::tagged()` method was changed to return
an iterator [1].

We only use the result for iteration, or, in this case, to pass a bunch
of "reporters" to the error handler middleware, therefore we need to
accept an iterable here.

[1]: https://laravel.com/docs/5.8/upgrade#container-generators
2020-05-08 23:30:17 +02:00
Franz Liedke
484933db7d Test setup: Do not use env() helper
Not needed, and not working without a full Laravel installation.
2020-05-08 23:30:17 +02:00
Franz Liedke
f6347dcc46 Update Laravel components to v5.8
First part of #2055.
2020-05-08 21:46:13 +02:00
Franz Liedke
107b4be726 Remove empty comment 2020-05-08 16:05:25 +02:00
Franz Liedke
93d4192b54 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-05-08 14:03:48 +00:00
Franz Liedke
ecdce44d55 Fix container configuration when not installed 2020-05-08 16:03:20 +02:00
Franz Liedke
a5e286e662 Drop MigrationServiceProvider 2020-05-08 12:04:24 +02:00
Franz Liedke
443949f7b9 Fix generate:migration command for extensions
Apparently, this code was from back when we had a special "extensions"
directory for Composer packages marked as Flarum extensions.

While we're at it, we now inject the Paths instance instead of using one
of the global helpers (which I am trying to get rid of).

Refs #2055.
2020-05-08 12:01:11 +02:00
Franz Liedke
4884aad2f0 Update beta.13 changelog 2020-05-08 11:35:46 +02:00
Franz Liedke
365eb15d29 Merge pull request #2142 from flarum/fl/2055-prepare-for-laravel-58
Split up Application and Container
2020-05-07 22:49:36 +02:00
flarum-bot
85e2623622 Bundled output for commit 7d99727168 [skip ci] 2020-05-07 07:20:06 +00:00
Daniël Klabbers
7d99727168 commit version constant 2020-05-07 09:17:26 +02:00
Daniël Klabbers
84784c9839 Release v0.1.0-beta.13 2020-05-07 09:18:04 +02:00
Franz Liedke
a9470b463f Make two more tests compatible with PHPUnit 8 2020-05-07 09:18:04 +02:00
Franz Liedke
deb48bd173 Remove obsolete method 2020-05-07 09:18:04 +02:00
Alexander Skvortsov
b38bd60362 Added simply confirmation popup for hiding / deleting posts (#2135) 2020-05-07 09:18:04 +02:00
Franz Liedke
260e7cd48f Inject new Paths class instead of Application
This (and similar work in other areas) will allow us to further
reduce the API surface of the Application class.

Separation of concerns etc.
2020-05-01 15:47:35 +02:00
Franz Liedke
41a56c4ad1 Split up Application and Container
- Stop trying to implement Laravel's Application contract, which
  has no value for us.
- Stop inheriting from the Container, injecting one works equally
  well and does not clutter up the interfaces.
- Inject the Paths collection instead of unwrapping it again, for
  better encapsulation.

This brings us one step closer toward upgrading our Laravel
components (#2055), because we no longer need to adopt the changes
to the Application contract.
2020-05-01 15:47:35 +02:00
Franz Liedke
d0ae2839f0 Extract a class to hold / determine paths 2020-05-01 15:24:20 +02:00
flarum-bot
d31a747631 Bundled output for commit 526081bd06 [skip ci] 2020-05-01 09:53:55 +00:00
Franz Liedke
526081bd06 Update Webpack 2020-05-01 11:52:26 +02:00
Franz Liedke
cbdd3c5cc7 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-04-27 20:04:41 +00:00
Franz Liedke
7d1ef9d891 Remove a bunch of deprecated events
Use extenders instead!

Refs #1891.
2020-04-27 22:04:08 +02:00
Alexander Skvortsov
7794546845 Model extender: Fix inheritance (#2132)
This ensures that default values, date attributes and relationships are properly inherited, when we have deeper model class hierarchies.

This also adds test cases to ensure that inheritance order is honored for relationship and default attribute extender. As there's no way to remove date attributes, the order of evaluation there doesn't matter.
2020-04-24 21:17:31 +02:00
Franz Liedke
c43cc874ee Model extender: Add failing test
We determined that child classes are not properly affected when
extending the parent classes.

Refs #2100.
2020-04-24 17:54:30 +02:00
Franz Liedke
33cf94c192 Fix test to match its description
Refs #2100.
2020-04-24 17:31:08 +02:00
Franz Liedke
036e519865 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-04-24 14:56:37 +00:00
Franz Liedke
9386c91af9 Tweak model extender tests
- Format code
- Reorder methods
- Test a different scenario to avoid the use of sleep()

Refs #2100.
2020-04-24 16:55:04 +02:00
Franz Liedke
8306cef963 Clean up model extender
- Remove unused private attributes
- Complete docblocks
- Add scalar type hints
- Format code
- Reorder methods

Refs #2100.
2020-04-24 16:33:08 +02:00
Franz Liedke
51ea326959 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-04-24 13:10:36 +00:00
Alexander Skvortsov
15bed971e6 Add model extender (#2100)
This covers default attribute values, date attributes and custom relationships.
2020-04-24 15:10:24 +02:00
Franz Liedke
c896cd8696 npm audit fix 2020-04-24 14:30:16 +02:00
flarum-bot
54ac83d0b6 Bundled output for commit 1592cd1013 [skip ci] 2020-04-22 21:38:57 +00:00
Franz Liedke
1592cd1013 CI: Shorten the lint job name 2020-04-22 23:37:37 +02:00
Alexander Skvortsov
6e8884f190 Implement hidden permission groups (#2129)
Only users that have the new `viewHiddenGroups` permissions will be able to see these groups.

You might want this when you want to give certain users special permissions, but don't want to make your authorization scheme public to regular users.

Co-authored-by: luceos <daniel+github@klabbers.email>
2020-04-21 17:49:53 +02:00
Franz Liedke
df8f73bd3d Statically access Flarum version everywhere
One less reason to inject the huge Application class.

Refs #2055.
2020-04-21 16:48:36 +02:00
Franz Liedke
3f0f89afb1 Use Container contract where easily possible
Less usages of the Application god-class simplifies splitting it up.

Refs #2055.
2020-04-21 16:48:06 +02:00
Franz Liedke
f0f301c5f4 Add compatiblity with Composer 2.0
- The structure of vendor/composer/installed.json will change.
- The same file will now contain the relative path to package locations.

References:
- https://github.com/composer/composer/blob/master/UPGRADE-2.0.md
- https://php.watch/articles/composer-2
2020-04-21 15:47:58 +02:00
Franz Liedke
3045bde167 Format code
- Early returns
- Comments
- Write variables only when needed

Refs #2020.
2020-04-19 16:53:52 +02:00
Robert Korulczyk
ee7a4627d8 Load only translations for enabled extensions from language packs (#2020)
fix #1837

Co-authored-by: Daniel Klabbers <daniel+git@klabbers.email>
2020-04-19 16:29:45 +02:00
Franz Liedke
b9fb92d49a Inline test class
Refs #1977.
2020-04-19 15:55:10 +02:00
Clark Winkelmann
b5accca957 Make AbstractPolicy compatible with both object and class as $model (#1977) 2020-04-19 15:52:59 +02:00
flarum-bot
798a3486bf Bundled output for commit 89ef14faf1 [skip ci] 2020-04-17 09:59:47 +00:00
Franz Liedke
89ef14faf1 Run prettier for all JS files 2020-04-17 11:57:55 +02:00
Franz Liedke
84cf938379 Merge pull request #2099 from flarum/fl/prettier
Install prettier for consistent JS styling
2020-04-17 11:20:52 +02:00
Franz Liedke
899cdfda4e CI: Run prettier to check for JS code formatting 2020-04-17 11:14:37 +02:00
Franz Liedke
72ed4faa83 Setup husky for automatic formatting before commit 2020-04-17 10:45:36 +02:00
Franz Liedke
64ad21e5da Add NPM shortcut for running prettier 2020-04-17 10:45:05 +02:00
Franz Liedke
14e8e9a7cb Configure prettier via JSON file 2020-04-17 10:44:36 +02:00
Franz Liedke
ee996e2cae Install prettier 2020-04-17 10:44:31 +02:00
Franz Liedke
7b35674e4a Merge pull request #2117 from flarum/fl/2055-streamline-uploads
Simplify uploads, avoid Application contract
2020-04-15 22:52:03 +02:00
Franz Liedke
1d953b3514 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-04-13 09:59:07 +00:00
Franz Liedke
b7d8f77529 Tweak event extender (tests)
- Inject contract, not implementation
- Do not dispatch event in test, let the core do that
- Ensure the relevant database tables are reset prior to the test
- Use correct parameter order for assertions

Refs #2097.
2020-04-13 11:58:47 +02:00
Franz Liedke
b343206c7b Tweak mail extender (tests)
- Use private over protected
- Use "public" API for building requests in tests
- Add more assertions
- Formatting
- Use correct parameter order for assertions

Refs #2012.
2020-04-13 11:58:46 +02:00
flarum-bot
2aead54aea Bundled output for commit dbfae0b55e [skip ci] 2020-04-13 09:22:40 +00:00
Alexander Skvortsov
dbfae0b55e Add year, localization support for displaying things older than 1 year (#2034) 2020-04-13 11:21:27 +02:00
Alexander Skvortsov
2d86eb9b9f Mail Extender (#2012)
This allows registering new drivers, or overwriting existing ones.
2020-04-13 10:46:33 +02:00
Alexander Skvortsov
3ac5e58fa1 Add event extender (used for domain events) (#2097) 2020-04-13 10:45:34 +02:00
Alexander Skvortsov
ffa56595c3 Improved UI of Switch with loading indicator (#2039)
* Moved loading indicator outside of checkboxes to improve ui
* Made loading indicator more visible, fade label when switch is loading
2020-04-10 22:51:58 +02:00
flarum-bot
453c44632d Bundled output for commit 117c2f65ac [skip ci] 2020-04-10 19:18:00 +00:00
w-4
117c2f65ac Fix PostStreamScrubber click (#1945) 2020-04-10 21:16:57 +02:00
Franz Liedke
cd9edf656b ForumSerializer: Use UrlGenerator for base URLs
The test from the previous commit proves this works as intended. :)

This is one more step in trying to avoid the widespread usage of the
`Application` godclass.

Refs #2055.
2020-04-10 17:46:15 +02:00
Franz Liedke
8c19ba1aaa Add integration test for API root endpoint 2020-04-10 17:46:15 +02:00
Hasan Özbey
3f5554816e Fix mobile notification bubble on colored header (#2109) 2020-04-10 12:50:36 +02:00
flarum-bot
cb9801a324 Bundled output for commit fd4c0d30d8 [skip ci] 2020-04-10 10:32:46 +00:00
Taraflex
fd4c0d30d8 Protect dismissible modals from closing by ESC key 2020-04-10 12:30:56 +02:00
Franz Liedke
922e294668 Permissions page: Tweak icon styling
- Give them a fixed width (independent of font library)
- Center the icons in their column
- De-emphasize the icons by applying a muted color

Fixes #2016, closes #2018.
2020-04-10 12:01:04 +02:00
Franz Liedke
1fa37a7a6a Simplify uploads, inject filesystem instances
This avoids injecting the Application god class and assembling default
file locations in multiple places.

In addition, we no longer use the `MountManager` for these uploads. It
only added complexity (by moving tmp files around) and will not be
available in the next major release of Flysystem.

Note: Passing PSR upload streams to Intervention Image requires an
explicit upgrade of the library. (Very likely, users have already
updated to the newer versions, as the old constraint allowed it, but
we should be explicit for correctness' sake.)
2020-04-10 11:38:57 +02:00
Franz Liedke
1cbb2a365e Validate PSR-compatible file upload
Instead of converting the uploaded file object to an UploadedFile
instance from Symfony, because the latter is compatible with
Laravel's validation, let's re-implement the validation for the
three rules we were using.

The benefit: we can now avoid copying the uploaded file to a
temporary location just to do the wrapping.

In the next step, we will remove the temporary file and let the
uploader / Intervention Image handle the PSR stream directly.
2020-04-10 11:38:55 +02:00
Charlie
4c50c8d77a Change default discussion comment count
This allows new public discussions to be immediately visible by users.
2020-04-08 01:13:52 +02:00
Alexander Skvortsov
0d57820b50 Added CSRF Extender (#2095) 2020-04-03 21:32:18 +02:00
flarum-bot
ecdd7a2b49 Bundled output for commit 30942bdf38 [skip ci] 2020-04-03 19:27:57 +00:00
Sami Mazouz
30942bdf38 Fix new post injected above unread sticky (#1868)
Refresh the discussion list instead of prepending the new post
2020-04-03 21:26:51 +02:00
Alexander Skvortsov
345ad4bc6d Add console extender (#2057)
* Made the console command system extender-friendly

* Added console extender

* Added ConsoleTestCase to integration tests

* Added integration tests for console extender

* Marked event-based console extension system as deprecated

* Moved trimming command output of whitespace into superclass

* Renamed 'add' to 'command'

* Added special processing for laravel commands

* Code style fixes

* More style fixes

* Fixed $this->container
2020-04-03 19:38:54 +02:00
Alexander Skvortsov
03a4997a1c Send emails through the queue 2020-04-03 13:47:12 +02:00
flarum-bot
857fd95b5e Bundled output for commit dd43e49d0a [skip ci] 2020-04-03 10:03:45 +00:00
Franz Liedke
dd43e49d0a Update JS dependencies to secure versions 2020-04-03 12:02:18 +02:00
Franz Liedke
4efdd2a4f2 Deprecations: Add removal dates and replacements 2020-04-03 11:46:32 +02:00
Hasan Özbey
b286e39429 fix extensions page layout 2020-04-03 11:44:02 +02:00
Franz Liedke
1cda9dca4f Revert BC breaks around notification blueprints
No need for breaking backwards compatibility here - encapsulating the
logic for `getAttributes()` in one place turns out to be quite useful.

Refs #1931.
2020-04-03 11:33:33 +02:00
flarum-bot
e16d57d4e2 Bundled output for commit 2e2aa8747e [skip ci] 2020-04-01 12:42:05 +00:00
Daniël Klabbers
2e2aa8747e fixed an issue with Post--by-start-user for discussions that contain posts of deleted users 2020-04-01 14:40:40 +02:00
flarum-bot
44ac2ec8ee Bundled output for commit 6bbd603a41 [skip ci] 2020-03-30 19:19:56 +00:00
Hasan Özbey
6bbd603a41 Update ModalManager.js 2020-03-30 21:18:48 +02:00
Hasan Özbey
a4910f3d94 Update Modal.less 2020-03-30 21:18:48 +02:00
Hasan Özbey
f003f6e04a fix modals 2020-03-30 21:18:48 +02:00
Franz Liedke
2fe3987c19 Use UrlGenerator over Application for base URL
We need to get rid of this god class, as Laravel's Application contract
gets even bigger with 5.8. To avoid having to add all these methods, we
should try to stop using it where we can.
2020-03-28 11:17:45 +01:00
Franz Liedke
f4ab6f4b1f Laravel: Stop calling deprecated fire() method
This has been deprecated and removed from the contract for a long time,
and it will be completely dropped in v5.8, our next upgrade target.
2020-03-28 11:08:44 +01:00
Franz Liedke
9ae8bcdffe Make tests compatible with PHPUnit 8 2020-03-28 11:06:47 +01:00
Franz Liedke
29bdd471bc Merge pull request #1931 from flarum/dk/1869-queue-notifications
Notifications into the queue
2020-03-27 23:06:36 +01:00
Franz Liedke
fb70826469 Add new method to DiscussionRenamedBlueprint 2020-03-27 16:22:39 +01:00
Franz Liedke
bbe7e97ba1 Add BC layer for notification blueprints
This gives extension authors time to add the new `getAttributes()`
method to their `BlueprintInterface` implementations.

The layer itself is easy to remove in beta.14.
2020-03-27 16:22:38 +01:00
Franz Liedke
310065fb1c Remove unnecessary constructor parameter 2020-03-27 16:22:38 +01:00
Franz Liedke
23da7b3373 Remove Notifying event for now
As discussed with @luceos, let's add this once the use case comes up. It
might be a left-over from a previous state of this PR anyway.
2020-03-27 16:22:37 +01:00
Daniël Klabbers
2ba29a9088 Moved sending emails to the syncer
This separates sending each individual mail, thus hardening the app.
There are still many improvements possible in this code, e.g. chaining
these commands, making emails just another notification type and
listening to the Notify event instead. We can postpone this to a later
stable release.
2020-03-27 16:22:37 +01:00
Daniël Klabbers
cd8a8e9dd7 Notifications into the queue
Forces notifications into a dedicated SendNotificationsJob and passed
to the queue.

- One static method re-used in the job ::getAttributes, is that okay or
  use a trait?
- Do we want to use this solution and refactor into a better Hub after
  stable, postpone this implementation or use it in b11?
2020-03-27 16:16:36 +01:00
Franz Liedke
6b3d634917 Convert last two controller tests to request tests 2020-03-27 13:39:38 +01:00
Daniël Klabbers
8c6fac62d6 fixes checking for enabled extension and correct pointer of 30c6ea9912 2020-03-27 13:29:16 +01:00
Franz Liedke
02e72f4b03 Rename API tests for more consistency
I could not come up with a noun for the new "UpdateTest" for users, so
this is easier in terms of consistency.
2020-03-27 13:22:27 +01:00
Franz Liedke
e3f1e69748 Convert more controller tests to request tests 2020-03-27 13:21:10 +01:00
Matt Kilgore
bc7cea6e61 Fix test and extender for middleware (#2084) 2020-03-27 11:00:30 +01:00
Daniël Klabbers
30c6ea9912 Resolved enabled extension test
The getEnabled method returns all extensions (previously) enabled, yet manually
uninstalled through composer. This does not reference the exact, current state
of the forum. getEnabledExtensions returns a list where the getEnabled list
is filtered on the extensions found in the composer installed.json file.
2020-03-25 11:47:39 +01:00
Matt Kilgore
0bc06e1bb1 fix insertAfter and insertBefore middleware extender functions (#2063) 2020-03-20 22:59:57 +01:00
Franz Liedke
b10a17529d Convert more controller tests to request tests 2020-03-20 18:54:20 +01:00
Franz Liedke
bc80085ce4 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-03-20 17:28:58 +00:00
Franz Liedke
f31fbc5bcf Tests: Use new authenticatedAs option where useful
There are two more API integration tests that explicitly add the
"Authorization" header right now:

- `Flarum\Tests\integration\api\authentication\WithApiKeyTest`
- `Flarum\Tests\integration\api\csrf_protection\RequireCsrfTokenTest`

These two specifically test authentication, so in those cases the
explicitness seems desirable.
2020-03-20 18:28:35 +01:00
Franz Liedke
25f772c1ea Replace authenticatedRequest() by request() option
I feel this makes the parameters a bit more clear, does not rely on
inheritance (you can only inherit from one class, but we might want more
of these helpers in the future), and has less side effects (e.g. no
creation and, more importantly, deletion of users in the database).

Refs #2052.
2020-03-20 18:23:06 +01:00
Franz Liedke
a13c0bb612 Tests: Extract trait for building requests 2020-03-20 17:51:03 +01:00
Alexander Skvortsov
4791cc77b3 Add Authenticated Test Case utility 2020-03-20 17:18:35 +01:00
Alexander Skvortsov
e10da825d4 Users should not be able to restore discussions if deleted by admins (#2037) 2020-03-20 15:57:03 +01:00
Franz Liedke
a2d1d2b819 Update less.php to version 3.0
Now that we require PHP 7.2, this ensures we get the latest updates and
fixes as well.

Refs #1988.
2020-03-17 23:12:23 +01:00
Matt Kilgore
fb277df3b0 Change Extenders properties to private (#1958) 2020-03-17 22:37:17 +01:00
dependabot[bot]
a854fa8bcb Bump acorn from 6.4.0 to 6.4.1 in /js (#2065)
Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-03-17 22:29:36 +01:00
Franz Liedke
bc69588785 CI: Fix broken build on GitHub Actions
The MySQL service is no longer started by default on these agents.

See https://github.blog/changelog/2020-02-21-github-actions-breaking-change-ubuntu-virtual-environments-will-no-longer-start-the-mysql-service-automatically/.
2020-03-17 22:23:11 +01:00
flarum-bot
a2d1245e90 Bundled output for commit 090b05736a [skip ci] 2020-03-09 12:41:19 +00:00
Daniël Klabbers
090b05736a showing start user in class list now 2020-03-09 13:39:26 +01:00
Franz Liedke
4b45ce0a58 Add a baseline test for the middleware extender
Refs #2017.
2020-03-06 15:05:16 +01:00
Franz Liedke
9f8ee7dc94 Fix typo 2020-03-06 15:05:15 +01:00
Franz Liedke
4413848c11 Apply fixes from StyleCI
[ci skip] [skip ci]
2020-03-06 13:55:39 +00:00
Matt Kilgore
9212330ac2 Test Middleware extender (#2017) 2020-03-06 14:55:21 +01:00
Daniël Klabbers
455d070599 start using a dev stability version constant during the cycle 2020-03-05 10:50:30 +01:00
Franz Liedke
84ae88794f Remove deprecated ConfigureMiddleware Event (#2032) 2020-03-04 23:02:05 +01:00
Franz Liedke
ec3e9c722b Remove deprecated Flarum\Util\Str class 2020-03-04 22:59:14 +01:00
Franz Liedke
2e6cd584aa Remove mail settings backwards compatibility layer 2020-03-04 22:58:15 +01:00
Franz Liedke
27b0d1802e Merge branch 'refs/heads/v0.1.0-beta.12'
# Conflicts:
#	composer.json
2020-03-04 22:56:37 +01:00
Daniël Klabbers
2c02702d60 updated core developers in authors 2020-03-03 15:47:00 +01:00
Daniël Klabbers
9c3a016123 Update Application.php
updated version constant for b12
2020-03-03 15:38:15 +01:00
Alexander Skvortsov
0d208dc443 Drop support for PHP 7.1 (#2014)
* Updated PHP requirement to 7.2

* Set wikimedia less version to 1.8

* Indentation fix on composer json

* Revert "Set wikimedia less version to 1.8"

This reverts commit 22d862fd98.
2020-02-27 00:52:03 +01:00
Franz Liedke
e7c71ec445 Re-add mail settings backwards compatibility layer 2020-02-26 23:11:22 +01:00
Franz Liedke
46e2e17c3c Require new mail driver methods, remove BC layer 2020-02-26 22:56:09 +01:00
Alexander Skvortsov
f574f97174 Removed support for SES Mail Driver (#2011) 2020-02-26 22:36:27 +01:00
Alexander Skvortsov
674303b997 Remove Zend compatability bridge (#2010) 2020-02-26 22:29:44 +01:00
Franz Liedke
0fba2c0c0a Re-add util class and mark it as deprecated
This would be the only breaking change in beta.12. Let's stick to our
backwards compatibility promise / intentions as much as possible, even
if we assume the class has not been used anywhere.

This BC layer will be removed again for beta.13.

Refs #1975.
2020-02-26 22:14:23 +01:00
Franz Liedke
0666448ef5 Prepare changelog for beta.12 release 2020-02-26 21:10:52 +01:00
Matt Kilgore
08e40bc693 Force fixed version of text formatter 2020-02-25 11:27:59 +01:00
Franz Liedke
eaf1767008 Merge pull request #2002 from flarum/fl/extender-tests
Start testing extenders
2020-02-14 18:47:58 +01:00
flarum-bot
9f1eca555f Bundled output for commit 72fd32dbf6 [skip ci] 2020-02-14 14:57:19 +00:00
Clark Winkelmann
72fd32dbf6 Add disabled prop to the Select component (#1978) 2020-02-14 15:56:04 +01:00
Clark Winkelmann
d5ebbab3a7 Rename dead is_activated references with the new is_email_confirmed (#1974) 2020-02-14 15:34:32 +01:00
Matt Kilgore
17257aacaf Updates s9e/text-formatter to 2.x (#1982)
No additional changes required, tested with fof/formatting extension.
2020-02-14 12:34:40 +01:00
flarum-bot
f87c8c6dcd Bundled output for commit f9556d9d6a [skip ci] 2020-02-10 22:55:40 +00:00
D Mata
f9556d9d6a Update AvatarEditor.js onchange to oninput (#1570)
onchange does not work in IE11 and other IE browsers. This change works with all modern browsers as well.
2020-02-10 23:54:41 +01:00
Franz Liedke
fdfc6c0de2 CI: Test on PHP 7.4 as well
If we're lucky, this should fail right now, due to #1980.
2020-02-09 06:46:33 +01:00
Franz Liedke
64e4132c92 Switch to Wikimedia's less.php fork
The original library is no longer maintained. The fork supports PHP 7.4.
2020-02-09 06:46:33 +01:00
Franz Liedke
4b78a3114f Try to fix installer in PHP 7.4 2020-02-09 06:46:33 +01:00
Franz Liedke
c01eea58b6 Start testing Route extender 2020-02-08 00:04:32 +01:00
Franz Liedke
19cb74c856 Integration tests: Allow registering extenders 2020-02-07 23:29:14 +01:00
Franz Liedke
27bcdb949b Integration tests: Add lazy server helper
This allows sending requests directly in an integration test, without
having *explicitly* booted the app.
2020-02-07 23:28:37 +01:00
Franz Liedke
94fc460240 Integration tests: Create app lazily when needed
This will allow registering extenders in test scenarios. Previously,
this would not have had any effect as the app would have booted already.
2020-02-07 23:22:22 +01:00
flarum-bot
fc59f0fdd8 Bundled output for commit b91e903284 [skip ci] 2020-02-07 14:35:37 +00:00
Franz Liedke
b91e903284 Merge pull request #1938 from flarum/ds/1255-throttling-bypass-permission
Add permission to bypass throttling
2020-02-07 15:34:25 +01:00
David Sevilla Martín
711e775de7 Add permission to bypass throttling 2020-02-07 15:30:09 +01:00
flarum-bot
736e90d423 Bundled output for commit 2f3d9995d1 [skip ci] 2020-02-07 11:18:30 +00:00
Franz Liedke
2f3d9995d1 Fix race condition in post preview
The post composer could have been closed in between scheduling and
executing the callback.

Fixes flarum/org#58.
Refs #1881.
2020-02-07 12:17:11 +01:00
flarum-bot
ac14f84a9a Bundled output for commit 1d7641cbb0 [skip ci] 2020-02-07 11:06:58 +00:00
Franz Liedke
1d7641cbb0 Merge pull request #1921 from flarum/ds/1763-handle-incomplete-email-configuration
Improve handling of incomplete mail configuration
2020-02-07 12:05:41 +01:00
Franz Liedke
dce36cbeed New extender for error handling (#1970)
This extender implements several methods for extending the new error
handling stack implemented in #1843.

Most use-cases should be covered, but I expect some challenges for more
complex setups. We can tackle those once they come up, though. Basic
use-cases should be covered.

Fixes #1781.
2020-01-31 14:01:12 +01:00
flarum-bot
7e1087cba5 Bundled output for commit 8877bf97c4 [skip ci] 2020-01-31 12:34:20 +00:00
Franz Liedke
8877bf97c4 Merge pull request #1975 from flarum/fl/194-better-slugs
Use Laravel's slugger for basic transliteration
2020-01-31 13:32:55 +01:00
flarum-bot
7e74f5a03c Bundled output for commit 02ceed4fed [skip ci] 2020-01-26 22:38:29 +00:00
Clark Winkelmann
02ceed4fed Fix the "reply posted" alert empty body 2020-01-26 23:37:19 +01:00
Franz Liedke
27f159f6b8 Remove unnecessary use statement 2020-01-26 20:21:19 +01:00
ozzzzzzzam
499f33fbb6 Remove forum title from confirmation email subject (#1613)
The forum title is already used as the display name for the sender email address, so having it in the subject is just a duplication and waste of space.
2020-01-25 14:35:47 +01:00
Matthew Kilgore
8dd3bd420b Additional functionality for Middleware extender
Implements the remove, insertBefore, insertAfter and replace
functionality for middlewares.

The IoC container now holds one array of middleware (bindings) per
frontend stack - the extender operates on that array, before it is
wrapped in a middleware "pipe".

Fixes #1957, closes #1971.
2020-01-24 21:20:33 +01:00
Franz Liedke
2ca3188eff Add BC layer for mail driver configuration
By commenting out the new methods on the `DriverInterface` and checking
for these methods' existence before calling them, old implementations in
extensions will not break right away.

This will be removed after beta.12 is released, giving extension authors
about two months time to update their extensions.
2020-01-24 18:04:16 +01:00
Franz Liedke
f275bcdd2c Clarify the use-case of the JS slug helper 2020-01-24 17:42:14 +01:00
Franz Liedke
64c702aaf7 Use Laravel's slugger for basic transliteration
This is better than the current system, as it adds transliteration rules
for special characters, rather than just throwing all of them away.

For languages that cannot be transliterated to ASCII in a reasonable
manner, more possible improvements are outlined in #194.
2020-01-24 17:40:09 +01:00
Franz Liedke
833ea4e06e Connect labels with their form fields 2020-01-24 15:41:26 +01:00
Franz Liedke
5643ee649b Style validation errors 2020-01-24 15:41:26 +01:00
Franz Liedke
97b2db84c6 Mail drivers: Separate definition from validation 2020-01-24 15:41:26 +01:00
David Sevilla Martin
4fea25959c Change implementation to add validation rules, of which 'required' is shown in the frontend 2020-01-24 15:41:25 +01:00
David Sevilla Martin
8b70cec6a1 Add required fields, incomplete configuration warning, and null transport 2020-01-24 15:41:25 +01:00
flarum-bot
a330a8fa28 Bundled output for commit 02899d4f68 [skip ci] 2020-01-22 23:02:59 +00:00
David Sevilla Martín
02899d4f68 Add Content for User page, preload user & throw 404 accordingly (#1901) 2020-01-23 00:01:26 +01:00
Franz Liedke
76f7d566b2 Convert another test
Test the request, not a controller (implementation detail). This also
focuses on the observable behavior instead of hacking our way into the
middleware pipeline in order to observe internal behavior.

The authenticated user is now determined by looking at the API response
to compare permissions and (non-)existing JSON keys.
2020-01-22 23:39:41 +01:00
David Sevilla Martín
e296bbf0aa Initial template for Stale bot configuration (#1841) 2020-01-18 02:06:36 +01:00
Julian Berger
0a4ee93fde Get translations from fallback catalogues (#1961) 2020-01-17 23:37:50 +01:00
Franz Liedke
1e7fbf1ed9 Add backwards compatibility layer for mail drivers
Support the old format (a simple list of available fields), in addition
to the new format (a map from field names to their types + metadata).

This will be removed after beta.12 is released.
2020-01-14 11:45:44 +01:00
Franz Liedke
1170d5c2cf Document changes in mail driver interface 2020-01-14 11:44:29 +01:00
flarum-bot
fcbbedd884 Bundled output for commit 4c89e2eb77 [skip ci] 2020-01-10 17:18:42 +00:00
Vladimir Vinogradov
4c89e2eb77 Add Mailgun region setting
Fixes #1834.
2020-01-10 18:17:04 +01:00
Franz Liedke
809f353c52 Ensure page parameters are always integers 2020-01-09 00:45:50 +01:00
Matt Kilgore
d7a5a6ad14 Change Zend namespace to Laminas (#1963)
Also ensure backwards compatibility for extensions that use the Zend framework but don't explicitly require it.
2020-01-06 22:29:34 +01:00
luceos
ca0c52d60a Apply fixes from StyleCI
[ci skip] [skip ci]
2020-01-05 21:28:46 +00:00
Daniël Klabbers
2325e33e38 Update LICENSE 2020-01-05 22:28:27 +01:00
Matt Kilgore
aba291c542 Middleware extender (#1952) 2019-12-12 09:22:04 +01:00
flarum-bot
9b00244454 Bundled output for commit c1878fe29b [skip ci] 2019-12-10 14:40:37 +00:00
Franz Liedke
c1878fe29b Update Webpack 2019-12-10 15:38:56 +01:00
Franz Liedke
43c551929b Catch more exceptions during boot process
This extends our boot exception handling block to also catch and format
all exceptions that could be thrown while building our request handler,
i.e. the middleware stack handling requests.

The only exceptions that would now not be handled in this way could be
raised by Zend's `RequestHandlerRunner` and its delegates, which we
should be able to rely on.

Exceptions on request execution will be handled by the error handler in
the middleware stack.

Fixes #1607.
2019-12-07 01:16:48 +01:00
w-4
840e740309 Fix update page with custom base path (#1947)
Calling UpdateHandler causes RouteNotFoundException when basepath is not /.
2019-12-04 23:37:33 +01:00
Franz Liedke
babb36d375 Link to security policy from README 2019-12-04 21:51:53 +01:00
Franz Liedke
25b9d88469 FUNDING.yml does not inherit 2019-12-04 21:42:40 +01:00
Franz Liedke
b5c2285167 Add a custom FUNDING.yml file for this repository
Let's hope GitHub inherits the lines from our default community health
files at https://github.com/flarum/.github.
2019-12-04 21:41:41 +01:00
Daniël Klabbers
beaaa21f58 Update CHANGELOG.md 2019-12-02 10:36:41 +01:00
Daniel Klabbers
8a1bcf30d2 releasing beta 11.1 2019-12-02 09:28:48 +01:00
Franz Liedke
ff384569f8 Fix implementations of settings repo interface 2019-12-01 22:10:58 +01:00
Daniel Klabbers
f64a253450 Revert "7.4 release, forcing tests to work with them"
This reverts commit da5628d125.
2019-11-29 13:01:51 +01:00
Daniel Klabbers
da5628d125 7.4 release, forcing tests to work with them 2019-11-29 13:00:34 +01:00
1143 changed files with 56769 additions and 24311 deletions

View File

@@ -15,5 +15,5 @@ indent_size = 2
[*.{diff,md}]
trim_trailing_whitespace = false
[*.{php,xml}]
[*.{php,xml,json}]
indent_size = 4

6
.gitattributes vendored
View File

@@ -11,3 +11,9 @@ 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

@@ -1,24 +0,0 @@
<!--
IMPORTANT: We applaud pull requests, they excite us every single time. As we have an obligation to maintain a healthy code standard and quality, we take sufficient time for reviews. Please do create a separate pull request per change/issue/feature; we will ask you to split bundled pull requests.
-->
**Fixes #0000**
**Changes proposed in this pull request:**
<!-- fill this out, mention the pages and/or components which have been impacted -->
**Reviewers should focus on:**
<!-- fill this out, ask for feedback on specific changes you are unsure about -->
**Screenshot**
<!-- include an image of the most relevant user-facing change, if any -->
**Confirmed**
- [ ] Frontend changes: tested on a local Flarum installation.
- [ ] Backend changes: tests are green (run `composer test`).
**Required changes:**
- [ ] Related documentation PR: (Remove if irrelevant)
- [ ] Related core extension PRs: (Remove if irrelevant)

13
.github/SECURITY.md vendored
View File

@@ -1,13 +0,0 @@
# Security Policy
## Supported Versions
During the beta phase, we will only patch security vulnerabilities in the latest beta release.
## Reporting a Vulnerability
If you discover a security vulnerability within Flarum, please send an email to security@flarum.org so we can address it promptly.
We will get back to you as time allows.
Discussions may commence internally, so you may not hear back immediately.
When reporting a vulnerability, please provide your GitHub username (if available), so that we can invite you to collaborate on a [security advisory on GitHub](https://help.github.com/en/articles/about-maintainer-security-advisories).

26
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
daysUntilStale: 90
daysUntilClose: 30
staleLabel: stale
exemptLabels:
- org/keep
- type/bug
- type/regression
- critical
- security
exemptAssignees: true
exemptMilestones: true
exemptProjects: true
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. We do this
to keep the amount of open issues to a manageable minimum.
In any case, thanks for taking an interest in this software and contributing
by opening the issue in the first place!
closeComment: >
We are closing this issue as it seems to have grown stale. If you still
encounter this problem with the latest version, feel free to re-open it.

15
.github/workflows/backend.yml vendored Normal file
View File

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

View File

@@ -1,16 +0,0 @@
name: JavaScript
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: flarum/action-build@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

76
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@@ -0,0 +1,76 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
# Run on:
# - pushes to master, or
# - PRs with a base of `master`
# - which do not **only** consist of changes to .md or .less files
on:
push:
branches: [ master ]
paths-ignore:
- '**/*.md'
- '**/*.less'
pull_request:
branches: [ master ]
paths-ignore:
- '**/*.md'
- '**/*.less'
schedule:
- cron: '0 0 * * 1,3,5'
jobs:
analyze:
name: Analyze / ${{ matrix.language }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

23
.github/workflows/frontend.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Core JS
on: [workflow_dispatch, push, pull_request]
# The reusable workflow definitions will be moved to the `flarum/framework` repo soon.
# This will break your current script.
# When this happens, run `flarum-cli audit infra --fix` to update your infrastructure.
jobs:
run:
uses: flarum/.github/.github/workflows/REUSABLE_frontend.yml@main
with:
enable_bundlewatch: true
enable_prettier: true
enable_typescript: true
frontend_directory: ./js
backend_directory: .
js_package_manager: yarn
main_git_branch: master
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@@ -1,65 +0,0 @@
name: Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.1, 7.2, 7.3]
service: ['mysql:5.7', mariadb]
prefix: ['', flarum_]
include:
- service: 'mysql:5.7'
db: MySQL
- service: mariadb
db: MariaDB
- prefix: flarum_
prefixStr: (prefix)
exclude:
- php: 7.1
service: 'mysql:5.7'
prefix: flarum_
- php: 7.1
service: mariadb
prefix: flarum_
- php: 7.2
service: 'mysql:5.7'
prefix: flarum_
- php: 7.2
service: mariadb
prefix: flarum_
services:
mysql:
image: ${{ matrix.service }}
ports:
- 13306:3306
name: 'PHP ${{ matrix.php }} / ${{ matrix.db }} ${{ matrix.prefixStr }}'
steps:
- uses: actions/checkout@master
- name: Select PHP version
run: sudo update-alternatives --set php $(which php${{ matrix.php }})
- name: Create MySQL Database
run: mysql -uroot -proot -e 'CREATE DATABASE flarum_test;' --port 13306
- name: Install Composer dependencies
run: composer install
- name: Setup Composer tests
run: composer test:setup
env:
DB_PORT: 13306
DB_PASSWORD: root
DB_PREFIX: ${{ matrix.prefix }}
- name: Run Composer tests
run: composer test

5
.gitignore vendored
View File

@@ -1,9 +1,12 @@
/vendor
composer.lock
composer.phar
node_modules
.DS_Store
Thumbs.db
tests/.phpunit.result.cache
/tests/integration/tmp
.vagrant
.idea/*
.vscode
js/coverage-ts

View File

@@ -12,7 +12,3 @@ disabled:
- phpdoc_order
- phpdoc_separation
- phpdoc_types
finder:
exclude:
- "stubs"

View File

@@ -1,5 +1,605 @@
# Changelog
## [1.2.0](https://github.com/flarum/core/compare/v1.1.1...v1.2.0)
### Added
- View `README` documentation in extension pages (https://github.com/flarum/core/pull/3094).
- Declare & Use CSS Custom Properties (https://github.com/flarum/core/pull/3146).
- Lazy draw dropdowns to improve performance (https://github.com/flarum/core/pull/2925).
- Default Settings Extender (https://github.com/flarum/core/pull/3127).
- Add `textarea` setting type to admin pages (https://github.com/flarum/core/pull/3141).
- Allow registering settings as `Less` config vars through Settings Extender (https://github.com/flarum/core/pull/3011).
- Allow replacing of blade template namespaces via extender (https://github.com/flarum/core/pull/3167).
- Update to Webpack 5 (https://github.com/flarum/core/pull/3135).
- Introduce `Less` custom function extender with a `is-extension-enabled` function (https://github.com/flarum/core/pull/3190).
- Support for `few` in ICU Message syntax (https://github.com/flarum/core/pull/3122).
- ES6 local support for number formatting (https://github.com/flarum/core/pull/3099).
- Added dedicated endpoint for retrieving single groups (https://github.com/flarum/core/pull/3084).
- Callback `loadWhere` relation eager loading extender (https://github.com/flarum/core/pull/3116).
- Extensible document title driver implementation (https://github.com/flarum/core/pull/3109).
- Type checks, typescript coverage GH action (https://github.com/flarum/core/pull/3136).
- Add color indicator in appearance admin page instead of validating colors (https://github.com/flarum/core/pull/3140).
- Add typing files for our translator libraries (https://github.com/flarum/core/pull/3175).
- `StatusWidget` tools extensibility (https://github.com/flarum/core/pull/3189).
- Allow switching the `ImageManager` driver (https://github.com/flarum/core/pull/3195).
- Events for notification read/all read actions (https://github.com/flarum/core/pull/3203).
### Changed
- Testing with php8.1 (https://github.com/flarum/core/pull/3102).
- Migrate fully to Yarn (https://github.com/flarum/core/pull/3155).
- Handle post rendering errors to avoid crashes (https://github.com/flarum/core/pull/3061).
- Added basic filtering, sorting, and pagination to groups endpoint (https://github.com/flarum/core/pull/3084).
- Pass IP address to API Client pipeline (https://github.com/flarum/core/pull/3124).
- Rename Extension Page "Uninstall" to "Purge" (https://github.com/flarum/core/pull/3123).
- [A11Y] Improve accessibility for discussion reply count on post stream (https://github.com/flarum/core/pull/3090).
- Improved post loading support (https://github.com/flarum/core/pull/3100).
- Rewrite SubtreeRetainer into Typescript (https://github.com/flarum/core/pull/3137).
- Rewrite ModalManager and state to Typescript (https://github.com/flarum/core/pull/3007).
- Rewrite frontend application files to Typescript (https://github.com/flarum/core/pull/3006).
- Allow extensions to modify the minimum search length in the Search component (https://github.com/flarum/core/pull/3130).
- Allow use of any tag in `listItems` helper (https://github.com/flarum/core/pull/3147).
- Replace `for ... in` with `Array.reduce` (https://github.com/flarum/core/pull/3149).
- Page title format is now implemented through translations (https://github.com/flarum/core/pull/3077, https://github.com/flarum/core/pull/3228)
- Add `aria-label` attribute to the navigation drawer button (https://github.com/flarum/core/pull/3157).
- Convert extend util to TypeScript (https://github.com/flarum/core/pull/2928).
- Better typings for DiscussionListState (https://github.com/flarum/core/pull/3132).
- Rewrite ItemList, update `ItemList` typings (https://github.com/flarum/core/pull/3005).
- Add priority order to discussion page controls (https://github.com/flarum/core/pull/3165).
- Use `@php` in Blade templates (https://github.com/flarum/core/pull/3172).
- Convert some common classes/utils to TS (https://github.com/flarum/core/pull/2929).
- Convert routes to Typescript (https://github.com/flarum/core/pull/3177).
- Move admin `colorItems` to an `ItemList` (https://github.com/flarum/core/pull/3186).
- Centralize pagination/canonical meta URL generation in Document (https://github.com/flarum/core/pull/3077).
- Use revision versioner to allow custom asset versioning (https://github.com/flarum/core/pull/3183).
- Split up application error handling (https://github.com/flarum/core/pull/3184).
- Make SlugManager available to blade template (https://github.com/flarum/core/pull/3194).
- Convert models to TS (https://github.com/flarum/core/pull/3174).
- Allow loading relations in other discussion endpoints (https://github.com/flarum/core/pull/3191).
- Improve selected text stylization (https://github.com/flarum/core/pull/2961).
- Extract notification `primaryControl` items to an ItemList (https://github.com/flarum/core/pull/3204).
- Frontend code housekeeping (#3214, #3213).
- Only retain scroll position if coming from discussion (https://github.com/flarum/core/pull/3229).
- Use `aria-live` regions to focus screenreader attention on alerts as they appear (https://github.com/flarum/core/pull/3237).
- Prevent unwarranted `a11y` warnings on custom Button subclasses (https://github.com/flarum/core/pull/3238).
### Fixed
- Missing locale text in the user editing modal (https://github.com/flarum/core/pull/3093).
- Dashes in table prefix prevent installation (https://github.com/flarum/core/pull/3089).
- Missing autocomplete attributes to input fields (https://github.com/flarum/core/pull/3088).
- Missing route parameters throwing an error (https://github.com/flarum/core/pull/3118).
- Mail settings select component never used (https://github.com/flarum/core/pull/3120).
- White avatar image throws javascript errors on the profile page (https://github.com/flarum/core/pull/3119).
- Unformatted avatar upload validation errors (https://github.com/flarum/core/pull/2946).
- Webkit input clear button shows up with the custom one (https://github.com/flarum/core/pull/3128).
- Media query breakpoints conflict with Windows display scaling (https://github.com/flarum/core/pull/3139).
- `typeof this` not recognized by some IDEs (https://github.com/flarum/core/pull/3142).
- `Model.save()` cannot save `null` `hasOne` relationship (https://github.com/flarum/core/pull/3131).
- Edit post `until reply` policy broken on PHP 8 (https://github.com/flarum/core/pull/3145).
- Inaccurate `Component.component` argument typings (https://github.com/flarum/core/pull/3148).
- Scrolling notification list infinitely repeats (https://github.com/flarum/core/pull/3159).
- Argument for INFO constant was assigned to `maxfiles` argument incorrectly (bfd81a83cfd0fa8125395a147ff0c9ce622f38e3).
- `Activated` event is sent every time an email is confirmed instead of just once (https://github.com/flarum/core/pull/3163).
- [A11Y] Modal close button missing accessible label (https://github.com/flarum/core/pull/3161).
- [A11Y] Auth modal inputs missing accessible labels (https://github.com/flarum/core/pull/3207).
- [A11Y] Triggering click on drawer button can cause layered backdrops (https://github.com/flarum/core/pull/3018).
- [A11Y] Focus can leave open nav drawer on mobile (https://github.com/flarum/core/pull/3018).
- [A11Y] Post action items not showing when focus is within the post (https://github.com/flarum/core/pull/3173).
- [A11Y] Missing accessible label for alert dismiss button (https://github.com/flarum/core/pull/3237).
- Error accessing the forum after saving a setting with more than 65k characters (https://github.com/flarum/core/pull/3162).
- Cannot restart queue from within (https://github.com/flarum/core/pull/3166).
- `Post--by-actor` not showing when comparing user instances (https://github.com/flarum/core/pull/3170).
- Incorrect typings for Modal `hide()` method (https://github.com/flarum/core/pull/3180).
- Avatar Upload throws errors with correct mimetype and incorrect extension (https://github.com/flarum/core/pull/3181).
- Clicking the dropdown button on a post opens all dropdowns in `Post-actions` (https://github.com/flarum/core/pull/3185).
- `getPlainContent()` causes external content to be fetched (https://github.com/flarum/core/pull/3193).
- `listItems` not accepting all `Mithril.Children` (https://github.com/flarum/core/pull/3176).
- Notifications mark as read option updates all notifications including the read ones (https://github.com/flarum/core/pull/3202).
- Post meta permalink not properly generated (https://github.com/flarum/core/pull/3216).
- Broken contribution link in README (https://github.com/flarum/core/pull/3211).
- `WelcomeHero` is displayed when content is empty (https://github.com/flarum/core/pull/3219).
- `last_activity_at, last_seen_at` updated on all API requests (https://github.com/flarum/core/pull/3231).
- `RememberMe` access token updated twice in API requests (https://github.com/flarum/core/pull/3233).
- Error in `funding` item in `composer.json` bricks the frontend (https://github.com/flarum/core/pull/3239).
- Escaped quotes in window title (https://github.com/flarum/core/pull/3264)
- `schedule:list` command fails due to missing timezone configuration.
### Deprecated
- Unused `evented` utility (https://github.com/flarum/core/pull/3125).
## [1.1.1](https://github.com/flarum/core/compare/v1.1.0...v1.1.1)
### Fixed
- Performance issue with very large communities.
## [1.1.0](https://github.com/flarum/core/compare/v1.0.4...v1.1.0)
### Added
- Info command now displays MySQL version, queue driver, mail driver (https://github.com/flarum/core/pull/2991)
- Use organization Prettier config (https://github.com/flarum/core/pull/2967)
- Support for global typings in extensions (https://github.com/flarum/core/pull/2992)
- Typings for class component state attribute (https://github.com/flarum/core/pull/2995)
- Custom colorising with CSS custom properties (https://github.com/flarum/core/pull/3001)
- Theme Extender to allow overriding LESS files (https://github.com/flarum/core/pull/3008)
- Update lastSeenAt when authenticating via API (https://github.com/flarum/core/pull/3058)
- NoJs Admin View (https://github.com/flarum/core/pull/3059)
- Preload FontAwesome, JS and CSS, and add `preload` extender (https://github.com/flarum/core/pull/3057)
### Changed
- Move Day.js plugin types import to global typings (https://github.com/flarum/core/pull/2954)
- Avoid resolving excluded middleware on each middleware items
- Allow extra attrs provided to `<Select>` to be passed through to the DOM element (https://github.com/flarum/core/pull/2959)
- Limit height of code blocks (https://github.com/flarum/core/pull/3012)
- Update normalize.css from v3.0.2 to v8.0.1 (https://github.com/flarum/core/pull/3015)
- Permission Grid: stick the headers to handle a lot of tags (https://github.com/flarum/core/pull/2887)
- Use `ItemList` for `DiscussionPage` content (https://github.com/flarum/core/pull/3004)
- Move email confirmation to POST request (https://github.com/flarum/core/pull/3038)
- Minor CSS code cleanup (https://github.com/flarum/core/pull/3026)
- Replace username with display name in more places (https://github.com/flarum/core/pull/3040)
- Rewrite Button to Typescript (https://github.com/flarum/core/pull/2984)
- Rewrite AdminPage abstract component into Typescript (https://github.com/flarum/core/pull/2996)
- Allow adding page parameters to PaginatedListState (https://github.com/flarum/core/pull/2935)
- Pass filter params to getApiDocument (https://github.com/flarum/core/pull/3037)
- Use author filter instead of gambit to get a user's discussions (https://github.com/flarum/core/pull/3068)
- [A11Y] Accessibility improvements for the Search component (https://github.com/flarum/core/pull/3017)
- Add determinsm to extension order resolution (https://github.com/flarum/core/pull/3076)
- Add cache control headers to the admin area (https://github.com/flarum/core/pull/3097)
### Fixed
- HLJS 11 new styles resulting in double padding (https://github.com/flarum/core/pull/2909)
- Internal API client attempting to load an uninstantiated session
- Empty post footer taking visual space (https://github.com/flarum/core/pull/2926)
- Unrecognized component class custom attribute typings (https://github.com/flarum/core/pull/2962)
- User edit groups permission not visually depending on view hidden groups permission (https://github.com/flarum/core/pull/2880)
- Event post excerpt preview triggers error (https://github.com/flarum/core/pull/2964)
- Missing settings defaults for display name driver and User slug driver (https://github.com/flarum/core/pull/2971)
- [A11Y] Icons not hidden from screenreaders (https://github.com/flarum/core/pull/3027)
- [A11Y] Checkboxes not focusable (https://github.com/flarum/core/pull/3014)
- Uploading ICO favicons resulting in server errors (https://github.com/flarum/core/pull/2949)
- Missing proper validation for large avatar upload payload (https://github.com/flarum/core/pull/3042)
- [A11Y] Missing focus rings in control elements (https://github.com/flarum/core/pull/3016)
- Unsanitised integer query parameters (https://github.com/flarum/core/pull/3064)
###### Code Contributors
@lhsazevedo, @Ornanovitch, @pierres, @the-turk, @iPurpl3x
###### Issue Reporters
@uamv, @dannyuk1982, @BurnNoticeSpy, @haarp, @peopleinside, @matteocontrini
## [1.0.4](https://github.com/flarum/core/compare/v1.0.3...v1.0.4)
### Fixed
- Upgrade to v1.0 resets the "view" permission on all tags (https://github.com/flarum/core/pull/2941)
## [1.0.3](https://github.com/flarum/core/compare/v1.0.2...v1.0.3)
### Changed
- Removed [forum] prefix from Request Password and Email Confirmation emails ([a4a81c0](https://github.com/flarum/core/commit/a4a81c0ec237476cd6e7ca00c1ed9465493af476))
- Adopt huntr.dev for handling our security vulnerability reports (https://github.com/flarum/core/pull/2918)
- Maintenance handler can now be replaced through the service container (ioc) ([4acff91](https://github.com/flarum/core/commit/4acff91f8063fcced9bf8c9a76fbb510d06823c0))
- The colors on the auto generated avatars are now based on the Display Name of the user (https://github.com/flarum/core/pull/2873)
### Fixed
- Avatar in notifications list are incorrectly aligned (https://github.com/flarum/core/pull/2906)
- FilesystemManager is not compatible with upstream Laravel implementation (https://github.com/flarum/core/pull/2936)
## [1.0.2](https://github.com/flarum/core/compare/v1.0.1...v1.0.2)
### Fixed
- Critical XSS vulnerability
## [1.0.1](https://github.com/flarum/core/compare/v1.0.0...v1.0.1)
### Fixed
- Installation fails on environments without proc_* functions enabled or mysql client binary (https://github.com/flarum/core/issues/2890)
## [1.0.0](https://github.com/flarum/core/compare/v0.1.0-beta.16...v1.0.0)
### Added
- Task scheduling
- `load()` method on `ApiController` extender to allow eager loading of relations (https://github.com/flarum/core/pull/2724)
- Installation supports enabling a set of extensions (https://github.com/flarum/core/pull/2757)
- RequestUtil helper class added to abstract the logic of the actor, session, locale and route name from the request (https://github.com/flarum/core/pull/2449)
- Code scanning action with GitHub CodeQL (https://github.com/flarum/core/pull/2744)
- The Formatter extender now has an `unparse` method to allow extensions to hook into the unparsing of content (https://github.com/flarum/core/pull/2780)
- A Filesystem extender allows direct modification and addition of filesystem disks (https://github.com/flarum/core/pull/2732)
- A slug driver based on the User ID was introduced (https://github.com/flarum/core/pull/2787)
- An extensible users list was added to the admin area (https://github.com/flarum/core/pull/2626)
- Headers hardened by adding Referer Policy, Xss Protection and Content type (https://github.com/flarum/core/pull/2721)
- Tooltip component (https://github.com/flarum/core/pull/2843)
- Moved `insertText` and `styleSelectedText` from markdown to core (https://github.com/flarum/core/pull/2826)
- A squashed database schema install dump to speed up new installs (https://github.com/flarum/core/pull/2842)
- Pagination in the canonical URL for discussion pages (https://github.com/flarum/core/pull/2853)
- PaginatedListState for the DiscussionList and to support paginated lists in the frontend (https://github.com/flarum/core/pull/2781)
- Introduce the new webpack config and flarum-tsconfig for typehinting (https://github.com/flarum/core/pull/2856)
### Changed
- Now tracking bundle sizes to keep an eye on web performance (https://github.com/flarum/core/pull/2695)
- Eager load relations on ListPostsController to improve performance (https://github.com/flarum/core/pull/2717)
- Replace classList with clsx library (https://github.com/flarum/core/pull/2760)
- Replaced the javascript based loading spinner with a pure CSS version (https://github.com/flarum/core/pull/2764)
- Route names now have to be unique (https://github.com/flarum/core/pull/2771)
- ActorReference is now available from the error handler middleware (https://github.com/flarum/core/pull/2410)
- The `migrations` table now has an Auto Increment ID (https://github.com/flarum/core/pull/2794)
- Assets and avatars are now managed using Laravel filesystem disks (https://github.com/flarum/core/pull/2729)
- Extracted asset publishing (`php flarum assets:publish`) from migrating (https://github.com/flarum/core/pull/2731)
- Assets were compiled in the format `<asset>-<revision>.<js|css>`, this is now `<asset>.<js|css>?v=<revision>` (https://github.com/flarum/core/pull/2805)
- The powered by header can now be configured in the config under `headers` (https://github.com/flarum/core/pull/2777)
- Switched to the ICU format for translation files (https://github.com/flarum/core/pull/2759)
- Allow extend and override to apply to multiple methods in one call
- Notifications dropdown and list refactored (https://github.com/flarum/core/pull/2822)
- Updated validation locale strings based on Laravel 8 changes (https://github.com/flarum/core/pull/2829)
- Caching of permissions is now taken care of centrally, reducing code duplication (https://github.com/flarum/core/pull/2832)
- Replaced lodash-es by throttle-debounce to reduce bundle size (https://github.com/flarum/core/pull/2827)
- Internal API requests are now executed through middleware (https://github.com/flarum/core/pull/2783)
- Permission changes: `viewDiscussions` to `viewForum` and `viewUserList` to `searchUsers` (https://github.com/flarum/core/pull/2854)
### Fixes
- Javascript is shown when editing the title of a discussion (https://github.com/flarum/core/pull/2693)
- Canonical url logic uses request object which causes wrong URL's when a different page is default (https://github.com/flarum/core/pull/2674)
- Dropdown toggle has no aria label (https://github.com/flarum/core/pull/2668)
- Nav drawer is focusable when off-screen on small viewports (https://github.com/flarum/core/pull/2666)
- Search input has no aria-label and no role (https://github.com/flarum/core/pull/2669)
- Code duplication exists between SendConfirmationEmailController and AccountActivationMailer (https://github.com/flarum/core/pull/2493)
- When setting tags as homepage default, visiting a tag will show all posts (https://github.com/flarum/core/pull/2754)
- Locale cache is cleared twice when cache clearing (https://github.com/flarum/core/pull/2738)
- When cache clearing fails an exception can be thrown due to a partial flush (https://github.com/flarum/core/pull/2756)
- Database migrations rely on MyISAM even though the eventual migrated database does not use it (https://github.com/flarum/core/pull/2442)
- Discussion search result is not sorted by relevance by default (https://github.com/flarum/core/pull/2773)
- Extensions cannot register custom searcher classes (https://github.com/flarum/core/pull/2755)
- Searching discussion titles is not possible (https://github.com/flarum/core/pull/2698)
- Boot errors due to failing extenders throw a generic error (https://github.com/flarum/core/pull/2740)
- Required argument to `Component.$()` isn't really required (https://github.com/flarum/core/pull/2844)
- Component does not allows use of all mithril lifecycle functionality (https://github.com/flarum/core/pull/2847)
### Removed
- The `make:migration` command has been removed (https://github.com/flarum/core/pull/2686)
- Background fade on the header has been removed (https://github.com/flarum/core/pull/2685)
- Remove vendor prefixes in less (https://github.com/flarum/core/pull/2766)
- The session is no longer available from the User class (https://github.com/flarum/core/pull/2790)
- The `mail` key is removed from the laravel related config (https://github.com/flarum/core/pull/2796)
## [0.1.0-beta.16](https://github.com/flarum/core/compare/v0.1.0-beta.15...v0.1.0-beta.16)
### Added
- Allow event subscribers (https://github.com/flarum/core/pull/2535)
- Allow Settings extender to have a default value (https://github.com/flarum/core/pull/2495)
- Allow hooking into the sending of notifications before being send (https://github.com/flarum/core/pull/2533)
- PHP 8 support (https://github.com/flarum/core/pull/2507)
- Search extender (https://github.com/flarum/core/pull/2483)
- User badges to post preview (https://github.com/flarum/core/pull/2555)
- Optional extension dependencies allow a booting order (https://github.com/flarum/core/pull/2579)
- Auth extender (https://github.com/flarum/core/pull/2176)
- `X-Powered-By` header added to allow indexers easier data aggregation of Flarum adoption (https://github.com/flarum/core/pull/2618)
### Changed
- Run integration tests in transaction (https://github.com/flarum/core/pull/2304)
- Allow policies to return a boolean for simplified allow/deny (https://github.com/flarum/core/pull/2534)
- Converted highlight helper to typescript (https://github.com/flarum/core/pull/2532)
- Add accessibility attributes to Mark as Read button (https://github.com/flarum/core/pull/2564)
- Dismiss errors on change email modal upon a new request ([00913d5](https://github.com/flarum/core/commit/00913d5b0be2172cfce1f16aaf64a24f3d2e6d4b))
- Disabled extensions now are marked with a red circle instead of a red dot (https://github.com/flarum/core/pull/2562)
- Extension dependency errors now show the extension title instead of the ID (https://github.com/flarum/core/pull/2563)
- Change `mutate` method on ApiSerializer extender to `attributes` (https://github.com/flarum/core/pull/2578)
- Moved locale files to the core from the language pack (https://github.com/flarum/core/pull/2408)
- AdminPage extensibility and generic improvements (https://github.com/flarum/core/pull/2593)
- Remove entry of authors, link to https://flarum.org/team (https://github.com/flarum/core/pull/2625)
- Search and filtering are split (https://github.com/flarum/core/pull/2454)
- Move IP identification into a middleware (https://github.com/flarum/core/pull/2624)
- Editor Driver abstraction introduced (https://github.com/flarum/core/pull/2594)
- Allow overriding routes (https://github.com/flarum/core/pull/2577)
- Split user edit permissions into permissions for editing of user credentials, username, groups and suspending (https://github.com/flarum/core/pull/2620)
- Reduced number of admin extension categories (https://github.com/flarum/core/pull/2604)
- Move search related classes to a dedicated Query namespace (https://github.com/flarum/core/pull/2645)
- Rewrite common helpers into typescript (https://github.com/flarum/core/pull/2541)
- `TextEditor` is moved to the common namespace for use in the admin frontend (https://github.com/flarum/core/pull/2649)
- Update Laravel/Illuminate components to 8 (https://github.com/flarum/core/pull/2576)
- Eager load relations in discussion listing to improve performance (https://github.com/flarum/core/pull/2639)
- Adopt flarum/testing package (https://github.com/flarum/core/pull/2545)
- Replace `user` gambit with `author` gambit ([612a57c](https://github.com/flarum/core/commit/612a57c4664415a3ea120103483645c32acc6f12))
- Posts page of on user profile loads posts using username instead of id ([30017ee](https://github.com/flarum/core/commit/30017eef09ae9e78640c4e2cacd4909fffa8d775))
### Fixed
- Transform css breaks iOS scroll functionality (https://github.com/flarum/core/pull/2527)
- Composer header is hidden on mobile devices (https://github.com/flarum/core/pull/2279)
- Cannot delete a post or discussion of a deleted user (https://github.com/flarum/core/pull/2521)
- DiscussionListPane jumps around not keeping the scroll position (https://github.com/flarum/core/pull/2402)
- Infinite scroll on notifications dropdown broken (https://github.com/flarum/core/pull/2524)
- The show language selector switch remains toggled on ([9347b12](https://github.com/flarum/core/commit/9347b12b47bf4ab97ffb7ca92673604b237c1012))
- Model Visibility extender throws exception on extensions that aren't installed or enabled (https://github.com/flarum/core/pull/2580)
- Extensions are marked as enabled when enabling fails to unmet extension dependencies (https://github.com/flarum/core/pull/2558)
- Routes to admin extension pages without a valid ID break the admin page (https://github.com/flarum/core/pull/2584)
- Disabled fieldset use an incorrect CSS property `disallowed` (https://github.com/flarum/core/pull/2585)
- Scrolling to a post that is already loaded the Load More button shows and does not trigger (https://github.com/flarum/core/pull/2388)
- Opening discussions on some mobile devices require a double tap (https://github.com/flarum/core/pull/2607)
- iOS devices show erratic behavior in the post stream while updating (https://github.com/flarum/core/pull/2548)
- Small mobile screens partially hides the composer when the keyboard is open (https://github.com/flarum/core/pull/2631)
- Clearing cache does not clear the template cache in storage/views (https://github.com/flarum/core/pull/2648)
- Boot errors show critical information (https://github.com/flarum/core/pull/2633)
- List user endpoint discloses last online even if user choose against it (https://github.com/flarum/core/pull/2634)
- Group gambit disclosed hidden groups (https://github.com/flarum/core/pull/2657)
- Search results on small windows not fully visible (https://github.com/flarum/core/pull/2650)
- Composer goes off screen on Safari when starting to type (https://github.com/flarum/core/pull/2660)
- A search that has no results shows the search results dropdown ([b88a7cb](https://github.com/flarum/core/commit/b88a7cb33b56e318f11670e9e2d563aef94db039))
- The composer modal moves around when typing on Safari ([a64c398](https://github.com/flarum/core/commit/a64c39835aba43e831209609f4a9638ae589aa41))
### Removed
- Deprecated CSRF wildcard path match
- Deprecated policy and visibility scoping events
- Deprecated post types event
- Deprecated validation events
- Deprecated notification events
- Deprecated floodgate
- Deprecated user preferences event
- Deprecated formatting events
- Deprecated api events
- Deprecated bootstrap.php support
- PHP 7.2 support (https://github.com/flarum/core/pull/2507)
- Bidi attribute in the rendered HTML (https://github.com/flarum/core/pull/2602)
- `AccessToken::find`, use `AccessToken::findValid` instead (https://github.com/flarum/core/pull/2651)
### Deprecated
- `GetModelIsPrivate` event (https://github.com/flarum/core/pull/2587)
- `CheckingPassword` event (https://github.com/flarum/core/pull/2176)
- `event()` helper (https://github.com/flarum/core/pull/2608)
- `AccessToken::generate` argument `$lifetime` (https://github.com/flarum/core/pull/2651)
- `Rememberer::remember` argument `$token` should receive an instance of `RememberAccessToken` with `AccessToken` being deprecated (https://github.com/flarum/core/pull/2651)
- `Rememberer::rememberUser` (https://github.com/flarum/core/pull/2651)
- `SessionAuthenticator::logIn` argument `$userId`, should be replaced with `AccessToken` (https://github.com/flarum/core/pull/2651)
- `TextEditor` has been moved to `common` (https://github.com/flarum/core/pull/2649)
- `UserFilter` ([91e8b56](https://github.com/flarum/core/commit/91e8b569618957c86757ef89bac666e9102db5ae))
## [0.1.0-beta.15](https://github.com/flarum/core/compare/v0.1.0-beta.14.1...v0.1.0-beta.15)
### Added
- Slug drivers support (https://github.com/flarum/core/pull/2456).
- Notification type extender (https://github.com/flarum/core/pull/2424).
- Validation extender (https://github.com/flarum/core/pull/2102).
- Post extender (https://github.com/flarum/core/pull/2101).
- Notification channel extender (https://github.com/flarum/core/pull/2432).
- Service provider extender (https://github.com/flarum/core/pull/2437).
- API serializer extender (https://github.com/flarum/core/pull/2438).
- User preferences extender (https://github.com/flarum/core/pull/2463).
- Settings extender (https://github.com/flarum/core/pull/2452).
- ApiController extender (https://github.com/flarum/core/pull/2451).
- Model visibility extender (https://github.com/flarum/core/pull/2460).
- Policy extender (https://github.com/flarum/core/pull/2461).
### Changed
- Time helpers converted to Typescript (https://github.com/flarum/core/pull/2391).
- Improved the formatter extender (https://github.com/flarum/core/pull/2098).
- Improve wording on installer when facing file permission issues (https://github.com/flarum/core/pull/2435).
- Background color of checkbox toggles improved for better usability (https://github.com/flarum/core/pull/2443).
- Route resolving refactored (https://github.com/flarum/core/pull/2425).
- Administration panel UX refactored (https://github.com/flarum/core/pull/2409).
- Floodgate moved to middleware and extender added (https://github.com/flarum/core/pull/2170).
- DRY up image uploading logic (https://github.com/flarum/core/pull/2477).
- Process isolation on testing (https://github.com/flarum/core/commit/984f751c718c89501cc09857bc271efa2c7eea8c).
- Forum and admin javascript exports namespaced (https://github.com/flarum/core/pull/2488).
### Fixed
- Web updater does not take into account subfolder installations (https://github.com/flarum/core/pull/2426).
- Callables handling in extenders failed (https://github.com/flarum/core/pull/2423).
- Scrolling on mobile from PostSteam changes didn't work correctly (https://github.com/flarum/core/pull/2385).
- Side pane covers part of the discussion page due to `app.discussions` being empty (https://github.com/flarum/core/commit/102e76b084bf47fdfb4c73f95e1fbb322537f7aa).
- Change email modal keeps showing the previous error message even on success (https://github.com/flarum/core/pull/2467).
- Comment count not updated when discussions are deleted (https://github.com/flarum/core/pull/2472).
- `goToIndex` in PostStream does not trigger an xhr to retrieve new data (https://github.com/flarum/core/commit/09e2736cbcc267594b660beabbd001d9030f9880).
- On refresh the post number is reduced by one (https://github.com/flarum/core/pull/2476).
- Queue worker would instantiate a new Queue factory, not the bound one (https://github.com/flarum/core/pull/2481).
- Header accidentally has a border bottom (https://github.com/flarum/core/pull/2489).
- Namespace mentioned in docblock is incorrect (https://github.com/flarum/core/pull/2494).
- Scrolling inside longer discussions (especially Firefox) skips posts (https://github.com/flarum/core/commit/210a6b3e253d7917bd1eacd3ed8d2f95073ae99d).
- Uploading avatars that are jpg/jpeg fails with a validation error (https://github.com/flarum/core/pull/2497).
### Removed
- MomentJS alias (https://github.com/flarum/core/pull/2428).
- Deprecated user events `GetDisplayName` and `PrepareUserGroups` (https://github.com/flarum/core/pull/2428).
- AssertPermissionTrait (https://github.com/flarum/core/pull/2428).
- Path related helpers and methods in Application (https://github.com/flarum/core/pull/2428).
- Backward compatibility layers from the frontend rewrite (https://github.com/flarum/core/pull/2428).
### Deprecated
- `CheckingForFlooding` (https://github.com/flarum/core/commit/8e25bcb68f86cc992c46dfa70368419fe9f936ac).
## [0.1.0-beta.14.1](https://github.com/flarum/core/compare/v0.1.0-beta.14...v0.1.0-beta.14.1)
### Fixed
- SuperTextarea component is not exported.
- Symfony dependencies do not match those depended on by Laravel (https://github.com/flarum/core/pull/2407).
- Scripts from textformatter aren't executed (https://github.com/flarum/core/pull/2415)
- Sub path installations have no page title.
- Losing focus of Composer area when coming from fullscreen.
## [0.1.0-beta.14](https://github.com/flarum/core/compare/v0.1.0-beta.13...v0.1.0-beta.14)
### Added
- Check dependencies before enabling / disabling extensions (https://github.com/flarum/core/pull/2188)
- Set up temporary infrastructure for TypeScript in core (https://github.com/flarum/core/pull/2206)
- Better UI for request error modals (https://github.com/flarum/core/pull/1929)
- Display name extender, tests, frontend UI (https://github.com/flarum/core/pull/2174)
- Scroll to post or show alert when editing a post from another page (https://github.com/flarum/core/pull/2108)
- Feature to test email config by sending an email to the current user (https://github.com/flarum/core/pull/2023)
- Allow searching users by group ID using the group gambit (https://github.com/flarum/core/pull/2192)
- Use `liveHumanTimes` helper to update times without reload/rerender (https://github.com/flarum/core/pull/2208)
- View extender, tests (https://github.com/flarum/core/pull/2134)
- User extender to replace `PrepareUserGroups` (https://github.com/flarum/core/pull/2110)
- Increase extensibility of skeleton PHP (https://github.com/flarum/core/pull/2308, https://github.com/flarum/core/pull/2318)
- Pass a translator instance to `getEmailSubject` in `MailableInterface` (https://github.com/flarum/core/pull/2244)
- Force LF line endings on windows (https://github.com/flarum/core/pull/2321)
- Add a `Link` component for internal and external links (https://github.com/flarum/core/pull/2315)
- `ConfirmDocumentUnload` component
- Error handler middleware can now be manipulated by the middleware extender
### Changed
- Update to Mithril 2 (https://github.com/flarum/core/pull/2255)
- Stop storing component instances (https://github.com/flarum/core/issues/1821, https://github.com/flarum/core/issues/2144)
- Update to Laravel 6.x (https://github.com/flarum/core/issues/2055)
- `Flarum\Foundation\Application` no longer implements `Illuminate\Contracts\Foundation\Application` (#2142)
- `Flarum\Foundation\Application` no longer inherits `Illuminate\Container\Container` (#2142)
- `paths` have been split off from `Flarum\Foundation\Application` into `Flarum\Foundation\Paths`, which can be injected where needed (#2142)
- `Flarum\User\Gate` no longer implements `Illuminate\Contracts\Auth\Access\Gate` (https://github.com/flarum/core/pull/2181)
- Improve Group Gambit performance (https://github.com/flarum/core/pull/2192)
- Switch to `dayjs` from `momentjs` (https://github.com/flarum/core/pull/2219)
- Don't create a `bio` column in `users` for new installations (https://github.com/flarum/core/pull/2215)
- Start converting core JS to TypeScript (https://github.com/flarum/core/pull/2207)
- Make Carbon an explicit dependency (https://github.com/flarum/core/commit/3b39c212e0fef7522e7d541a9214ff3817138d5d)
- Use Symfony's translator interface instead of Laravel's (https://github.com/flarum/core/pull/2243)
- Use newer versions of fontawesome (https://github.com/flarum/core/pull/2274)
- Use URL generator instead of `app()->url()` where possible (https://github.com/flarum/core/pull/2302)
- Move config from `config.php` into an injectable helper class (https://github.com/flarum/core/pull/2271)
- Use reserved TLD for bogus and test urls (https://github.com/flarum/core/commit/6860b24b70bd04544dde90e537ce021a5fc5a689)
- Replace `m.stream` with `flarum/utils/Stream` (https://github.com/flarum/core/pull/2316)
- Replace `affixedSidebar` util with `AffixedSidebar` component
- Replace `m.withAttr` with `flarum/utils/withAttr`
- Scroll Listener is now passive, performance improvement (https://github.com/flarum/core/pull/2387)
### Fixed
- `generate:migration` command for extensions (https://github.com/flarum/core/commit/443949f7b9d7558dbc1e0994cb898cbac59bec87)
- Container config for `UninstalledSite` (https://github.com/flarum/core/commit/ecdce44d555dd36a365fd472b2916e677ef173cf)
- Tooltip glitch on page chang (https://github.com/flarum/core/issues/2118)
- Using multiple extenders in tests (https://github.com/flarum/core/commit/c4f4f218bf4b175a30880b807f9ccb1a37a25330)
- Header glitch when opening modals (https://github.com/flarum/core/pull/2131)
- Ensure `SameSite` is explicitly set for cookies (https://github.com/flarum/core/pull/2159)
- Ensure `Flarum\User\Event\AvatarChanged` event is properly dispatched (https://github.com/flarum/core/pull/2197)
- Show correct error message on wrong password when changing email (https://github.com/flarum/core/pull/2171)
- Discussion unreadCount could be higher than commentCount if posts deleted (https://github.com/flarum/core/pull/2195)
- Don't show page title on the default route (https://github.com/flarum/core/pull/2047)
- Add page title to `All Discussions` page when it isn't the default route (https://github.com/flarum/core/pull/2047)
- Accept `'0'` as `false` for `flarum/components/Checkbox` (https://github.com/flarum/core/pull/2210)
- Fix PostStreamScrubber background (https://github.com/flarum/core/pull/2222)
- Test port on BaseUrl tests (https://github.com/flarum/core/pull/2226)
- `UrlGenerator` can now generate urls with optional parameters (https://github.com/flarum/core/pull/2246)
- Allow `less` to be compiled independently of Flarum (https://github.com/flarum/core/pull/2252)
- Use correct number abbreviation (https://github.com/flarum/core/pull/2261)
- Ensure avatar html uses alt tags for accessibility (https://github.com/flarum/core/pull/2269)
- Escape regex when searching (https://github.com/flarum/core/pull/2273)
- Remove unneeded semicolons inserted during JS compilation (https://github.com/flarum/core/pull/2280)
- Don't require a username/password for SMTP (https://github.com/flarum/core/pull/2287)
- Allow uppercase entries for SMTP encryption validation (https://github.com/flarum/core/pull/2289)
- Ensure that the right number of posts is returned from list posts API (https://github.com/flarum/core/pull/2291)
- Fix a variety of PostStream bugs (https://github.com/flarum/core/pull/2160, https://github.com/flarum/core/pull/2160)
- Sliding discussion glitch on mobile (https://github.com/flarum/core/pull/2324)
- Sliding discussion button in wrong place (https://github.com/flarum/core/pull/2330, https://github.com/flarum/core/pull/2383)
- Sliding discussion glitch on mobile (https://github.com/flarum/core/pull/2381)
- Fix PostStream for posts with top margins, and scrubber position when scrolling below posts (https://github.com/flarum/core/pull/2369)
### Removed
- `Flarum\Event\AbstractConfigureRoutes` event class
- `Flarum\Event\ConfigureApiRoutes` event class
- `Flarum\Event\ConfigureForumRoutes` event class
- `Flarum\Console\Event\Configuring` event class
- `Flarum\Event\ConfigureModelDates` event class
- `Flarum\Event\ConfigureLocales` event class
- `Flarum\Event\ConfigureModelDefaultAttributes` event class
- `Flarum\Event\GetModelRelationship` event class
- `Flarum\User\Event\BioChanged` event class
- `Flarum\Database\MigrationServiceProvider` moved into `Flarum\Database\DatabaseServiceProvider`
- Unused `admin/components/Widget` component (`admin/component/DashboardWidget` should be used instead)
- Mandrill mail driver (https://github.com/flarum/core/commit/bca833d3f1c34d45d95bf905902368a2753b8908)
### Deprecated
- `Flarum\User\Event\GetDisplayName` event class
- Global path helpers, `Flarum\Foundation\Application` path methods (https://github.com/flarum/core/pull/2155)
- `Flarum\User\AssertPermissionTrait` (https://github.com/flarum/core/pull/2044)
## [0.1.0-beta.13](https://github.com/flarum/core/compare/v0.1.0-beta.12...v0.1.0-beta.13)
### Added
- Console extender (#2057)
- CSRF extender (#2095)
- Event extender (#2097)
- Mail extender (#2012)
- Model extender (#2100)
- Posts by users that started a discussion now have the CSS class `.Post--by-start-user`
- PHPUnit 8 compatibility
- Composer 2 compatibility
- Permission groups can now be hidden (#2129)
- Confirmation popup when hiding or deleting posts (#2135)
### Changed
- Updated less.php dependency version to 3.0
- Updated JS dependencies
- All notifications and other emails now processed through the queue, if enabled (#978, #1928, #1931, #2096)
- Simplified uploads, removing need to store intermediate files (#2117)
- Improved date handling for dates older than 1 year (#2034)
- Linting and automatic formatting for JS (#2099)
- Translation files from Language Packs are only loaded for extensions that are enabled (#2020)
- PHP extenders' properties are now `private` instead of `protected`, intentionally making it harder to extend these classes (#1958)
- Preparation for upgrading Laravel components to 5.8 and then 6.0 (#2055, #2117)
- Allowed permission checks based on model classes in addition to instances (#1977)
### Fixed
- Users can no longer restore discussions hidden by admins (#2037)
- Issues of the Modal not showing or auto hiding (#1504, #1813, #2080)
- Columnar layout on admin extensions page was broken in Firefox (#2029, #2111)
- Non-dismissible modals could still be dismissed using the ESC key (#1917)
- New discussions were added to the discussion list above unread sticky posts (#1751, #1868)
- New discussions not visible to users when using Pusher (#2076, #2077)
- Permission icons were aligned unevenly in admin permissions list (#2016, #2018)
- Notification bubble not inversed on mobile with colored header (#1983, #2109)
- Post stream scrubber clicks jumped back to first post (#1945)
- Loading state of Switch toggle component was hard to see (#2039, #1491)
- `Flarum\Extend\Middleware`: The methods `insertBefore()` and `insertAfter()` did not work as described (#2063, #2084)
### Removed
- Support for PHP 7.1 (#2014)
- Zend compatibility bridge (#2010)
- SES mail support (#2011)
- Backward compatibility layer for `Flarum\Mail\DriverInterface`, new methods from beta.12 are now required
- `Flarum\Util\Str` helper class
- `Flarum\Event\ConfigureMiddleware` event
### Deprecated
- `Flarum\Event\AbstractConfigureRoutes` event class
- `Flarum\Event\ConfigureApiRoutes` event class
- `Flarum\Event\ConfigureForumRoutes` event class
- `Flarum\Event\ConfigureLocales` event class
## [0.1.0-beta.12](https://github.com/flarum/core/compare/v0.1.0-beta.11.1...v0.1.0-beta.12)
### Added
- Full support for PHP 7.4 (#1980)
- Mail settings: Configure region for the Mailgun driver (#1834, #1850)
- Mail settings: Alert admins about incomplete settings (#1763, #1921)
- New permission that allows users to post without throttling (#1255, #1938)
- Basic transliteration of discussion "slugs" / pretty URLs (#194, #1975)
- User profiles: Render basic content on server side (#1901)
- New extender for configuring middleware (#1919, #1952, #1957, #1971)
- New extender for configuring error handling (#1781, #1970)
- Automated tests for PHP extenders to guarantee their backwards compatibility
### Changed
- Profile URLs for non-existing users properly return HTTP 404 (#1846, #1901)
- Confirmation email subject no longer contains the forum title (#1613)
- Improved error handling during Flarum's early boot phase (#1607)
- Updated deprecated "Zend" libraries to their new "Laminas" equivalents (#1963)
### Fixed
- Update page did not work when installed in subdirectories (#1947)
- Avatar upload did not work in IE11 / Edge (#1125, #1570)
- Translation fallback was ignored for client-rendered pages (#1774, #1961)
- The success alert when posting replies was invisible (#1976)
## [0.1.0-beta.11.1](https://github.com/flarum/core/compare/v0.1.0-beta.11...v0.1.0-beta.11.1)
### Fixed
- Saving custom css in admin failed (#1946)
## [0.1.0-beta.11](https://github.com/flarum/core/compare/v0.1.0-beta.10...v0.1.0-beta.11)
### Added

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2019 Stichting Flarum (Flarum Foundation)
Copyright (c) 2019-2021 Stichting Flarum (Flarum Foundation)
Copyright (c) 2014-2019 Toby Zerner (toby.zerner@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@@ -1,10 +1,12 @@
<p align="center"><img src="https://flarum.org/img/logo.png"></p>
<p align="center"><img src="https://flarum.org/assets/img/logo.png"></p>
<p align="center">
<a href="https://travis-ci.org/flarum/core"><img src="https://travis-ci.org/flarum/core.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/flarum/core"><img src="https://poser.pugx.org/flarum/core/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/flarum/core"><img src="https://poser.pugx.org/flarum/core/v/stable.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/flarum/core"><img src="https://poser.pugx.org/flarum/core/license.svg" alt="License"></a>
<a href="https://github.com/flarum/core/actions?query=workflow%3ATests"><img src="https://github.com/flarum/core/workflows/Tests/badge.svg" alt="PHP Tests"></a>
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/packagist/dt/flarum/core" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/github/v/release/flarum/core?sort=semver" alt="Latest Version"></a>
<a href="https://packagist.org/packages/flarum/core"><img src="https://img.shields.io/packagist/l/flarum/core" alt="License"></a>
<a href="https://huntr.dev/bounties/disclose/?target=https://github.com/flarum/core"><img src="https://cdn.huntr.dev/huntr_security_badge_mono.svg" alt="huntr"></a>
<a href="https://github.styleci.io/repos/28257573"><img src="https://github.styleci.io/repos/28257573/shield?style=flat" alt="StyleCI"></a>
</p>
## About Flarum
@@ -17,19 +19,20 @@
* **Powerful and extensible.** Customize, extend, and integrate Flarum to suit your community. Flarums architecture is amazingly flexible, with a powerful Extension API.
![Screenshot of a Flarum instance, showing multiple discussions and tags.](https://flarum.org/assets/img/home-screenshot.png)
## Installation
This repository contains Flarum's core code. If you want to set up a forum, visit the [Flarum skeleton repository](https://github.com/flarum/flarum).
This repository contains Flarum's core code. If you want to set up a forum, visit the [Flarum skeleton repository](https://github.com/flarum/flarum). For support, refer to the [documentation](https://docs.flarum.org/), and ask questions on [Flarum Discuss](https://discuss.flarum.org/) (our community forum) or [Discord server](https://flarum.org/discord/).
## Contributing
Thank you for considering contributing to Flarum! Please read the **[Contributing guide](https://flarum.org/docs/contributing.html)** to learn how you can help.
Thank you for considering contributing to Flarum! Please read the **[Contributing guide](https://docs.flarum.org/contributing)** to learn how you can help.
## Security Vulnerabilities
If you discover a security vulnerability within Flarum, please send an e-mail to [security@flarum.org](mailto:security@flarum.org). All security vulnerabilities will be promptly addressed.
If you discover a security vulnerability within Flarum, please send an e-mail to [security@flarum.org](mailto:security@flarum.org). All security vulnerabilities will be promptly addressed. More details can be found in our [security policy](https://github.com/flarum/core/security/policy).
## License
Flarum is open-source software licensed under the [MIT License](https://github.com/flarum/flarum/blob/master/LICENSE).

View File

@@ -1,76 +1,92 @@
{
"name": "flarum/core",
"description": "Delightfully simple forum software.",
"keywords": ["forum", "discussion"],
"keywords": [
"forum",
"discussion"
],
"homepage": "https://flarum.org/",
"license": "MIT",
"authors": [
{
"name": "Toby Zerner",
"email": "toby.zerner@gmail.com"
"name": "Flarum",
"email": "info@flarum.org",
"homepage": "https://flarum.org/team"
}
],
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/flarum"
},
{
"name": "Franz Liedke",
"email": "franz@develophp.org"
"type": "github",
"url": "https://github.com/sponsors/flarum"
},
{
"name": "Daniel Klabbers",
"email": "daniel@klabbers.email"
"type": "other",
"url": "https://flarum.org/donate"
}
],
"support": {
"issues": "https://github.com/flarum/core/issues",
"source": "https://github.com/flarum/core",
"docs": "https://flarum.org/docs/"
"docs": "https://docs.flarum.org",
"forum": "https://discuss.flarum.org",
"chat": "https://flarum.org/chat"
},
"require": {
"php": ">=7.1",
"php": ">=7.3",
"axy/sourcemap": "^0.1.4",
"components/font-awesome": "5.9.*",
"dflydev/fig-cookies": "^1.0.2",
"components/font-awesome": "^5.14.0",
"dflydev/fig-cookies": "^3.0.0",
"doctrine/dbal": "^2.7",
"franzl/whoops-middleware": "^0.4.0",
"illuminate/bus": "5.7.*",
"illuminate/cache": "5.7.*",
"illuminate/config": "5.7.*",
"illuminate/container": "5.7.*",
"illuminate/contracts": "5.7.*",
"illuminate/database": "5.7.*",
"illuminate/events": "5.7.*",
"illuminate/filesystem": "5.7.*",
"illuminate/hashing": "5.7.*",
"illuminate/mail": "5.7.*",
"illuminate/queue": "5.7.*",
"illuminate/session": "5.7.*",
"illuminate/support": "5.7.*",
"illuminate/validation": "5.7.*",
"illuminate/view": "5.7.*",
"intervention/image": "^2.3.0",
"dragonmantank/cron-expression": "^3.1.0",
"franzl/whoops-middleware": "^2.0.0",
"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": "^1.1",
"middlewares/base-path-router": "^0.2.1",
"middlewares/request-handler": "^1.2",
"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",
"oyejorge/less.php": "^1.7",
"psr/http-message": "^1.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"s9e/text-formatter": "^1.2.0",
"symfony/config": "^3.3",
"symfony/console": "^4.2",
"symfony/event-dispatcher": "^4.3.2",
"symfony/translation": "^3.3",
"symfony/yaml": "^3.3",
"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",
"zendframework/zend-diactoros": "^1.8.4",
"zendframework/zend-httphandlerrunner": "^1.0",
"zendframework/zend-stratigility": "^3.0"
"wikimedia/less.php": "^3.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^7.0"
"flarum/testing": "^1.0.0"
},
"autoload": {
"psr-4": {
@@ -90,7 +106,29 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.1.x-dev"
"dev-master": "1.x-dev"
},
"flarum-cli": {
"excludeScaffolding": [
"LICENSE.md",
"js/tsconfig.json",
"js/webpack.config.js"
],
"modules": {
"backendTesting": true,
"js": true,
"gitConf": true,
"githubActions": true,
"prettier": true,
"typescript": true,
"bundlewatch": true,
"editorConfig": true,
"styleci": true,
"admin": true,
"forum": true,
"jsCommon": true,
"css": true
}
}
},
"scripts": {

View File

@@ -0,0 +1,8 @@
{
"files": [
{
"path": "./dist/*.js"
}
],
"defaultCompression": "gzip"
}

9
js/.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
node_modules

768
js/.yarn/releases/yarn-3.1.1.cjs vendored Executable file

File diff suppressed because one or more lines are too long

3
js/.yarnrc.yml Normal file
View File

@@ -0,0 +1,3 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.1.1.cjs

View File

@@ -1,11 +0,0 @@
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
export * from './src/common';
export * from './src/admin';

2
js/admin.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from './src/common';
export * from './src/admin';

138
js/dist-typings/@types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,138 @@
declare type Writable<T> = { -readonly [P in keyof T]: T[P] };
declare type DeepWritable<T> = { -readonly [P in keyof T]: DeepWritable<T[P]> };
declare type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> };
/**
* UTILITY TYPES
*/
/**
* Type that returns an array of all keys of a provided object that are of
* of the provided type, or a subtype of the type.
*/
declare type KeysOfType<Type extends object, Match> = {
[Key in keyof Type]-?: Type[Key] extends Match ? Key : never;
};
/**
* Type that matches one of the keys of an object that is of the provided
* type, or a subtype of it.
*/
declare type KeyOfType<Type extends object, Match> = KeysOfType<Type, Match>[keyof Type];
type Component<A> = import('mithril').Component<A>;
declare type ComponentClass<Attrs = Record<string, unknown>, C extends Component<Attrs> = Component<Attrs>> = {
new (...args: any[]): Component<Attrs>;
prototype: C;
};
/**
* Unfortunately, TypeScript only supports strings and classes for JSX tags.
* Therefore, our type definition should only allow for those two types.
*
* @see https://github.com/microsoft/TypeScript/issues/14789#issuecomment-412247771
*/
declare type VnodeElementTag<Attrs = Record<string, unknown>, C extends Component<Attrs> = Component<Attrs>> = string | ComponentClass<Attrs, C>;
/**
* @deprecated Please import `app` from a namespace instead of using it as a global variable.
*
* @example App in forum JS
* ```
* import app from 'flarum/forum/app';
* ```
*
* @example App in admin JS
* ```
* import app from 'flarum/admin/app';
* ```
*
* @example App in common JS
* ```
* import app from 'flarum/common/app';
* ```
*/
declare const app: never;
declare const m: import('mithril').Static;
declare const dayjs: typeof import('dayjs');
/**
* From https://github.com/lokesh/color-thief/issues/188
*/
declare module 'color-thief-browser' {
type Color = [number, number, number];
export default class ColorThief {
getColor: (img: HTMLImageElement | null) => Color;
getPalette: (img: HTMLImageElement | null) => Color[];
}
}
type ESModule = { __esModule: true; [key: string]: unknown };
/**
* The global `flarum` variable.
*
* Contains the compiled ES Modules for all Flarum extensions and core.
*
* @example <caption>Check if `flarum-tags` is present</captions>
* if ('flarum-tags' in flarum.extensions) {
* // Tags is installed and enabled!
* }
*/
interface FlarumObject {
/**
* Contains the compiled ES Module for Flarum's core.
*
* You shouldn't need to access this directly for any reason.
*/
core: Readonly<ESModule>;
/**
* Contains the compiled ES Modules for all Flarum extensions.
*
* @example <caption>Check if `flarum-tags` is present</captions>
* if ('flarum-tags' in flarum.extensions) {
* // Tags is installed and enabled!
* }
*/
extensions: Readonly<Record<string, ESModule>>;
}
declare const flarum: FlarumObject;
// Extend JQuery with our custom functions, defined with $.fn
interface JQuery {
/**
* Flarum's tooltip JQuery plugin.
*
* Do not use this directly. Instead use the `<Tooltip>` component that
* is exported from `flarum/common/components/Tooltip`.
*
* This will be removed in a future version of Flarum.
*
* @deprecated
*/
tooltip: import('./tooltips/index').TooltipJQueryFunction;
}
/**
* For more info, see: https://www.typescriptlang.org/docs/handbook/jsx.html#attribute-type-checking
*
* In a nutshell, we need to add `ElementAttributesProperty` to tell Typescript
* what property on component classes to look at for attribute typings. For our
* Component class, this would be `attrs` (e.g. `this.attrs...`)
*/
interface JSX {
ElementAttributesProperty: {
attrs: Record<string, unknown>;
};
}
interface Event {
/**
* Whether this event should trigger a Mithril redraw.
*/
redraw: boolean;
}

View File

@@ -0,0 +1,68 @@
/**
* Selection of options accepted by [Bootstrap's tooltips](https://getbootstrap.com/docs/3.3/javascript/#tooltips-options).
*
* ---
*
* Not all options are present from Bootstrap to discourage the use of options
* that will be deprecated in the future.
*
* More commonly used options that will be deprecated remain, but are marked as
* such.
*
* @see https://getbootstrap.com/docs/3.3/javascript/#tooltips-options
*/
export interface TooltipCreationOptions {
/**
* Whether HTML content is allowed in the tooltip.
*
* ---
*
* **Warning:** this is a possible XSS attack vector. This option shouldn't
* be used wherever possible, and will not work when we migrate to CSS-only
* tooltips.
*
* @deprecated
*/
html?: boolean;
/**
* Tooltip position around the target element.
*/
placement?: 'top' | 'bottom' | 'left' | 'right';
/**
* Sets the delay between a trigger state occurring and the tooltip appearing
* on-screen.
*
* ---
*
* **Warning:** this option will be removed when we switch to CSS-only
* tooltips.
*
* @deprecated
*/
delay?: number;
/**
* Value used if no `title` attribute is present on the HTML element.
*
* If a function is given, it will be called with its `this` reference set to
* the element that the tooltip is attached to.
*/
title?: string;
/**
* How the tooltip is triggered.
*
* Either on `hover`, on `hover focus` (either of the two).
*
* ---
*
* **Warning:** `manual`, `click` and `focus` on its own are deprecated options
* which will not be supported in the future.
*/
trigger?: 'hover' | 'hover focus';
}
/**
* Creates a tooltip on a jQuery element reference.
*
* Returns the same jQuery reference to allow for method chaining.
*/
export type TooltipJQueryFunction = (tooltipOptions?: TooltipCreationOptions | 'destroy' | 'show' | 'hide') => JQuery;

View File

@@ -0,0 +1,26 @@
declare module '@askvortsov/rich-icu-message-formatter' {
type IValues = Record<string, any>;
type ITypeHandler = (
value: string,
matches: string,
locale: string,
values: IValues,
format: (message: string, values: IValues) => string
) => string;
type IRichHandler = (tag: any, values: IValues, contents: string) => any;
type ValueOrArray<T> = T | ValueOrArray<T>[];
type NestedStringArray = ValueOrArray<string>;
export class RichMessageFormatter {
locale: string | null;
constructor(locale: string | null, typeHandlers: Record<string, ITypeHandler>, richHandler: IRichHandler);
format(message: string, values: IValues): string;
process(message: string, values: IValues): NestedStringArray;
rich(message: string, values: IValues): NestedStringArray;
}
export function mithrilRichHandler(tag: any, values: IValues, contents: string): any;
}

View File

@@ -0,0 +1,17 @@
declare module '@ultraq/icu-message-formatter' {
export function pluralTypeHandler(
value: string,
matches: string,
locale: string,
values: Record<string, any>,
format: (text: string, values: Record<string, any>) => string
): string;
export function selectTypeHandler(
value: string,
matches: string,
locale: string,
values: Record<string, any>,
format: (text: string, values: Record<string, any>) => string
): string;
}

View File

@@ -0,0 +1,61 @@
import Application from '../common/Application';
import ExtensionData from './utils/ExtensionData';
export declare type Extension = {
id: string;
version: string;
description?: string;
icon?: {
name: string;
};
links: {
authors?: {
name?: string;
link?: string;
}[];
discuss?: string;
documentation?: string;
support?: string;
website?: string;
donate?: string;
source?: string;
};
extra: {
'flarum-extension': {
title: string;
};
};
};
export default class AdminApplication extends Application {
extensionData: ExtensionData;
extensionCategories: {
feature: number;
theme: number;
language: number;
};
history: {
canGoBack: () => boolean;
getPrevious: () => void;
backUrl: () => string;
back: () => void;
};
/**
* Settings are serialized to the admin dashboard as strings.
* Additional encoding/decoding is possible, but must take
* place on the client side.
*
* @inheritdoc
*/
data: Application['data'] & {
extensions: Record<string, Extension>;
settings: Record<string, string>;
modelStatistics: Record<string, {
total: number;
}>;
};
constructor();
/**
* @inheritdoc
*/
mount(): void;
getRequiredPermissions(permission: string): string[];
}

3
js/dist-typings/admin/app.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import Admin from './AdminApplication';
declare const app: Admin;
export default app;

165
js/dist-typings/admin/compat.d.ts vendored Normal file
View File

@@ -0,0 +1,165 @@
declare var _default: {
extend: any;
Session: typeof import("../common/Session").default;
Store: typeof import("../common/Store").default;
'utils/BasicEditorDriver': typeof import("../common/utils/BasicEditorDriver").default;
'utils/evented': {
handlers: Record<string, unknown>;
getHandlers(event: string): Function[];
trigger(event: string, ...args: any[]): void;
on(event: string, handler: Function): void;
one(event: string, handler: Function): void;
off(event: string, handler: Function): void;
};
'utils/liveHumanTimes': typeof import("../common/utils/liveHumanTimes").default;
'utils/ItemList': typeof import("../common/utils/ItemList").default;
'utils/mixin': typeof import("../common/utils/mixin").default;
'utils/humanTime': typeof import("../common/utils/humanTime").default;
'utils/computed': typeof import("../common/utils/computed").default;
'utils/insertText': typeof import("../common/utils/insertText").default;
'utils/styleSelectedText': typeof import("../common/utils/styleSelectedText").default;
'utils/Drawer': typeof import("../common/utils/Drawer").default;
'utils/anchorScroll': typeof import("../common/utils/anchorScroll").default;
'utils/RequestError': typeof import("../common/utils/RequestError").default;
'utils/abbreviateNumber': typeof import("../common/utils/abbreviateNumber").default;
'utils/string': typeof import("../common/utils/string");
'utils/SubtreeRetainer': typeof import("../common/utils/SubtreeRetainer").default;
'utils/escapeRegExp': typeof import("../common/utils/escapeRegExp").default;
'utils/extract': typeof import("../common/utils/extract").default;
'utils/ScrollListener': typeof import("../common/utils/ScrollListener").default;
'utils/stringToColor': typeof import("../common/utils/stringToColor").default;
'utils/Stream': typeof import("mithril/stream");
'utils/subclassOf': typeof import("../common/utils/subclassOf").default;
'utils/setRouteWithForcedRefresh': typeof import("../common/utils/setRouteWithForcedRefresh").default;
'utils/patchMithril': typeof import("../common/utils/patchMithril").default;
'utils/proxifyCompat': typeof import("../common/utils/proxifyCompat").default;
'utils/classList': (...classes: import("clsx").ClassValue[]) => string;
'utils/extractText': typeof import("../common/utils/extractText").default;
'utils/formatNumber': typeof import("../common/utils/formatNumber").default;
'utils/mapRoutes': typeof import("../common/utils/mapRoutes").default;
'utils/withAttr': (key: string, cb: Function) => (this: Element) => void;
'utils/throttleDebounce': typeof import("../common/utils/throttleDebounce");
'utils/isObject': typeof import("../common/utils/isObject").default;
'utils/focusTrap': typeof import("../common/utils/focusTrap");
'models/Notification': typeof import("../common/models/Notification").default;
'models/User': typeof import("../common/models/User").default;
'models/Post': typeof import("../common/models/Post").default;
'models/Discussion': typeof import("../common/models/Discussion").default;
'models/Group': typeof import("../common/models/Group").default;
'models/Forum': typeof import("../common/models/Forum").default;
Component: typeof import("../common/Component").default;
Fragment: typeof import("../common/Fragment").default;
Translator: typeof import("../common/Translator").default;
'components/AlertManager': typeof import("../common/components/AlertManager").default;
'components/Page': typeof import("../common/components/Page").default;
'components/Switch': typeof import("../common/components/Switch").default;
'components/Badge': typeof import("../common/components/Badge").default;
'components/LoadingIndicator': typeof import("../common/components/LoadingIndicator").default;
'components/Placeholder': typeof import("../common/components/Placeholder").default;
'components/Separator': typeof import("../common/components/Separator").default;
'components/Dropdown': typeof import("../common/components/Dropdown").default;
'components/SplitDropdown': typeof import("../common/components/SplitDropdown").default;
'components/RequestErrorModal': typeof import("../common/components/RequestErrorModal").default;
'components/FieldSet': typeof import("../common/components/FieldSet").default;
'components/Select': typeof import("../common/components/Select").default;
'components/Navigation': typeof import("../common/components/Navigation").default;
'components/Alert': typeof import("../common/components/Alert").default;
'components/Link': typeof import("../common/components/Link").default;
'components/LinkButton': typeof import("../common/components/LinkButton").default;
'components/Checkbox': typeof import("../common/components/Checkbox").default;
'components/ColorPreviewInput': typeof import("../common/components/ColorPreviewInput").default;
'components/SelectDropdown': typeof import("../common/components/SelectDropdown").default;
'components/ModalManager': typeof import("../common/components/ModalManager").default;
'components/Button': typeof import("../common/components/Button").default;
'components/Modal': typeof import("../common/components/Modal").default;
'components/GroupBadge': typeof import("../common/components/GroupBadge").default;
'components/TextEditor': typeof import("../common/components/TextEditor").default;
'components/TextEditorButton': typeof import("../common/components/TextEditorButton").default;
'components/Tooltip': typeof import("../common/components/Tooltip").default;
'components/EditUserModal': typeof import("../common/components/EditUserModal").default;
Model: typeof import("../common/Model").default;
Application: typeof import("../common/Application").default;
'helpers/fullTime': typeof import("../common/helpers/fullTime").default;
'helpers/avatar': typeof import("../common/helpers/avatar").default;
'helpers/icon': typeof import("../common/helpers/icon").default;
'helpers/humanTime': typeof import("../common/helpers/humanTime").default;
'helpers/punctuateSeries': typeof import("../common/helpers/punctuateSeries").default;
'helpers/highlight': typeof import("../common/helpers/highlight").default;
'helpers/username': typeof import("../common/helpers/username").default;
'helpers/userOnline': typeof import("../common/helpers/userOnline").default;
'helpers/listItems': typeof import("../common/helpers/listItems").default;
'resolvers/DefaultResolver': typeof import("../common/resolvers/DefaultResolver").default;
'states/PaginatedListState': typeof import("../common/states/PaginatedListState").default;
} & {
'utils/saveSettings': typeof saveSettings;
'utils/ExtensionData': typeof ExtensionData;
'utils/isExtensionEnabled': typeof isExtensionEnabled;
'utils/getCategorizedExtensions': typeof getCategorizedExtensions;
'utils/generateElementId': typeof generateElementId;
'components/SettingDropdown': typeof SettingDropdown;
'components/EditCustomFooterModal': typeof EditCustomFooterModal;
'components/SessionDropdown': typeof SessionDropdown;
'components/HeaderPrimary': typeof HeaderPrimary;
'components/AdminPage': typeof AdminPage;
'components/AppearancePage': typeof AppearancePage;
'components/StatusWidget': typeof StatusWidget;
'components/ExtensionsWidget': typeof ExtensionsWidget;
'components/HeaderSecondary': typeof HeaderSecondary;
'components/SettingsModal': typeof SettingsModal;
'components/DashboardWidget': typeof DashboardWidget;
'components/ExtensionPage': typeof ExtensionPage;
'components/ExtensionLinkButton': typeof ExtensionLinkButton;
'components/PermissionGrid': typeof PermissionGrid;
'components/ExtensionPermissionGrid': typeof ExtensionPermissionGrid;
'components/MailPage': typeof MailPage;
'components/UploadImageButton': typeof UploadImageButton;
'components/LoadingModal': typeof LoadingModal;
'components/DashboardPage': typeof DashboardPage;
'components/BasicsPage': typeof BasicsPage;
'components/UserListPage': typeof UserListPage;
'components/EditCustomHeaderModal': typeof EditCustomHeaderModal;
'components/PermissionsPage': typeof PermissionsPage;
'components/PermissionDropdown': typeof PermissionDropdown;
'components/AdminNav': typeof AdminNav;
'components/AdminHeader': typeof AdminHeader;
'components/EditCustomCssModal': typeof EditCustomCssModal;
'components/EditGroupModal': typeof EditGroupModal;
routes: typeof routes;
AdminApplication: typeof AdminApplication;
};
export default _default;
import saveSettings from "./utils/saveSettings";
import ExtensionData from "./utils/ExtensionData";
import isExtensionEnabled from "./utils/isExtensionEnabled";
import getCategorizedExtensions from "./utils/getCategorizedExtensions";
import generateElementId from "./utils/generateElementId";
import SettingDropdown from "./components/SettingDropdown";
import EditCustomFooterModal from "./components/EditCustomFooterModal";
import SessionDropdown from "./components/SessionDropdown";
import HeaderPrimary from "./components/HeaderPrimary";
import AdminPage from "./components/AdminPage";
import AppearancePage from "./components/AppearancePage";
import StatusWidget from "./components/StatusWidget";
import ExtensionsWidget from "./components/ExtensionsWidget";
import HeaderSecondary from "./components/HeaderSecondary";
import SettingsModal from "./components/SettingsModal";
import DashboardWidget from "./components/DashboardWidget";
import ExtensionPage from "./components/ExtensionPage";
import ExtensionLinkButton from "./components/ExtensionLinkButton";
import PermissionGrid from "./components/PermissionGrid";
import ExtensionPermissionGrid from "./components/ExtensionPermissionGrid";
import MailPage from "./components/MailPage";
import UploadImageButton from "./components/UploadImageButton";
import LoadingModal from "./components/LoadingModal";
import DashboardPage from "./components/DashboardPage";
import BasicsPage from "./components/BasicsPage";
import UserListPage from "./components/UserListPage";
import EditCustomHeaderModal from "./components/EditCustomHeaderModal";
import PermissionsPage from "./components/PermissionsPage";
import PermissionDropdown from "./components/PermissionDropdown";
import AdminNav from "./components/AdminNav";
import AdminHeader from "./components/AdminHeader";
import EditCustomCssModal from "./components/EditCustomCssModal";
import EditGroupModal from "./components/EditGroupModal";
import routes from "./routes";
import AdminApplication from "./AdminApplication";

View File

@@ -0,0 +1,4 @@
export default class AdminHeader extends Component<import("../../common/Component").ComponentAttrs, undefined> {
constructor();
}
import Component from "../../common/Component";

View File

@@ -0,0 +1,15 @@
export default class AdminNav extends Component<import("../../common/Component").ComponentAttrs, undefined> {
constructor();
query: Stream<string> | undefined;
scrollToActive(): void;
/**
* Build an item list of main links to show in the admin navigation.
*
* @return {ItemList<import('mithril').Children>}
*/
items(): ItemList<import('mithril').Children>;
extensionItems(): ItemList<any>;
}
import Component from "../../common/Component";
import Stream from "../../common/utils/Stream";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,167 @@
import type Mithril from 'mithril';
import Page, { IPageAttrs } from '../../common/components/Page';
import Stream from '../../common/utils/Stream';
export interface AdminHeaderOptions {
title: Mithril.Children;
description: Mithril.Children;
icon: string;
/**
* Will be used as the class for the AdminPage.
*
* Will also be appended with `-header` and set as the class for the `AdminHeader` component.
*/
className: string;
}
/**
* A type that matches any valid value for the `type` attribute on an HTML `<input>` element.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-type
*
* Note: this will be exported from a different location in the future.
*
* @see https://github.com/flarum/core/issues/3039
*/
export declare type HTMLInputTypes = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week';
interface CommonSettingsItemOptions extends Mithril.Attributes {
setting: string;
label: Mithril.Children;
help?: Mithril.Children;
className?: string;
}
/**
* Valid options for the setting component builder to generate an HTML input element.
*/
export interface HTMLInputSettingsComponentOptions extends CommonSettingsItemOptions {
/**
* Any valid HTML input `type` value.
*/
type: HTMLInputTypes;
}
declare const BooleanSettingTypes: readonly ["bool", "checkbox", "switch", "boolean"];
declare const SelectSettingTypes: readonly ["select", "dropdown", "selectdropdown"];
declare const TextareaSettingTypes: readonly ["textarea"];
declare const ColorPreviewSettingType = "color-preview";
/**
* Valid options for the setting component builder to generate a Switch.
*/
export interface SwitchSettingComponentOptions extends CommonSettingsItemOptions {
type: typeof BooleanSettingTypes[number];
}
/**
* Valid options for the setting component builder to generate a Select dropdown.
*/
export interface SelectSettingComponentOptions extends CommonSettingsItemOptions {
type: typeof SelectSettingTypes[number];
/**
* Map of values to their labels
*/
options: {
[value: string]: Mithril.Children;
};
default: string;
}
/**
* Valid options for the setting component builder to generate a Textarea.
*/
export interface TextareaSettingComponentOptions extends CommonSettingsItemOptions {
type: typeof TextareaSettingTypes[number];
}
/**
* Valid options for the setting component builder to generate a ColorPreviewInput.
*/
export interface ColorPreviewSettingComponentOptions extends CommonSettingsItemOptions {
type: typeof ColorPreviewSettingType;
}
/**
* All valid options for the setting component builder.
*/
export declare type SettingsComponentOptions = HTMLInputSettingsComponentOptions | SwitchSettingComponentOptions | SelectSettingComponentOptions | TextareaSettingComponentOptions | ColorPreviewSettingComponentOptions;
/**
* Valid attrs that can be returned by the `headerInfo` function
*/
export declare type AdminHeaderAttrs = AdminHeaderOptions & Partial<Omit<Mithril.Attributes, 'class'>>;
export default abstract class AdminPage<CustomAttrs extends IPageAttrs = IPageAttrs> extends Page<CustomAttrs> {
settings: Record<string, Stream<string>>;
loading: boolean;
view(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
/**
* Returns the content of the AdminPage.
*/
abstract content(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
/**
* Returns the submit button for this AdminPage.
*
* Calls `this.saveSettings` when the button is clicked.
*/
submitButton(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
/**
* Returns the Header component for this AdminPage.
*/
header(vnode: Mithril.Vnode<CustomAttrs, this>): Mithril.Children;
/**
* Returns the options passed to the AdminHeader component.
*/
headerInfo(): AdminHeaderAttrs;
/**
* `buildSettingComponent` takes a settings object and turns it into a component.
* Depending on the type of input, you can set the type to 'bool', 'select', or
* any standard <input> type. Any values inside the 'extra' object will be added
* to the component as an attribute.
*
* Alternatively, you can pass a callback that will be executed in ExtensionPage's
* context to include custom JSX elements.
*
* @example
*
* {
* setting: 'acme.checkbox',
* label: app.translator.trans('acme.admin.setting_label'),
* type: 'bool',
* help: app.translator.trans('acme.admin.setting_help'),
* className: 'Setting-item'
* }
*
* @example
*
* {
* setting: 'acme.select',
* label: app.translator.trans('acme.admin.setting_label'),
* type: 'select',
* options: {
* 'option1': 'Option 1 label',
* 'option2': 'Option 2 label',
* },
* default: 'option1',
* }
*
* @example
*
* () => {
* return <p>My cool component</p>;
* }
*/
buildSettingComponent(entry: ((this: this) => Mithril.Children) | SettingsComponentOptions): Mithril.Children;
/**
* Called when `saveSettings` completes successfully.
*/
onsaved(): void;
/**
* Returns a function that fetches the setting from the `app` global.
*/
setting(key: string, fallback?: string): Stream<string>;
/**
* Returns a map of settings keys to values which includes only those which have been modified but not yet saved.
*/
dirty(): Record<string, string>;
/**
* Returns the number of settings that have been modified.
*/
isChanged(): number;
/**
* Saves the modified settings to the database.
*/
saveSettings(e: SubmitEvent & {
redraw: boolean;
}): Promise<void>;
}
export {};

View File

@@ -0,0 +1,6 @@
export default class AppearancePage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
constructor();
colorItems(): ItemList<any>;
}
import AdminPage from "./AdminPage";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,18 @@
export default class BasicsPage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
constructor();
localeOptions: {} | undefined;
displayNameOptions: {} | undefined;
slugDriverOptions: {} | undefined;
/**
* Build a list of options for the default homepage. Each option must be an
* object with `path` and `label` properties.
*
* @return {ItemList<{ path: string, label: import('mithril').Children }>}
*/
homePageItems(): ItemList<{
path: string;
label: import('mithril').Children;
}>;
}
import AdminPage from "./AdminPage";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,6 @@
export default class DashboardPage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
constructor();
availableWidgets(): ItemList<any>;
}
import AdminPage from "./AdminPage";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,16 @@
export default class DashboardWidget extends Component<import("../../common/Component").ComponentAttrs, undefined> {
constructor();
/**
* Get the class name to apply to the widget.
*
* @return {string}
*/
className(): string;
/**
* Get the content of the widget.
*
* @return {import('mithril').Children}
*/
content(): import('mithril').Children;
}
import Component from "../../common/Component";

View File

@@ -0,0 +1,3 @@
export default class EditCustomCssModal extends SettingsModal {
}
import SettingsModal from "./SettingsModal";

View File

@@ -0,0 +1,3 @@
export default class EditCustomFooterModal extends SettingsModal {
}
import SettingsModal from "./SettingsModal";

View File

@@ -0,0 +1,3 @@
export default class EditCustomHeaderModal extends SettingsModal {
}
import SettingsModal from "./SettingsModal";

View File

@@ -0,0 +1,25 @@
/**
* The `EditGroupModal` component shows a modal dialog which allows the user
* to create or edit a group.
*/
export default class EditGroupModal extends Modal<import("../../common/components/Modal").IInternalModalAttrs> {
constructor();
group: any;
nameSingular: Stream<any> | undefined;
namePlural: Stream<any> | undefined;
icon: Stream<any> | undefined;
color: Stream<any> | undefined;
isHidden: Stream<any> | undefined;
fields(): ItemList<any>;
submitData(): {
nameSingular: any;
namePlural: any;
color: any;
icon: any;
isHidden: any;
};
deleteGroup(): void;
}
import Modal from "../../common/components/Modal";
import Stream from "../../common/utils/Stream";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,5 @@
export default class ExtensionLinkButton extends LinkButton {
statusItems(name: any): ItemList<any>;
}
import LinkButton from "../../common/components/LinkButton";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,32 @@
import ItemList from '../../common/utils/ItemList';
import AdminPage from './AdminPage';
import RequestError from '../../common/utils/RequestError';
import { Extension } from '../AdminApplication';
import { IPageAttrs } from '../../common/components/Page';
import type Mithril from 'mithril';
export interface ExtensionPageAttrs extends IPageAttrs {
id: string;
}
export default class ExtensionPage<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs> extends AdminPage<Attrs> {
extension: Extension;
changingState: boolean;
infoFields: {
discuss: string;
documentation: string;
support: string;
website: string;
donate: string;
source: string;
};
oninit(vnode: Mithril.Vnode<Attrs, this>): void;
className(): string;
view(vnode: Mithril.VnodeDOM<Attrs, this>): JSX.Element | null;
header(): JSX.Element[];
sections(vnode: Mithril.VnodeDOM<Attrs, this>): ItemList<unknown>;
content(vnode: Mithril.VnodeDOM<Attrs, this>): JSX.Element;
topItems(): ItemList<Mithril.Children>;
infoItems(): ItemList<Mithril.Children>;
toggle(): void;
isEnabled(): any;
onerror(e: RequestError): void;
}

View File

@@ -0,0 +1,19 @@
import PermissionGrid, { PermissionGridEntry } from './PermissionGrid';
import ItemList from '../../common/utils/ItemList';
import Mithril from 'mithril';
export interface IExtensionPermissionGridAttrs {
extensionId: string;
}
export default class ExtensionPermissionGrid<CustomAttrs extends IExtensionPermissionGridAttrs = IExtensionPermissionGridAttrs> extends PermissionGrid<CustomAttrs> {
protected extensionId: string;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
permissionItems(): ItemList<{
label: Mithril.Children;
children: PermissionGridEntry[];
}>;
viewItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
startItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
replyItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
moderateItems(): ItemList<import("./PermissionGrid").PermissionConfig>;
scopeControlItems(): ItemList<unknown>;
}

View File

@@ -0,0 +1,6 @@
export default class ExtensionsWidget extends DashboardWidget {
categorizedExtensions: {} | undefined;
extensionCategory(category: any): JSX.Element;
extensionWidget(extension: any): JSX.Element;
}
import DashboardWidget from "./DashboardWidget";

View File

@@ -0,0 +1,16 @@
/**
* The `HeaderPrimary` component displays primary header controls. On the
* default skin, these are shown just to the right of the forum title.
*/
export default class HeaderPrimary extends Component<import("../../common/Component").ComponentAttrs, undefined> {
constructor();
config(isInitialized: any, context: any): void;
/**
* Build an item list for the controls.
*
* @return {ItemList<import('mithril').Children>}
*/
items(): ItemList<import('mithril').Children>;
}
import Component from "../../common/Component";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,14 @@
/**
* The `HeaderSecondary` component displays secondary header controls.
*/
export default class HeaderSecondary extends Component<import("../../common/Component").ComponentAttrs, undefined> {
constructor();
/**
* Build an item list for the controls.
*
* @return {ItemList<import('mithril').Children>}
*/
items(): ItemList<import('mithril').Children>;
}
import Component from "../../common/Component";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,14 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
export interface ILoadingModalAttrs extends IInternalModalAttrs {
}
export default class LoadingModal<ModalAttrs extends ILoadingModalAttrs = ILoadingModalAttrs> extends Modal<ModalAttrs> {
/**
* @inheritdoc
*/
static readonly isDismissible: boolean;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
content(): string;
onsubmit(e: Event): void;
}

View File

@@ -0,0 +1,13 @@
export default class MailPage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
constructor();
sendingTest: boolean | undefined;
refresh(): void;
status: {
sending: boolean;
errors: {};
} | undefined;
driverFields: any;
sendTestEmail(): void;
testEmailSuccessAlert: number | undefined;
}
import AdminPage from "./AdminPage";

View File

@@ -0,0 +1,6 @@
export default class PermissionDropdown extends Dropdown {
save(groupIds: any): void;
toggle(groupId: any): void;
isGroupDisabled(id: any): boolean;
}
import Dropdown from "../../common/components/Dropdown";

View File

@@ -0,0 +1,36 @@
import Component, { ComponentAttrs } from '../../common/Component';
import ItemList from '../../common/utils/ItemList';
import type Mithril from 'mithril';
export interface PermissionConfig {
permission: string;
icon: string;
label: Mithril.Children;
allowGuest?: boolean;
}
export interface PermissionSetting {
setting: () => Mithril.Children;
icon: string;
label: Mithril.Children;
}
export declare type PermissionGridEntry = PermissionConfig | PermissionSetting;
export declare type PermissionType = 'view' | 'start' | 'reply' | 'moderate';
export interface ScopeItem {
label: Mithril.Children;
render: (permission: PermissionGridEntry) => Mithril.Children;
onremove?: () => void;
}
export interface IPermissionGridAttrs extends ComponentAttrs {
}
export default class PermissionGrid<CustomAttrs extends IPermissionGridAttrs = IPermissionGridAttrs> extends Component<CustomAttrs> {
view(vnode: Mithril.Vnode<CustomAttrs, this>): JSX.Element;
permissionItems(): ItemList<{
label: Mithril.Children;
children: PermissionGridEntry[];
}>;
viewItems(): ItemList<PermissionGridEntry>;
startItems(): ItemList<PermissionGridEntry>;
replyItems(): ItemList<PermissionGridEntry>;
moderateItems(): ItemList<PermissionGridEntry>;
scopeItems(): ItemList<ScopeItem>;
scopeControlItems(): ItemList<unknown>;
}

View File

@@ -0,0 +1,4 @@
export default class PermissionsPage extends AdminPage<import("../../common/components/Page").IPageAttrs> {
constructor();
}
import AdminPage from "./AdminPage";

View File

@@ -0,0 +1,18 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Modal, { IInternalModalAttrs } from '../../common/components/Modal';
import ExtensionReadme from '../models/ExtensionReadme';
import type Mithril from 'mithril';
import type { Extension } from '../AdminApplication';
export interface IReadmeModalAttrs extends IInternalModalAttrs {
extension: Extension;
}
export default class ReadmeModal<CustomAttrs extends IReadmeModalAttrs = IReadmeModalAttrs> extends Modal<CustomAttrs> {
protected name: string;
protected extName: string;
protected readme: ExtensionReadme;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
content(): JSX.Element;
loadReadme(): Promise<void>;
}

View File

@@ -0,0 +1,14 @@
/**
* The `SessionDropdown` component shows a button with the current user's
* avatar/name, with a dropdown of session controls.
*/
export default class SessionDropdown extends Dropdown {
/**
* Build an item list for the contents of the dropdown menu.
*
* @return {ItemList}
*/
items(): ItemList<any>;
}
import Dropdown from "../../common/components/Dropdown";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,3 @@
export default class SettingDropdown extends SelectDropdown {
}
import SelectDropdown from "../../common/components/SelectDropdown";

View File

@@ -0,0 +1,11 @@
export default class SettingsModal extends Modal<import("../../common/components/Modal").IInternalModalAttrs> {
constructor();
settings: {} | undefined;
form(): string;
submitButton(): JSX.Element;
setting(key: any, fallback?: string): any;
dirty(): {};
changed(): number;
onsaved(): void;
}
import Modal from "../../common/components/Modal";

View File

@@ -0,0 +1,7 @@
export default class StatusWidget extends DashboardWidget {
items(): ItemList<any>;
toolsItems(): ItemList<any>;
handleClearCache(e: any): void;
}
import DashboardWidget from "./DashboardWidget";
import ItemList from "../../common/utils/ItemList";

View File

@@ -0,0 +1,28 @@
export default class UploadImageButton extends Button<import("../../common/components/Button").IButtonAttrs> {
constructor();
loading: boolean;
/**
* Prompt the user to upload an image.
*/
upload(): void;
/**
* Remove the logo.
*/
remove(): void;
resourceUrl(): string;
/**
* After a successful upload/removal, reload the page.
*
* @param {object} response
* @protected
*/
protected success(response: object): void;
/**
* If upload/removal fails, stop loading.
*
* @param {object} response
* @protected
*/
protected failure(response: object): void;
}
import Button from "../../common/components/Button";

View File

@@ -0,0 +1,85 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import type Mithril from 'mithril';
import type User from '../../common/models/User';
import ItemList from '../../common/utils/ItemList';
import AdminPage from './AdminPage';
declare type ColumnData = {
/**
* Column title
*/
name: Mithril.Children;
/**
* Component(s) to show for this column.
*/
content: (user: User) => Mithril.Children;
};
/**
* Admin page which displays a paginated list of all users on the forum.
*/
export default class UserListPage extends AdminPage {
/**
* Number of users to load per page.
*/
private numPerPage;
/**
* Current page number. Zero-indexed.
*/
private pageNumber;
/**
* Total number of forum users.
*
* Fetched from the active `AdminApplication` (`app`), with
* data provided by `AdminPayload.php`, or `flarum/statistics`
* if installed.
*/
readonly userCount: number;
/**
* Get total number of user pages.
*/
private getTotalPageCount;
/**
* This page's array of users.
*
* `undefined` when page loads as no data has been fetched.
*/
private pageData;
/**
* Are there more users available?
*/
private moreData;
private isLoadingPage;
/**
* Component to render.
*/
content(): JSX.Element[];
/**
* Build an item list of columns to show for each user.
*
* Each column in the list should be an object with keys `name` and `content`.
*
* `name` is a string that will be used as the column name.
* `content` is a function with the User model passed as the first and only argument.
*
* See `UserListPage.tsx` for examples.
*/
columns(): ItemList<ColumnData>;
headerInfo(): {
className: string;
icon: string;
title: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
description: import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
};
/**
* Asynchronously fetch the next set of users to be rendered.
*
* Returns an array of Users, plus the raw API payload.
*
* Uses the `this.numPerPage` as the response limit, and automatically calculates the offset required from `pageNumber`.
*
* @param pageNumber The page number to load and display
*/
loadPage(pageNumber: number): Promise<void>;
nextPage(): void;
previousPage(): void;
}
export {};

3
js/dist-typings/admin/index.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
import app from './app';
export { app };
export declare const compat: Record<string, unknown>;

View File

@@ -0,0 +1,4 @@
export default class ExtensionReadme extends Model {
content: () => any;
}
import Model from "../../common/Model";

View File

@@ -0,0 +1,10 @@
import DefaultResolver from '../../common/resolvers/DefaultResolver';
import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage';
/**
* A custom route resolver for ExtensionPage that generates handles routes
* to default extension pages or a page provided by an extension.
*/
export default class ExtensionPageResolver<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs, RouteArgs extends Record<string, unknown> = {}> extends DefaultResolver<Attrs, ExtensionPage<Attrs>, RouteArgs> {
static extension: string | null;
onmatch(args: Attrs & RouteArgs, requestedPath: string, route: string): new () => ExtensionPage<Attrs>;
}

5
js/dist-typings/admin/routes.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
import AdminApplication from './AdminApplication';
/**
* The `routes` initializer defines the forum app's routes.
*/
export default function (app: AdminApplication): void;

View File

@@ -0,0 +1,96 @@
import type Mithril from 'mithril';
import ItemList from '../../common/utils/ItemList';
import { SettingsComponentOptions } from '../components/AdminPage';
import ExtensionPage, { ExtensionPageAttrs } from '../components/ExtensionPage';
import { PermissionConfig, PermissionType } from '../components/PermissionGrid';
declare type SettingConfigInput = SettingsComponentOptions | (() => Mithril.Children);
declare type SettingConfigInternal = SettingsComponentOptions | ((() => Mithril.Children) & {
setting: string;
});
export declare type CustomExtensionPage<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs> = new () => ExtensionPage<Attrs>;
declare type ExtensionConfig = {
settings?: ItemList<SettingConfigInternal>;
permissions?: {
view?: ItemList<PermissionConfig>;
start?: ItemList<PermissionConfig>;
reply?: ItemList<PermissionConfig>;
moderate?: ItemList<PermissionConfig>;
};
page?: CustomExtensionPage;
};
declare type InnerDataNoActiveExtension = {
currentExtension: null;
data: {
[key: string]: ExtensionConfig | undefined;
};
};
declare type InnerDataActiveExtension = {
currentExtension: string;
data: {
[key: string]: ExtensionConfig;
};
};
export default class ExtensionData {
protected state: InnerDataActiveExtension | InnerDataNoActiveExtension;
/**
* This function simply takes the extension id
*
* @example
* app.extensionData.for('flarum-tags')
*
* flarum/flags -> flarum-flags | acme/extension -> acme-extension
*/
for(extension: string): this;
/**
* This function registers your settings with Flarum
*
* It takes either a settings object or a callback.
*
* @example
*
* .registerSetting({
* setting: 'flarum-flags.guidelines_url',
* type: 'text', // This will be inputted into the input tag for the setting (text/number/etc)
* label: app.translator.trans('flarum-flags.admin.settings.guidelines_url_label')
* }, 15) // priority is optional (ItemList)
*/
registerSetting(content: SettingConfigInput, priority?: number): this;
/**
* This function registers your permission with Flarum
*
* @example
*
* .registerPermission('permissions', {
* icon: 'fas fa-flag',
* label: app.translator.trans('flarum-flags.admin.permissions.view_flags_label'),
* permission: 'discussion.viewFlags'
* }, 'moderate', 65)
*/
registerPermission(content: PermissionConfig, permissionType: PermissionType, priority?: number): this;
/**
* Replace the default extension page with a custom component.
* This component would typically extend ExtensionPage
*/
registerPage(component: CustomExtensionPage): this;
/**
* Get an extension's registered settings
*/
getSettings(extensionId: string): SettingConfigInternal[] | undefined;
/**
* Get an ItemList of all extensions' registered permissions
*/
getAllExtensionPermissions(type: PermissionType): ItemList<PermissionConfig>;
/**
* Get a singular extension's registered permissions
*/
getExtensionPermissions(extension: string, type: PermissionType): ItemList<PermissionConfig>;
/**
* Checks whether a given extension has registered permissions.
*/
extensionHasPermissions(extension: string): boolean;
/**
* Returns an extension's custom page component if it exists.
*/
getPage<Attrs extends ExtensionPageAttrs = ExtensionPageAttrs>(extension: string): CustomExtensionPage<Attrs> | undefined;
}
export {};

View File

@@ -0,0 +1 @@
export { nanoid as default } from 'nanoid';

View File

@@ -0,0 +1 @@
export default function getCategorizedExtensions(): {};

View File

@@ -0,0 +1 @@
export default function isExtensionEnabled(name: any): any;

View File

@@ -0,0 +1 @@
export default function saveSettings(settings: any): Promise<any>;

237
js/dist-typings/common/Application.d.ts vendored Normal file
View File

@@ -0,0 +1,237 @@
import ItemList from './utils/ItemList';
import Translator from './Translator';
import Store, { ApiPayload, ApiResponsePlural, ApiResponseSingle } from './Store';
import Session from './Session';
import Drawer from './utils/Drawer';
import RequestError, { InternalFlarumRequestOptions } from './utils/RequestError';
import Forum from './models/Forum';
import PageState from './states/PageState';
import ModalManagerState from './states/ModalManagerState';
import AlertManagerState from './states/AlertManagerState';
import type DefaultResolver from './resolvers/DefaultResolver';
import type Mithril from 'mithril';
import type Component from './Component';
import type { ComponentAttrs } from './Component';
import Model, { SavedModelData } from './Model';
export declare type FlarumScreens = 'phone' | 'tablet' | 'desktop' | 'desktop-hd';
export declare type FlarumGenericRoute = RouteItem<any, any, any>;
export interface FlarumRequestOptions<ResponseType> extends Omit<Mithril.RequestOptions<ResponseType>, 'extract'> {
errorHandler?: (error: RequestError) => void;
url: string;
/**
* Manipulate the response text before it is parsed into JSON.
*
* @deprecated Please use `modifyText` instead.
*/
extract?: (responseText: string) => string;
/**
* Manipulate the response text before it is parsed into JSON.
*
* This overrides any `extract` method provided.
*/
modifyText?: (responseText: string) => string;
}
/**
* A valid route definition.
*/
export declare type RouteItem<Attrs extends ComponentAttrs, Comp extends Component<Attrs & {
routeName: string;
}>, RouteArgs extends Record<string, unknown> = {}> = {
/**
* The path for your route.
*
* This might be a specific URL path (e.g.,`/myPage`), or it might
* contain a variable used by a resolver (e.g., `/myPage/:id`).
*
* @see https://docs.flarum.org/extend/frontend-pages.html#route-resolvers-advanced
*/
path: `/${string}`;
} & ({
/**
* The component to render when this route matches.
*/
component: new () => Comp;
/**
* A custom resolver class.
*
* This should be the class itself, and **not** an instance of the
* class.
*/
resolverClass?: new (component: new () => Comp, routeName: string) => DefaultResolver<Attrs, Comp, RouteArgs>;
} | {
/**
* An instance of a route resolver.
*/
resolver: RouteResolver<Attrs, Comp, RouteArgs>;
});
export interface RouteResolver<Attrs extends ComponentAttrs, Comp extends Component<Attrs & {
routeName: string;
}>, RouteArgs extends Record<string, unknown> = {}> {
/**
* A method which selects which component to render based on
* conditional logic.
*
* Returns the component class, and **not** a Vnode or JSX
* expression.
*
* @see https://mithril.js.org/route.html#routeresolveronmatch
*/
onmatch(this: this, args: RouteArgs, requestedPath: string, route: string): {
new (): Comp;
};
/**
* A function which renders the provided component.
*
* If not specified, the route will default to rendering the
* component on its own, inside of a fragment.
*
* Returns a Mithril Vnode or other children.
*
* @see https://mithril.js.org/route.html#routeresolverrender
*/
render?(this: this, vnode: Mithril.Vnode<Attrs, Comp>): Mithril.Children;
}
/**
* The `App` class provides a container for an application, as well as various
* utilities for the rest of the app to use.
*/
export default class Application {
/**
* The forum model for this application.
*/
forum: Forum;
/**
* A map of routes, keyed by a unique route name. Each route is an object
* containing the following properties:
*
* - `path` The path that the route is accessed at.
* - `component` The Mithril component to render when this route is active.
*
* @example
* app.routes.discussion = { path: '/d/:id', component: DiscussionPage };
*/
routes: Record<string, FlarumGenericRoute>;
/**
* An ordered list of initializers to bootstrap the application.
*/
initializers: ItemList<(app: this) => void>;
/**
* The app's session.
*
* Stores info about the current user.
*/
session: Session;
/**
* The app's translator.
*/
translator: Translator;
/**
* The app's data store.
*/
store: Store;
/**
* A local cache that can be used to store data at the application level, so
* that is persists between different routes.
*/
cache: Record<string, unknown>;
/**
* Whether or not the app has been booted.
*/
booted: boolean;
/**
* The page the app is currently on.
*
* This object holds information about the type of page we are currently
* visiting, and sometimes additional arbitrary page state that may be
* relevant to lower-level components.
*/
current: PageState;
/**
* The page the app was on before the current page.
*
* Once the application navigates to another page, the object previously
* assigned to this.current will be moved to this.previous, while this.current
* is re-initialized.
*/
previous: PageState;
/**
* An object that manages modal state.
*/
modal: ModalManagerState;
/**
* An object that manages the state of active alerts.
*/
alerts: AlertManagerState;
/**
* An object that manages the state of the navigation drawer.
*/
drawer: Drawer;
data: {
apiDocument: ApiPayload | null;
locale: string;
locales: Record<string, string>;
resources: SavedModelData[];
session: {
userId: number;
csrfToken: string;
};
[key: string]: unknown;
};
private _title;
private _titleCount;
private set title(value);
get title(): string;
private set titleCount(value);
get titleCount(): number;
/**
* The key for an Alert that was shown as a result of an AJAX request error.
* If present, it will be dismissed on the next successful request.
*/
private requestErrorAlert;
initialRoute: string;
load(payload: Application['data']): void;
boot(): void;
bootExtensions(extensions: Record<string, {
extend?: unknown[];
}>): void;
protected mount(basePath?: string): void;
/**
* Get the API response document that has been preloaded into the application.
*/
preloadedApiDocument<M extends Model>(): ApiResponseSingle<M> | null;
preloadedApiDocument<Ms extends Model[]>(): ApiResponsePlural<Ms[number]> | null;
/**
* Determine the current screen mode, based on our media queries.
*/
screen(): FlarumScreens;
/**
* Set the `<title>` of the page.
*
* @param title New page title
*/
setTitle(title: string): void;
/**
* Set a number to display in the `<title>` of the page.
*
* @param count Number to display in title
*/
setTitleCount(count: number): void;
updateTitle(): void;
protected transformRequestOptions<ResponseType>(flarumOptions: FlarumRequestOptions<ResponseType>): InternalFlarumRequestOptions<ResponseType>;
/**
* Make an AJAX request, handling any low-level errors that may occur.
*
* @see https://mithril.js.org/request.html
*/
request<ResponseType>(originalOptions: FlarumRequestOptions<ResponseType>): Promise<ResponseType>;
/**
* By default, show an error alert, and log the error to the console.
*/
protected requestErrorCatch<ResponseType>(error: RequestError, customErrorHandler: FlarumRequestOptions<ResponseType>['errorHandler']): Promise<never>;
protected requestErrorDefaultHandler(e: unknown, isDebug: boolean, formattedErrors: string[]): void;
private showDebug;
/**
* Construct a URL to the route with the given name.
*/
route(name: string, params?: Record<string, unknown>): string;
}

114
js/dist-typings/common/Component.d.ts vendored Normal file
View File

@@ -0,0 +1,114 @@
import type Mithril from 'mithril';
export interface ComponentAttrs extends Mithril.Attributes {
}
/**
* The `Component` class defines a user interface 'building block'. A component
* generates a virtual DOM to be rendered on each redraw.
*
* Essentially, this is a wrapper for Mithril's components that adds several useful features:
*
* - In the `oninit` and `onbeforeupdate` lifecycle hooks, we store vnode attrs in `this.attrs.
* This allows us to use attrs across components without having to pass the vnode to every single
* method.
* - The static `initAttrs` method allows a convenient way to provide defaults (or to otherwise modify)
* the attrs that have been passed into a component.
* - When the component is created in the DOM, we store its DOM element under `this.element`; this lets
* us use jQuery to modify child DOM state from internal methods via the `this.$()` method.
* - A convenience `component` method, which serves as an alternative to hyperscript and JSX.
*
* As with other Mithril components, components extending Component can be initialized
* and nested using JSX, hyperscript, or a combination of both. The `component` method can also
* be used.
*
* @example
* return m('div', <MyComponent foo="bar"><p>Hello World</p></MyComponent>);
*
* @example
* return m('div', MyComponent.component({foo: 'bar'), m('p', 'Hello World!'));
*
* @see https://mithril.js.org/components.html
*/
export default abstract class Component<Attrs extends ComponentAttrs = ComponentAttrs, State = undefined> implements Mithril.ClassComponent<Attrs> {
/**
* The root DOM element for the component.
*/
protected element: Element;
/**
* The attributes passed into the component.
*
* @see https://mithril.js.org/components.html#passing-data-to-components
*/
protected attrs: Attrs;
/**
* Class component state that is persisted between redraws.
*
* Updating this will **not** automatically trigger a redraw, unlike
* other frameworks.
*
* This is different to Vnode state, which is always an instance of your
* class component.
*
* This is `undefined` by default.
*/
protected state: State;
/**
* @inheritdoc
*/
abstract view(vnode: Mithril.Vnode<Attrs, this>): Mithril.Children;
/**
* @inheritdoc
*/
oninit(vnode: Mithril.Vnode<Attrs, this>): void;
/**
* @inheritdoc
*/
oncreate(vnode: Mithril.VnodeDOM<Attrs, this>): void;
/**
* @inheritdoc
*/
onbeforeupdate(vnode: Mithril.VnodeDOM<Attrs, this>): void;
/**
* @inheritdoc
*/
onupdate(vnode: Mithril.VnodeDOM<Attrs, this>): void;
/**
* @inheritdoc
*/
onbeforeremove(vnode: Mithril.VnodeDOM<Attrs, this>): void;
/**
* @inheritdoc
*/
onremove(vnode: Mithril.VnodeDOM<Attrs, this>): void;
/**
* Returns a jQuery object for this component's element. If you pass in a
* selector string, this method will return a jQuery object, using the current
* element as its buffer.
*
* For example, calling `component.$('li')` will return a jQuery object
* containing all of the `li` elements inside the DOM element of this
* component.
*
* @param [selector] a jQuery-compatible selector string
* @returns the jQuery object for the DOM node
* @final
*/
protected $(selector?: string): JQuery;
/**
* Convenience method to attach a component without JSX.
* Has the same effect as calling `m(THIS_CLASS, attrs, children)`.
*
* @see https://mithril.js.org/hyperscript.html#mselector,-attributes,-children
*/
static component<SAttrs extends ComponentAttrs = ComponentAttrs>(attrs?: SAttrs, children?: Mithril.Children): Mithril.Vnode;
/**
* Saves a reference to the vnode attrs after running them through initAttrs,
* and checking for common issues.
*/
private setAttrs;
/**
* Initialize the component's attrs.
*
* This can be used to assign default values for missing, optional attrs.
*/
protected static initAttrs<T>(attrs: T): void;
}

53
js/dist-typings/common/Fragment.d.ts vendored Normal file
View File

@@ -0,0 +1,53 @@
import type Mithril from 'mithril';
/**
* The `Fragment` class represents a chunk of DOM that is rendered once with Mithril and then takes
* over control of its own DOM and lifecycle.
*
* This is very similar to the `Component` wrapper class, but is used for more fine-grained control over
* the rendering and display of some significant chunks of the DOM. In contrast to components, fragments
* do not offer Mithril's lifecycle hooks.
*
* Use this when you want to enjoy the benefits of JSX / VDOM for initial rendering, combined with
* small helper methods that then make updates to that DOM directly, instead of fully redrawing
* everything through Mithril.
*
* This should only be used when necessary, and only with `m.render`. If you are unsure whether you need
* this or `Component, you probably need `Component`.
*/
export default abstract class Fragment {
/**
* The root DOM element for the fragment.
*/
protected element: Element;
/**
* Returns a jQuery object for this fragment's element. If you pass in a
* selector string, this method will return a jQuery object, using the current
* element as its buffer.
*
* For example, calling `fragment.$('li')` will return a jQuery object
* containing all of the `li` elements inside the DOM element of this
* fragment.
*
* @param [selector] a jQuery-compatible selector string
* @returns the jQuery object for the DOM node
* @final
*/
$(selector?: string): JQuery;
/**
* Get the renderable virtual DOM that represents the fragment's view.
*
* This should NOT be overridden by subclasses. Subclasses wishing to define
* their virtual DOM should override Fragment#view instead.
*
* @example
* const fragment = new MyFragment();
* m.render(document.body, fragment.render());
*
* @final
*/
render(): Mithril.Vnode<Mithril.Attributes, this>;
/**
* Creates a view out of virtual elements.
*/
abstract view(): Mithril.Vnode<Mithril.Attributes, this>;
}

147
js/dist-typings/common/Model.d.ts vendored Normal file
View File

@@ -0,0 +1,147 @@
import { FlarumRequestOptions } from './Application';
import Store, { ApiPayloadSingle, ApiResponseSingle, MetaInformation } from './Store';
export interface ModelIdentifier {
type: string;
id: string;
}
export interface ModelAttributes {
[key: string]: unknown;
}
export interface ModelRelationships {
[relationship: string]: {
data: ModelIdentifier | ModelIdentifier[];
};
}
export interface UnsavedModelData {
type?: string;
attributes?: ModelAttributes;
relationships?: ModelRelationships;
}
export interface SavedModelData {
type: string;
id: string;
attributes?: ModelAttributes;
relationships?: ModelRelationships;
}
export declare type ModelData = UnsavedModelData | SavedModelData;
export interface SaveRelationships {
[relationship: string]: Model | Model[];
}
export interface SaveAttributes {
[key: string]: unknown;
relationships?: SaveRelationships;
}
/**
* The `Model` class represents a local data resource. It provides methods to
* persist changes via the API.
*/
export default abstract class Model {
/**
* The resource object from the API.
*/
data: ModelData;
/**
* The time at which the model's data was last updated. Watching the value
* of this property is a fast way to retain/cache a subtree if data hasn't
* changed.
*/
freshness: Date;
/**
* Whether or not the resource exists on the server.
*/
exists: boolean;
/**
* The data store that this resource should be persisted to.
*/
protected store: Store;
/**
* @param data A resource object from the API.
* @param store The data store that this model should be persisted to.
*/
constructor(data?: ModelData, store?: Store);
/**
* Get the model's ID.
*
* @final
*/
id(): string | undefined;
/**
* Get one of the model's attributes.
*
* @final
*/
attribute<T = unknown>(attribute: string): T;
/**
* Merge new data into this model locally.
*
* @param data A resource object to merge into this model
*/
pushData(data: ModelData | {
relationships?: SaveRelationships;
}): this;
/**
* Merge new attributes into this model locally.
*
* @param attributes The attributes to merge.
*/
pushAttributes(attributes: ModelAttributes): void;
/**
* Merge new attributes into this model, both locally and with persistence.
*
* @param attributes The attributes to save. If a 'relationships' key
* exists, it will be extracted and relationships will also be saved.
*/
save(attributes: SaveAttributes, options?: Omit<FlarumRequestOptions<ApiPayloadSingle>, 'url'> & {
meta?: MetaInformation;
}): Promise<ApiResponseSingle<this>>;
/**
* Send a request to delete the resource.
*
* @param body Data to send along with the DELETE request.
*/
delete(body?: FlarumRequestOptions<void>['body'], options?: Omit<FlarumRequestOptions<void>, 'url'>): Promise<void>;
/**
* Construct a path to the API endpoint for this resource.
*/
protected apiEndpoint(): string;
protected copyData(): ModelData;
protected rawRelationship<M extends Model>(relationship: string): undefined | ModelIdentifier;
protected rawRelationship<M extends Model[]>(relationship: string): undefined | ModelIdentifier[];
/**
* Generate a function which returns the value of the given attribute.
*
* @param transform A function to transform the attribute value
*/
static attribute<T>(name: string): () => T;
static attribute<T, O = unknown>(name: string, transform: (attr: O) => T): () => T;
/**
* Generate a function which returns the value of the given has-one
* relationship.
*
* @return false if no information about the
* relationship exists; undefined if the relationship exists but the model
* has not been loaded; or the model if it has been loaded.
*/
static hasOne<M extends Model>(name: string): () => M | false;
static hasOne<M extends Model | null>(name: string): () => M | null | false;
/**
* Generate a function which returns the value of the given has-many
* relationship.
*
* @return false if no information about the relationship
* exists; an array if it does, containing models if they have been
* loaded, and undefined for those that have not.
*/
static hasMany<M extends Model>(name: string): () => (M | undefined)[] | false;
/**
* Transform the given value into a Date object.
*/
static transformDate(value: string): Date;
static transformDate(value: string | null): Date | null;
static transformDate(value: string | undefined): Date | undefined;
static transformDate(value: string | null | undefined): Date | null | undefined;
/**
* Get a resource identifier object for the given model.
*/
protected static getIdentifier(model: Model): ModelIdentifier;
}

33
js/dist-typings/common/Session.d.ts vendored Normal file
View File

@@ -0,0 +1,33 @@
import User from './models/User';
import { FlarumRequestOptions } from './Application';
export declare type LoginParams = {
/**
* The username/email
*/
identification: string;
password: string;
remember: boolean;
};
/**
* The `Session` class defines the current user session. It stores a reference
* to the current authenticated user, and provides methods to log in/out.
*/
export default class Session {
/**
* The current authenticated user.
*/
user: User | null;
/**
* The CSRF token.
*/
csrfToken: string;
constructor(user: User | null, csrfToken: string);
/**
* Attempt to log in a user.
*/
login(body: LoginParams, options?: Omit<FlarumRequestOptions<any>, 'url' | 'body' | 'method'>): Promise<any>;
/**
* Log the user out.
*/
logout(): void;
}

127
js/dist-typings/common/Store.d.ts vendored Normal file
View File

@@ -0,0 +1,127 @@
import { FlarumRequestOptions } from './Application';
import Model, { ModelData, SavedModelData } from './Model';
export interface MetaInformation {
[key: string]: any;
}
export interface ApiQueryParamsSingle {
fields?: string[];
include?: string;
bySlug?: boolean;
meta?: MetaInformation;
}
export interface ApiQueryParamsPlural {
fields?: string[];
include?: string;
filter?: {
q: string;
[key: string]: string;
};
page?: {
offset?: number;
number?: number;
limit?: number;
size?: number;
};
sort?: string;
meta?: MetaInformation;
}
export declare type ApiQueryParams = ApiQueryParamsPlural | ApiQueryParamsSingle;
export interface ApiPayloadSingle {
data: SavedModelData;
included?: SavedModelData[];
meta?: MetaInformation;
}
export interface ApiPayloadPlural {
data: SavedModelData[];
included?: SavedModelData[];
links?: {
first: string;
next?: string;
prev?: string;
};
meta?: MetaInformation;
}
export declare type ApiPayload = ApiPayloadSingle | ApiPayloadPlural;
export declare type ApiResponseSingle<M extends Model> = M & {
payload: ApiPayloadSingle;
};
export declare type ApiResponsePlural<M extends Model> = M[] & {
payload: ApiPayloadPlural;
};
export declare type ApiResponse<M extends Model> = ApiResponseSingle<M> | ApiResponsePlural<M>;
interface ApiQueryRequestOptions<ResponseType> extends Omit<FlarumRequestOptions<ResponseType>, 'url'> {
}
interface StoreData {
[type: string]: Partial<Record<string, Model>>;
}
export declare function payloadIsPlural(payload: ApiPayload): payload is ApiPayloadPlural;
/**
* The `Store` class defines a local data store, and provides methods to
* retrieve data from the API.
*/
export default class Store {
/**
* The local data store. A tree of resource types to IDs, such that
* accessing data[type][id] will return the model for that type/ID.
*/
protected data: StoreData;
/**
* The model registry. A map of resource types to the model class that
* should be used to represent resources of that type.
*/
models: Record<string, typeof Model>;
constructor(models: Record<string, typeof Model>);
/**
* Push resources contained within an API payload into the store.
*
* @return The model(s) representing the resource(s) contained
* within the 'data' key of the payload.
*/
pushPayload<M extends Model>(payload: ApiPayloadSingle): ApiResponseSingle<M>;
pushPayload<Ms extends Model[]>(payload: ApiPayloadPlural): ApiResponsePlural<Ms[number]>;
/**
* Create a model to represent a resource object (or update an existing one),
* and push it into the store.
*
* @param data The resource object
* @return The model, or null if no model class has been
* registered for this resource type.
*/
pushObject<M extends Model>(data: SavedModelData): M | null;
pushObject<M extends Model>(data: SavedModelData, allowUnregistered: false): M;
/**
* Make a request to the API to find record(s) of a specific type.
*/
find<M extends Model>(type: string, params: ApiQueryParamsSingle): Promise<ApiResponseSingle<M>>;
find<Ms extends Model[]>(type: string, params: ApiQueryParamsPlural): Promise<ApiResponsePlural<Ms[number]>>;
find<M extends Model>(type: string, id: string, params?: ApiQueryParamsSingle, options?: ApiQueryRequestOptions<ApiPayloadSingle>): Promise<ApiResponseSingle<M>>;
find<Ms extends Model[]>(type: string, ids: string[], params?: ApiQueryParamsPlural, options?: ApiQueryRequestOptions<ApiPayloadPlural>): Promise<ApiResponsePlural<Ms[number]>>;
/**
* Get a record from the store by ID.
*/
getById<M extends Model>(type: string, id: string): M | undefined;
/**
* Get a record from the store by the value of a model attribute.
*
* @param type The resource type.
* @param key The name of the method on the model.
* @param value The value of the model attribute.
*/
getBy<M extends Model, T = unknown>(type: string, key: keyof M, value: T): M | undefined;
/**
* Get all loaded records of a specific type.
*/
all<M extends Model>(type: string): M[];
/**
* Remove the given model from the store.
*/
remove(model: Model): void;
/**
* Create a new record of the given type.
*
* @param type The resource type
* @param data Any data to initialize the model with
*/
createRecord<M extends Model>(type: string, data?: ModelData): M;
}
export {};

34
js/dist-typings/common/Translator.d.ts vendored Normal file
View File

@@ -0,0 +1,34 @@
/// <reference path="../@types/translator-icu-rich.d.ts" />
import { RichMessageFormatter } from '@askvortsov/rich-icu-message-formatter';
import { pluralTypeHandler, selectTypeHandler } from '@ultraq/icu-message-formatter';
declare type Translations = Record<string, string>;
declare type TranslatorParameters = Record<string, unknown>;
export default class Translator {
/**
* A map of translation keys to their translated values.
*/
translations: Translations;
/**
* The underlying ICU MessageFormatter util.
*/
protected formatter: RichMessageFormatter;
setLocale(locale: string): void;
addTranslations(translations: Translations): void;
/**
* An extensible entrypoint for extenders to register type handlers for translations.
*/
protected formatterTypeHandlers(): {
plural: typeof pluralTypeHandler;
select: typeof selectTypeHandler;
};
/**
* A temporary system to preprocess parameters.
* Should not be used by extensions.
* TODO: An extender will be added in v1.x.
*
* @internal
*/
protected preprocessParameters(parameters: TranslatorParameters): TranslatorParameters;
trans(id: string, parameters?: TranslatorParameters): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
}
export {};

6
js/dist-typings/common/app.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
import type Application from './Application';
declare const _default: Application;
/**
* The instance of Application within the common namespace.
*/
export default _default;

174
js/dist-typings/common/compat.d.ts vendored Normal file
View File

@@ -0,0 +1,174 @@
declare var _default: {
extend: any;
Session: typeof Session;
Store: typeof Store;
'utils/BasicEditorDriver': typeof BasicEditorDriver;
'utils/evented': {
handlers: Record<string, unknown>;
getHandlers(event: string): Function[];
trigger(event: string, ...args: any[]): void;
on(event: string, handler: Function): void;
one(event: string, handler: Function): void;
off(event: string, handler: Function): void;
};
'utils/liveHumanTimes': typeof liveHumanTimes;
'utils/ItemList': typeof ItemList;
'utils/mixin': typeof mixin;
'utils/humanTime': typeof humanTime;
'utils/computed': typeof computed;
'utils/insertText': typeof insertText;
'utils/styleSelectedText': typeof styleSelectedText;
'utils/Drawer': typeof Drawer;
'utils/anchorScroll': typeof anchorScroll;
'utils/RequestError': typeof RequestError;
'utils/abbreviateNumber': typeof abbreviateNumber;
'utils/string': typeof string;
'utils/SubtreeRetainer': typeof SubtreeRetainer;
'utils/escapeRegExp': typeof escapeRegExp;
'utils/extract': typeof extract;
'utils/ScrollListener': typeof ScrollListener;
'utils/stringToColor': typeof stringToColor;
'utils/Stream': typeof Stream;
'utils/subclassOf': typeof subclassOf;
'utils/setRouteWithForcedRefresh': typeof setRouteWithForcedRefresh;
'utils/patchMithril': typeof patchMithril;
'utils/proxifyCompat': typeof proxifyCompat;
'utils/classList': (...classes: import("clsx").ClassValue[]) => string;
'utils/extractText': typeof extractText;
'utils/formatNumber': typeof formatNumber;
'utils/mapRoutes': typeof mapRoutes;
'utils/withAttr': (key: string, cb: Function) => (this: Element) => void;
'utils/throttleDebounce': typeof ThrottleDebounce;
'utils/isObject': typeof isObject;
'utils/focusTrap': typeof FocusTrap;
'models/Notification': typeof Notification;
'models/User': typeof User;
'models/Post': typeof Post;
'models/Discussion': typeof Discussion;
'models/Group': typeof Group;
'models/Forum': typeof Forum;
Component: typeof Component;
Fragment: typeof Fragment;
Translator: typeof Translator;
'components/AlertManager': typeof AlertManager;
'components/Page': typeof Page;
'components/Switch': typeof Switch;
'components/Badge': typeof Badge;
'components/LoadingIndicator': typeof LoadingIndicator;
'components/Placeholder': typeof Placeholder;
'components/Separator': typeof Separator;
'components/Dropdown': typeof Dropdown;
'components/SplitDropdown': typeof SplitDropdown;
'components/RequestErrorModal': typeof RequestErrorModal;
'components/FieldSet': typeof FieldSet;
'components/Select': typeof Select;
'components/Navigation': typeof Navigation;
'components/Alert': typeof Alert;
'components/Link': typeof Link;
'components/LinkButton': typeof LinkButton;
'components/Checkbox': typeof Checkbox;
'components/ColorPreviewInput': typeof ColorPreviewInput;
'components/SelectDropdown': typeof SelectDropdown;
'components/ModalManager': typeof ModalManager;
'components/Button': typeof Button;
'components/Modal': typeof Modal;
'components/GroupBadge': typeof GroupBadge;
'components/TextEditor': typeof TextEditor;
'components/TextEditorButton': typeof TextEditorButton;
'components/Tooltip': typeof Tooltip;
'components/EditUserModal': typeof EditUserModal;
Model: typeof Model;
Application: typeof Application;
'helpers/fullTime': typeof fullTime;
'helpers/avatar': typeof avatar;
'helpers/icon': typeof icon;
'helpers/humanTime': typeof humanTimeHelper;
'helpers/punctuateSeries': typeof punctuateSeries;
'helpers/highlight': typeof highlight;
'helpers/username': typeof username;
'helpers/userOnline': typeof userOnline;
'helpers/listItems': typeof listItems;
'resolvers/DefaultResolver': typeof DefaultResolver;
'states/PaginatedListState': typeof PaginatedListState;
};
export default _default;
import Session from "./Session";
import Store from "./Store";
import BasicEditorDriver from "./utils/BasicEditorDriver";
import liveHumanTimes from "./utils/liveHumanTimes";
import ItemList from "./utils/ItemList";
import mixin from "./utils/mixin";
import humanTime from "./utils/humanTime";
import computed from "./utils/computed";
import insertText from "./utils/insertText";
import styleSelectedText from "./utils/styleSelectedText";
import Drawer from "./utils/Drawer";
import anchorScroll from "./utils/anchorScroll";
import RequestError from "./utils/RequestError";
import abbreviateNumber from "./utils/abbreviateNumber";
import * as string from "./utils/string";
import SubtreeRetainer from "./utils/SubtreeRetainer";
import escapeRegExp from "./utils/escapeRegExp";
import extract from "./utils/extract";
import ScrollListener from "./utils/ScrollListener";
import stringToColor from "./utils/stringToColor";
import Stream from "./utils/Stream";
import subclassOf from "./utils/subclassOf";
import setRouteWithForcedRefresh from "./utils/setRouteWithForcedRefresh";
import patchMithril from "./utils/patchMithril";
import proxifyCompat from "./utils/proxifyCompat";
import extractText from "./utils/extractText";
import formatNumber from "./utils/formatNumber";
import mapRoutes from "./utils/mapRoutes";
import * as ThrottleDebounce from "./utils/throttleDebounce";
import isObject from "./utils/isObject";
import * as FocusTrap from "./utils/focusTrap";
import Notification from "./models/Notification";
import User from "./models/User";
import Post from "./models/Post";
import Discussion from "./models/Discussion";
import Group from "./models/Group";
import Forum from "./models/Forum";
import Component from "./Component";
import Fragment from "./Fragment";
import Translator from "./Translator";
import AlertManager from "./components/AlertManager";
import Page from "./components/Page";
import Switch from "./components/Switch";
import Badge from "./components/Badge";
import LoadingIndicator from "./components/LoadingIndicator";
import Placeholder from "./components/Placeholder";
import Separator from "./components/Separator";
import Dropdown from "./components/Dropdown";
import SplitDropdown from "./components/SplitDropdown";
import RequestErrorModal from "./components/RequestErrorModal";
import FieldSet from "./components/FieldSet";
import Select from "./components/Select";
import Navigation from "./components/Navigation";
import Alert from "./components/Alert";
import Link from "./components/Link";
import LinkButton from "./components/LinkButton";
import Checkbox from "./components/Checkbox";
import ColorPreviewInput from "./components/ColorPreviewInput";
import SelectDropdown from "./components/SelectDropdown";
import ModalManager from "./components/ModalManager";
import Button from "./components/Button";
import Modal from "./components/Modal";
import GroupBadge from "./components/GroupBadge";
import TextEditor from "./components/TextEditor";
import TextEditorButton from "./components/TextEditorButton";
import Tooltip from "./components/Tooltip";
import EditUserModal from "./components/EditUserModal";
import Model from "./Model";
import Application from "./Application";
import fullTime from "./helpers/fullTime";
import avatar from "./helpers/avatar";
import icon from "./helpers/icon";
import humanTimeHelper from "./helpers/humanTime";
import punctuateSeries from "./helpers/punctuateSeries";
import highlight from "./helpers/highlight";
import username from "./helpers/username";
import userOnline from "./helpers/userOnline";
import listItems from "./helpers/listItems";
import DefaultResolver from "./resolvers/DefaultResolver";
import PaginatedListState from "./states/PaginatedListState";

View File

@@ -0,0 +1,19 @@
import Component, { ComponentAttrs } from '../Component';
import type Mithril from 'mithril';
export interface AlertAttrs extends ComponentAttrs {
/** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */
type?: string;
/** An array of controls to show in the alert. */
controls?: Mithril.Children;
/** Whether or not the alert can be dismissed. */
dismissible?: boolean;
/** A callback to run when the alert is dismissed */
ondismiss?: Function;
}
/**
* The `Alert` component represents an alert box, which contains a message,
* some controls, and may be dismissible.
*/
export default class Alert<T extends AlertAttrs = AlertAttrs> extends Component<T> {
view(vnode: Mithril.VnodeDOM<T, this>): JSX.Element;
}

View File

@@ -0,0 +1,8 @@
/**
* The `AlertManager` component provides an area in which `Alert` components can
* be shown and dismissed.
*/
export default class AlertManager extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
}
import Component from "../Component";

View File

@@ -0,0 +1,17 @@
/**
* The `Badge` component represents a user/discussion badge, indicating some
* status (e.g. a discussion is stickied, a user is an admin).
*
* A badge may have the following special attrs:
*
* - `type` The type of badge this is. This will be used to give the badge a
* class name of `Badge--{type}`.
* - `icon` The name of an icon to show inside the badge.
* - `label`
*
* All other attrs will be assigned as attributes on the badge element.
*/
export default class Badge extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
}
import Component from "../Component";

View File

@@ -0,0 +1,69 @@
import type Mithril from 'mithril';
import Component, { ComponentAttrs } from '../Component';
export interface IButtonAttrs extends ComponentAttrs {
/**
* Class(es) of an optional icon to be rendered within the button.
*
* If provided, the button will gain a `has-icon` class.
*/
icon?: string;
/**
* Disables button from user input.
*
* Default: `false`
*/
disabled?: boolean;
/**
* Show a loading spinner within the button.
*
* If `true`, also disables the button.
*
* Default: `false`
*/
loading?: boolean;
/**
* **DEPRECATED:** Please use the `aria-label` attribute instead. For tooltips, use
* the `<Tooltip>` component.
*
* Accessible text for the button. This should always be present if the button only
* contains an icon.
*
* The textual content of this attribute is passed to the DOM element as `aria-label`.
*
* @deprecated
*/
title?: string | Mithril.ChildArray;
/**
* Accessible text for the button. This should always be present if the button only
* contains an icon.
*
* The textual content of this attribute is passed to the DOM element as `aria-label`.
*/
'aria-label'?: string | Mithril.ChildArray;
/**
* Button type.
*
* Default: `"button"`
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type
*/
type?: string;
}
/**
* The `Button` component defines an element which, when clicked, performs an
* action.
*
* Other attrs will be assigned as attributes on the `<button>` element.
*
* Note that a Button has no default class names. This is because a Button can
* be used to represent any generic clickable control, like a menu item. Common
* styles can be applied by providing `className="Button"` to the Button component.
*/
export default class Button<CustomAttrs extends IButtonAttrs = IButtonAttrs> extends Component<CustomAttrs> {
view(vnode: Mithril.VnodeDOM<CustomAttrs, this>): JSX.Element;
oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
/**
* Get the template for the button's content.
*/
protected getButtonContent(children: Mithril.Children): Mithril.ChildArray;
}

View File

@@ -0,0 +1,30 @@
/**
* The `Checkbox` component defines a checkbox input.
*
* ### Attrs
*
* - `state` Whether or not the checkbox is checked.
* - `className` The class name for the root element.
* - `disabled` Whether or not the checkbox is disabled.
* - `loading` Whether or not the checkbox is loading.
* - `onchange` A callback to run when the checkbox is checked/unchecked.
* - `children` A text label to display next to the checkbox.
*/
export default class Checkbox extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
/**
* Get the template for the checkbox's display (tick/cross icon).
*
* @return {import('mithril').Children}
* @protected
*/
protected getDisplay(): import('mithril').Children;
/**
* Run a callback when the state of the checkbox is changed.
*
* @param {boolean} checked
* @protected
*/
protected onchange(checked: boolean): void;
}
import Component from "../Component";

View File

@@ -0,0 +1,5 @@
import type Mithril from 'mithril';
import Component, { ComponentAttrs } from '../Component';
export default class ColorPreviewInput extends Component {
view(vnode: Mithril.Vnode<ComponentAttrs, this>): JSX.Element;
}

View File

@@ -0,0 +1,22 @@
/**
* The `ConfirmDocumentUnload` component can be used to register a global
* event handler that prevents closing the browser window/tab based on the
* return value of a given callback prop.
*
* ### Attrs
*
* - `when` - a callback returning true when the browser should prompt for
* confirmation before closing the window/tab
*
* ### Children
*
* NOTE: Only the first child will be rendered. (Use this component to wrap
* another component / DOM element.)
*
*/
export default class ConfirmDocumentUnload extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
handler(): any;
boundHandler: (() => any) | undefined;
}
import Component from "../Component";

View File

@@ -0,0 +1,38 @@
/**
* The `Dropdown` component displays a button which, when clicked, shows a
* dropdown menu beneath it.
*
* ### Attrs
*
* - `buttonClassName` A class name to apply to the dropdown toggle button.
* - `menuClassName` A class name to apply to the dropdown menu.
* - `icon` The name of an icon to show in the dropdown toggle button.
* - `caretIcon` The name of an icon to show on the right of the button.
* - `label` The label of the dropdown toggle button. Defaults to 'Controls'.
* - `accessibleToggleLabel` The label used to describe the dropdown toggle button to assistive readers. Defaults to 'Toggle dropdown menu'.
* - `onhide`
* - `onshow`
*
* The children will be displayed as a list inside of the dropdown menu.
*/
export default class Dropdown extends Component<import("../Component").ComponentAttrs, undefined> {
static initAttrs(attrs: any): void;
constructor();
showing: boolean | undefined;
/**
* Get the template for the button.
*
* @return {import('mithril').Children}
* @protected
*/
protected getButton(children: any): import('mithril').Children;
/**
* Get the template for the button's content.
*
* @return {import('mithril').Children}
* @protected
*/
protected getButtonContent(children: any): import('mithril').Children;
getMenu(items: any): JSX.Element;
}
import Component from "../Component";

View File

@@ -0,0 +1,31 @@
/// <reference path="../../@types/translator-icu-rich.d.ts" />
import Modal, { IInternalModalAttrs } from './Modal';
import ItemList from '../utils/ItemList';
import Stream from '../utils/Stream';
import type Mithril from 'mithril';
import type User from '../models/User';
import type { SaveAttributes } from '../Model';
export interface IEditUserModalAttrs extends IInternalModalAttrs {
user: User;
}
export default class EditUserModal<CustomAttrs extends IEditUserModalAttrs = IEditUserModalAttrs> extends Modal<CustomAttrs> {
protected username: Stream<string>;
protected email: Stream<string>;
protected isEmailConfirmed: Stream<boolean>;
protected setPassword: Stream<boolean>;
protected password: Stream<string>;
protected groups: Record<string, Stream<boolean>>;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
className(): string;
title(): import("@askvortsov/rich-icu-message-formatter").NestedStringArray;
content(): JSX.Element;
fields(): ItemList<unknown>;
activate(): void;
data(): SaveAttributes;
onsubmit(e: SubmitEvent): void;
nonAdminEditingAdmin(): boolean | null;
/**
* @internal
*/
protected userIsAdmin(user: User | null): boolean | null;
}

View File

@@ -0,0 +1,13 @@
/**
* The `FieldSet` component defines a collection of fields, displayed in a list
* underneath a title. Accepted properties are:
*
* - `className` The class name for the fieldset.
* - `label` The title of this group of fields.
*
* The children should be an array of items to show in the fieldset.
*/
export default class FieldSet extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
}
import Component from "../Component";

View File

@@ -0,0 +1,4 @@
export default class GroupBadge extends Badge {
static initAttrs(attrs: any): void;
}
import Badge from "./Badge";

View File

@@ -0,0 +1,12 @@
/**
* The link component enables both internal and external links.
* It will return a regular HTML link for any links to external sites,
* and it will use Mithril's m.route.Link for any internal links.
*
* Links will default to internal; the 'external' attr must be set to
* `true` for the link to be external.
*/
export default class Link extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
}
import Component from "../Component";

View File

@@ -0,0 +1,25 @@
/**
* The `LinkButton` component defines a `Button` which links to a route.
*
* ### Attrs
*
* All of the attrs accepted by `Button`, plus:
*
* - `active` Whether or not the page that this button links to is currently
* active.
* - `href` The URL to link to. If the current URL `m.route()` matches this,
* the `active` prop will automatically be set to true.
* - `force` Whether the page should be fully rerendered. Defaults to `true`.
*/
export default class LinkButton extends Button<import("./Button").IButtonAttrs> {
static initAttrs(attrs: any): void;
/**
* Determine whether a component with the given attrs is 'active'.
*
* @param {object} attrs
* @return {boolean}
*/
static isActive(attrs: object): boolean;
constructor();
}
import Button from "./Button";

View File

@@ -0,0 +1,56 @@
/// <reference types="mithril" />
import Component, { ComponentAttrs } from '../Component';
export interface LoadingIndicatorAttrs extends ComponentAttrs {
/**
* Custom classes for the loading indicator's container.
*/
className?: string;
/**
* Custom classes for the loading indicator's container.
*/
containerClassName?: string;
/**
* Optional size for the loading indicator.
*/
size?: 'large' | 'medium' | 'small';
/**
* Optional attributes to apply to the loading indicator's container.
*/
containerAttrs?: Partial<ComponentAttrs>;
/**
* Display type of the spinner.
*
* @default 'block'
*/
display?: 'block' | 'inline' | 'unset';
}
/**
* The `LoadingIndicator` component displays a simple CSS-based loading spinner.
*
* To set a custom color, use the CSS `color` property.
*
* To increase spacing around the spinner, use the CSS `height` property on the
* spinner's **container**. Setting the `display` attribute to `block` will set
* a height of `100px` by default.
*
* To apply a custom size to the loading indicator, set the `--size` and
* `--thickness` CSS custom properties on the loading indicator container.
*
* If you *really* want to change how this looks as part of your custom theme,
* you can override the `border-radius` and `border` then set either a
* background image, or use `content: "\<glyph>"` (e.g. `content: "\f1ce"`)
* and `font-family: 'Font Awesome 5 Free'` to set an FA icon if you'd rather.
*
* ### Attrs
*
* - `containerClassName` Class name(s) to apply to the indicator's parent
* - `className` Class name(s) to apply to the indicator itself
* - `display` Determines how the spinner should be displayed (`inline`, `block` (default) or `unset`)
* - `size` Size of the loading indicator (`small`, `medium` or `large`)
* - `containerAttrs` Optional attrs to be applied to the container DOM element
*
* All other attrs will be assigned as attributes on the DOM element.
*/
export default class LoadingIndicator extends Component<LoadingIndicatorAttrs> {
view(): JSX.Element;
}

View File

@@ -0,0 +1,68 @@
import Component from '../Component';
import { AlertAttrs } from './Alert';
import type Mithril from 'mithril';
import type ModalManagerState from '../states/ModalManagerState';
import type RequestError from '../utils/RequestError';
import type ModalManager from './ModalManager';
export interface IInternalModalAttrs {
state: ModalManagerState;
animateShow: ModalManager['animateShow'];
animateHide: ModalManager['animateHide'];
}
/**
* The `Modal` component displays a modal dialog, wrapped in a form. Subclasses
* should implement the `className`, `title`, and `content` methods.
*/
export default abstract class Modal<ModalAttrs extends IInternalModalAttrs = IInternalModalAttrs> extends Component<ModalAttrs> {
/**
* Determine whether or not the modal should be dismissible via an 'x' button.
*/
static readonly isDismissible: boolean;
protected loading: boolean;
/**
* Attributes for an alert component to show below the header.
*/
alertAttrs: AlertAttrs | null;
oninit(vnode: Mithril.Vnode<ModalAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<ModalAttrs, this>): void;
onbeforeremove(vnode: Mithril.VnodeDOM<ModalAttrs, this>): Promise<void> | void;
/**
* @todo split into FormModal and Modal in 2.0
*/
view(): JSX.Element;
/**
* Get the class name to apply to the modal.
*/
abstract className(): string;
/**
* Get the title of the modal dialog.
*/
abstract title(): Mithril.Children;
/**
* Get the content of the modal.
*/
abstract content(): Mithril.Children;
/**
* Handle the modal form's submit event.
*/
onsubmit(e: SubmitEvent): void;
/**
* Callback executed when the modal is shown and ready to be interacted with.
*
* @remark Focuses the first input in the modal.
*/
onready(): void;
/**
* Hides the modal.
*/
hide(): void;
/**
* Sets `loading` to false and triggers a redraw.
*/
loaded(): void;
/**
* Shows an alert describing an error returned from the API, and gives focus to
* the first relevant field involved in the error.
*/
onerror(error: RequestError): void;
}

View File

@@ -0,0 +1,25 @@
import Component from '../Component';
import { FocusTrap } from '../utils/focusTrap';
import type ModalManagerState from '../states/ModalManagerState';
import type Mithril from 'mithril';
interface IModalManagerAttrs {
state: ModalManagerState;
}
/**
* The `ModalManager` component manages a modal dialog. Only one modal dialog
* can be shown at once; loading a new component into the ModalManager will
* overwrite the previous one.
*/
export default class ModalManager extends Component<IModalManagerAttrs> {
protected focusTrap: FocusTrap | undefined;
/**
* Whether a modal is currently shown by this modal manager.
*/
protected modalShown: boolean;
view(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): Mithril.Children;
oncreate(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): void;
onupdate(vnode: Mithril.VnodeDOM<IModalManagerAttrs, this>): void;
animateShow(readyCallback: () => void): void;
animateHide(): void;
}
export {};

View File

@@ -0,0 +1,40 @@
/**
* The `Navigation` component displays a set of navigation buttons. Typically
* this is just a back button which pops the app's History. If the user is on
* the root page and there is no history to pop, then in some instances it may
* show a button that toggles the app's drawer.
*
* If the app has a pane, it will also include a 'pin' button which toggles the
* pinned state of the pane.
*
* Accepts the following attrs:
*
* - `className` The name of a class to set on the root element.
* - `drawer` Whether or not to show a button to toggle the app's drawer if
* there is no more history to pop.
*/
export default class Navigation extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
/**
* Get the back button.
*
* @return {import('mithril').Children}
* @protected
*/
protected getBackButton(): import('mithril').Children;
/**
* Get the pane pinned toggle button.
*
* @return {import('mithril').Children}
* @protected
*/
protected getPaneButton(): import('mithril').Children;
/**
* Get the drawer toggle button.
*
* @return {import('mithril').Children}
* @protected
*/
protected getDrawerButton(): import('mithril').Children;
}
import Component from "../Component";

View File

@@ -0,0 +1,28 @@
import type Mithril from 'mithril';
import Component from '../Component';
export interface IPageAttrs {
key?: number;
routeName: string;
}
/**
* The `Page` component
*
* @abstract
*/
export default abstract class Page<CustomAttrs extends IPageAttrs = IPageAttrs> extends Component<CustomAttrs> {
/**
* A class name to apply to the body while the route is active.
*/
protected bodyClass: string;
/**
* Whether we should scroll to the top of the page when its rendered.
*/
protected scrollTopOnCreate: boolean;
/**
* Whether the browser should restore scroll state on refreshes.
*/
protected useBrowserScrollRestoration: boolean;
oninit(vnode: Mithril.Vnode<CustomAttrs, this>): void;
oncreate(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
onremove(vnode: Mithril.VnodeDOM<CustomAttrs, this>): void;
}

View File

@@ -0,0 +1,12 @@
/**
* The `Placeholder` component displays a muted text with some call to action,
* usually used as an empty state.
*
* ### Attrs
*
* - `text`
*/
export default class Placeholder extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
}
import Component from "../Component";

View File

@@ -0,0 +1,12 @@
/// <reference types="mithril" />
import type RequestError from '../utils/RequestError';
import Modal, { IInternalModalAttrs } from './Modal';
export interface IRequestErrorModalAttrs extends IInternalModalAttrs {
error: RequestError;
formattedError: string[];
}
export default class RequestErrorModal<CustomAttrs extends IRequestErrorModalAttrs = IRequestErrorModalAttrs> extends Modal<CustomAttrs> {
className(): string;
title(): string;
content(): JSX.Element;
}

View File

@@ -0,0 +1,16 @@
/**
* The `Select` component displays a <select> input, surrounded with some extra
* elements for styling. It accepts the following attrs:
*
* - `options` A map of option values to labels.
* - `onchange` A callback to run when the selected value is changed.
* - `value` The value of the selected option.
* - `disabled` Disabled state for the input.
* - `wrapperAttrs` A map of attrs to be passed to the DOM element wrapping the `<select>`
*
* Other attributes are passed directly to the `<select>` element rendered to the DOM.
*/
export default class Select extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
}
import Component from "../Component";

View File

@@ -0,0 +1,13 @@
/**
* The `SelectDropdown` component is the same as a `Dropdown`, except the toggle
* button's label is set as the label of the first child which has a truthy
* `active` prop.
*
* ### Attrs
*
* - `caretIcon`
* - `defaultLabel`
*/
export default class SelectDropdown extends Dropdown {
}
import Dropdown from "./Dropdown";

View File

@@ -0,0 +1,11 @@
export default Separator;
/**
* The `Separator` component defines a menu separator item.
*/
declare class Separator extends Component<import("../Component").ComponentAttrs, undefined> {
constructor();
}
declare namespace Separator {
const isListItem: boolean;
}
import Component from "../Component";

View File

@@ -0,0 +1,16 @@
/**
* The `SplitDropdown` component is similar to `Dropdown`, but the first child
* is displayed as its own button prior to the toggle button.
*/
export default class SplitDropdown extends Dropdown {
/**
* Get the first child. If the first child is an array, the first item in that
* array will be returned.
*
* @param {unknown[] | unknown} children
* @return {unknown}
* @protected
*/
protected getFirstChild(children: unknown[] | unknown): unknown;
}
import Dropdown from "./Dropdown";

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