* Use post excerpt for best posts to avoid giant posts ruining it * Make sure short emojis (e.g. `:joy:`) render in best posts and best topics * Make images show in best post excerpts (requires core change) * Fix invite action error, using column that doesn't exist * Add missing # for top category slugs * Refactor report service + controller a little to make it easier to figure out what went wrong if it fails, and to use the guardian user Copies a couple of fixes from https://github.com/discourse/discourse-rewind/pull/28 to make things work locally, the conflicts will be easy to resolve. **Best topics before** <img width="977" height="712" alt="image" src="https://github.com/user-attachments/assets/e120507f-d0d8-44f0-b242-e1056084ef03" /> **Best topics after** <img width="969" height="648" alt="image" src="https://github.com/user-attachments/assets/dd13f6ac-35df-4e9a-907e-9ed5102843b6" /> **Categories before** <img width="904" height="465" alt="image" src="https://github.com/user-attachments/assets/0d15e73d-3534-4836-b776-2c97381e58ef" /> **Categories after** <img width="925" height="466" alt="image" src="https://github.com/user-attachments/assets/3d6e4eae-32ed-4f11-a4f4-090e4473ebe9" />
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
import Component from "@glimmer/component";
|
|
import { concat } from "@ember/helper";
|
|
import { htmlSafe } from "@ember/template";
|
|
import replaceEmoji from "discourse/helpers/replace-emoji";
|
|
import { i18n } from "discourse-i18n";
|
|
|
|
export default class BestTopics extends Component {
|
|
rank(idx) {
|
|
return idx + 1;
|
|
}
|
|
|
|
<template>
|
|
{{#if @report.data.length}}
|
|
<div class="rewind-report-page -best-topics">
|
|
<h2 class="rewind-report-title">{{i18n
|
|
"discourse_rewind.reports.best_topics.title"
|
|
[email protected]
|
|
}}</h2>
|
|
<div class="rewind-report-container">
|
|
<div class="rewind-card">
|
|
{{#each @report.data as |topic idx|}}
|
|
<a
|
|
href={{concat "/t/-/" topic.topic_id}}
|
|
class={{concat "best-topics__topic" " rank-" (this.rank idx)}}
|
|
>
|
|
<span class="best-topics -rank"></span>
|
|
<span class="best-topics -rank"></span>
|
|
<h2 class="best-topics__header">{{topic.title}}</h2>
|
|
<span class="best-topics__excerpt">{{replaceEmoji
|
|
(htmlSafe topic.excerpt)
|
|
}}</span>
|
|
</a>
|
|
{{/each}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
</template>
|
|
}
|