Skip to content

Commit ebec6cc

Browse files
committed
Feedback form: Add hidden fields
Helps #868
1 parent 2f6959e commit ebec6cc

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

kolibri_explore_plugin/assets/src/components/DiscoveryNavBar.vue

Lines changed: 31 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,24 @@
99101
return assets.EndlessLogo;
100102
},
101103
feedbackUrl() {
104+
// FIXME add language=currentLanguage and platform=
105+
const hiddenFormFields = new URLSearchParams({
106+
language: currentLanguage,
107+
platform: 'unknown',
108+
kolibriVersion: window.kolibriCoreAppGlobal.version,
109+
});
110+
111+
if (this.buildInfo) {
112+
hiddenFormFields[
113+
'endlessKeyRelease'
114+
] = `${this.buildInfo.version_name} ${this.buildInfo.last_release}`;
115+
}
116+
102117
switch (languageIdToCode(currentLanguage)) {
103118
case 'es':
104-
return plugin_data.feedbackUrlEs;
119+
return plugin_data.feedbackUrlEs + '#' + hiddenFormFields.toString();
105120
default:
106-
return plugin_data.feedbackUrl;
121+
return plugin_data.feedbackUrl + '#' + hiddenFormFields.toString();
107122
}
108123
},
109124
showFeedbackButton() {
@@ -116,6 +131,9 @@
116131
return !!plugin_data.androidApplicationId && !!plugin_data.windowsApplicationId;
117132
},
118133
},
134+
mounted() {
135+
this.getBuildInfo();
136+
},
119137
created() {
120138
this.isOffline = !navigator.onLine;
121139
window.addEventListener('offline', this.onOffline);
@@ -169,6 +187,17 @@
169187
this.$store.commit('topicsRoot/SET_SHOW_SIDE_NAV', true);
170188
}
171189
},
190+
getBuildInfo() {
191+
const buildInfo = urls.static(`build-info.json`);
192+
fetch(buildInfo)
193+
.then(response => response.json())
194+
.then(data => {
195+
this.buildInfo = data;
196+
})
197+
.catch(error => {
198+
console.error(error);
199+
});
200+
},
172201
},
173202
$trs: {
174203
feedbackLabel: 'Feedback',

0 commit comments

Comments
 (0)