Skip to content

Commit

Permalink
DEV: Update for glimmer topic list (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaylorhq authored Jan 14, 2025
1 parent 98a77d9 commit 9094599
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 42 deletions.
1 change: 1 addition & 0 deletions .discourse-compatibility
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
< 3.4.0.beta4-dev: 98a77d91522cb1d05004665cf7cf3b76832b2d12
< 3.4.0.beta2-dev: 251f93afe6686e49e219531dc5edd39976d0f9ec
< 3.4.0.beta1-dev: e69ca72ad7ddd1ee1d0bb2b2597bdf5557bd2670
< 3.3.0.beta1-dev: 1018ccd20333f53d6342d5a44e415322a0b0c637
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import I18n from "discourse-i18n";

export default class GroupTrackerTopicStatus extends Component {
@service site;

context = this.args.context;
@service siteSettings;

get titleName() {
const trackedGroups = this.site && this.site.tracked_groups;
const trackedGroup = trackedGroups.find(
(g) => g.name === this.context.topic.first_tracked_post.group
(g) => g.name === this.args.topic.first_tracked_post.group
);
let title = "";

Expand All @@ -27,28 +26,25 @@ export default class GroupTrackerTopicStatus extends Component {

<template>
<span class="topic-icon-container">
{{#if this.context.topic.first_tracked_post}}
{{#if @topic.first_tracked_post}}
<a
class="tracked-post group-{{this.context.topic.first_tracked_post.group}}"
href="{{this.context.topic.url}}/{{this.context.topic.first_tracked_post.post_number}}"
class="tracked-post group-{{@topic.first_tracked_post.group}}"
href="{{@topic.url}}/{{@topic.first_tracked_post.post_number}}"
title={{this.titleName}}
>
{{icon
this.context.topic.firstTrackedPostIcon
class="first-tracked-post"
}}
{{#if this.context.siteSettings.group_tracker_topic_icon}}
{{icon @topic.firstTrackedPostIcon class="first-tracked-post"}}
{{#if this.siteSettings.group_tracker_topic_icon}}
{{icon
this.context.siteSettings.group_tracker_topic_icon
class=this.context.siteSettings.group_tracker_topic_icon_class
this.siteSettings.group_tracker_topic_icon
class=this.siteSettings.group_tracker_topic_icon_class
}}
{{/if}}
</a>
{{else}}
{{#if this.context.siteSettings.group_tracker_topic_icon}}
{{#if this.siteSettings.group_tracker_topic_icon}}
{{icon
this.context.siteSettings.group_tracker_topic_icon
class=this.context.siteSettings.group_tracker_topic_icon_class
this.siteSettings.group_tracker_topic_icon
class=this.siteSettings.group_tracker_topic_icon_class
}}
{{/if}}
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import GroupTrackerTopicStatus from "../../components/group-tracker-topic-status";

const connector = <template>
<GroupTrackerTopicStatus @topic={{@outletArgs.topic}} />
</template>;

export default connector;

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { withPluginApi } from "discourse/lib/plugin-api";
import Composer from "discourse/models/composer";
import { withSilencedDeprecations } from "discourse-common/lib/deprecated";
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";
import getURL from "discourse-common/lib/get-url";
import computed from "discourse-common/utils/decorators";
Expand All @@ -20,19 +21,32 @@ function modifyTopicModel(api) {
}

function addTrackedGroupToTopicList(api) {
api.modifyClass("component:topic-list-item", {
pluginId: PLUGIN_ID,

@computed("topic.first_tracked_post")
unboundClassNames(firstTrackedPost) {
let classNames = this._super();

api.registerValueTransformer(
"topic-list-item-class",
({ value: classNames, context }) => {
const firstTrackedPost = context.topic.first_tracked_post;
if (firstTrackedPost) {
classNames += ` group-${firstTrackedPost.group}`;
classNames.push(`group-${firstTrackedPost.group}`);
}

return classNames;
},
}
);

withSilencedDeprecations("discourse.hbr-topic-list-overrides", () => {
api.modifyClass("component:topic-list-item", {
pluginId: PLUGIN_ID,

@computed("topic.first_tracked_post")
unboundClassNames(firstTrackedPost) {
let classNames = this._super();

if (firstTrackedPost) {
classNames += ` group-${firstTrackedPost.group}`;
}

return classNames;
},
});
});
}

Expand Down

This file was deleted.

14 changes: 0 additions & 14 deletions assets/javascripts/discourse/raw-views/tracker-topic-status.gjs

This file was deleted.

0 comments on commit 9094599

Please sign in to comment.