mirror of
https://github.com/flarum/core.git
synced 2025-08-08 01:16:52 +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
|
* The `DiscussionRenamedPost` component displays a discussion event post
|
||||||
* indicating that the discussion has been renamed.
|
* 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 {
|
export default class DiscussionRenamedPost extends EventPost {
|
||||||
icon() {
|
icon() {
|
||||||
@@ -22,7 +22,7 @@ export default class DiscussionRenamedPost extends EventPost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
descriptionData() {
|
descriptionData() {
|
||||||
const post = this.props.post;
|
const post = this.attrs.post;
|
||||||
const oldTitle = post.content()[0];
|
const oldTitle = post.content()[0];
|
||||||
const newTitle = post.content()[1];
|
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
|
* event, like a discussion being renamed or stickied. Subclasses must implement
|
||||||
* the `icon` and `description` methods.
|
* the `icon` and `description` methods.
|
||||||
*
|
*
|
||||||
* ### Props
|
* ### Attrs
|
||||||
*
|
*
|
||||||
* - All of the props for `Post`
|
* - All of the attrs for `Post`
|
||||||
*
|
*
|
||||||
* @abstract
|
* @abstract
|
||||||
*/
|
*/
|
||||||
export default class EventPost extends Post {
|
export default class EventPost extends Post {
|
||||||
attrs() {
|
elementAttrs() {
|
||||||
const attrs = super.attrs();
|
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;
|
return attrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
content() {
|
content() {
|
||||||
const user = this.props.post.user();
|
const user = this.attrs.post.user();
|
||||||
const username = usernameHelper(user);
|
const username = usernameHelper(user);
|
||||||
const data = Object.assign(this.descriptionData(), {
|
const data = Object.assign(this.descriptionData(), {
|
||||||
user,
|
user,
|
||||||
username: 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}
|
{username}
|
||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
|
Reference in New Issue
Block a user