From c592688704f87c487cc0f02d38585794bc7137f2 Mon Sep 17 00:00:00 2001
From: Ian Morland
Date: Mon, 17 May 2021 15:51:27 +0100
Subject: [PATCH] Flarum 1.0 update
---
composer.json | 7 +++++--
js/package-lock.json | 6 +++---
js/package.json | 2 +-
js/src/forum/components/UserBio.js | 7 ++-----
js/src/forum/index.js | 14 +++-----------
5 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/composer.json b/composer.json
index f5bcfff..7e1f4e2 100644
--- a/composer.json
+++ b/composer.json
@@ -20,7 +20,7 @@
}
],
"require": {
- "flarum/core": "^0.1.0-beta.16"
+ "flarum/core": "^1.0.0"
},
"authors": [
{
@@ -43,7 +43,10 @@
"name": "fas fa-pen",
"backgroundColor": "#e74c3c",
"color": "#fff"
- }
+ },
+ "optional-dependencies": [
+ "flarum/suspend"
+ ]
},
"flagrow": {
"discuss": "https://discuss.flarum.org/d/17775"
diff --git a/js/package-lock.json b/js/package-lock.json
index d0ef5e0..c837246 100644
--- a/js/package-lock.json
+++ b/js/package-lock.json
@@ -3399,9 +3399,9 @@
"integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs="
},
"prettier": {
- "version": "1.19.1",
- "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
- "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.3.0.tgz",
+ "integrity": "sha512-kXtO4s0Lz/DW/IJ9QdWhAf7/NmPWQXkFr/r/WkR3vyI+0v8amTDxiaQSLzs8NBlytfLWX/7uQUMIW677yLKl4w==",
"dev": true
},
"private": {
diff --git a/js/package.json b/js/package.json
index 7456a5e..bf0ce77 100644
--- a/js/package.json
+++ b/js/package.json
@@ -14,6 +14,6 @@
},
"devDependencies": {
"flarum": "0.1.0-beta.16",
- "prettier": "^1.19.1"
+ "prettier": "^2.2.1"
}
}
diff --git a/js/src/forum/components/UserBio.js b/js/src/forum/components/UserBio.js
index ae2fd80..fffdfbb 100644
--- a/js/src/forum/components/UserBio.js
+++ b/js/src/forum/components/UserBio.js
@@ -103,16 +103,13 @@ export default class UserBio extends Component {
m.redraw.sync();
const bio = this;
- const save = function(e) {
+ const save = function (e) {
if (e.shiftKey) return;
e.preventDefault();
bio.save($(this).val());
};
- this.$('textarea')
- .focus()
- .bind('blur', save)
- .bind('keydown', 'return', save);
+ this.$('textarea').focus().bind('blur', save).bind('keydown', 'return', save);
m.redraw();
}
diff --git a/js/src/forum/index.js b/js/src/forum/index.js
index 3b9f563..f680328 100644
--- a/js/src/forum/index.js
+++ b/js/src/forum/index.js
@@ -8,19 +8,11 @@ import UserBio from './components/UserBio';
app.initializers.add('fof-user-bio', () => {
User.prototype.bio = Model.attribute('bio');
- User.prototype.bioHtml = computed('bio', bio =>
- bio
- ? '' +
- $('
')
- .text(bio)
- .html()
- .replace(/\n/g, '
')
- .autoLink({ rel: 'nofollow ugc' }) +
- '
'
- : ''
+ User.prototype.bioHtml = computed('bio', (bio) =>
+ bio ? '' + $('
').text(bio).html().replace(/\n/g, '
').autoLink({ rel: 'nofollow ugc' }) + '' : ''
);
- extend(UserCard.prototype, 'infoItems', function(items) {
+ extend(UserCard.prototype, 'infoItems', function (items) {
let user = this.attrs.user;
if (!user.attribute('canViewBio')) {