mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
UX: remove in:unpinned
filter from advanced search page. (#9911)
This commit is contained in:
parent
74d28a43d1
commit
ce1491e830
|
@ -21,7 +21,7 @@ const REGEXP_MIN_POST_COUNT_PREFIX = /^min_post_count:/gi;
|
|||
const REGEXP_POST_TIME_PREFIX = /^(before|after):/gi;
|
||||
const REGEXP_TAGS_REPLACE = /(^(tags?:|#(?=[a-z0-9\-]+::tag))|::tag\s?$)/gi;
|
||||
|
||||
const REGEXP_IN_MATCH = /^(in|with):(posted|created|watching|tracking|bookmarks|first|pinned|unpinned|wiki|unseen|image)/gi;
|
||||
const REGEXP_IN_MATCH = /^(in|with):(posted|created|watching|tracking|bookmarks|first|pinned|wiki|unseen|image)/gi;
|
||||
const REGEXP_SPECIAL_IN_LIKES_MATCH = /^in:likes/gi;
|
||||
const REGEXP_SPECIAL_IN_TITLE_MATCH = /^in:title/gi;
|
||||
const REGEXP_SPECIAL_IN_PERSONAL_MATCH = /^in:personal/gi;
|
||||
|
@ -51,7 +51,6 @@ export default Component.extend({
|
|||
this.inOptionsForAll = [
|
||||
{ name: I18n.t("search.advanced.filters.first"), value: "first" },
|
||||
{ name: I18n.t("search.advanced.filters.pinned"), value: "pinned" },
|
||||
{ name: I18n.t("search.advanced.filters.unpinned"), value: "unpinned" },
|
||||
{ name: I18n.t("search.advanced.filters.wiki"), value: "wiki" },
|
||||
{ name: I18n.t("search.advanced.filters.images"), value: "images" }
|
||||
];
|
||||
|
|
|
@ -2005,7 +2005,6 @@ en:
|
|||
bookmarks: I bookmarked
|
||||
first: are the very first post
|
||||
pinned: are pinned
|
||||
unpinned: are not pinned
|
||||
seen: I read
|
||||
unseen: I've not read
|
||||
wiki: are wiki
|
||||
|
|
|
@ -354,14 +354,6 @@ class Search
|
|||
posts.where("topics.pinned_at IS NOT NULL")
|
||||
end
|
||||
|
||||
advanced_filter(/^in:unpinned$/) do |posts|
|
||||
if @guardian.user
|
||||
posts.where("topics.pinned_at IS NOT NULL AND topics.id IN (
|
||||
SELECT topic_id FROM topic_users WHERE user_id = ? AND cleared_pinned_at IS NOT NULL
|
||||
)", @guardian.user.id)
|
||||
end
|
||||
end
|
||||
|
||||
advanced_filter(/^in:wiki$/) do |posts, match|
|
||||
posts.where(wiki: true)
|
||||
end
|
||||
|
|
|
@ -946,7 +946,7 @@ describe Search do
|
|||
|
||||
describe 'Advanced search' do
|
||||
|
||||
it 'supports pinned and unpinned' do
|
||||
it 'supports pinned' do
|
||||
topic = Fabricate(:topic)
|
||||
Fabricate(:post, raw: 'hi this is a test 123 123', topic: topic)
|
||||
_post = Fabricate(:post, raw: 'boom boom shake the room', topic: topic)
|
||||
|
@ -957,11 +957,6 @@ describe Search do
|
|||
guardian = Guardian.new(user)
|
||||
|
||||
expect(Search.execute('boom in:pinned').posts.length).to eq(1)
|
||||
expect(Search.execute('boom in:unpinned', guardian: guardian).posts.length).to eq(0)
|
||||
|
||||
topic.clear_pin_for(user)
|
||||
|
||||
expect(Search.execute('boom in:unpinned', guardian: guardian).posts.length).to eq(1)
|
||||
end
|
||||
|
||||
it 'supports wiki' do
|
||||
|
|
|
@ -135,7 +135,6 @@ QUnit.test("Right filters are shown to anonymous users", async assert => {
|
|||
|
||||
assert.ok(inSelector.rowByValue("first").exists());
|
||||
assert.ok(inSelector.rowByValue("pinned").exists());
|
||||
assert.ok(inSelector.rowByValue("unpinned").exists());
|
||||
assert.ok(inSelector.rowByValue("wiki").exists());
|
||||
assert.ok(inSelector.rowByValue("images").exists());
|
||||
|
||||
|
@ -161,7 +160,6 @@ QUnit.test("Right filters are shown to logged-in users", async assert => {
|
|||
|
||||
assert.ok(inSelector.rowByValue("first").exists());
|
||||
assert.ok(inSelector.rowByValue("pinned").exists());
|
||||
assert.ok(inSelector.rowByValue("unpinned").exists());
|
||||
assert.ok(inSelector.rowByValue("wiki").exists());
|
||||
assert.ok(inSelector.rowByValue("images").exists());
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user