mirror of
https://github.com/flarum/core.git
synced 2025-08-11 10:55:47 +02:00
update: forum/components/Notification, forum/components/DiscussionRenamedNotification
- Not yet tested
This commit is contained in:
committed by
Franz Liedke
parent
fe011bf285
commit
73891b751b
@@ -4,9 +4,9 @@ import Notification from './Notification';
|
||||
* The `DiscussionRenamedNotification` component displays a notification which
|
||||
* indicates that a discussion has had its title changed.
|
||||
*
|
||||
* ### Props
|
||||
* ### Attrs
|
||||
*
|
||||
* - All of the props for Notification
|
||||
* - All of the attrs for Notification
|
||||
*/
|
||||
export default class DiscussionRenamedNotification extends Notification {
|
||||
icon() {
|
||||
@@ -14,12 +14,12 @@ export default class DiscussionRenamedNotification extends Notification {
|
||||
}
|
||||
|
||||
href() {
|
||||
const notification = this.props.notification;
|
||||
const notification = this.attrs.notification;
|
||||
|
||||
return app.route.discussion(notification.subject(), notification.content().postNumber);
|
||||
}
|
||||
|
||||
content() {
|
||||
return app.translator.trans('core.forum.notifications.discussion_renamed_text', { user: this.props.notification.fromUser() });
|
||||
return app.translator.trans('core.forum.notifications.discussion_renamed_text', { user: this.attrs.notification.fromUser() });
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@ import Button from '../../common/components/Button';
|
||||
* The `Notification` component abstract displays a single notification.
|
||||
* Subclasses should implement the `icon`, `href`, and `content` methods.
|
||||
*
|
||||
* ### Props
|
||||
* ### Attrs
|
||||
*
|
||||
* - `notification`
|
||||
*
|
||||
@@ -16,7 +16,7 @@ import Button from '../../common/components/Button';
|
||||
*/
|
||||
export default class Notification extends Component {
|
||||
view() {
|
||||
const notification = this.props.notification;
|
||||
const notification = this.attrs.notification;
|
||||
const href = this.href();
|
||||
|
||||
return (
|
||||
@@ -86,10 +86,10 @@ export default class Notification extends Component {
|
||||
* Mark the notification as read.
|
||||
*/
|
||||
markAsRead() {
|
||||
if (this.props.notification.isRead()) return;
|
||||
if (this.attrs.notification.isRead()) return;
|
||||
|
||||
app.session.user.pushAttributes({ unreadNotificationCount: app.session.user.unreadNotificationCount() - 1 });
|
||||
|
||||
this.props.notification.save({ isRead: true });
|
||||
this.attrs.notification.save({ isRead: true });
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user