Hi,
We are trying to remove the $content from notification email if it exceeds 25MB ( or maybe a lot less, 5MB ), since Gmail SMTP doesn't accept email larger than 25MB, and yes some of our users are creating a page bigger than 25MB when it renders using multiple SQL macros...
In templates/chrome/main-table-1.0.0.soy from confluence-email-notifications-plugin, we've tried modifying the if statement but it didn't work..
{if $content and strLen($content) < 5000000} <tr> <td {if $pattern.id}id="{$pattern.id}" {/if}class="email-content-main mobile-expand{if $pattern.class} {$pattern.class}{/if}{if isLast($pattern)} last-row-padding{/if}"> {$content|noAutoescape} </td> </tr> {else} <tr> <td {if $pattern.id}id="{$pattern.id}" {/if}class="email-content-main mobile-expand{if $pattern.class} {$pattern.class}{/if}{if isLast($pattern)} last-row-padding{/if}"> Content too large, visit page to see the content. </td> </tr> {/if}
I saw strLen function listed in https://bitbucket.org/atlassian/atlassian-soy-templates/src/a2c124d7a22a52fd28c3d2ec4475529d161d139b/core/src/main/java/com/atlassian/soy/impl/modules/CustomFunctionsModule.java?at=master&fileviewer=file-view-default, so I thought it might would work.
We've also tried following too but didn't work either..
Please suggest any method of achieving this, or documentation on available functions for getting the string length.
Thanks,
Community moderators have prevented the ability to post new answers.
Can't really help with the logging issue unfortunately. I'd suggest raising a Bug in jira.atlassian.com/browse/CONF - I would think it should log email errors. You might also want to try explicitly looking at the mail logs to see if it's been logged there instead. Best of luck!
It's worth noting that the strLen
function isn't listed on the Closure Template docs - https://developers.google.com/closure/templates/docs/functions
I'm not sure whether it's actually available or not (it would seem not). Confluence may also be using an older version of the Soy plugin (and of Closure Templates themselves).
You can create your own Soy functions using an Atlassian plugin. Note that these functions will be globally available, so you should prefix them with your company name. You define them by extending SoyServerFunction (or SoyClientFunction to support JS contexts) and register them in your atlassian-plugin.xml with a module like:
<soy-function key="mycompany-strlen-soy-function" class="com.myCompany.StrLen"/>
Hope that helps!
Adam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello I am working on this as well along Ken. When we try any of the paths that "didn't work" we don't get any notification email sent by Confluence but we also don't get any log information regarding what kind of error was thrown. This is how we try to print strLen: {code} <br />StrLen: {strLen($content)}<br /> {code} I can also see there are custom soy functions inside the confluence-email-notifications-plugin-6.4.0.jar that we have tested successfully but none of them returns a String's length. Is there a way for us to create this new function and add it to the jar? Or can you provide us with a way to get the lenght of any String from within the .soy files in the jar? Thanx Luis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you define "didn't work" please? You might be able to get more information also by printing the strLen into the template.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.