Bug 50490 - univention-web/js/tools.js: isTrue() is only a negation of isFalse()
univention-web/js/tools.js: isTrue() is only a negation of isFalse()
Status: NEW
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: UMC maintainers
UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-11-13 12:19 CET by Sönke Schwardt-Krummrich
Modified: 2019-11-13 12:36 CET (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2019-11-13 12:19:12 CET
univention-web/js/tools.js contains a isFalse() and a isTrue() method. But isTrue() is only a negation of isFalse(). I think this is suboptimal if "input" is e.g. the value "manually". We should check explicitly for the corresponding "true" values like in isFalse().


		isFalse: function(/*mixed*/ input) {
			if (typeof input === "string") {
				switch (input.toLowerCase()) {
					case 'no':
					case 'not':
					case 'false':
					case '0':
					case 'disable':
					case 'disabled':
					case 'off':
						return true;
				}
			}
			if (false === input || 0 === input || null === input || undefined === input || '' === input) {
				return true;
			}
			return false;
		},

		isTrue: function(/*mixed*/ input) {
			//('yes', 'true', '1', 'enable', 'enabled', 'on')
			return !this.isFalse(input);
		},