From 1f5219f2a2c3eb8511ff02d5e57d5ebefc7f82f3 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"
---
js/forum/src/components/DiscussionListItem.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/js/forum/src/components/DiscussionListItem.js b/js/forum/src/components/DiscussionListItem.js
index 935aa0af7..a3cce4719 100644
--- a/js/forum/src/components/DiscussionListItem.js
+++ b/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 159810c33570cd702fd9ceb64f36805225c0fe08 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
---
src/Api/ApiServiceProvider.php | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/Api/ApiServiceProvider.php b/src/Api/ApiServiceProvider.php
index 09012694b..764d2dcd8 100644
--- a/src/Api/ApiServiceProvider.php
+++ b/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 537ab6e41f82789c3d9790b4ee39fe3d1d8b6d93 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
---
src/Api/ApiServiceProvider.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/Api/ApiServiceProvider.php b/src/Api/ApiServiceProvider.php
index 764d2dcd8..acd114fdf 100644
--- a/src/Api/ApiServiceProvider.php
+++ b/src/Api/ApiServiceProvider.php
@@ -110,7 +110,6 @@ class ApiServiceProvider extends AbstractServiceProvider
$toController('Flarum\Api\Controller\ShowForumController')
);
-
// Retrieve authentication token
$routes->post(
'/token',
From 4a6137fdb1a2dff0091b8a006fa5c3d8b0c9422a 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
---
src/Foundation/AbstractServer.php | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/Foundation/AbstractServer.php b/src/Foundation/AbstractServer.php
index 5dfda65c0..6cb669642 100644
--- a/src/Foundation/AbstractServer.php
+++ b/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 bd1d05ee2c476343226c3c8c4551e2a03f749ce6 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
---
src/Event/ConfigureLocales.php | 43 ++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/src/Event/ConfigureLocales.php b/src/Event/ConfigureLocales.php
index 8ecf98518..64044e7c4 100644
--- a/src/Event/ConfigureLocales.php
+++ b/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 15398fcc6dea578e923c19b03b71c7ab59f88b5b 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)
---
js/lib/models/User.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/js/lib/models/User.js b/js/lib/models/User.js
index a1b231654..cd7ead7be 100644
--- a/js/lib/models/User.js
+++ b/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 5120d9577e6c697c3148a4b111f8ef02a2eee6df 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"
---
js/forum/src/components/IndexPage.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/js/forum/src/components/IndexPage.js b/js/forum/src/components/IndexPage.js
index 5848520f0..d85867b94 100644
--- a/js/forum/src/components/IndexPage.js
+++ b/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 02bcb0f898fd092755fd752b389c22f45c2956c5 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:
---
js/forum/src/components/PostStream.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/js/forum/src/components/PostStream.js b/js/forum/src/components/PostStream.js
index d18cec577..5fc1cff41 100644
--- a/js/forum/src/components/PostStream.js
+++ b/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 94a62293eb0c14c02a629236e5726df7332f0c0d 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.
---
less/lib/lib.less | 2 --
src/Http/Controller/ClientView.php | 10 ++++++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/less/lib/lib.less b/less/lib/lib.less
index b942aa28d..45396ecd3 100755
--- a/less/lib/lib.less
+++ b/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/src/Http/Controller/ClientView.php b/src/Http/Controller/ClientView.php
index b5f786b1c..97554de88 100644
--- a/src/Http/Controller/ClientView.php
+++ b/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 8506d095db2ca47b79fe83c13965bd36d688d53e 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
---
src/Event/ConfigureLocales.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Event/ConfigureLocales.php b/src/Event/ConfigureLocales.php
index 64044e7c4..c37e84c49 100644
--- a/src/Event/ConfigureLocales.php
+++ b/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.");
}