Skip to content

Commit

Permalink
Merge branch 'master' into v10.1-documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
amyblais authored Oct 15, 2024
2 parents 1039695 + 49561ea commit 48efbdb
Show file tree
Hide file tree
Showing 11 changed files with 1,455 additions and 70 deletions.
11 changes: 10 additions & 1 deletion source/_static/js/mattermost-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,15 @@ class SearchClass {
if (this.hasConfigSettingsIndex()) {
console.log("query(): searching lunr");
/** @type {Array<{score: number, ref: string, matchData: Record<string,any>}>} */
const lunrResults = this._lunrConfigSettingIndex.search(query);
let lunrResults;
try {
lunrResults = this._lunrConfigSettingIndex.search(query);
} catch (e) {
console.log('Error when trying to search query ' + JSON.stringify(query) + ' in lunr');
this.setPostSearchStatus(0, 0);
return;
}

console.log(`query(): lunr search returned ${lunrResults.length} results`);
configSettingSearchResults = lunrResults.map((result) => {
/** @type {Array<ConfigSettingRecord>} */
Expand Down Expand Up @@ -638,6 +646,7 @@ class SearchClass {
if (!numberOfResults && !numberOfConfigSettingResults) {
const searchStatusEl = document.getElementById("search-summary");
if (searchStatusEl) {
this.title.innerText = _('Search Results');
searchStatusEl.innerText = "Your search did not match any documents. Please make sure that all words are spelled correctly.";
}
return;
Expand Down
120 changes: 68 additions & 52 deletions source/_templates/search.html
Original file line number Diff line number Diff line change
@@ -1,54 +1,70 @@
{% extends "page.html" %}
{%- block regular_scripts -%}
{# Load lunr.js and mark.js before anything else #}
<script type="text/javascript" src="https://unpkg.com/[email protected]/lunr.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.es6.min.js"
integrity="sha512-jZSRKDD86PmExf0ZoXQEMxhtxvLtOxo2xMJwgnx3VE/5VT5c8LCsnvut4wK3fIdFyO4szlbz/2tpg+xulnJDyQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
{{ super() }}
<script src="{{ pathto('_static/js/mattermost-search.js', 1) }}"></script>
<script src="{{ pathto('_static/language_data.js', 1) }}"></script>
{%- endblock regular_scripts -%}
{%- block htmltitle -%}
<title>{{ _("Search") }} - {{ docstitle }}</title>
{%- endblock htmltitle -%}
{% block content %}
<noscript>
<div class="admonition error">
<p class="admonition-title">{% trans %}Error{% endtrans %}</p>
<p>
{% trans %}Please activate JavaScript to enable the search functionality.{% endtrans %}
</p>
</div>
</noscript>
{% extends "page.html" %} {%- block regular_scripts -%} {# Load lunr.js and
mark.js before anything else #}
<script
type="text/javascript"
src="https://unpkg.com/[email protected]/lunr.js"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.es6.min.js"
integrity="sha512-jZSRKDD86PmExf0ZoXQEMxhtxvLtOxo2xMJwgnx3VE/5VT5c8LCsnvut4wK3fIdFyO4szlbz/2tpg+xulnJDyQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
{{ super() }}
<script src="{{ pathto('_static/js/mattermost-search.js', 1) }}"></script>
<script src="{{ pathto('_static/language_data.js', 1) }}"></script>
{%- endblock regular_scripts -%} {%- block htmltitle -%}
<title>{{ _("Search") }} - {{ docstitle }}</title>
{%- endblock htmltitle -%} {% block content %}
<noscript>
<div class="admonition error">
<p class="admonition-title">{% trans %}Error{% endtrans %}</p>
<p>
{% trans %}Please activate JavaScript to enable the search
functionality.{% endtrans %}
</p>
</div>
</noscript>

<div style="display:inline-block">
<h2 id="search-title" style="float: left;"></h2><h2 id="search-dots" style="float: right;"></h2>
</div>
<p id="search-summary" class="search-summary"></p>
<!-- configuration setting-specific results will display here -->
<div id="config-setting-results-section" style="display: none;">
<h3>Configuration settings</h3><a id="config-setting-results-anchor"></a>
<div class="search" id="config-setting-results-list"></div>
</div>
<!-- all other results will display here -->
<div id="search-additional-information-header" style="display: none;">
<h3>Additional information</h3><a id="search-results-anchor"></a>
</div>
<div id="search-results">
<ul class="search" id="search-results-list"></ul>
</div>
{% endblock %}
{% block scripts -%}
{{ super() }}
{# Load the search indexes after the DOM has finished loading #}
<script lang="js">
_ready(() => {
Search.loadIndex("{{ pathto('searchindex.js', 1) }}");
});
_ready(() => {
Search.loadConfigSettingsIndex("{{ pathto('config-settings-index.json', 1) }}");
});
</script>
<div style="display: inline-block">
<h2 id="search-title" style="float: left"></h2>
<h2 id="search-dots" style="float: right"></h2>
</div>
<p id="search-summary" class="search-summary"></p>
<!-- configuration setting-specific results will display here -->
<div id="config-setting-results-section" style="display: none">
<h3>Configuration settings</h3>
<a id="config-setting-results-anchor"></a>
<div class="search" id="config-setting-results-list"></div>
</div>
<!-- all other results will display here -->
<div id="search-additional-information-header" style="display: none">
<h3>Additional information</h3>
<a id="search-results-anchor"></a>
</div>
<div id="search-results">
<ul class="search" id="search-results-list"></ul>
</div>
{% endblock %} {% block scripts -%} {{ super() }} {# Load the search indexes
after the DOM has finished loading #}
<script lang="js">
_ready(() => {
Search.loadIndex("{{ pathto('searchindex.js', 1) }}");
});
_ready(() => {
Search.loadConfigSettingsIndex("{{ pathto('config-settings-index.json', 1) }}");
});

document.addEventListener('DOMContentLoaded', function() {
const searchTitle = document.getElementById('search-title');
const searchResults = document.getElementById('search-results');
const searchSummary = document.getElementById('search-summary');
const searchQuery = new URLSearchParams(window.location.search).get('q');

if (!searchQuery || searchQuery.trim() === '') {
searchTitle.textContent = "Search Results";
searchSummary.textContent = "Please enter at least one search term.";
}
});
</script>
{%- endblock scripts %}
1 change: 0 additions & 1 deletion source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3827,7 +3827,6 @@ def setup(_: Sphinx):
:class: theme-icon
.. |acknowledge-button| image:: /images/Ack-Button-Default.svg
:alt: Select the Acknowledge button to indicate that you've read it and taken necessary action.
:class: theme-icon
.. |reply-arrow| image:: /images/reply-outline_F0F20.svg
:alt: Reply icon.
:class: theme-icon
Expand Down
26 changes: 14 additions & 12 deletions source/configure/plugins-configuration-settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ Access the following configuration settings in the System Console by going to **
.. config:setting:: plugins-surveysenable
:displayname: Enable plugin (Plugins - User Satisfaction Surveys)
:systemconsole: Plugins > User Satisfaction Surveys
:configjson: N/A
:configjson: PluginSettings.PluginStates.com.mattermost.user-survey.Enable
:environment: N/A

- **true**: (Default) Enables the Mattermost User Satisfaction Surveys plugin on your Mattermost workspace.
Expand All @@ -1369,15 +1369,16 @@ Access the following configuration settings in the System Console by going to **
Enable plugin
~~~~~~~~~~~~~

+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| - **true**: (Default) Enables the Mattermost User Satisfaction Surveys plugin on your Mattermost workspace. | - System Config path: **Plugins > User Satisfaction Surveys** |
| - **false**: Disables the Mattermost User Satisfaction Surveys plugin on your Mattermost workspace. | |
+---------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
+---------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+
| - **true**: (Default) Enables the Mattermost User Satisfaction Surveys plugin on your Mattermost workspace. | - System Config path: **Plugins > User Satisfaction Surveys** |
| - **false**: Disables the Mattermost User Satisfaction Surveys plugin on your Mattermost workspace. | - ``config.json`` setting: ``PluginSettings.PluginStates.com.mattermost.user-survey.Enable`` |
| | - Environment variable: N/A |
+---------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+

.. config:setting:: plugins-surveysenablesend
:displayname: Enable user satisfaction survey (Plugins - User Satisfaction Surveys)
:systemconsole: Plugins > User Satisfaction Surveys
:configjson: N/A
:configjson: PluginSettings.PluginStates.com.mattermost.user-survey.Enable
:environment: N/A

- **true**: A user satisfaction survey is sent to all users every quarter.
Expand All @@ -1386,12 +1387,13 @@ Enable plugin
Enable user satisfaction survey
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+-----------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| - **true**: A survey is sent to all users every quarter. Results are used by Mattermost, Inc. to improve the product. | - System Config path: **Plugins > User Satisfaction Surveys** |
| - **false**: (Default) User satisfaction surveys are disabled. | |
+-----------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
| **Note**: See the `Mattermost Privacy Policy <https://mattermost.com/privacy-policy/>`__ for more information on the collection and use of information by Mattermost. |
+-----------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------+
+-----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| - **true**: A survey is sent to all users every quarter. Results are used by Mattermost, Inc. to improve the product. | - System Config path: **Plugins > User Satisfaction Surveys** |
| - **false**: (Default) User satisfaction surveys are disabled. | - ``config.json`` setting: ``PluginSettings.Plugins.com.mattermost.user-survey.systemconsolesetting.EnableSurvey`` |
| | - Environment variable: N/A |
+-----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+
| **Note**: See the `Mattermost Privacy Policy <https://mattermost.com/privacy-policy/>`__ for more information on the collection and use of information by Mattermost. |
+-----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+

----

Expand Down
Loading

0 comments on commit 48efbdb

Please sign in to comment.