mirror of
https://github.com/flarum/core.git
synced 2025-07-16 22:31:18 +02:00
feat: expose {time} to eventPost data, fix renamed tooltip (#3698)
This commit is contained in:
@@ -29,8 +29,8 @@ flarum-lock:
|
|||||||
|
|
||||||
# These translations are displayed between posts in the post stream.
|
# These translations are displayed between posts in the post stream.
|
||||||
post_stream:
|
post_stream:
|
||||||
discussion_locked_text: "{username} locked the discussion."
|
discussion_locked_text: "{username} locked the discussion {time}."
|
||||||
discussion_unlocked_text: "{username} unlocked the discussion."
|
discussion_unlocked_text: "{username} unlocked the discussion {time}."
|
||||||
|
|
||||||
# These translations are used in the Settings page.
|
# These translations are used in the Settings page.
|
||||||
settings:
|
settings:
|
||||||
|
@@ -25,8 +25,8 @@ flarum-sticky:
|
|||||||
|
|
||||||
# These translations are displayed between posts in the post stream.
|
# These translations are displayed between posts in the post stream.
|
||||||
post_stream:
|
post_stream:
|
||||||
discussion_stickied_text: "{username} stickied the discussion."
|
discussion_stickied_text: "{username} stickied the discussion {time}."
|
||||||
discussion_unstickied_text: "{username} unstickied the discussion."
|
discussion_unstickied_text: "{username} unstickied the discussion {time}."
|
||||||
|
|
||||||
##
|
##
|
||||||
# REUSED TRANSLATIONS - These keys should not be used directly in code!
|
# REUSED TRANSLATIONS - These keys should not be used directly in code!
|
||||||
|
@@ -92,9 +92,9 @@ flarum-tags:
|
|||||||
|
|
||||||
# These translations are displayed between posts in the post stream.
|
# These translations are displayed between posts in the post stream.
|
||||||
post_stream:
|
post_stream:
|
||||||
added_and_removed_tags_text: "{username} added the {tagsAdded} and removed the {tagsRemoved}."
|
added_and_removed_tags_text: "{username} added the {tagsAdded} and removed the {tagsRemoved} {time}."
|
||||||
added_tags_text: "{username} added the {tagsAdded}."
|
added_tags_text: "{username} added the {tagsAdded} {time}."
|
||||||
removed_tags_text: "{username} removed the {tagsRemoved}."
|
removed_tags_text: "{username} removed the {tagsRemoved} {time}."
|
||||||
tags_text: "{count, plural, one {{tags} tag} other {{tags} tags}}"
|
tags_text: "{count, plural, one {{tags} tag} other {{tags} tags}}"
|
||||||
|
|
||||||
# These translations are used when visiting a single tag's discussion list.
|
# These translations are used when visiting a single tag's discussion list.
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import app from '../../forum/app';
|
import app from '../../forum/app';
|
||||||
import EventPost from './EventPost';
|
import EventPost from './EventPost';
|
||||||
import extractText from '../../common/utils/extractText';
|
import extractText from '../../common/utils/extractText';
|
||||||
|
import Tooltip from '../../common/components/Tooltip';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `DiscussionRenamedPost` component displays a discussion event post
|
* The `DiscussionRenamedPost` component displays a discussion event post
|
||||||
@@ -17,9 +18,8 @@ export default class DiscussionRenamedPost extends EventPost {
|
|||||||
|
|
||||||
description(data) {
|
description(data) {
|
||||||
const renamed = app.translator.trans('core.forum.post_stream.discussion_renamed_text', data);
|
const renamed = app.translator.trans('core.forum.post_stream.discussion_renamed_text', data);
|
||||||
const oldName = app.translator.trans('core.forum.post_stream.discussion_renamed_old_tooltip', data);
|
|
||||||
|
|
||||||
return <span title={extractText(oldName)}>{renamed}</span>;
|
return <span>{renamed}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
descriptionData() {
|
descriptionData() {
|
||||||
@@ -28,8 +28,11 @@ export default class DiscussionRenamedPost extends EventPost {
|
|||||||
const newTitle = post.content()[1];
|
const newTitle = post.content()[1];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
old: oldTitle,
|
new: (
|
||||||
new: <strong className="DiscussionRenamedPost-new">{newTitle}</strong>,
|
<Tooltip text={extractText(app.translator.trans('core.forum.post_stream.discussion_renamed_old_tooltip', { old: oldTitle }))}>
|
||||||
|
<strong className="DiscussionRenamedPost-new">{newTitle}</strong>
|
||||||
|
</Tooltip>
|
||||||
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import { ucfirst } from '../../common/utils/string';
|
|||||||
import usernameHelper from '../../common/helpers/username';
|
import usernameHelper from '../../common/helpers/username';
|
||||||
import icon from '../../common/helpers/icon';
|
import icon from '../../common/helpers/icon';
|
||||||
import Link from '../../common/components/Link';
|
import Link from '../../common/components/Link';
|
||||||
|
import humanTime from '../../common/helpers/humanTime';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `EventPost` component displays a post which indicating a discussion
|
* The `EventPost` component displays a post which indicating a discussion
|
||||||
@@ -37,6 +38,7 @@ export default class EventPost extends Post {
|
|||||||
) : (
|
) : (
|
||||||
username
|
username
|
||||||
),
|
),
|
||||||
|
time: humanTime(this.attrs.post.createdAt()),
|
||||||
});
|
});
|
||||||
|
|
||||||
return super.content().concat([icon(this.icon(), { className: 'EventPost-icon' }), <div class="EventPost-info">{this.description(data)}</div>]);
|
return super.content().concat([icon(this.icon(), { className: 'EventPost-icon' }), <div class="EventPost-info">{this.description(data)}</div>]);
|
||||||
|
@@ -446,7 +446,7 @@ core:
|
|||||||
# These translations are displayed between posts in the post stream.
|
# These translations are displayed between posts in the post stream.
|
||||||
post_stream:
|
post_stream:
|
||||||
discussion_renamed_old_tooltip: 'The old title was: "{old}"'
|
discussion_renamed_old_tooltip: 'The old title was: "{old}"'
|
||||||
discussion_renamed_text: "{username} changed the title to {new}."
|
discussion_renamed_text: "{username} changed the title to {new} {time}."
|
||||||
load_more_button: => core.ref.load_more
|
load_more_button: => core.ref.load_more
|
||||||
reply_placeholder: => core.ref.write_a_reply
|
reply_placeholder: => core.ref.write_a_reply
|
||||||
time_lapsed_text: "{period} later"
|
time_lapsed_text: "{period} later"
|
||||||
|
Reference in New Issue
Block a user