mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:49:14 +08:00
FIX: Show all topic statuses on full page search.
This commit is contained in:
parent
db235c5ff9
commit
d9109ed436
|
@ -58,6 +58,14 @@ export default EmberObject.extend({
|
|||
results.push({ icon: "far-eye-slash", key: "unlisted" });
|
||||
}
|
||||
|
||||
if (
|
||||
this.showPrivateMessageIcon &&
|
||||
topic.isPrivateMessage &&
|
||||
!topic.is_warning
|
||||
) {
|
||||
results.push({ icon: "envelope", key: "personal_message" });
|
||||
}
|
||||
|
||||
results.forEach((result) => {
|
||||
result.title = I18n.t(`topic_statuses.${result.key}.help`);
|
||||
if (
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
{{/if}}
|
||||
|
||||
<a href={{result.url}} {{action "logClick" result.topic_id}} class="search-link">
|
||||
{{topic-status topic=result.topic disableActions=true showPrivateMessageIcon=true}}
|
||||
{{raw "topic-status" topic=result.topic showPrivateMessageIcon=true}}
|
||||
<span class="topic-title">
|
||||
{{#if result.useTopicTitleHeadline}}
|
||||
{{html-safe result.topicTitleHeadline}}
|
||||
|
|
|
@ -105,12 +105,26 @@ acceptance("Search - Full Page", function (needs) {
|
|||
assert.ok(queryAll(".fps-topic").length === 0, "has no results");
|
||||
assert.ok(queryAll(".no-results-suggestion .google-search-form"));
|
||||
|
||||
await fillIn(".search-query", "posts");
|
||||
await fillIn(".search-query", "discourse");
|
||||
await click(".search-cta");
|
||||
|
||||
assert.ok(queryAll(".fps-topic").length === 1, "has one post");
|
||||
});
|
||||
|
||||
test("search for personal messages", async function (assert) {
|
||||
await visit("/search");
|
||||
|
||||
await fillIn(".search-query", "discourse in:personal");
|
||||
await click(".search-cta");
|
||||
|
||||
assert.ok(queryAll(".fps-topic").length === 1, "has one post");
|
||||
|
||||
assert.ok(
|
||||
queryAll(".topic-status .personal_message").length === 1,
|
||||
"shows the right icon"
|
||||
);
|
||||
});
|
||||
|
||||
test("escape search term", async function (assert) {
|
||||
await visit("/search");
|
||||
await fillIn(".search-query", "@<script>prompt(1337)</script>gmail.com");
|
||||
|
|
|
@ -28,7 +28,7 @@ acceptance("Search - Mobile", function (needs) {
|
|||
"it should expand advanced search filters"
|
||||
);
|
||||
|
||||
await fillIn(".search-query", "posts");
|
||||
await fillIn(".search-query", "discourse");
|
||||
await click(".search-cta");
|
||||
|
||||
assert.ok(queryAll(".fps-topic").length === 1, "has one post");
|
||||
|
@ -42,7 +42,7 @@ acceptance("Search - Mobile", function (needs) {
|
|||
|
||||
assert.equal(
|
||||
queryAll("input.full-page-search").val(),
|
||||
"posts",
|
||||
"discourse",
|
||||
"it does not reset input when hitting search icon again"
|
||||
);
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -219,31 +219,15 @@ export function applyDefaultHandlers(pretender) {
|
|||
pretender.post("/clicks/track", success);
|
||||
|
||||
pretender.get("/search", (request) => {
|
||||
if (request.queryParams.q === "posts") {
|
||||
return response({
|
||||
posts: [
|
||||
{
|
||||
id: 1234,
|
||||
},
|
||||
],
|
||||
});
|
||||
} else if (request.queryParams.q === "evil") {
|
||||
return response({
|
||||
posts: [
|
||||
{
|
||||
id: 1234,
|
||||
},
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 6,
|
||||
name: "eviltrout",
|
||||
},
|
||||
],
|
||||
});
|
||||
if (request.queryParams.q === "discourse") {
|
||||
return response(fixturesByUrl["/search.json"]);
|
||||
} else if (request.queryParams.q === "discourse in:personal") {
|
||||
const fixtures = fixturesByUrl["/search.json"];
|
||||
fixtures.topics.firstObject.archetype = "private_message";
|
||||
return response(fixtures);
|
||||
} else {
|
||||
return response({});
|
||||
}
|
||||
|
||||
return response({});
|
||||
});
|
||||
|
||||
pretender.put("/u/eviltrout.json", () => response({ user: {} }));
|
||||
|
|
Loading…
Reference in New Issue
Block a user