Rock icon indicating copy to clipboard operation
Rock copied to clipboard

{% If %} Command >, <, >=, <= Operators Always Return True When Using Communication Entry Wizard

Open bscottdavis opened this issue 5 years ago • 3 comments

Description

Using >, <, >= or <= in the Communication Entry Wizard will always return True regardless of the comparison values. This appears to be the case in both the preview and the email that is sent.

First reported by Gary Holeman in RocketChat.

image

Steps to Reproduce

  1. Go to 'The New Communication Page'
  2. Continue through to the Communication Wizard Email Editor Page
  3. Enter {% if 2 < 1%} This shouldn't be in the output. {% endif %} into an HTML or Text Entry Block
  4. See that "This shouldn't be in the output." is outputted in the Preview and Sent Email

Expected behavior:

The >, <, >= and <= operators return True based on the values being evaluated.

Actual behavior:

The >, <, >= and <= operators always return True.

Versions

Rock Version: Rock McKinley 11.2 (1.11.2.1)

Client Culture Setting: en-US

bscottdavis avatar Dec 06 '20 01:12 bscottdavis

I tested this on Rock McKinley 11.3 with the same results.

garyholeman avatar Dec 06 '20 02:12 garyholeman

@JimMichael noticed that this is related to Issue #2674. The only difference appears to be that the discussion in Issue #2674 seems to imply that the issue is only related to the visual WYSIWYG editor whereas I am noticing that the issue appears to be presenting itself in the code version of the WYSIWYG editor as well as the HTML block in the Communication Entry. I'm guessing it's unfixable as well in this case, but thought I would make the distinction just in case a solution could be found for these non-WYSIWYG editors.

From what I am seeing the only current workaround to include a < operator in the Communication Wizard is to pull the code in from an external source such as a shortcode or {% include %}.

bscottdavis avatar Dec 06 '20 22:12 bscottdavis

We're fighting this too. We enter {% if profileCount > 0 %} in the HTML code editor of the Communication Wizard. After we Complete the code edit, if you inspect it again you find the > has been escaped and it reads {% if profileCount &gt; 0 %}. Note that we are editing the using the code editor. It's being escaped behind the scenes. In this case, the code editor really isn't a code editor. It's trying to sanitize the "code" without understanding Lava syntax.

SteveSwaringen avatar Feb 02 '24 20:02 SteveSwaringen