mirror of
https://github.com/flarum/core.git
synced 2025-08-16 13:24:11 +02:00
Compare commits
159 Commits
v0.1.0-bet
...
v0.1.0-bet
Author | SHA1 | Date | |
---|---|---|---|
|
ce8a5b3e0f | ||
|
5faf0fcde5 | ||
|
65c0b436c0 | ||
|
8d76168bd4 | ||
|
d16f4dbefa | ||
|
e3e4786391 | ||
|
c1c7d4c73a | ||
|
8da8c9ac7d | ||
|
fb68aa88db | ||
|
afc597c189 | ||
|
4f3e67714e | ||
|
54be3ad3c8 | ||
|
0b00d56416 | ||
|
89d4a1e849 | ||
|
43ee7b59a4 | ||
|
d052f6b639 | ||
|
4b47adabcf | ||
|
93140b8fa4 | ||
|
ade2166310 | ||
|
a9969119d2 | ||
|
94a8eaec64 | ||
|
8ea13dc826 | ||
|
99d42372c3 | ||
|
01b56eecdb | ||
|
bcdcb8c20e | ||
|
d6c99eccdb | ||
|
01cb8ab79d | ||
|
877aed215b | ||
|
57570d960e | ||
|
04c4806f6f | ||
|
4c0339c30e | ||
|
e64dc4ea45 | ||
|
305076814f | ||
|
e31edd29d2 | ||
|
23b423c6ce | ||
|
1af1f472f9 | ||
|
7c86f7a34c | ||
|
14e49269d6 | ||
|
7837fff107 | ||
|
3dfa6bc8cb | ||
|
e47fe288fa | ||
|
03e30d7d4f | ||
|
9836ff6c54 | ||
|
bb1c655c90 | ||
|
bf20fe595a | ||
|
b5db57156b | ||
|
a7d3bdf244 | ||
|
c82f0bde61 | ||
|
986102c1d3 | ||
|
2140619c0b | ||
|
2f714a01ed | ||
|
231d018de5 | ||
|
5d62231004 | ||
|
123c3a93f5 | ||
|
c1eec2b261 | ||
|
60d3d6ef99 | ||
|
7862bd32dd | ||
|
92b555a246 | ||
|
687ec6a199 | ||
|
f788a0a972 | ||
|
e7bec9fe29 | ||
|
57da4e24cb | ||
|
7d1a22bcb5 | ||
|
8cc117d89d | ||
|
31ef02dc2c | ||
|
95c9ff9243 | ||
|
9718f54683 | ||
|
bb1e3278de | ||
|
bbcc33b5b5 | ||
|
30076547e5 | ||
|
7b710d5898 | ||
|
d02b5c9db7 | ||
|
cd70819fd5 | ||
|
20b4619e75 | ||
|
fdec2fd094 | ||
|
d7e4ae09b3 | ||
|
fcfc1b2a37 | ||
|
01eba18164 | ||
|
0dcf7d6aa9 | ||
|
015967a76c | ||
|
3cd59e12f5 | ||
|
26d07699e9 | ||
|
b7d6ba4893 | ||
|
d3753d94ae | ||
|
9349ed13fc | ||
|
91ace15f6d | ||
|
7c1b0bfcf2 | ||
|
542bae6277 | ||
|
275c14ee7f | ||
|
bccc970231 | ||
|
da6f79b34a | ||
|
a3cbec25db | ||
|
2225fdec72 | ||
|
6a532ec14e | ||
|
9416d16ebb | ||
|
d6857b0fe5 | ||
|
2c7e7f5b39 | ||
|
b5b18dd436 | ||
|
4778ae5f74 | ||
|
0936a630ef | ||
|
ec8ae6e03b | ||
|
9ffdeff608 | ||
|
8540932638 | ||
|
974f45e4e8 | ||
|
32ac48c6a9 | ||
|
af5b86806a | ||
|
aeef45b3cd | ||
|
8aa70de765 | ||
|
076a71c621 | ||
|
06c32b668d | ||
|
7af4b8d45f | ||
|
cbba325a87 | ||
|
b7d7e8b18a | ||
|
1031826a3d | ||
|
3612ca7aca | ||
|
c2ee84a115 | ||
|
060745ecb7 | ||
|
dd209b1747 | ||
|
aeb0a411b9 | ||
|
1ebb8bf39a | ||
|
fcdf36b3d0 | ||
|
ab912ba1ad | ||
|
4b8eb5d6e4 | ||
|
0e20949eb0 | ||
|
b2c691a03d | ||
|
dde0de046a | ||
|
7a9795fbc3 | ||
|
f30fac6a94 | ||
|
1fb8092987 | ||
|
ea6b943dbd | ||
|
b9918e6c40 | ||
|
b3e1a023c2 | ||
|
96926a180a | ||
|
f3bdc163fa | ||
|
0df6eee10f | ||
|
258a4b352d | ||
|
24580ced7a | ||
|
8e90d9f9e2 | ||
|
af36ef3fa9 | ||
|
eef63745e6 | ||
|
c702e911b3 | ||
|
73d2ee825b | ||
|
9f99610542 | ||
|
1192867c4f | ||
|
b048498b84 | ||
|
81f7a39a31 | ||
|
ea12bbaf48 | ||
|
c8122a7879 | ||
|
1a5d7a337d | ||
|
c29ea98d48 | ||
|
3702ffa998 | ||
|
58f9c22375 | ||
|
939a1e9ca8 | ||
|
736f22a31a | ||
|
592dd6a927 | ||
|
2c5aa138cd | ||
|
53fd7b66b4 | ||
|
a1a22aa4ce | ||
|
05c9ce335e |
7
.gitattributes
vendored
7
.gitattributes
vendored
@@ -2,3 +2,10 @@
|
|||||||
.gitignore export-ignore
|
.gitignore export-ignore
|
||||||
.gitmodules export-ignore
|
.gitmodules export-ignore
|
||||||
.travis.yml export-ignore
|
.travis.yml export-ignore
|
||||||
|
.editorconfig export-ignore
|
||||||
|
.styleci.yml export-ignore
|
||||||
|
|
||||||
|
phpunit.xml export-ignore
|
||||||
|
tests export-ignore
|
||||||
|
|
||||||
|
js/*/dist/*.js -diff
|
||||||
|
@@ -5,6 +5,7 @@ enabled:
|
|||||||
|
|
||||||
disabled:
|
disabled:
|
||||||
- align_double_arrow
|
- align_double_arrow
|
||||||
|
- blank_line_after_opening_tag
|
||||||
- multiline_array_trailing_comma
|
- multiline_array_trailing_comma
|
||||||
- new_with_braces
|
- new_with_braces
|
||||||
- phpdoc_align
|
- phpdoc_align
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 5.5
|
|
||||||
- 5.6
|
- 5.6
|
||||||
- 7.0
|
- 7.0
|
||||||
|
- 7.1
|
||||||
- hhvm
|
- hhvm
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014-2016 Toby Zerner
|
Copyright (c) 2014-2017 Toby Zerner
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
"docs": "http://flarum.org/docs"
|
"docs": "http://flarum.org/docs"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.5.9",
|
"php": ">=5.6.0",
|
||||||
"dflydev/fig-cookies": "^1.0.2",
|
"dflydev/fig-cookies": "^1.0.2",
|
||||||
"doctrine/dbal": "^2.5",
|
"doctrine/dbal": "^2.5",
|
||||||
"components/font-awesome": "^4.6",
|
"components/font-awesome": "^4.6",
|
||||||
@@ -50,10 +50,10 @@
|
|||||||
"symfony/http-foundation": "^2.7",
|
"symfony/http-foundation": "^2.7",
|
||||||
"symfony/translation": "^2.7",
|
"symfony/translation": "^2.7",
|
||||||
"symfony/yaml": "^2.7",
|
"symfony/yaml": "^2.7",
|
||||||
"s9e/text-formatter": "^0.6.1",
|
"s9e/text-formatter": "^0.8.1",
|
||||||
"tobscure/json-api": "^0.3.0",
|
"tobscure/json-api": "^0.3.0",
|
||||||
"zendframework/zend-diactoros": "^1.1",
|
"zendframework/zend-diactoros": "^1.1",
|
||||||
"zendframework/zend-stratigility": "^1.1"
|
"zendframework/zend-stratigility": "^1.3"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mockery/mockery": "^0.9.4",
|
"mockery/mockery": "^0.9.4",
|
||||||
|
456
js/admin/dist/app.js
vendored
456
js/admin/dist/app.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ export default class AddExtensionModal extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
title() {
|
title() {
|
||||||
return 'Add Extension';
|
return app.translator.trans('core.admin.add_extension.title');
|
||||||
}
|
}
|
||||||
|
|
||||||
content() {
|
content() {
|
||||||
|
@@ -28,8 +28,8 @@ export default class AppearancePage extends Page {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="AppearancePage-colors-input">
|
<div className="AppearancePage-colors-input">
|
||||||
<input className="FormControl" placeholder="#aaaaaa" value={this.primaryColor()} onchange={m.withAttr('value', this.primaryColor)}/>
|
<input className="FormControl" type="color" placeholder="#aaaaaa" value={this.primaryColor()} onchange={m.withAttr('value', this.primaryColor)}/>
|
||||||
<input className="FormControl" placeholder="#aaaaaa" value={this.secondaryColor()} onchange={m.withAttr('value', this.secondaryColor)}/>
|
<input className="FormControl" type="color" placeholder="#aaaaaa" value={this.secondaryColor()} onchange={m.withAttr('value', this.secondaryColor)}/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{Switch.component({
|
{Switch.component({
|
||||||
|
@@ -5,6 +5,7 @@ import Button from 'flarum/components/Button';
|
|||||||
import Alert from 'flarum/components/Alert';
|
import Alert from 'flarum/components/Alert';
|
||||||
import saveSettings from 'flarum/utils/saveSettings';
|
import saveSettings from 'flarum/utils/saveSettings';
|
||||||
import ItemList from 'flarum/utils/ItemList';
|
import ItemList from 'flarum/utils/ItemList';
|
||||||
|
import Switch from 'flarum/components/Switch';
|
||||||
|
|
||||||
export default class BasicsPage extends Page {
|
export default class BasicsPage extends Page {
|
||||||
init() {
|
init() {
|
||||||
@@ -16,6 +17,7 @@ export default class BasicsPage extends Page {
|
|||||||
'forum_title',
|
'forum_title',
|
||||||
'forum_description',
|
'forum_description',
|
||||||
'default_locale',
|
'default_locale',
|
||||||
|
'show_language_selector',
|
||||||
'default_route',
|
'default_route',
|
||||||
'welcome_title',
|
'welcome_title',
|
||||||
'welcome_message'
|
'welcome_message'
|
||||||
@@ -23,13 +25,15 @@ export default class BasicsPage extends Page {
|
|||||||
this.values = {};
|
this.values = {};
|
||||||
|
|
||||||
const settings = app.data.settings;
|
const settings = app.data.settings;
|
||||||
this.fields.forEach(key => this.values[key] = m.prop(settings[key]));
|
this.fields.forEach(key => this.values[key] = m.prop(settings[key] || false));
|
||||||
|
|
||||||
this.localeOptions = {};
|
this.localeOptions = {};
|
||||||
const locales = app.data.locales;
|
const locales = app.data.locales;
|
||||||
for (const i in locales) {
|
for (const i in locales) {
|
||||||
this.localeOptions[i] = `${locales[i]} (${i})`;
|
this.localeOptions[i] = `${locales[i]} (${i})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof this.values.show_language_selector() !== "number") this.values.show_language_selector(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
view() {
|
view() {
|
||||||
@@ -60,7 +64,13 @@ export default class BasicsPage extends Page {
|
|||||||
children: [
|
children: [
|
||||||
Select.component({
|
Select.component({
|
||||||
options: this.localeOptions,
|
options: this.localeOptions,
|
||||||
|
value: this.values.default_locale(),
|
||||||
onchange: this.values.default_locale
|
onchange: this.values.default_locale
|
||||||
|
}),
|
||||||
|
Switch.component({
|
||||||
|
state: this.values.show_language_selector(),
|
||||||
|
onchange: this.values.show_language_selector,
|
||||||
|
children: app.translator.trans('core.admin.basics.show_language_selector_label'),
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@@ -91,6 +91,13 @@ export default class PermissionGrid extends Component {
|
|||||||
allowGuest: true
|
allowGuest: true
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
|
items.add('viewUserList', {
|
||||||
|
icon: 'users',
|
||||||
|
label: app.translator.trans('core.admin.permissions.view_user_list_label'),
|
||||||
|
permission: 'viewUserList',
|
||||||
|
allowGuest: true
|
||||||
|
}, 100);
|
||||||
|
|
||||||
items.add('signUp', {
|
items.add('signUp', {
|
||||||
icon: 'user-plus',
|
icon: 'user-plus',
|
||||||
label: app.translator.trans('core.admin.permissions.sign_up_label'),
|
label: app.translator.trans('core.admin.permissions.sign_up_label'),
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
"es6-micro-loader": "caridy/es6-micro-loader#v0.2.1",
|
"es6-micro-loader": "caridy/es6-micro-loader#v0.2.1",
|
||||||
"fastclick": "~1.0.6",
|
"fastclick": "~1.0.6",
|
||||||
"autolink": "~1.0.0",
|
"autolink": "~1.0.0",
|
||||||
"m.attrs.bidi": "tobscure/m.attrs.bidi"
|
"m.attrs.bidi": "tobscure/m.attrs.bidi",
|
||||||
|
"punycode": "http://cdnjs.cloudflare.com/ajax/libs/punycode/1.4.1/punycode.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,8 @@ gulp({
|
|||||||
|
|
||||||
bowerDir + '/spin.js/spin.js',
|
bowerDir + '/spin.js/spin.js',
|
||||||
bowerDir + '/spin.js/jquery.spin.js',
|
bowerDir + '/spin.js/jquery.spin.js',
|
||||||
bowerDir + '/fastclick/lib/fastclick.js'
|
bowerDir + '/fastclick/lib/fastclick.js',
|
||||||
|
bowerDir + '/punycode/index.js'
|
||||||
],
|
],
|
||||||
modules: {
|
modules: {
|
||||||
'flarum': [
|
'flarum': [
|
||||||
|
1509
js/forum/dist/app.js
vendored
1509
js/forum/dist/app.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@ export default class EditUserModal extends Modal {
|
|||||||
|
|
||||||
this.username = m.prop(user.username() || '');
|
this.username = m.prop(user.username() || '');
|
||||||
this.email = m.prop(user.email() || '');
|
this.email = m.prop(user.email() || '');
|
||||||
|
this.isActivated = m.prop(user.isActivated() || false);
|
||||||
this.setPassword = m.prop(false);
|
this.setPassword = m.prop(false);
|
||||||
this.password = m.prop(user.password() || '');
|
this.password = m.prop(user.password() || '');
|
||||||
this.groups = {};
|
this.groups = {};
|
||||||
@@ -37,22 +38,32 @@ export default class EditUserModal extends Modal {
|
|||||||
<div className="Modal-body">
|
<div className="Modal-body">
|
||||||
<div className="Form">
|
<div className="Form">
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
<label>Username</label>
|
<label>{app.translator.trans('core.forum.edit_user.username_heading')}</label>
|
||||||
<input className="FormControl" placeholder={extractText(app.translator.trans('core.forum.edit_user.username_label'))}
|
<input className="FormControl" placeholder={extractText(app.translator.trans('core.forum.edit_user.username_label'))}
|
||||||
bidi={this.username} />
|
bidi={this.username} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{app.session.user !== this.props.user ? [
|
{app.session.user !== this.props.user ? [
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
<label>Email</label>
|
<label>{app.translator.trans('core.forum.edit_user.email_heading')}</label>
|
||||||
<div>
|
<div>
|
||||||
<input className="FormControl" placeholder={extractText(app.translator.trans('core.forum.edit_user.email_label'))}
|
<input className="FormControl" placeholder={extractText(app.translator.trans('core.forum.edit_user.email_label'))}
|
||||||
bidi={this.email} />
|
bidi={this.email} />
|
||||||
</div>
|
</div>
|
||||||
|
{!this.isActivated() ? (
|
||||||
|
<div>
|
||||||
|
{Button.component({
|
||||||
|
className: 'Button Button--block',
|
||||||
|
children: app.translator.trans('core.forum.edit_user.activate_button'),
|
||||||
|
loading: this.loading,
|
||||||
|
onclick: this.activate.bind(this)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
) : ''}
|
||||||
</div>,
|
</div>,
|
||||||
|
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
<label>Password</label>
|
<label>{app.translator.trans('core.forum.edit_user.password_heading')}</label>
|
||||||
<div>
|
<div>
|
||||||
<label className="checkbox">
|
<label className="checkbox">
|
||||||
<input type="checkbox" checked={this.setPassword()} onchange={e => {
|
<input type="checkbox" checked={this.setPassword()} onchange={e => {
|
||||||
@@ -61,7 +72,7 @@ export default class EditUserModal extends Modal {
|
|||||||
if (e.target.checked) this.$('[name=password]').select();
|
if (e.target.checked) this.$('[name=password]').select();
|
||||||
m.redraw.strategy('none');
|
m.redraw.strategy('none');
|
||||||
}}/>
|
}}/>
|
||||||
Set new password
|
{app.translator.trans('core.forum.edit_user.set_password_label')}
|
||||||
</label>
|
</label>
|
||||||
{this.setPassword() ? (
|
{this.setPassword() ? (
|
||||||
<input className="FormControl" type="password" name="password" placeholder={extractText(app.translator.trans('core.forum.edit_user.password_label'))}
|
<input className="FormControl" type="password" name="password" placeholder={extractText(app.translator.trans('core.forum.edit_user.password_label'))}
|
||||||
@@ -72,7 +83,7 @@ export default class EditUserModal extends Modal {
|
|||||||
] : ''}
|
] : ''}
|
||||||
|
|
||||||
<div className="Form-group EditUserModal-groups">
|
<div className="Form-group EditUserModal-groups">
|
||||||
<label>Groups</label>
|
<label>{app.translator.trans('core.forum.edit_user.groups_heading')}</label>
|
||||||
<div>
|
<div>
|
||||||
{Object.keys(this.groups)
|
{Object.keys(this.groups)
|
||||||
.map(id => app.store.getById('groups', id))
|
.map(id => app.store.getById('groups', id))
|
||||||
@@ -100,6 +111,24 @@ export default class EditUserModal extends Modal {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activate() {
|
||||||
|
this.loading = true;
|
||||||
|
const data = {
|
||||||
|
username: this.username(),
|
||||||
|
isActivated: true,
|
||||||
|
};
|
||||||
|
this.props.user.save(data, {errorHandler: this.onerror.bind(this)})
|
||||||
|
.then(() => {
|
||||||
|
this.isActivated(true);
|
||||||
|
this.loading = false;
|
||||||
|
m.redraw();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.loading = false;
|
||||||
|
m.redraw();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
const groups = Object.keys(this.groups)
|
const groups = Object.keys(this.groups)
|
||||||
.filter(id => this.groups[id]())
|
.filter(id => this.groups[id]())
|
||||||
|
@@ -39,7 +39,7 @@ export default class HeaderSecondary extends Component {
|
|||||||
|
|
||||||
items.add('search', app.search.render(), 30);
|
items.add('search', app.search.render(), 30);
|
||||||
|
|
||||||
if (Object.keys(app.data.locales).length > 1) {
|
if (app.forum.attribute("showLanguageSelector") && Object.keys(app.data.locales).length > 1) {
|
||||||
const locales = [];
|
const locales = [];
|
||||||
|
|
||||||
for (const locale in app.data.locales) {
|
for (const locale in app.data.locales) {
|
||||||
|
@@ -8,7 +8,7 @@ import WelcomeHero from 'flarum/components/WelcomeHero';
|
|||||||
import DiscussionComposer from 'flarum/components/DiscussionComposer';
|
import DiscussionComposer from 'flarum/components/DiscussionComposer';
|
||||||
import LogInModal from 'flarum/components/LogInModal';
|
import LogInModal from 'flarum/components/LogInModal';
|
||||||
import DiscussionPage from 'flarum/components/DiscussionPage';
|
import DiscussionPage from 'flarum/components/DiscussionPage';
|
||||||
import Select from 'flarum/components/Select';
|
import Dropdown from 'flarum/components/Dropdown';
|
||||||
import Button from 'flarum/components/Button';
|
import Button from 'flarum/components/Button';
|
||||||
import LinkButton from 'flarum/components/LinkButton';
|
import LinkButton from 'flarum/components/LinkButton';
|
||||||
import SelectDropdown from 'flarum/components/SelectDropdown';
|
import SelectDropdown from 'flarum/components/SelectDropdown';
|
||||||
@@ -55,7 +55,7 @@ export default class IndexPage extends Page {
|
|||||||
app.cache.discussionList = new DiscussionList({params});
|
app.cache.discussionList = new DiscussionList({params});
|
||||||
}
|
}
|
||||||
|
|
||||||
app.history.push('index', icon('bars'));
|
app.history.push('index', app.translator.trans('core.forum.header.back_to_index_tooltip'));
|
||||||
|
|
||||||
this.bodyClass = 'App--index';
|
this.bodyClass = 'App--index';
|
||||||
}
|
}
|
||||||
@@ -212,10 +212,20 @@ export default class IndexPage extends Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
items.add('sort',
|
items.add('sort',
|
||||||
Select.component({
|
Dropdown.component({
|
||||||
options: sortOptions,
|
buttonClassName: 'Button',
|
||||||
value: this.params().sort || Object.keys(sortMap)[0],
|
label: sortOptions[this.params().sort] || Object.keys(sortMap).map(key => sortOptions[key])[0],
|
||||||
onchange: this.changeSort.bind(this)
|
children: Object.keys(sortOptions).map(value => {
|
||||||
|
const label = sortOptions[value];
|
||||||
|
const active = (this.params().sort || Object.keys(sortMap)[0]) === value;
|
||||||
|
|
||||||
|
return Button.component({
|
||||||
|
children: label,
|
||||||
|
icon: active ? 'check' : true,
|
||||||
|
onclick: this.changeSort.bind(this, value),
|
||||||
|
active: active,
|
||||||
|
})
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -236,7 +246,13 @@ export default class IndexPage extends Page {
|
|||||||
title: app.translator.trans('core.forum.index.refresh_tooltip'),
|
title: app.translator.trans('core.forum.index.refresh_tooltip'),
|
||||||
icon: 'refresh',
|
icon: 'refresh',
|
||||||
className: 'Button Button--icon',
|
className: 'Button Button--icon',
|
||||||
onclick: () => app.cache.discussionList.refresh()
|
onclick: () => {
|
||||||
|
app.cache.discussionList.refresh();
|
||||||
|
if (app.session.user) {
|
||||||
|
app.store.find('users', app.session.user.id());
|
||||||
|
m.redraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@ import extractText from 'flarum/utils/extractText';
|
|||||||
*
|
*
|
||||||
* ### Props
|
* ### Props
|
||||||
*
|
*
|
||||||
* - `email`
|
* - `identification`
|
||||||
* - `password`
|
* - `password`
|
||||||
*/
|
*/
|
||||||
export default class LogInModal extends Modal {
|
export default class LogInModal extends Modal {
|
||||||
@@ -19,11 +19,11 @@ export default class LogInModal extends Modal {
|
|||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value of the email input.
|
* The value of the identification input.
|
||||||
*
|
*
|
||||||
* @type {Function}
|
* @type {Function}
|
||||||
*/
|
*/
|
||||||
this.email = m.prop(this.props.email || '');
|
this.identification = m.prop(this.props.identification || '');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value of the password input.
|
* The value of the password input.
|
||||||
@@ -31,6 +31,13 @@ export default class LogInModal extends Modal {
|
|||||||
* @type {Function}
|
* @type {Function}
|
||||||
*/
|
*/
|
||||||
this.password = m.prop(this.props.password || '');
|
this.password = m.prop(this.props.password || '');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value of the remember me input.
|
||||||
|
*
|
||||||
|
* @type {Function}
|
||||||
|
*/
|
||||||
|
this.remember = m.prop(!!this.props.remember);
|
||||||
}
|
}
|
||||||
|
|
||||||
className() {
|
className() {
|
||||||
@@ -48,8 +55,8 @@ export default class LogInModal extends Modal {
|
|||||||
|
|
||||||
<div className="Form Form--centered">
|
<div className="Form Form--centered">
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
<input className="FormControl" name="email" type="text" placeholder={extractText(app.translator.trans('core.forum.log_in.username_or_email_placeholder'))}
|
<input className="FormControl" name="identification" type="text" placeholder={extractText(app.translator.trans('core.forum.log_in.username_or_email_placeholder'))}
|
||||||
bidi={this.email}
|
bidi={this.identification}
|
||||||
disabled={this.loading} />
|
disabled={this.loading} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -59,6 +66,15 @@ export default class LogInModal extends Modal {
|
|||||||
disabled={this.loading} />
|
disabled={this.loading} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="Form-group">
|
||||||
|
<div>
|
||||||
|
<label className="checkbox">
|
||||||
|
<input type="checkbox" bidi={this.remember} disabled={this.loading} />
|
||||||
|
{app.translator.trans('core.forum.log_in.remember_me_label')}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
{Button.component({
|
{Button.component({
|
||||||
className: 'Button Button--primary Button--block',
|
className: 'Button Button--primary Button--block',
|
||||||
@@ -90,7 +106,7 @@ export default class LogInModal extends Modal {
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
forgotPassword() {
|
forgotPassword() {
|
||||||
const email = this.email();
|
const email = this.identification();
|
||||||
const props = email.indexOf('@') !== -1 ? {email} : undefined;
|
const props = email.indexOf('@') !== -1 ? {email} : undefined;
|
||||||
|
|
||||||
app.modal.show(new ForgotPasswordModal(props));
|
app.modal.show(new ForgotPasswordModal(props));
|
||||||
@@ -104,14 +120,14 @@ export default class LogInModal extends Modal {
|
|||||||
*/
|
*/
|
||||||
signUp() {
|
signUp() {
|
||||||
const props = {password: this.password()};
|
const props = {password: this.password()};
|
||||||
const email = this.email();
|
const identification = this.identification();
|
||||||
props[email.indexOf('@') !== -1 ? 'email' : 'username'] = email;
|
props[identification.indexOf('@') !== -1 ? 'email' : 'username'] = identification;
|
||||||
|
|
||||||
app.modal.show(new SignUpModal(props));
|
app.modal.show(new SignUpModal(props));
|
||||||
}
|
}
|
||||||
|
|
||||||
onready() {
|
onready() {
|
||||||
this.$('[name=' + (this.email() ? 'password' : 'email') + ']').select();
|
this.$('[name=' + (this.identification() ? 'password' : 'identification') + ']').select();
|
||||||
}
|
}
|
||||||
|
|
||||||
onsubmit(e) {
|
onsubmit(e) {
|
||||||
@@ -119,13 +135,15 @@ export default class LogInModal extends Modal {
|
|||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
const email = this.email();
|
const identification = this.identification();
|
||||||
const password = this.password();
|
const password = this.password();
|
||||||
|
const remember = this.remember();
|
||||||
|
|
||||||
app.session.login(email, password, {errorHandler: this.onerror.bind(this)}).then(
|
app.session.login({identification, password, remember}, {errorHandler: this.onerror.bind(this)})
|
||||||
() => window.location.reload(),
|
.then(
|
||||||
this.loaded.bind(this)
|
() => window.location.reload(),
|
||||||
);
|
this.loaded.bind(this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
onerror(error) {
|
onerror(error) {
|
||||||
|
70
js/forum/src/components/RenameDiscussionModal.js
Normal file
70
js/forum/src/components/RenameDiscussionModal.js
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
import Modal from 'flarum/components/Modal';
|
||||||
|
import Button from 'flarum/components/Button';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The 'RenameDiscussionModal' displays a modal dialog with an input to rename a discussion
|
||||||
|
*/
|
||||||
|
export default class RenameDiscussionModal extends Modal {
|
||||||
|
init() {
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
this.discussion = this.props.discussion;
|
||||||
|
this.currentTitle = this.props.currentTitle;
|
||||||
|
this.newTitle = m.prop(this.currentTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
className() {
|
||||||
|
return 'RenameDiscussionModal Modal--small';
|
||||||
|
}
|
||||||
|
|
||||||
|
title() {
|
||||||
|
return app.translator.trans('core.forum.rename_discussion.title');
|
||||||
|
}
|
||||||
|
|
||||||
|
content() {
|
||||||
|
return (
|
||||||
|
<div className="Modal-body">
|
||||||
|
<div className="Form Form--centered">
|
||||||
|
<div className="Form-group">
|
||||||
|
<input className="FormControl" bidi={this.newTitle} type="text" />
|
||||||
|
</div>
|
||||||
|
<div className="Form-group">
|
||||||
|
{Button.component({
|
||||||
|
className: 'Button Button--primary Button--block',
|
||||||
|
type: 'submit',
|
||||||
|
loading: this.loading,
|
||||||
|
children: app.translator.trans('core.forum.rename_discussion.submit_button')
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
onsubmit(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
this.loading = true;
|
||||||
|
|
||||||
|
const title = this.newTitle;
|
||||||
|
const currentTitle = this.currentTitle;
|
||||||
|
|
||||||
|
// If the title is different to what it was before, then save it. After the
|
||||||
|
// save has completed, update the post stream as there will be a new post
|
||||||
|
// indicating that the discussion was renamed.
|
||||||
|
if (title && title !== currentTitle) {
|
||||||
|
return this.discussion.save({title}).then(() => {
|
||||||
|
if (app.viewingDiscussion(this.discussion)) {
|
||||||
|
app.current.stream.update();
|
||||||
|
}
|
||||||
|
m.redraw();
|
||||||
|
this.hide();
|
||||||
|
}).catch(() => {
|
||||||
|
this.loading = false;
|
||||||
|
m.redraw();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -83,6 +83,7 @@ export default class Search extends Component {
|
|||||||
})}>
|
})}>
|
||||||
<div className="Search-input">
|
<div className="Search-input">
|
||||||
<input className="FormControl"
|
<input className="FormControl"
|
||||||
|
type="search"
|
||||||
placeholder={extractText(app.translator.trans('core.forum.header.search_placeholder'))}
|
placeholder={extractText(app.translator.trans('core.forum.header.search_placeholder'))}
|
||||||
value={this.value()}
|
value={this.value()}
|
||||||
oninput={m.withAttr('value', this.value)}
|
oninput={m.withAttr('value', this.value)}
|
||||||
|
@@ -116,7 +116,7 @@ export default class SignUpModal extends Modal {
|
|||||||
*/
|
*/
|
||||||
logIn() {
|
logIn() {
|
||||||
const props = {
|
const props = {
|
||||||
email: this.email() || this.username(),
|
identification: this.email() || this.username(),
|
||||||
password: this.password()
|
password: this.password()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -45,15 +45,14 @@ export default class UserBio extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content = <div className="UserBio-content">{subContent}</div>;
|
content = <div className="UserBio-content" onclick={this.edit.bind(this)}>{subContent}</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={'UserBio ' + classList({
|
<div className={'UserBio ' + classList({
|
||||||
editable: this.props.editable,
|
editable: this.props.editable,
|
||||||
editing: this.editing
|
editing: this.editing
|
||||||
})}
|
})}>
|
||||||
onclick={this.edit.bind(this)}>
|
|
||||||
{content}
|
{content}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -26,8 +26,6 @@ export default class UserPage extends Page {
|
|||||||
*/
|
*/
|
||||||
this.user = null;
|
this.user = null;
|
||||||
|
|
||||||
app.history.push('user');
|
|
||||||
|
|
||||||
this.bodyClass = 'App--user';
|
this.bodyClass = 'App--user';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +72,6 @@ export default class UserPage extends Page {
|
|||||||
show(user) {
|
show(user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
|
||||||
app.history.push('user', user.username());
|
|
||||||
app.setTitle(user.username());
|
app.setTitle(user.username());
|
||||||
|
|
||||||
m.redraw();
|
m.redraw();
|
||||||
|
@@ -4,7 +4,6 @@ import ScrollListener from 'flarum/utils/ScrollListener';
|
|||||||
import Pane from 'flarum/utils/Pane';
|
import Pane from 'flarum/utils/Pane';
|
||||||
import Drawer from 'flarum/utils/Drawer';
|
import Drawer from 'flarum/utils/Drawer';
|
||||||
import mapRoutes from 'flarum/utils/mapRoutes';
|
import mapRoutes from 'flarum/utils/mapRoutes';
|
||||||
import icon from 'flarum/helpers/icon';
|
|
||||||
import Navigation from 'flarum/components/Navigation';
|
import Navigation from 'flarum/components/Navigation';
|
||||||
import HeaderPrimary from 'flarum/components/HeaderPrimary';
|
import HeaderPrimary from 'flarum/components/HeaderPrimary';
|
||||||
import HeaderSecondary from 'flarum/components/HeaderSecondary';
|
import HeaderSecondary from 'flarum/components/HeaderSecondary';
|
||||||
@@ -31,7 +30,7 @@ export default function boot(app) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.routes[defaultAction].path = '/';
|
app.routes[defaultAction].path = '/';
|
||||||
app.history.push(defaultAction, icon('bars'), '/');
|
app.history.push(defaultAction, app.translator.trans('core.forum.header.back_to_index_tooltip'), '/');
|
||||||
|
|
||||||
m.startComputation();
|
m.startComputation();
|
||||||
|
|
||||||
@@ -62,6 +61,10 @@ export default function boot(app) {
|
|||||||
if (e.ctrlKey || e.metaKey || e.which === 2) return;
|
if (e.ctrlKey || e.metaKey || e.which === 2) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
app.history.home();
|
app.history.home();
|
||||||
|
if (app.session.user) {
|
||||||
|
app.store.find('users', app.session.user.id());
|
||||||
|
m.redraw();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add a class to the body which indicates that the page has been scrolled
|
// Add a class to the body which indicates that the page has been scrolled
|
||||||
|
@@ -3,6 +3,7 @@ import ReplyComposer from 'flarum/components/ReplyComposer';
|
|||||||
import LogInModal from 'flarum/components/LogInModal';
|
import LogInModal from 'flarum/components/LogInModal';
|
||||||
import Button from 'flarum/components/Button';
|
import Button from 'flarum/components/Button';
|
||||||
import Separator from 'flarum/components/Separator';
|
import Separator from 'flarum/components/Separator';
|
||||||
|
import RenameDiscussionModal from 'flarum/components/RenameDiscussionModal';
|
||||||
import ItemList from 'flarum/utils/ItemList';
|
import ItemList from 'flarum/utils/ItemList';
|
||||||
import extractText from 'flarum/utils/extractText';
|
import extractText from 'flarum/utils/extractText';
|
||||||
|
|
||||||
@@ -227,19 +228,9 @@ export default {
|
|||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
renameAction() {
|
renameAction() {
|
||||||
const currentTitle = this.title();
|
return app.modal.show(new RenameDiscussionModal({
|
||||||
const title = prompt(extractText(app.translator.trans('core.forum.discussion_controls.rename_text')), currentTitle);
|
currentTitle: this.title(),
|
||||||
|
discussion: this
|
||||||
// If the title is different to what it was before, then save it. After the
|
}));
|
||||||
// save has completed, update the post stream as there will be a new post
|
|
||||||
// indicating that the discussion was renamed.
|
|
||||||
if (title && title !== currentTitle) {
|
|
||||||
return this.save({title}).then(() => {
|
|
||||||
if (app.viewingDiscussion(this)) {
|
|
||||||
app.current.stream.update();
|
|
||||||
}
|
|
||||||
m.redraw();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -18,11 +18,11 @@ export default {
|
|||||||
* @return {ItemList}
|
* @return {ItemList}
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
controls(discussion, context) {
|
controls(user, context) {
|
||||||
const items = new ItemList();
|
const items = new ItemList();
|
||||||
|
|
||||||
['user', 'moderation', 'destructive'].forEach(section => {
|
['user', 'moderation', 'destructive'].forEach(section => {
|
||||||
const controls = this[section + 'Controls'](discussion, context).toArray();
|
const controls = this[section + 'Controls'](user, context).toArray();
|
||||||
if (controls.length) {
|
if (controls.length) {
|
||||||
controls.forEach(item => items.add(item.itemName, item));
|
controls.forEach(item => items.add(item.itemName, item));
|
||||||
items.add(section + 'Separator', Separator.component());
|
items.add(section + 'Separator', Separator.component());
|
||||||
|
@@ -4,22 +4,38 @@
|
|||||||
*
|
*
|
||||||
* @param {DOMElement} element
|
* @param {DOMElement} element
|
||||||
* @param {Boolean} isInitialized
|
* @param {Boolean} isInitialized
|
||||||
|
* @param {Object} context
|
||||||
*/
|
*/
|
||||||
export default function affixSidebar(element, isInitialized) {
|
export default function affixSidebar(element, isInitialized, context) {
|
||||||
if (isInitialized) return;
|
if (isInitialized) return;
|
||||||
|
|
||||||
const $sidebar = $(element);
|
const onresize = () => {
|
||||||
const $header = $('#header');
|
const $sidebar = $(element);
|
||||||
const $footer = $('#footer');
|
const $header = $('#header');
|
||||||
|
const $footer = $('#footer');
|
||||||
|
const $affixElement = $sidebar.find('> ul');
|
||||||
|
|
||||||
// Don't affix the sidebar if it is taller than the viewport (otherwise
|
$(window).off('.affix');
|
||||||
// there would be no way to scroll through its content).
|
$affixElement
|
||||||
if ($sidebar.outerHeight(true) > $(window).height() - $header.outerHeight(true)) return;
|
.removeClass('affix affix-top affix-bottom')
|
||||||
|
.removeData('bs.affix');
|
||||||
|
|
||||||
$sidebar.find('> ul').affix({
|
// Don't affix the sidebar if it is taller than the viewport (otherwise
|
||||||
offset: {
|
// there would be no way to scroll through its content).
|
||||||
top: () => $sidebar.offset().top - $header.outerHeight(true) - parseInt($sidebar.css('margin-top'), 10),
|
if ($sidebar.outerHeight(true) > $(window).height() - $header.outerHeight(true)) return;
|
||||||
bottom: () => this.bottom = $footer.outerHeight(true)
|
|
||||||
}
|
$affixElement.affix({
|
||||||
});
|
offset: {
|
||||||
|
top: () => $sidebar.offset().top - $header.outerHeight(true) - parseInt($sidebar.css('margin-top'), 10),
|
||||||
|
bottom: () => this.bottom = $footer.outerHeight(true)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Register the affix plugin to execute on every window resize (and trigger)
|
||||||
|
$(window).on('resize', onresize).resize();
|
||||||
|
|
||||||
|
context.onunload = () => {
|
||||||
|
$(window).off('resize', onresize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,11 +30,11 @@ export default class Session {
|
|||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
login(identification, password, options = {}) {
|
login(data, options = {}) {
|
||||||
return app.request(Object.assign({
|
return app.request(Object.assign({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: app.forum.attribute('baseUrl') + '/login',
|
url: app.forum.attribute('baseUrl') + '/login',
|
||||||
data: {identification, password}
|
data
|
||||||
}, options));
|
}, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,10 +50,10 @@ export default class Navigation extends Component {
|
|||||||
const previous = history.getPrevious() || {};
|
const previous = history.getPrevious() || {};
|
||||||
|
|
||||||
return LinkButton.component({
|
return LinkButton.component({
|
||||||
className: 'Button Navigation-back ' + (previous.title ? '' : 'Button--icon'),
|
className: 'Button Navigation-back Button--icon',
|
||||||
href: history.backUrl(),
|
href: history.backUrl(),
|
||||||
icon: 'chevron-left',
|
icon: 'chevron-left',
|
||||||
children: previous.title,
|
title: previous.title,
|
||||||
config: () => {},
|
config: () => {},
|
||||||
onclick: e => {
|
onclick: e => {
|
||||||
if (e.shiftKey || e.ctrlKey || e.metaKey || e.which === 2) return;
|
if (e.shiftKey || e.ctrlKey || e.metaKey || e.which === 2) return;
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
* @return {Object}
|
* @return {Object}
|
||||||
*/
|
*/
|
||||||
export default function icon(name, attrs = {}) {
|
export default function icon(name, attrs = {}) {
|
||||||
attrs.className = 'icon fa fa-fw fa-' + name + ' ' + (attrs.className || '');
|
attrs.className = 'icon fa fa-' + name + ' ' + (attrs.className || '');
|
||||||
|
|
||||||
return <i {...attrs}/>;
|
return <i {...attrs}/>;
|
||||||
}
|
}
|
||||||
|
@@ -102,5 +102,3 @@ Object.assign(Discussion.prototype, {
|
|||||||
return posts ? posts.data.map(link => link.id) : [];
|
return posts ? posts.data.map(link => link.id) : [];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Discussion;
|
|
||||||
|
@@ -17,5 +17,3 @@ Object.assign(Notification.prototype, {
|
|||||||
sender: Model.hasOne('sender'),
|
sender: Model.hasOne('sender'),
|
||||||
subject: Model.hasOne('subject')
|
subject: Model.hasOne('subject')
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Notification;
|
|
@@ -26,5 +26,3 @@ Object.assign(Post.prototype, {
|
|||||||
canEdit: Model.attribute('canEdit'),
|
canEdit: Model.attribute('canEdit'),
|
||||||
canDelete: Model.attribute('canDelete')
|
canDelete: Model.attribute('canDelete')
|
||||||
});
|
});
|
||||||
|
|
||||||
export default Post;
|
|
||||||
|
@@ -109,5 +109,3 @@ Object.assign(User.prototype, {
|
|||||||
return this.save({preferences});
|
return this.save({preferences});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default User;
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
* the prototype of a parent object.
|
* the prototype of a parent object.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* class MyClass extends mixin(ExtistingClass, evented, etc) {}
|
* class MyClass extends mixin(ExistingClass, evented, etc) {}
|
||||||
*
|
*
|
||||||
* @param {Class} Parent The class to extend the new class from.
|
* @param {Class} Parent The class to extend the new class from.
|
||||||
* @param {...Object} mixins The objects to mix in.
|
* @param {...Object} mixins The objects to mix in.
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
fieldset {
|
fieldset {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 20px;
|
||||||
|
|
||||||
> ul {
|
> ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
@@ -61,6 +61,7 @@
|
|||||||
}
|
}
|
||||||
.icon {
|
.icon {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
margin-right: 3px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
.icon {
|
.icon {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
|
.fa-fw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.NotificationGrid-checkbox {
|
.NotificationGrid-checkbox {
|
||||||
|
@@ -224,14 +224,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.Button-icon {
|
.Button-icon {
|
||||||
margin-right: 3px;
|
margin-right: 7px;
|
||||||
}
|
}
|
||||||
.Button-icon,
|
.Button-icon,
|
||||||
.Button-caret {
|
.Button-caret {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
.Button-caret {
|
.Button-caret {
|
||||||
margin-left: 3px;
|
margin-left: 7px;
|
||||||
}
|
}
|
||||||
.Button-badge {
|
.Button-badge {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
float: left;
|
float: left;
|
||||||
margin-left: -25px;
|
margin-left: -25px;
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
|
.fa-fw();
|
||||||
}
|
}
|
||||||
|
|
||||||
&.disabled {
|
&.disabled {
|
||||||
|
@@ -60,6 +60,7 @@
|
|||||||
padding-left: 32px;
|
padding-left: 32px;
|
||||||
padding-right: 32px;
|
padding-right: 32px;
|
||||||
.transition(all 0.4s);
|
.transition(all 0.4s);
|
||||||
|
box-sizing: inherit !important;
|
||||||
}
|
}
|
||||||
.Button {
|
.Button {
|
||||||
float: left;
|
float: left;
|
||||||
|
@@ -16,4 +16,5 @@
|
|||||||
margin-left: -30px;
|
margin-left: -30px;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
color: @control-color;
|
color: @control-color;
|
||||||
|
.fa-fw();
|
||||||
}
|
}
|
||||||
|
@@ -83,6 +83,10 @@ fieldset {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
|
||||||
|
> ul > li {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
legend {
|
legend {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Flarum\Database\Migration;
|
||||||
|
|
||||||
|
return Migration::addColumns('discussions', [
|
||||||
|
'is_private' => ['boolean', 'default' => false]
|
||||||
|
]);
|
16
migrations/2017_04_07_114138_add_is_private_to_posts.php
Normal file
16
migrations/2017_04_07_114138_add_is_private_to_posts.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Flarum\Database\Migration;
|
||||||
|
|
||||||
|
return Migration::addColumns('posts', [
|
||||||
|
'is_private' => ['boolean', 'default' => false]
|
||||||
|
]);
|
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Schema\Builder;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'up' => function (Builder $schema) {
|
||||||
|
$schema->table('posts', function (Blueprint $table) {
|
||||||
|
$table->mediumText('content')->change();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
'down' => function (Builder $schema) {
|
||||||
|
$schema->table('posts', function (Blueprint $table) {
|
||||||
|
$table->text('content')->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
];
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -25,11 +25,16 @@ class Server extends AbstractServer
|
|||||||
protected function getMiddleware(Application $app)
|
protected function getMiddleware(Application $app)
|
||||||
{
|
{
|
||||||
$pipe = new MiddlewarePipe;
|
$pipe = new MiddlewarePipe;
|
||||||
|
$pipe->raiseThrowables();
|
||||||
|
|
||||||
if ($app->isInstalled()) {
|
if ($app->isInstalled()) {
|
||||||
$path = parse_url($app->url('admin'), PHP_URL_PATH);
|
$path = parse_url($app->url('admin'), PHP_URL_PATH);
|
||||||
$errorDir = __DIR__.'/../../error';
|
$errorDir = __DIR__.'/../../error';
|
||||||
|
|
||||||
|
// All requests should first be piped through our global error handler
|
||||||
|
$debugMode = ! $app->isUpToDate() || $app->inDebugMode();
|
||||||
|
$pipe->pipe($path, new HandleErrors($errorDir, $app->make('log'), $debugMode));
|
||||||
|
|
||||||
if ($app->isUpToDate()) {
|
if ($app->isUpToDate()) {
|
||||||
$pipe->pipe($path, $app->make('Flarum\Http\Middleware\ParseJsonBody'));
|
$pipe->pipe($path, $app->make('Flarum\Http\Middleware\ParseJsonBody'));
|
||||||
$pipe->pipe($path, $app->make('Flarum\Http\Middleware\StartSession'));
|
$pipe->pipe($path, $app->make('Flarum\Http\Middleware\StartSession'));
|
||||||
@@ -41,12 +46,10 @@ class Server extends AbstractServer
|
|||||||
event(new ConfigureMiddleware($pipe, $path, $this));
|
event(new ConfigureMiddleware($pipe, $path, $this));
|
||||||
|
|
||||||
$pipe->pipe($path, $app->make('Flarum\Http\Middleware\DispatchRoute', ['routes' => $app->make('flarum.admin.routes')]));
|
$pipe->pipe($path, $app->make('Flarum\Http\Middleware\DispatchRoute', ['routes' => $app->make('flarum.admin.routes')]));
|
||||||
$pipe->pipe($path, new HandleErrors($errorDir, $app->make('log'), $app->inDebugMode()));
|
|
||||||
} else {
|
} else {
|
||||||
$app->register('Flarum\Update\UpdateServiceProvider');
|
$app->register('Flarum\Update\UpdateServiceProvider');
|
||||||
|
|
||||||
$pipe->pipe($path, $app->make('Flarum\Http\Middleware\DispatchRoute', ['routes' => $app->make('flarum.update.routes')]));
|
$pipe->pipe($path, $app->make('Flarum\Http\Middleware\DispatchRoute', ['routes' => $app->make('flarum.update.routes')]));
|
||||||
$pipe->pipe($path, new HandleErrors($errorDir, $app->make('log'), true));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@@ -12,30 +13,29 @@ namespace Flarum\Api;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Flarum\Core\User;
|
use Flarum\Core\User;
|
||||||
|
use Flarum\Foundation\Application;
|
||||||
use Flarum\Http\Controller\ControllerInterface;
|
use Flarum\Http\Controller\ControllerInterface;
|
||||||
use Illuminate\Contracts\Container\Container;
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Zend\Diactoros\ServerRequestFactory;
|
use Zend\Diactoros\ServerRequestFactory;
|
||||||
|
|
||||||
class Client
|
class Client
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @var Container
|
|
||||||
*/
|
|
||||||
protected $container;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ErrorHandler
|
* @var ErrorHandler
|
||||||
*/
|
*/
|
||||||
protected $errorHandler;
|
protected $errorHandler;
|
||||||
|
/**
|
||||||
|
* @var Application
|
||||||
|
*/
|
||||||
|
private $app;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Container $container
|
* @param Application $app
|
||||||
* @param ErrorHandler $errorHandler
|
* @param ErrorHandler $errorHandler
|
||||||
*/
|
*/
|
||||||
public function __construct(Container $container, ErrorHandler $errorHandler)
|
public function __construct(Application $app, ErrorHandler $errorHandler)
|
||||||
{
|
{
|
||||||
$this->container = $container;
|
$this->app = $app;
|
||||||
$this->errorHandler = $errorHandler;
|
$this->errorHandler = $errorHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,6 +47,7 @@ class Client
|
|||||||
* @param array $queryParams
|
* @param array $queryParams
|
||||||
* @param array $body
|
* @param array $body
|
||||||
* @return \Psr\Http\Message\ResponseInterface
|
* @return \Psr\Http\Message\ResponseInterface
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function send($controller, $actor, array $queryParams = [], array $body = [])
|
public function send($controller, $actor, array $queryParams = [], array $body = [])
|
||||||
{
|
{
|
||||||
@@ -55,7 +56,7 @@ class Client
|
|||||||
$request = $request->withAttribute('actor', $actor);
|
$request = $request->withAttribute('actor', $actor);
|
||||||
|
|
||||||
if (is_string($controller)) {
|
if (is_string($controller)) {
|
||||||
$controller = $this->container->make($controller);
|
$controller = $this->app->make($controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! ($controller instanceof ControllerInterface)) {
|
if (! ($controller instanceof ControllerInterface)) {
|
||||||
@@ -67,6 +68,10 @@ class Client
|
|||||||
try {
|
try {
|
||||||
return $controller->handle($request);
|
return $controller->handle($request);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
if ($this->app->inDebugMode()) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->errorHandler->handle($e);
|
return $this->errorHandler->handle($e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@@ -185,7 +186,7 @@ abstract class AbstractSerializeController implements ControllerInterface
|
|||||||
*/
|
*/
|
||||||
protected function extractFilter(ServerRequestInterface $request)
|
protected function extractFilter(ServerRequestInterface $request)
|
||||||
{
|
{
|
||||||
return $this->buildParameters($request)->getFilter();
|
return $this->buildParameters($request)->getFilter() ?: [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
@@ -11,6 +12,7 @@
|
|||||||
namespace Flarum\Api\Controller;
|
namespace Flarum\Api\Controller;
|
||||||
|
|
||||||
use Flarum\Api\UrlGenerator;
|
use Flarum\Api\UrlGenerator;
|
||||||
|
use Flarum\Core\Exception\PermissionDeniedException;
|
||||||
use Flarum\Core\Search\SearchCriteria;
|
use Flarum\Core\Search\SearchCriteria;
|
||||||
use Flarum\Core\Search\User\UserSearcher;
|
use Flarum\Core\Search\User\UserSearcher;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
@@ -33,7 +35,7 @@ class ListUsersController extends AbstractCollectionController
|
|||||||
*/
|
*/
|
||||||
public $sortFields = [
|
public $sortFields = [
|
||||||
'username',
|
'username',
|
||||||
'postsCount',
|
'commentsCount',
|
||||||
'discussionsCount',
|
'discussionsCount',
|
||||||
'lastSeenTime',
|
'lastSeenTime',
|
||||||
'joinTime'
|
'joinTime'
|
||||||
@@ -65,6 +67,11 @@ class ListUsersController extends AbstractCollectionController
|
|||||||
protected function data(ServerRequestInterface $request, Document $document)
|
protected function data(ServerRequestInterface $request, Document $document)
|
||||||
{
|
{
|
||||||
$actor = $request->getAttribute('actor');
|
$actor = $request->getAttribute('actor');
|
||||||
|
|
||||||
|
if ($actor->cannot('viewUserList')) {
|
||||||
|
throw new PermissionDeniedException;
|
||||||
|
}
|
||||||
|
|
||||||
$query = array_get($this->extractFilter($request), 'q');
|
$query = array_get($this->extractFilter($request), 'q');
|
||||||
$sort = $this->extractSort($request);
|
$sort = $this->extractSort($request);
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Flarum.
|
* This file is part of Flarum.
|
||||||
*
|
*
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user