Skip to content

Commit

Permalink
Add back urlDefined and remove null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
khalidadil committed Oct 7, 2021
1 parent a9daee1 commit abc93d0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 25 deletions.
11 changes: 4 additions & 7 deletions src/plugins/conditionWidget/components/ConditionWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ export default {
};
},
computed: {
urlDefined() {
return this.internalDomainObject.url && this.internalDomainObject.url.length > 0;
},
url() {
const urlDefined = this.internalDomainObject.url && this.internalDomainObject.url.length > 0;
let url = urlDefined ? this.internalDomainObject.url : null;
if (url) {
url = sanitizeUrl(url);
}
return url;
return this.urlDefined ? sanitizeUrl(this.internalDomainObject.url) : null;
}
},
mounted() {
Expand Down
7 changes: 1 addition & 6 deletions src/plugins/hyperlink/HyperlinkLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ export default {
return true;
},
url() {
let url = this.domainObject.url;
if (url) {
url = sanitizeUrl(url);
}
return url;
return sanitizeUrl(this.domainObject.url);
}
}
};
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/summaryWidget/src/SummaryWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ define([
*/
SummaryWidget.prototype.addHyperlink = function (url, openNewTab) {
if (url) {
const sanitizeUrl = urlSanitizeLib.sanitizeUrl;
url = sanitizeUrl(url);
this.widgetButton.attr('href', url);
this.widgetButton.attr('href', urlSanitizeLib.sanitizeUrl(url));
} else {
this.widgetButton.removeAttr('href');
}
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/summaryWidget/src/views/SummaryWidgetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ define([

let url = this.domainObject.url;
if (url) {
const sanitizeUrl = urlSanitizeLib.sanitizeUrl;
url = sanitizeUrl(url);
this.widget.setAttribute('href', url);
this.widget.setAttribute('href', urlSanitizeLib.sanitizeUrl(url));
} else {
this.widget.removeAttribute('href');
}
Expand Down
7 changes: 1 addition & 6 deletions src/plugins/webPage/components/WebPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ export default {
},
computed: {
url() {
let url = this.currentDomainObject.url;
if (url) {
url = sanitizeUrl(url);
}
return url;
return sanitizeUrl(this.currentDomainObject.url);
}
}
};
Expand Down

0 comments on commit abc93d0

Please sign in to comment.