mirror of
https://github.com/flarum/core.git
synced 2025-08-05 16:07:34 +02:00
Database changes (#15)
* Implement database changes * Split foreign keys into their own migration * Use whereColumn * Rename flag.time * Rename forum.flagCount * Rename forum.newFlagCount
This commit is contained in:
committed by
Franz Liedke
parent
f218f14160
commit
ec60fed381
@@ -41,7 +41,7 @@ export default class FlagList extends Component {
|
||||
<span className="Notification-content">
|
||||
{app.translator.trans('flarum-flags.forum.flagged_posts.item_text', {username: username(post.user()), em: <em/>, discussion: post.discussion().title()})}
|
||||
</span>
|
||||
{humanTime(flag.time())}
|
||||
{humanTime(flag.createdAt())}
|
||||
<div className="Notification-excerpt">
|
||||
{post.contentPlain()}
|
||||
</div>
|
||||
@@ -63,7 +63,7 @@ export default class FlagList extends Component {
|
||||
* been loaded.
|
||||
*/
|
||||
load() {
|
||||
if (app.cache.flags && !app.session.user.attribute('newFlagsCount')) {
|
||||
if (app.cache.flags && !app.session.user.attribute('newFlagCount')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ export default class FlagList extends Component {
|
||||
|
||||
app.store.find('flags')
|
||||
.then(flags => {
|
||||
app.session.user.pushAttributes({newFlagsCount: 0});
|
||||
app.cache.flags = flags.sort((a, b) => b.time() - a.time());
|
||||
app.session.user.pushAttributes({newFlagCount: 0});
|
||||
app.cache.flags = flags.sort((a, b) => b.createdAt() - a.createdAt());
|
||||
})
|
||||
.catch(() => {})
|
||||
.then(() => {
|
||||
|
@@ -21,10 +21,10 @@ export default class FlagsDropdown extends NotificationsDropdown {
|
||||
}
|
||||
|
||||
getUnreadCount() {
|
||||
return app.cache.flags ? app.cache.flags.length : app.forum.attribute('flagsCount');
|
||||
return app.cache.flags ? app.cache.flags.length : app.forum.attribute('flagCount');
|
||||
}
|
||||
|
||||
getNewCount() {
|
||||
return app.session.user.attribute('newFlagsCount');
|
||||
return app.session.user.attribute('newFlagCount');
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
import Model from 'flarum/Model';
|
||||
import mixin from 'flarum/utils/mixin';
|
||||
|
||||
class Flag extends Model {}
|
||||
|
||||
@@ -7,10 +6,10 @@ Object.assign(Flag.prototype, {
|
||||
type: Model.attribute('type'),
|
||||
reason: Model.attribute('reason'),
|
||||
reasonDetail: Model.attribute('reasonDetail'),
|
||||
time: Model.attribute('time', Model.transformDate),
|
||||
createdAt: Model.attribute('createdAt', Model.transformDate),
|
||||
|
||||
post: Model.hasOne('post'),
|
||||
user: Model.hasOne('user')
|
||||
});
|
||||
|
||||
export default Flag;
|
||||
export default Flag;
|
||||
|
Reference in New Issue
Block a user