FIX: show unassign button on mobile
This commit is contained in:
parent
312357988f
commit
1f938c3f41
|
@ -1,5 +1,6 @@
|
||||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||||
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
|
||||||
// should this be in API ?
|
// should this be in API ?
|
||||||
import showModal from "discourse/lib/show-modal";
|
import showModal from "discourse/lib/show-modal";
|
||||||
|
@ -12,12 +13,20 @@ function modifySelectKit(api) {
|
||||||
.modifySelectKit("topic-footer-mobile-dropdown")
|
.modifySelectKit("topic-footer-mobile-dropdown")
|
||||||
.modifyContent((context, existingContent) => {
|
.modifyContent((context, existingContent) => {
|
||||||
if (context.get("currentUser.staff")) {
|
if (context.get("currentUser.staff")) {
|
||||||
|
if (context.get("topic.assigned_to_user")) {
|
||||||
|
existingContent.push({
|
||||||
|
id: "unassign",
|
||||||
|
icon: "user-times",
|
||||||
|
name: I18n.t("discourse_assign.unassign.title")
|
||||||
|
});
|
||||||
|
} else {
|
||||||
existingContent.push({
|
existingContent.push({
|
||||||
id: "assign",
|
id: "assign",
|
||||||
icon: "user-plus",
|
icon: "user-plus",
|
||||||
name: I18n.t("discourse_assign.assign.title")
|
name: I18n.t("discourse_assign.assign.title")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return existingContent;
|
return existingContent;
|
||||||
})
|
})
|
||||||
.onSelect((context, value) => {
|
.onSelect((context, value) => {
|
||||||
|
@ -35,11 +44,18 @@ function modifySelectKit(api) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
context.set("value", null);
|
context.set("value", null);
|
||||||
|
} else if (value === "unassign") {
|
||||||
|
topic.set("assigned_to_user", null);
|
||||||
|
|
||||||
|
ajax("/assign/unassign", {
|
||||||
|
type: "PUT",
|
||||||
|
data: { topic_id: topic.get("id") }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize(api, container) {
|
function initialize(api) {
|
||||||
// You can't act on flags claimed by another user
|
// You can't act on flags claimed by another user
|
||||||
api.modifyClass(
|
api.modifyClass(
|
||||||
"component:flagged-post",
|
"component:flagged-post",
|
||||||
|
|
Loading…
Reference in New Issue