Skip to content

DEV: Small fixes and tweaks in the Glimmer Post Stream #33112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export default class PostStream extends Component {
}

daysBetween(post1, post2) {
const time1 = post1 ? new Date(post1.createdAt).getTime() : null;
const time2 = post2 ? new Date(post2.createdAt).getTime() : null;
const time1 = post1 ? new Date(post1.created_at).getTime() : null;
const time2 = post2 ? new Date(post2.created_at).getTime() : null;

if (!time1 || !time2) {
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Component from "@glimmer/component";
import { cached, tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { gt } from "truth-helpers";
import DButton from "discourse/components/d-button";
import icon from "discourse/helpers/d-icon";
import replaceEmoji from "discourse/helpers/replace-emoji";
Expand Down Expand Up @@ -51,7 +52,7 @@ export default class PostLinks extends Component {
<li>
<a
class="track-link inbound"
data-clicks={{link.clicks}}
data-clicks={{if (gt link.clicks 0) link.clicks}}
href={{link.url}}
>
{{icon "link"}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ export default class PostTimeGap extends Component {
}

<template>
<div class="topic-avatar"></div>
<div class="small-action-desc timegap">
{{this.description}}
<div class="time-gap small-action">
<div class="topic-avatar"></div>
<div class="small-action-desc timegap">
{{this.description}}
</div>
</div>
</template>
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,33 @@ module("Integration | Component | Post | PostLinks", function (hooks) {
assert.dom(".post-links a.track-link").exists({ count: 7 });
assert.dom(".expand-links").doesNotExist("there is no expand button");
});

test("data-clicks", async function (assert) {
this.post.link_counts = [
{
title: "Link 1",
url: "/t/1",
internal: true,
reflection: true,
clicks: 2,
},
{
title: "Link 2",
url: "/t/2",
internal: true,
reflection: true,
clicks: 0,
},
];

await renderComponent(this.post);

assert
.dom(".post-links a.track-link[href='/t/1']")
.hasAttribute("data-clicks", "2", "Link 1 has the correct click count");

assert
.dom(".post-links a.track-link[href='/t/2']")
.doesNotHaveAttribute("data-clicks");
});
});
5 changes: 5 additions & 0 deletions app/assets/stylesheets/common/base/topic-post.scss
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@ aside.quote {
flex: 0 0 auto;
margin-right: 0.5em;

.btn {
padding: revert;
}

&.post-date {
margin-right: 0;
}
Expand Down Expand Up @@ -988,6 +992,7 @@ aside.quote {
}

.d-icon {
margin-right: 0;
order: 1;
color: var(--primary-med-or-secondary-med);
}
Expand Down
Loading