mirror of
https://github.com/flarum/core.git
synced 2025-08-07 17:07:19 +02:00
Update: EventPost, DiscussionRenamedPost
This commit is contained in:
committed by
Franz Liedke
parent
3e79c3e3ff
commit
f127e67fd4
@@ -5,9 +5,9 @@ import extractText from '../../common/utils/extractText';
|
||||
* The `DiscussionRenamedPost` component displays a discussion event post
|
||||
* indicating that the discussion has been renamed.
|
||||
*
|
||||
* ### Props
|
||||
* ### Attrs
|
||||
*
|
||||
* - All of the props for EventPost
|
||||
* - All of the attrs for EventPost
|
||||
*/
|
||||
export default class DiscussionRenamedPost extends EventPost {
|
||||
icon() {
|
||||
@@ -22,7 +22,7 @@ export default class DiscussionRenamedPost extends EventPost {
|
||||
}
|
||||
|
||||
descriptionData() {
|
||||
const post = this.props.post;
|
||||
const post = this.attrs.post;
|
||||
const oldTitle = post.content()[0];
|
||||
const newTitle = post.content()[1];
|
||||
|
||||
|
@@ -8,28 +8,28 @@ import icon from '../../common/helpers/icon';
|
||||
* event, like a discussion being renamed or stickied. Subclasses must implement
|
||||
* the `icon` and `description` methods.
|
||||
*
|
||||
* ### Props
|
||||
* ### Attrs
|
||||
*
|
||||
* - All of the props for `Post`
|
||||
* - All of the attrs for `Post`
|
||||
*
|
||||
* @abstract
|
||||
*/
|
||||
export default class EventPost extends Post {
|
||||
attrs() {
|
||||
const attrs = super.attrs();
|
||||
elementAttrs() {
|
||||
const attrs = super.elementAttrs();
|
||||
|
||||
attrs.className = (attrs.className || '') + ' EventPost ' + ucfirst(this.props.post.contentType()) + 'Post';
|
||||
attrs.className = (attrs.className || '') + ' EventPost ' + ucfirst(this.attrs.post.contentType()) + 'Post';
|
||||
|
||||
return attrs;
|
||||
}
|
||||
|
||||
content() {
|
||||
const user = this.props.post.user();
|
||||
const user = this.attrs.post.user();
|
||||
const username = usernameHelper(user);
|
||||
const data = Object.assign(this.descriptionData(), {
|
||||
user,
|
||||
username: user ? (
|
||||
<a className="EventPost-user" href={app.route.user(user)} config={m.route}>
|
||||
<a className="EventPost-user" route={app.route.user(user)}>
|
||||
{username}
|
||||
</a>
|
||||
) : (
|
||||
|
Reference in New Issue
Block a user