mirror of
https://github.com/discourse/discourse.git
synced 2025-02-24 15:11:54 +08:00
UX: omit date in user stream for small action posts (#31236)
This change makes it possible to render the action code from small action posts (ie. close topic etc) without the relative date. This is applied in the user stream items to prevent duplication of dates.
This commit is contained in:
parent
79041cc1a6
commit
dc86ebe97a
@ -3,7 +3,7 @@ import { actionDescriptionHtml } from "discourse/widgets/post-small-action";
|
|||||||
|
|
||||||
export default class PostActionDescription extends Component {
|
export default class PostActionDescription extends Component {
|
||||||
get description() {
|
get description() {
|
||||||
if (this.args.actionCode && this.args.createdAt) {
|
if (this.args.actionCode) {
|
||||||
return actionDescriptionHtml(
|
return actionDescriptionHtml(
|
||||||
this.args.actionCode,
|
this.args.actionCode,
|
||||||
this.args.createdAt,
|
this.args.createdAt,
|
||||||
|
@ -186,7 +186,6 @@ export default class UserStreamComponent extends Component {
|
|||||||
<:abovePostItemExcerpt as |post|>
|
<:abovePostItemExcerpt as |post|>
|
||||||
<PostActionDescription
|
<PostActionDescription
|
||||||
@actionCode={{post.action_code}}
|
@actionCode={{post.action_code}}
|
||||||
@createdAt={{post.created_at}}
|
|
||||||
@username={{post.action_code_who}}
|
@username={{post.action_code_who}}
|
||||||
@path={{post.action_code_path}}
|
@path={{post.action_code_path}}
|
||||||
/>
|
/>
|
||||||
|
@ -12,10 +12,11 @@ import { createWidget } from "discourse/widgets/widget";
|
|||||||
import { i18n } from "discourse-i18n";
|
import { i18n } from "discourse-i18n";
|
||||||
|
|
||||||
export function actionDescriptionHtml(actionCode, createdAt, username, path) {
|
export function actionDescriptionHtml(actionCode, createdAt, username, path) {
|
||||||
const dt = new Date(createdAt);
|
const when = createdAt
|
||||||
const when = autoUpdatingRelativeAge(dt, {
|
? autoUpdatingRelativeAge(new Date(createdAt), {
|
||||||
format: "medium-with-ago-and-on",
|
format: "medium-with-ago-and-on",
|
||||||
});
|
})
|
||||||
|
: "";
|
||||||
|
|
||||||
let who = "";
|
let who = "";
|
||||||
if (username) {
|
if (username) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user