Download & Extend

Is trim() on the templates really necessary?

Project:Messaging
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Not sure if this is a bug or a feature, but if a field in the messaging_admin_message_form is empty the empty value is not saved in the database because of the conditional

if ($text = trim($text)) {

I'm sure there are cases where people would prefer nothing instead of a default value. I'd be glad to submit a patch, but I wanted to check to see what the thinking was here before doing so.

andre

Comments

#1

I think the feature makes sense so such patch would be welcomed.

However it is not that trivial because right now we have a fall-back system, so if you have not specified a message part for a sending method, it will default to the 'default' method's message part.

So I guess we'll need a special text like '', a checkbox or similar...

#2

Status:active» fixed

Added this feature, see new help texts on the page. ('')

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

#4

Title:Cannot unset message parts via messaging_admin_message_form» Is trim() on the templates really necessary?
Version:5.x-1.x-dev» 6.x-1.x-dev
Status:closed (fixed)» active

The same line:

if ($text = trim($text)) {

causes the new line characters to be filtered out as well. Is that trim really necessary?

AttachmentSize
messagingTrimPatch.patch 720 bytes

#5

Status:active» fixed

Yes, you're right, we don't want to trim the submitted template
(but we want to check it is not only spaces and/or new lines)

So applied something similar

if (trim($text)) // Checks not empty but doesn't change the actual text saved.

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here