Skip to content
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

FIX: Use the correct container #539

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
18 changes: 14 additions & 4 deletions assets/javascripts/discourse/initializers/extend-for-assigns.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getOwner } from "@ember/application";
import { inject as service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { h } from "virtual-dom";
Expand Down Expand Up @@ -502,9 +503,9 @@ function initialize(api) {
: {}
);

function assignedToUserPath(assignedToUser) {
function assignedToUserPath(assignedToUser, settings) {
return getURL(
siteSettings.assigns_user_url_path.replace(
settings.assigns_user_url_path.replace(
"{username}",
assignedToUser.username
)
Expand All @@ -518,9 +519,11 @@ function initialize(api) {
api.modifyClass("model:bookmark", {
pluginId: PLUGIN_ID,

siteSettings: service(),

@discourseComputed("assigned_to_user")
assignedToUserPath(assignedToUser) {
return assignedToUserPath(assignedToUser);
return assignedToUserPath(assignedToUser, this.siteSettings);
},
@discourseComputed("assigned_to_group")
assignedToGroupPath(assignedToGroup) {
Expand All @@ -531,6 +534,8 @@ function initialize(api) {
api.modifyClass("component:topic-notifications-button", {
pluginId: PLUGIN_ID,

currentUser: service(),

@discourseComputed(
"topic",
"topic.details.{notification_level,notifications_reason_id}"
Expand Down Expand Up @@ -663,6 +668,8 @@ function initialize(api) {
});

api.createWidget("assigned-to-first-post", {
services: ["site-settings"],

html(attrs) {
const topic = attrs.topic;
const [assignedToUser, assignedToGroup, indirectlyAssignedTo] = [
Expand All @@ -688,7 +695,7 @@ function initialize(api) {
new RawHtml({
html: assignedHtml(
assignedToUser.username,
assignedToUserPath(assignedToUser),
assignedToUserPath(assignedToUser, this.siteSettings),
"user"
),
})
Expand Down Expand Up @@ -757,6 +764,9 @@ function initialize(api) {
api.modifyClass("controller:topic", {
pluginId: PLUGIN_ID,

appEvents: service(),
messageBus: service(),

subscribe() {
this._super(...arguments);

Expand Down