Skip to content
This repository was archived by the owner on Feb 6, 2025. It is now read-only.
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
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: 804f5efe5651ab08f93fd6eb1d54971d98f40944
< 3.4.0.beta2-dev: 9a9f6af455cb2497aa64cd32031aca020b497829
< 3.4.0.beta1-dev: 14e0fb988ba91eaa514341575cdde8042b823c5b
< 3.3.0.beta2-dev: 54a59be6176d2ce02a7aaae8c6b7cb57b1f4bfff
Expand Down
60 changes: 38 additions & 22 deletions assets/javascripts/discourse/api-initializers/encrypt-icons.gjs
Original file line number Diff line number Diff line change
@@ -1,35 +1,51 @@
import { computed } from "@ember/object";
import TopicStatusIcons from "discourse/helpers/topic-status-icons";
import { apiInitializer } from "discourse/lib/api";
import icon from "discourse-common/helpers/d-icon";
import i18n from "discourse-common/helpers/i18n";
import { withSilencedDeprecations } from "discourse-common/lib/deprecated";
import I18n from "discourse-i18n";

export default apiInitializer("0.8", (api) => {
// Header icon
if (!TopicStatusIcons.find(([prop]) => prop === "encrypted_title")) {
TopicStatusIcons.addObject(["encrypted_title", "user-secret", "encrypted"]);
}
export default apiInitializer("2.0.0", (api) => {
withSilencedDeprecations("discourse.hbr-topic-list-overrides", () => {
let topicStatusIcons;
try {
topicStatusIcons =
require("discourse/helpers/topic-status-icons").default;
} catch {}

// topic-list-item icon
api.modifyClass("raw-view:topic-status", {
pluginId: "encrypt",
if (
topicStatusIcons &&
!topicStatusIcons.entries.find(
({ attribute }) => attribute === "encrypted_title"
)
) {
topicStatusIcons?.addObject([
"encrypted_title",
"user-secret",
"encrypted",
]);
}

statuses: computed(function () {
const results = this._super(...arguments);
// topic-list-item icon
api.modifyClass("raw-view:topic-status", {
pluginId: "encrypt",

if (this.topic.encrypted_title) {
results.push({
openTag: "span",
closeTag: "span",
title: I18n.t("topic-statuses.encrypted.help"),
icon: "user-secret",
key: "encrypted",
});
}
statuses: computed(function () {
const results = this._super(...arguments);

return results;
}),
if (this.topic.encrypted_title) {
results.push({
openTag: "span",
closeTag: "span",
title: I18n.t("topic-statuses.encrypted.help"),
icon: "user-secret",
key: "encrypted",
});
}

return results;
}),
});
});

// Main topic title
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";

const EncryptedStatus = <template>
{{~#if @outletArgs.topic.encrypted_title~}}
<span
title={{i18n "topic-statuses.encrypted.help"}}
class="topic-status"
>{{icon "user-secret"}}</span>
{{~/if~}}
</template>;

export default EncryptedStatus;
Loading