FIX: do not show PM topics when moving posts to an existing public topic (#6876)

This commit is contained in:
Arpit Jalan
2019-01-14 15:00:45 +05:30
committed by GitHub
parent 78748f1501
commit a121d40771
5 changed files with 49 additions and 17 deletions
@@ -32,20 +32,22 @@ export default Ember.Component.extend({
return;
}
searchForTerm(title, { typeFilter: "topic", searchForId: true }).then(
function(results) {
if (results && results.posts && results.posts.length > 0) {
self.set(
"topics",
results.posts
.mapBy("topic")
.filter(t => t.get("id") !== currentTopicId)
);
} else {
self.setProperties({ topics: null, loading: false });
}
searchForTerm(title, {
typeFilter: "topic",
searchForId: true,
restrictToArchetype: "regular"
}).then(function(results) {
if (results && results.posts && results.posts.length > 0) {
self.set(
"topics",
results.posts
.mapBy("topic")
.filter(t => t.get("id") !== currentTopicId)
);
} else {
self.setProperties({ topics: null, loading: false });
}
);
});
}, 300),
actions: {
@@ -107,6 +107,8 @@ export function searchForTerm(term, opts) {
const data = { term: term, include_blurbs: "true" };
if (opts.typeFilter) data.type_filter = opts.typeFilter;
if (opts.searchForId) data.search_for_id = true;
if (opts.restrictToArchetype)
data.restrict_to_archetype = opts.restrictToArchetype;
if (opts.searchContext) {
data.search_context = {