From 2c51f6e312492865281ea93a478ad5d5d5b38687 Mon Sep 17 00:00:00 2001
From: Bogdan Teodoru
Date: Sun, 10 Jan 2016 17:20:01 +0200
Subject: [PATCH 01/10] #679 Ask for confirmation before "Mark all as Read"
---
.../core/js/forum/src/components/DiscussionListItem.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/framework/core/js/forum/src/components/DiscussionListItem.js b/framework/core/js/forum/src/components/DiscussionListItem.js
index 935aa0af7..a3cce4719 100644
--- a/framework/core/js/forum/src/components/DiscussionListItem.js
+++ b/framework/core/js/forum/src/components/DiscussionListItem.js
@@ -174,8 +174,12 @@ export default class DiscussionListItem extends Component {
const discussion = this.props.discussion;
if (discussion.isUnread()) {
- discussion.save({readNumber: discussion.lastPostNumber()});
- m.redraw();
+ const confirmation = confirm(app.translator.trans('core.forum.discussion_list.mark_all_as_read_confirmation'));
+
+ if (confirmation) {
+ discussion.save({readNumber: discussion.lastPostNumber()});
+ m.redraw();
+ }
}
}
From 9cb4dee4151da171e93e76ce40161adc76487173 Mon Sep 17 00:00:00 2001
From: Daniel Klabbers
Date: Mon, 11 Jan 2016 08:09:01 +0100
Subject: [PATCH 02/10] removed patch from api routes, fixes #725
---
framework/core/src/Api/ApiServiceProvider.php | 6 ------
1 file changed, 6 deletions(-)
diff --git a/framework/core/src/Api/ApiServiceProvider.php b/framework/core/src/Api/ApiServiceProvider.php
index 09012694b..764d2dcd8 100644
--- a/framework/core/src/Api/ApiServiceProvider.php
+++ b/framework/core/src/Api/ApiServiceProvider.php
@@ -110,12 +110,6 @@ class ApiServiceProvider extends AbstractServiceProvider
$toController('Flarum\Api\Controller\ShowForumController')
);
- // Save forum information
- $routes->patch(
- '/forum',
- 'forum.update',
- $toController('Flarum\Api\Controller\UpdateForumController')
- );
// Retrieve authentication token
$routes->post(
From 56d7fc9cf5c08acd1f417644f1ac85d3b474d91d Mon Sep 17 00:00:00 2001
From: Franz Liedke
Date: Mon, 11 Jan 2016 08:15:14 +0100
Subject: [PATCH 03/10] Remove empty line
---
framework/core/src/Api/ApiServiceProvider.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/framework/core/src/Api/ApiServiceProvider.php b/framework/core/src/Api/ApiServiceProvider.php
index 764d2dcd8..acd114fdf 100644
--- a/framework/core/src/Api/ApiServiceProvider.php
+++ b/framework/core/src/Api/ApiServiceProvider.php
@@ -110,7 +110,6 @@ class ApiServiceProvider extends AbstractServiceProvider
$toController('Flarum\Api\Controller\ShowForumController')
);
-
// Retrieve authentication token
$routes->post(
'/token',
From 13354e7ed7f7b77bf19e02bbb123b4b3475bbae8 Mon Sep 17 00:00:00 2001
From: Franz Liedke
Date: Mon, 11 Jan 2016 08:38:24 +0100
Subject: [PATCH 04/10] Remove Studio hack
---
framework/core/src/Foundation/AbstractServer.php | 8 --------
1 file changed, 8 deletions(-)
diff --git a/framework/core/src/Foundation/AbstractServer.php b/framework/core/src/Foundation/AbstractServer.php
index 5dfda65c0..6cb669642 100644
--- a/framework/core/src/Foundation/AbstractServer.php
+++ b/framework/core/src/Foundation/AbstractServer.php
@@ -78,14 +78,6 @@ abstract class AbstractServer
*/
protected function getApp()
{
- // franzliedke/studio currently doesn't autoload files (see issue
- // below), so we will need to load them manually if we're using studio.
- // https://github.com/franzliedke/studio/issues/29
- if (file_exists($corePath = $this->path.'/core')) {
- require $corePath.'/src/helpers.php';
- require $corePath.'/vendor/swiftmailer/swiftmailer/lib/swift_required.php';
- }
-
date_default_timezone_set('UTC');
$app = new Application($this->path);
From 4f869b98291e09c78a79a3c84348e25ec169768e Mon Sep 17 00:00:00 2001
From: Franz Liedke
Date: Mon, 11 Jan 2016 08:46:20 +0100
Subject: [PATCH 05/10] #717: Implement helper for registering a language pack
---
framework/core/src/Event/ConfigureLocales.php | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/framework/core/src/Event/ConfigureLocales.php b/framework/core/src/Event/ConfigureLocales.php
index 8ecf98518..64044e7c4 100644
--- a/framework/core/src/Event/ConfigureLocales.php
+++ b/framework/core/src/Event/ConfigureLocales.php
@@ -10,7 +10,9 @@
namespace Flarum\Event;
+use DirectoryIterator;
use Flarum\Locale\LocaleManager;
+use RuntimeException;
class ConfigureLocales
{
@@ -26,4 +28,45 @@ class ConfigureLocales
{
$this->locales = $locales;
}
+
+ /**
+ * Load language pack resources from the given directory.
+ *
+ * @param $directory
+ */
+ public function loadLanguagePackFrom($directory)
+ {
+ $name = $title = basename($directory);
+
+ if (file_exists($manifest = __DIR__.'/composer.json')) {
+ $json = json_decode(file_get_contents($manifest), true);
+
+ if (empty($json)) {
+ throw new RuntimeException("Error parsing composer.json in $name: ".json_last_error_msg());
+ }
+
+ $locale = array_get($json, 'extra.flarum-locale.code');
+ $title = array_get($json, 'extra.flarum-locale.title', $title);
+ }
+
+ if (! isset($locale)) {
+ throw new RuntimeException("Language pack $name must define \"extra.flarum-locale.code\" in composer.json.");
+ }
+
+ $this->locales->addLocale($locale, $title);
+
+ if (! is_dir($localeDir = __DIR__.'/locale')) {
+ throw new RuntimeException("Language pack $name must have a \"locale\" subdirectory.");
+ }
+
+ if (file_exists($file = $localeDir.'/config.js')) {
+ $this->locales->addJsFile($locale, $file);
+ }
+
+ foreach (new DirectoryIterator($localeDir) as $file) {
+ if ($file->isFile() && in_array($file->getExtension(), ['yml', 'yaml'])) {
+ $this->locales->addTranslations($locale, $file->getPathname());
+ }
+ }
+ }
}
From e84ab1daa14e95dde3eb5bd1cbfc3fb639550d53 Mon Sep 17 00:00:00 2001
From: Sajjad Hasehmian
Date: Mon, 11 Jan 2016 13:29:01 +0330
Subject: [PATCH 06/10] Add rel="nofollow" to bio links (fixes #449)
---
framework/core/js/lib/models/User.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/framework/core/js/lib/models/User.js b/framework/core/js/lib/models/User.js
index a1b231654..cd7ead7be 100644
--- a/framework/core/js/lib/models/User.js
+++ b/framework/core/js/lib/models/User.js
@@ -17,7 +17,7 @@ Object.assign(User.prototype, {
avatarUrl: Model.attribute('avatarUrl'),
bio: Model.attribute('bio'),
- bioHtml: computed('bio', bio => bio ? '' + $('
').text(bio).html().replace(/\n/g, '
').autoLink() + '
' : ''),
+ bioHtml: computed('bio', bio => bio ? '' + $('
').text(bio).html().replace(/\n/g, '
').autoLink({rel: 'nofollow'}) + '' : ''),
preferences: Model.attribute('preferences'),
groups: Model.hasMany('groups'),
From 6225a29e293ddb9bca01533b4a1a068e2e986151 Mon Sep 17 00:00:00 2001
From: Bogdan Teodoru
Date: Tue, 12 Jan 2016 08:23:02 +0200
Subject: [PATCH 07/10] #679 Ask for confirmation before "Mark all as Read"
---
framework/core/js/forum/src/components/IndexPage.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/framework/core/js/forum/src/components/IndexPage.js b/framework/core/js/forum/src/components/IndexPage.js
index 5848520f0..d85867b94 100644
--- a/framework/core/js/forum/src/components/IndexPage.js
+++ b/framework/core/js/forum/src/components/IndexPage.js
@@ -358,6 +358,10 @@ export default class IndexPage extends Page {
* @return void
*/
markAllAsRead() {
- app.session.user.save({readTime: new Date()});
+ const confirmation = confirm(app.translator.trans('core.forum.index.mark_all_as_read_confirmation'));
+
+ if (confirmation) {
+ app.session.user.save({readTime: new Date()});
+ }
}
}
From 746fc9ea1450b4dcba538f2967413323024bec2e Mon Sep 17 00:00:00 2001
From: Sajjad Hasehmian
Date: Tue, 12 Jan 2016 10:58:19 +0330
Subject: [PATCH 08/10] Add flash animation when scrolling to post preview
fixes #666 :metal:
---
framework/core/js/forum/src/components/PostStream.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/framework/core/js/forum/src/components/PostStream.js b/framework/core/js/forum/src/components/PostStream.js
index d18cec577..5fc1cff41 100644
--- a/framework/core/js/forum/src/components/PostStream.js
+++ b/framework/core/js/forum/src/components/PostStream.js
@@ -55,7 +55,9 @@ class PostStream extends Component {
return this.goToLast().then(() => {
$('html,body').stop(true).animate({
scrollTop: $(document).height() - $(window).height()
- }, 'fast');
+ }, 'fast', () => {
+ this.flashItem(this.$('.PostStream-item:last-child'));
+ });
});
}
From 90437016ea72d61b0596520838efdecf81c064c6 Mon Sep 17 00:00:00 2001
From: Toby Zerner
Date: Tue, 12 Jan 2016 18:29:21 +1030
Subject: [PATCH 09/10] Extract Google font import to a head string, make
overideable
Allowing headStrings to be named is a bit of a stopgap solution. Really ClientView needs to be given much more power with headStrings and footStrings as separate objects, similar to the ItemList in the JS app.
---
framework/core/less/lib/lib.less | 2 --
framework/core/src/Http/Controller/ClientView.php | 10 ++++++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/framework/core/less/lib/lib.less b/framework/core/less/lib/lib.less
index b942aa28d..45396ecd3 100755
--- a/framework/core/less/lib/lib.less
+++ b/framework/core/less/lib/lib.less
@@ -1,5 +1,3 @@
-@import url(//fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700,600);
-
@import "font-awesome.less";
@fa-font-path: "../../assets/fonts";
diff --git a/framework/core/src/Http/Controller/ClientView.php b/framework/core/src/Http/Controller/ClientView.php
index b5f786b1c..97554de88 100644
--- a/framework/core/src/Http/Controller/ClientView.php
+++ b/framework/core/src/Http/Controller/ClientView.php
@@ -127,6 +127,8 @@ class ClientView implements Renderable
$this->assets = $assets;
$this->layout = $layout;
$this->localeJs = $localeJs;
+
+ $this->addHeadString('', 'font');
}
/**
@@ -164,9 +166,13 @@ class ClientView implements Renderable
*
* @param string $string
*/
- public function addHeadString($string)
+ public function addHeadString($string, $name = null)
{
- $this->headStrings[] = $string;
+ if ($name) {
+ $this->headStrings[$name] = $string;
+ } else {
+ $this->headStrings[] = $string;
+ }
}
/**
From 1f3cdd55737d450251e8373798f3907069c794aa Mon Sep 17 00:00:00 2001
From: Toby Zerner
Date: Tue, 12 Jan 2016 18:35:37 +1030
Subject: [PATCH 10/10] Use correct directory in loadLanguagePackFrom API
---
framework/core/src/Event/ConfigureLocales.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/framework/core/src/Event/ConfigureLocales.php b/framework/core/src/Event/ConfigureLocales.php
index 64044e7c4..c37e84c49 100644
--- a/framework/core/src/Event/ConfigureLocales.php
+++ b/framework/core/src/Event/ConfigureLocales.php
@@ -38,7 +38,7 @@ class ConfigureLocales
{
$name = $title = basename($directory);
- if (file_exists($manifest = __DIR__.'/composer.json')) {
+ if (file_exists($manifest = $directory.'/composer.json')) {
$json = json_decode(file_get_contents($manifest), true);
if (empty($json)) {
@@ -55,7 +55,7 @@ class ConfigureLocales
$this->locales->addLocale($locale, $title);
- if (! is_dir($localeDir = __DIR__.'/locale')) {
+ if (! is_dir($localeDir = $directory.'/locale')) {
throw new RuntimeException("Language pack $name must have a \"locale\" subdirectory.");
}