Allow disabling of tag suggestion filtering

This commit is contained in:
byte[] 2022-01-20 17:37:05 -05:00
parent a9fb361591
commit ce5405c670
3 changed files with 10 additions and 2 deletions

View file

@ -2,6 +2,7 @@
/*
* Client-side tag completion.
*/
import store from './store';
/**
* @typedef {object} Result
@ -126,6 +127,8 @@ export class LocalAutocompleter {
* @param {{[key: string]: Result}} results
*/
scanResults(getResult, compare, results) {
const unfilter = store.get('unfilter_tag_suggestions');
let min = 0;
let max = this.numTags;
@ -154,8 +157,8 @@ export class LocalAutocompleter {
break;
}
// Add if no associations are filtered
if (hiddenTags.findIndex(ht => result.associations.includes(ht)) === -1) {
// Add if not filtering or no associations are filtered
if (unfilter || hiddenTags.findIndex(ht => result.associations.includes(ht)) === -1) {
results[result.name] = result;
}
}

View file

@ -43,6 +43,7 @@ defmodule PhilomenaWeb.SettingController do
|> set_cookie(user_params, "hide_staff_tools", "hide_staff_tools")
|> set_cookie(user_params, "hide_uploader", "hide_uploader")
|> set_cookie(user_params, "hide_score", "hide_score")
|> set_cookie(user_params, "unfilter_tag_suggestions", "unfilter_tag_suggestions")
end
defp set_cookie(conn, params, param_name, cookie_name) do

View file

@ -154,6 +154,10 @@ h1 Content Settings
=> label f, :hide_uploader
=> checkbox f, :hide_uploader, checked: @conn.cookies["hide_uploader"] == "true"
.fieldlabel: i Hide the uploader and date posted information on image pages.
.field
=> label f, :unfilter_tag_suggestions
=> checkbox f, :unfilter_tag_suggestions, checked: @conn.cookies["unfilter_tag_suggestions"] == "true"
.fieldlabel: i Don't attempt to filter tag suggestions using your current filter.
.field
=> label f, :hide_score
=> checkbox f, :hide_score, checked: @conn.cookies["hide_score"] == "true"