Skip to content

Commit 477ae05

Browse files
Merge pull request #5694 from Countly/rating-consent
[SER-1961] [star-rating] Fix consent field
2 parents f87cbc2 + 12c8d69 commit 477ae05

File tree

2 files changed

+31
-65
lines changed

2 files changed

+31
-65
lines changed

plugins/star-rating/frontend/public/javascripts/countly.views.js

+29-63
Original file line numberDiff line numberDiff line change
@@ -116,24 +116,25 @@
116116
methods: {
117117
// drawer event handlers
118118
onConsentCheckbox: function(ev) {
119-
ev.links = {
120-
"link": [
121-
{
122-
"text": "Terms and Conditions",
123-
"link": "https://termsandconditions.com",
124-
"textValue": "Terms and Conditions",
125-
"linkValue": "https://termsandconditions.com"
126-
},
127-
{
128-
"text": "Privacy Policy",
129-
"link": "https://privacyPolicy.com",
130-
"textValue": "Privacy Policy",
131-
"linkValue": "https://privacyPolicy.com"
132-
}
133-
],
134-
"finalText": "I agree to the Terms and Conditions and Privacy Policy."
135-
136-
};
119+
if (!ev.links || ev.links.length < 1) {
120+
ev.links = {
121+
"link": [
122+
{
123+
"text": "Terms and Conditions",
124+
"link": "https://termsandconditions.com",
125+
"textValue": "Terms and Conditions",
126+
"linkValue": "https://termsandconditions.com"
127+
},
128+
{
129+
"text": "Privacy Policy",
130+
"link": "https://privacyPolicy.com",
131+
"textValue": "Privacy Policy",
132+
"linkValue": "https://privacyPolicy.com"
133+
}
134+
],
135+
"finalText": "I agree to the Terms and Conditions and Privacy Policy.",
136+
};
137+
}
137138
},
138139
finalTxt: function(links) {
139140
let finalText = links.finalText;
@@ -222,31 +223,7 @@
222223
onOpen: function() {
223224
var self = this;
224225
var loadImage = new Image();
225-
if (this.controls.initialEditedObject.consent === true || this.controls.initialEditedObject.consent === "true") {
226-
this.controls.initialEditedObject.consent = true;
227-
this.consent = true;
228-
}
229-
else {
230-
this.controls.initialEditedObject.consent = false;
231-
}
232-
if (Array.isArray(this.controls.initialEditedObject.links)) {
233-
this.controls.initialEditedObject.links.forEach(function(link) {
234-
if (link.linkValue.indexOf('term')) {
235-
link.text = "Terms and Conditions";
236-
link.link = "https://termsandconditions.com";
237-
}
238-
else if (link.linkValue.indexOf('privacy')) {
239-
link.text = "Privacy Policy";
240-
link.link = "https://privacyPolicy.com";
241-
}
242-
else {
243-
link.text = "Another Link";
244-
link.link = "https://otherlink.com";
245-
}
246-
link.linkValue = link.linkValue.replace(new RegExp('[?&]' + CLY_X_INT + '=[^&]*'), '').replace(/[?&]$/, '');
247-
});
248-
this.controls.initialEditedObject.links = {"link": this.controls.initialEditedObject.links, "finalText": this.controls.initialEditedObject.finalText};
249-
}
226+
250227
if (this.controls.initialEditedObject.logo) {
251228

252229
if (this.controls.initialEditedObject.logo.indexOf("feedback_logo") > -1
@@ -806,24 +783,6 @@
806783
}
807784
}
808785
this.openDrawer("widget", {
809-
links: {
810-
"link": [
811-
{
812-
"text": "Terms and Conditions",
813-
"link": "https://termsandconditions.com",
814-
"textValue": "Terms and Conditions",
815-
"linkValue": "https://termsandconditions.com"
816-
},
817-
{
818-
"text": "Privacy Policy",
819-
"link": "https://privacyPolicy.com",
820-
"textValue": "Privacy Policy",
821-
"linkValue": "https://privacyPolicy.com"
822-
}
823-
],
824-
"finalText": "I agree to the Terms and Conditions and Privacy Policy."
825-
826-
},
827786
consent: false,
828787
popup_header_text: 'What\'s your opinion about this page?',
829788
popup_thanks_message: 'Thanks for your feedback!',
@@ -1145,6 +1104,14 @@
11451104
steps: null
11461105
};
11471106
}
1107+
1108+
if (this.widget.consent === true || this.widget.consent === "true") {
1109+
this.widget.consent = true;
1110+
}
1111+
else {
1112+
this.widget.consent = false;
1113+
}
1114+
11481115
if (Array.isArray(this.widget.links) && this.widget.links.length) {
11491116
this.widget.links.forEach(function(link) {
11501117
if (link.linkValue.indexOf('term')) {
@@ -1162,7 +1129,6 @@
11621129
link.linkValue = link.linkValue.replace(new RegExp('[?&]' + CLY_X_INT + '=[^&]*'), '').replace(/[?&]$/, '');
11631130
});
11641131
this.widget.links = {"link": this.widget.links, "finalText": this.widget.finalText};
1165-
this.widget.consent = true;
11661132
}
11671133
else {
11681134
this.widget.links = {
@@ -1183,8 +1149,8 @@
11831149
"finalText": "I agree to the Terms and Conditions and Privacy Policy."
11841150

11851151
};
1186-
this.widget.consent = false;
11871152
}
1153+
11881154
if (!this.widget.rating_symbol) {
11891155
this.widget.rating_symbol = "emojis";
11901156
}

plugins/star-rating/frontend/public/templates/widget-detail.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,5 @@ <h3 class="ratings-widget-detail-view__widget-name" data-test-id="ratings-detail
8282
</cly-dynamic-tabs>
8383

8484
</cly-main>
85-
<drawer @widget-edited="refresh()" :settings="drawerSettings" :controls="drawers.widget"></drawer>
86-
</div>
85+
<drawer @widgets-refresh="refresh()" :settings="drawerSettings" :controls="drawers.widget"></drawer>
86+
</div>

0 commit comments

Comments
 (0)