diff --git a/app/javascript/flavours/glitch/actions/search.js b/app/javascript/flavours/glitch/actions/search.js
index 5bb3aa3a79..7e54740d52 100644
--- a/app/javascript/flavours/glitch/actions/search.js
+++ b/app/javascript/flavours/glitch/actions/search.js
@@ -170,6 +170,11 @@ export const openURL = routerHistory => (dispatch, getState) => {
export const clickSearchResult = (q, type) => (dispatch, getState) => {
const previous = getState().getIn(['search', 'recent']);
+
+ if (previous.some(x => x.get('q') === q && x.get('type') === type)) {
+ return;
+ }
+
const me = getState().getIn(['meta', 'me']);
const current = previous.add(fromJS({ type, q })).takeLast(4);
@@ -198,4 +203,4 @@ export const hydrateSearch = () => (dispatch, getState) => {
if (history !== null) {
dispatch(updateSearchHistory(history));
}
-};
\ No newline at end of file
+};
diff --git a/app/javascript/flavours/glitch/features/compose/components/search.jsx b/app/javascript/flavours/glitch/features/compose/components/search.jsx
index 70c24d0a42..fa995663f0 100644
--- a/app/javascript/flavours/glitch/features/compose/components/search.jsx
+++ b/app/javascript/flavours/glitch/features/compose/components/search.jsx
@@ -63,14 +63,14 @@ class Search extends PureComponent {
};
defaultOptions = [
- { label: <>has: >, action: e => { e.preventDefault(); this._insertText('has:'); } },
- { label: <>is: >, action: e => { e.preventDefault(); this._insertText('is:'); } },
- { label: <>language: >, action: e => { e.preventDefault(); this._insertText('language:'); } },
- { label: <>from: >, action: e => { e.preventDefault(); this._insertText('from:'); } },
- { label: <>before: >, action: e => { e.preventDefault(); this._insertText('before:'); } },
- { label: <>during: >, action: e => { e.preventDefault(); this._insertText('during:'); } },
- { label: <>after: >, action: e => { e.preventDefault(); this._insertText('after:'); } },
- { label: <>in: >, action: e => { e.preventDefault(); this._insertText('in:'); } }
+ { key: 'prompt-has', label: <>has: >, action: e => { e.preventDefault(); this._insertText('has:'); } },
+ { key: 'prompt-is', label: <>is: >, action: e => { e.preventDefault(); this._insertText('is:'); } },
+ { key: 'prompt-language', label: <>language: >, action: e => { e.preventDefault(); this._insertText('language:'); } },
+ { key: 'prompt-from', label: <>from: >, action: e => { e.preventDefault(); this._insertText('from:'); } },
+ { key: 'prompt-before', label: <>before: >, action: e => { e.preventDefault(); this._insertText('before:'); } },
+ { key: 'prompt-during', label: <>during: >, action: e => { e.preventDefault(); this._insertText('during:'); } },
+ { key: 'prompt-after', label: <>after: >, action: e => { e.preventDefault(); this._insertText('after:'); } },
+ { key: 'prompt-in', label: <>in: >, action: e => { e.preventDefault(); this._insertText('in:'); } }
];
setRef = c => {
@@ -263,6 +263,8 @@ class Search extends PureComponent {
const { recent } = this.props;
return recent.toArray().map(search => ({
+ key: `${search.get('type')}/${search.get('q')}`,
+
label: labelForRecentSearch(search),
action: () => this.handleRecentSearchClick(search),
@@ -347,8 +349,8 @@ class Search extends PureComponent {
- {recent.size > 0 ? this._getOptions().map(({ label, action, forget }, i) => (
-