Skip to content

Commit 604ef47

Browse files
committed
Feedback form: Add hidden fields
Add current language, current project and Kolibri and Endless Key versions as hidden fields. In the format accepted by Typeform. Helps #868
1 parent 2f6959e commit 604ef47

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

kolibri_explore_plugin/assets/src/components/DiscoveryNavBar.vue

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767

6868
<script>
6969
70+
import urls from 'kolibri.urls';
7071
import { currentLanguage, languageIdToCode } from 'kolibri.utils.i18n';
7172
import ViewDashboardOutlineIcon from 'vue-material-design-icons/ViewDashboardOutline.vue';
7273
import MagnifyIcon from 'vue-material-design-icons/Magnify.vue';
@@ -91,6 +92,7 @@
9192
mixins: [commonExploreStrings],
9293
data() {
9394
return {
95+
buildInfo: null,
9496
isOffline: false,
9597
};
9698
},
@@ -99,11 +101,23 @@
99101
return assets.EndlessLogo;
100102
},
101103
feedbackUrl() {
104+
const hiddenFormFields = new URLSearchParams({
105+
language: currentLanguage,
106+
kolibriVersion: window.kolibriCoreAppGlobal.version,
107+
kolibriProject: plugin_data.kolibriProject || 'Unknown',
108+
});
109+
110+
if (this.buildInfo) {
111+
hiddenFormFields[
112+
'endlessKeyRelease'
113+
] = `${this.buildInfo.version_name} ${this.buildInfo.last_release}`;
114+
}
115+
102116
switch (languageIdToCode(currentLanguage)) {
103117
case 'es':
104-
return plugin_data.feedbackUrlEs;
118+
return plugin_data.feedbackUrlEs + '#' + hiddenFormFields.toString();
105119
default:
106-
return plugin_data.feedbackUrl;
120+
return plugin_data.feedbackUrl + '#' + hiddenFormFields.toString();
107121
}
108122
},
109123
showFeedbackButton() {
@@ -116,6 +130,9 @@
116130
return !!plugin_data.androidApplicationId && !!plugin_data.windowsApplicationId;
117131
},
118132
},
133+
mounted() {
134+
this.getBuildInfo();
135+
},
119136
created() {
120137
this.isOffline = !navigator.onLine;
121138
window.addEventListener('offline', this.onOffline);
@@ -169,6 +186,17 @@
169186
this.$store.commit('topicsRoot/SET_SHOW_SIDE_NAV', true);
170187
}
171188
},
189+
getBuildInfo() {
190+
const buildInfo = urls.static(`build-info.json`);
191+
fetch(buildInfo)
192+
.then(response => response.json())
193+
.then(data => {
194+
this.buildInfo = data;
195+
})
196+
.catch(error => {
197+
console.error(error);
198+
});
199+
},
172200
},
173201
$trs: {
174202
feedbackLabel: 'Feedback',

kolibri_explore_plugin/kolibri_plugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def plugin_data(self):
6464
"hideDiscoveryTab": conf.OPTIONS["Explore"]["HIDE_DISCOVERY_TAB"],
6565
"feedbackUrl": conf.OPTIONS["Explore"]["FEEDBACK_URL"],
6666
"feedbackUrlEs": conf.OPTIONS["Explore"]["FEEDBACK_URL_ES"],
67+
"kolibriProject": conf.OPTIONS["Deployment"]["PROJECT"],
6768
}
6869
if "Pwa" in conf.OPTIONS:
6970
pwa_options = {

0 commit comments

Comments
 (0)