Revert "FEATURE: Added unlisted topics option to advanced search (#7447)"
This reverts commit 539723f8ff
since it is failing the build.
This commit is contained in:
parent
ae493f4722
commit
7869a10d18
|
@ -28,17 +28,6 @@ const REGEXP_POST_TIME_WHEN = /^(before|after)/gi;
|
|||
|
||||
const IN_OPTIONS_MAPPING = { images: "with" };
|
||||
|
||||
const DEFAULT_STATUS_OPTIONS = [
|
||||
{ name: I18n.t("search.advanced.statuses.open"), value: "open" },
|
||||
{ name: I18n.t("search.advanced.statuses.closed"), value: "closed" },
|
||||
{ name: I18n.t("search.advanced.statuses.archived"), value: "archived" },
|
||||
{ name: I18n.t("search.advanced.statuses.noreplies"), value: "noreplies" },
|
||||
{
|
||||
name: I18n.t("search.advanced.statuses.single_user"),
|
||||
value: "single_user"
|
||||
}
|
||||
];
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: ["search-advanced-options"],
|
||||
|
||||
|
@ -58,6 +47,17 @@ export default Ember.Component.extend({
|
|||
{ name: I18n.t("search.advanced.filters.images"), value: "images" }
|
||||
],
|
||||
|
||||
statusOptions: [
|
||||
{ name: I18n.t("search.advanced.statuses.open"), value: "open" },
|
||||
{ name: I18n.t("search.advanced.statuses.closed"), value: "closed" },
|
||||
{ name: I18n.t("search.advanced.statuses.archived"), value: "archived" },
|
||||
{ name: I18n.t("search.advanced.statuses.noreplies"), value: "noreplies" },
|
||||
{
|
||||
name: I18n.t("search.advanced.statuses.single_user"),
|
||||
value: "single_user"
|
||||
}
|
||||
],
|
||||
|
||||
postTimeOptions: [
|
||||
{ name: I18n.t("search.advanced.post.time.before"), value: "before" },
|
||||
{ name: I18n.t("search.advanced.post.time.after"), value: "after" }
|
||||
|
@ -102,20 +102,10 @@ export default Ember.Component.extend({
|
|||
days: ""
|
||||
}
|
||||
},
|
||||
statusOptions: DEFAULT_STATUS_OPTIONS,
|
||||
inOptions: this.currentUser
|
||||
? this.inOptionsForUsers.concat(this.inOptionsForAll)
|
||||
: this.inOptionsForAll
|
||||
});
|
||||
|
||||
if (this.currentUser.get("staff")) {
|
||||
this.setProperties({
|
||||
statusOptions: DEFAULT_STATUS_OPTIONS.concat({
|
||||
name: I18n.t("search.advanced.statuses.unlisted"),
|
||||
value: "unlisted"
|
||||
})
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_update() {
|
||||
|
|
|
@ -1772,7 +1772,6 @@ en:
|
|||
archived: are archived
|
||||
noreplies: have zero replies
|
||||
single_user: contain a single user
|
||||
unlisted: are unlisted
|
||||
post:
|
||||
count:
|
||||
label: Minimum Post Count
|
||||
|
|
|
@ -280,14 +280,6 @@ class Search
|
|||
posts.where("topics.participant_count = 1")
|
||||
end
|
||||
|
||||
advanced_filter(/^status:unlisted$/) do |posts|
|
||||
if @guardian.is_staff?
|
||||
posts.where("NOT topics.visible")
|
||||
else
|
||||
posts.where("1=0")
|
||||
end
|
||||
end
|
||||
|
||||
advanced_filter(/^posts_count:(\d+)$/) do |posts, match|
|
||||
posts.where("topics.posts_count = ?", match.to_i)
|
||||
end
|
||||
|
@ -745,7 +737,7 @@ class Search
|
|||
|
||||
is_topic_search = @search_context.present? && @search_context.is_a?(Topic)
|
||||
|
||||
posts = posts.where("topics.visible") if !is_topic_search && !@guardian.is_staff?
|
||||
posts = posts.where("topics.visible") unless is_topic_search
|
||||
|
||||
if opts[:private_messages] || (is_topic_search && @search_context.private_message?)
|
||||
posts = posts.where("topics.archetype = ?", Archetype.private_message)
|
||||
|
|
|
@ -1130,25 +1130,6 @@ describe Search do
|
|||
.to eq([post7.id, post8.id])
|
||||
end
|
||||
|
||||
it "can search for unlisted topics as staff" do
|
||||
topic1 = Fabricate(:topic, visible: false)
|
||||
post = Fabricate(:post, raw: 'Testing post', topic: topic1)
|
||||
topic2 = Fabricate(:topic)
|
||||
Fabricate(:post, raw: 'Testing post', topic: topic2)
|
||||
|
||||
results = Search.execute('Testing post status:unlisted', guardian: Guardian.new(Fabricate(:moderator)))
|
||||
expect(results.posts.length).to eq(1)
|
||||
expect(results.posts.first.id).to eq(post.id)
|
||||
end
|
||||
|
||||
it "unlisted topics can't be found using search for non-staff" do
|
||||
topic = Fabricate(:topic, visible: false)
|
||||
Fabricate(:post, raw: 'Testing post', topic: topic)
|
||||
|
||||
results = Search.execute('Testing post', guardian: Guardian.new(Fabricate(:user)))
|
||||
expect(results.posts.length).to eq(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it "can find posts which contains filetypes" do
|
||||
|
|
Loading…
Reference in New Issue