Commit Graph

630 Commits

Author SHA1 Message Date
Toby Zerner
f255d318ef Add multiple UrlGenerator classes for forum/api/admin
Spent quite a while looking into the best solution here and ended up going with three separate classes. Thanks to @Luceos for the PR that got this rolling (#518). My reasoning is:

- The task of routing and URL generation is independent for each section of the app. Take Flarum\Api\Users\IndexAction for example. I don't want to generate a URL to a Flarum route... I specifically want to generate a URL to an API route. So there should be a class with that specific responsibility.
- In fact, each URL generator is slightly different, because we need to add a certain prefix to the start (e.g. /api)
- This also allows us to get rid of the "flarum.api" prefix on each route's name.
- It's still DRY, because they all extend a base class.

At the same time, I could see no reason this needed to be "interfaced", so all of the classes are concrete.

Goes a long way to fixing #123 - still just a few places left remaining with hardcoded URLs.
2015-10-02 17:35:29 +09:30
Toby Zerner
aa203de6e9 Update docblocks 2015-09-29 16:41:34 +09:30
Toby Zerner
e0aa99fabb Properly mark all notifications as read
Previously, clicking the "mark all notifications as read" button would individually mark each of the visible notifications as read. Since we now always show a badge with the number of unread notifications, we need to make sure that all notifications (not just the visible ones) can be marked as read. Otherwise it would be possible to get stuck with an unread badge there.

This commit adds a new API endpoint which marks *all* of a user's notifications as read. The JSON-API spec doesn't cover this kind of thing (updating all instances of a certain resource type), so I'm a bit unsure regarding what the endpoint should actually be. For now I've gone with POST /notifications/read, but I'm open to suggestions.

ref #500
2015-09-29 16:41:05 +09:30
Franz Liedke
5382d0ce1a Remove unused import 2015-09-29 01:31:34 +02:00
Franz Liedke
295f29e53e Make linter happy 2015-09-29 01:31:09 +02:00
Franz Liedke
040ce52724 Return both unread and new notification count from the API
Related to #500.
2015-09-29 01:28:47 +02:00
kirkbushell
c3374197d1 Added zend-stragility (missing), removed some redundant code. 2015-09-28 15:59:07 +01:00
Toby Zerner
3efbffdcec Extract English translations into a language pack
To make this work, we add support for the client working without any locale.

Also fixes #412.
2015-09-25 16:12:09 +09:30
Toby Zerner
02e40f7c47 Allow extensions to return a callback instead of a provider name
This is useful for very simple extensions like language packs, because it means no Composer/namespacing and thus bootstrap.php doesn't have to be changed at all.
2015-09-25 16:05:01 +09:30
Franz Liedke
de216af08d Change name of header for faking HTTP methods
Refs #502.
2015-09-25 00:35:57 +02:00
Franz Liedke
418b1b9bac Implement middleware for faking HTTP methods
Refs #502.
2015-09-25 00:31:31 +02:00
Daniel Klabbers
68369ac5bb heavier validation for username 2015-09-24 23:07:30 +02:00
Franz Liedke
7404debb21 Clean up unused variable
Closes #501.
2015-09-24 16:27:00 +02:00
Toby Zerner
35360b690c Temporary solution to resolve translation references
Just implemented this roughly so I can keep working :D /cc @franzliedke
2015-09-24 09:27:47 +09:30
Toby Zerner
b9bda2d443 Compile all core translations for now
May need to be specific again once we have admin translations, or it
may be better to just put admin translations under a different
namespace...
2015-09-24 09:06:44 +09:30
Toby Zerner
91fb24f7a3 Fix is:unread gambit
closes #485
2015-09-24 08:31:56 +09:30
Toby Zerner
273461040c Update local copy of notification when marking as read 2015-09-23 10:52:26 +09:30
Franz Liedke
ee9862004d Make sure JSON request bodies are parsed as array.
Refs #533.
2015-09-22 15:19:54 +02:00
Toby Zerner
db067c7d87 Refresh discussion metadata to make sure it's correct
The new Approval extension may hide new posts, in which case we don't
want to increment the comments count/set the last post.
2015-09-22 17:57:20 +09:30
Toby Zerner
7a0299d246 Relax self edit/rename restrictions
- Fixes the last post not being self-editable if it's hidden
- Fixes the discussion not being self-renameable its only post is hidden
2015-09-22 17:56:09 +09:30
Toby Zerner
264725d872 Allow discussions to be hidden and restored 2015-09-22 17:48:21 +09:30
Toby Zerner
8e19312534 Add API to run callback after a model instance is saved 2015-09-22 17:22:25 +09:30
Toby Zerner
ed602c6032 Remove importer for the time being 2015-09-22 17:14:01 +09:30
Toby Zerner
d6ed04ffce Fix incorrect version requirement in extension generator 2015-09-22 17:13:41 +09:30
Toby Zerner
8937050aed Rename column for consistency 2015-09-22 16:54:32 +09:30
Toby Zerner
8f387bbd52 Allow formatter to be used for things other than post formatting 2015-09-18 13:29:43 +09:30
Toby Zerner
c4dc1a5ee2 Allow settings to be deleted using LIKE
Also give migrations access to the SettingsRepository
2015-09-18 13:28:38 +09:30
Toby Zerner
ca09e834b1 Add events for serializing/unserializing config values 2015-09-18 13:16:35 +09:30
Toby Zerner
f4a4ed8b49 Extend social login access token expiry 2015-09-17 12:57:22 +09:30
Toby Zerner
dbd33f687c Remove "custom" home page input
Also add an API to let extensions define additional default route
options.

Allowing default routes with parameters (e.g. /d/123) is very difficult
because of the way Mithril routing works, and it doesn't have a
convincing use-case to justify the trouble. So I've removed the custom
input altogether.

closes #427
2015-09-17 12:56:39 +09:30
Toby Zerner
e038c5c9d9 Add migration generator 2015-09-17 12:16:38 +09:30
Toby Zerner
7fb582e8d7 Namespace migrations to avoid potential conflicts
Core migrations are under the Flarum\Migrations\Core namespace.
Extension migrations must be under the
Flarum\Migrations\{ExtensionName} namespace.

closes #422
2015-09-17 08:54:31 +09:30
Daniel Klabbers
84e670082b fixed flarum/core#489 missing meta description from admin area 2015-09-16 21:43:53 +02:00
Franz Liedke
ad060126ae Small cleanup in extension manager 2015-09-16 08:56:27 +02:00
Davide Bellini
fc8dfd8893 Changed default Admin password
Default Admin password doesn't pass the new validation rule (min 8 chars)

See: cbcad27679 (diff-2e6d4ed85cd06d3e11f7f8428746214eR126)
2015-09-15 17:52:33 +02:00
Toby Zerner
701ad0a977 Add API to set asset compiler filename 2015-09-15 21:20:32 +09:30
Franz Liedke
cd5f5515e2 Try to make PHP extension requirement message clearer 2015-09-15 09:18:26 +02:00
Toby Zerner
d8c2cbc265 Mark all notifications with the same subject as read 2015-09-15 16:20:22 +09:30
Toby Zerner
f6ad891850 Rename ExternalAuthenticator to Authenticator 2015-09-15 16:03:10 +09:30
Toby Zerner
e524c59f97 Improve external authentication API
Some providers (e.g. Twitter) don't expose user email addresses, so it
turns out we can't use that as the sole form of identification/account
matching.

This commit introduces a new `auth_tokens` table which stores arbitrary
attributes during the sign up process. For example, when Twitter is
authenticated, a new auth token containing the user's Twitter ID will
be created. When sign up is completed with this token, that Twitter ID
will be set as an attribute on the user's account.
2015-09-15 15:56:48 +09:30
Toby Zerner
6beb4fe898 Add external authenticator (social login) API
Allows registrations to be completed with a pre-confirmed email address
and no password.
2015-09-15 11:27:31 +09:30
Toby Zerner
cbcad27679 Improve installer validation
Very rough, but works for now. The basic premise being that we need to
collect all user data before we proceed with installation.
2015-09-14 18:13:24 +09:30
Toby Zerner
60323e0cf9 Bump version number 2015-09-14 16:32:31 +09:30
Toby Zerner
8cccaaaf6b Improve API error handling
- Change 'path' key to 'source.pointer', as per spec
- Add 500 error detail if debug mode is on
2015-09-14 15:40:07 +09:30
Toby Zerner
190aa925ac Set cookies to be HTTP only 2015-09-14 14:40:05 +09:30
Toby Zerner
60b19efe0a Password is not necessarily required
e.g. on my LAMP setup, I sometimes use a MySQL account without a
password
2015-09-14 14:39:18 +09:30
Franz Liedke
e7d7df3b0c Cleanup 2015-09-11 09:16:53 +02:00
Franz Liedke
3b5a01e603 Implement more validation in installer 2015-09-11 09:16:43 +02:00
Franz Liedke
902d01712b Remove pointless JSON-API action base class
Cleanup related to #118.
2015-09-09 09:04:49 +02:00
Franz Liedke
502a3787d5 Move remaining extension handling to middleware 2015-09-09 08:56:11 +02:00