reporting objectional material with no message doesn't get sent to admin with digest emails

Bug #1075760 reported by Hugh Davenport
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Low
Ghada El-Zoghbi
1.6
Fix Released
Low
Unassigned
1.7
Fix Released
Low
Son Nguyen
1.8
Fix Released
Low
Unassigned

Bug Description

This results in an email sent to all admins saying that the notification failed.

The admin with digest on will not receive the empty message, but those without digest will.

Reason is because it tries to store the data in a temporary table to digest them all.

A couple of solutions:
- take off the non null constraint on the temporary table (will fix similar issues if any)
- set the message to be required (won't fix similar issues if any)

If we do the second option, we should have a hunt around other notification types to see if they can have null message and fix them as well

Subject: User notification error was probably caused by your server
configuration.

exception 'SQLException' with message 'Failed to get a recordset: postgres7
error: [-1: ERROR: null value in column "message" violates not-null
constraint] in adodb_throw(INSERT INTO "notification_emaildigest_queue"
("type", "usr", "ctime", "url") VALUES (?, ?, ?, ?), Array)
Command was: INSERT INTO "notification_emaildigest_queue" ("type", "usr",
"ctime", "url") VALUES (?, ?, ?, ?) and values was (7,2,2012-10-23
15:41:44,view/artefact.php?artefact=1458781&view=219885)' in
/var/www/lib/dml.php:1060
Stack trace:
#0
/var/www/notification/emaildigest/lib.php(44):
insert_record('notification_em...', Object(stdClass))
#1 [internal function]:
PluginNotificationEmaildigest::notify_user(Object(stdClass), Object(stdClass))
#2
/var/www/lib/mahara.php(1359):
call_user_func_array(Array, Array)
#3
/var/www/lib/activity.php(468):
call_static_method('PluginNotificat...', 'notify_user', Object(stdClass),
Object(stdClass))
#4
/var/www/lib/activity.php(507):
ActivityType->notify_user(Object(stdClass))
#5
/var/www/lib/activity.php(82):
ActivityType->notify_users()
#6
/var/www/lib/activity.php(219):
handle_activity('7', Object(stdClass), true)
#7
/var/www/lib/cron.php(158):
activity_process_queue()
#8 {main}

Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.7.0 → 1.8.0
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.8rc1 → 1.8.0
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.8.0 → 1.8.1
Changed in mahara:
assignee: nobody → Ghada El-Zoghbi (ghada-z)
Revision history for this message
Ghada El-Zoghbi (ghada-z) wrote :

This is related to the Alfred Health bug - WR215749.

Applying the same fix plus making the message mandatory for objectionalble content.

Changed in mahara:
status: Confirmed → In Progress
Revision history for this message
Ghada El-Zoghbi (ghada-z) wrote :

Code committed for review:

https://reviews.mahara.org/2685

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/2685
Committed: http://gitorious.org/mahara/mahara/commit/568074bf23d6441b7dec2ca9eeae9d3d0735a02c
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 568074bf23d6441b7dec2ca9eeae9d3d0735a02c
Author: Ghada El-Zoghbi <email address hidden>
Date: Tue Nov 5 11:51:34 2013 +1100

Bug1075760: reporting objectional material with no message doesn't get sent to admin with digest emails

Email digest table has a not null contraint for the message field:
1. Force the user to enter something in the objectionable comment.
2. Other areas: if a user enteres a message (i.e. in a forum)
which is made up of html (i.e. a smiley face),
the message gets 'cleaned' by stripping html tags.
This leaves it empty and fails when trying to insert into the
email digest table.
Clean the message with html2text instead of str_shorten_html.
3. As a last resort, before inserting into the email digest table,
make sure there is at least a space in the message field (if it's empty).

Change-Id: I05a77e0682017839b34e74241eefb98fb788eab5
Signed-off-by: Ghada El-Zoghbi <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Aaron Wells (u-aaronw) wrote :
Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/2820
Committed: http://gitorious.org/mahara/mahara/commit/bf6d4c5e6d41958f961aff8e28e5ce721cf6455e
Submitter: Aaron Wells (<email address hidden>)
Branch: 1.8_STABLE

commit bf6d4c5e6d41958f961aff8e28e5ce721cf6455e
Author: Ghada El-Zoghbi <email address hidden>
Date: Tue Nov 5 11:51:34 2013 +1100

Bug1075760: reporting objectional material with no message doesn't get sent to admin with digest emails

Email digest table has a not null contraint for the message field:
1. Force the user to enter something in the objectionable comment.
2. Other areas: if a user enteres a message (i.e. in a forum)
which is made up of html (i.e. a smiley face),
the message gets 'cleaned' by stripping html tags.
This leaves it empty and fails when trying to insert into the
email digest table.
Clean the message with html2text instead of str_shorten_html.
3. As a last resort, before inserting into the email digest table,
make sure there is at least a space in the message field (if it's empty).

Change-Id: I05a77e0682017839b34e74241eefb98fb788eab5
Signed-off-by: Ghada El-Zoghbi <email address hidden>

Aaron Wells (u-aaronw)
no longer affects: mahara/1.5
Aaron Wells (u-aaronw)
Changed in mahara:
status: Fix Committed → Fix Released
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "1.6_STABLE" branch: https://reviews.mahara.org/3159

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/3159
Committed: http://gitorious.org/mahara/mahara/commit/8c7a5e68b14a0cddd919f539babf060a31948820
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.6_STABLE

commit 8c7a5e68b14a0cddd919f539babf060a31948820
Author: Ghada El-Zoghbi <email address hidden>
Date: Tue Nov 5 11:51:34 2013 +1100

Bug1075760: reporting objectional material with no message doesn't get sent to admin with digest emails

Email digest table has a not null contraint for the message field:
1. Force the user to enter something in the objectionable comment.
2. Other areas: if a user enteres a message (i.e. in a forum)
which is made up of html (i.e. a smiley face),
the message gets 'cleaned' by stripping html tags.
This leaves it empty and fails when trying to insert into the
email digest table.
Clean the message with html2text instead of str_shorten_html.
3. As a last resort, before inserting into the email digest table,
make sure there is at least a space in the message field (if it's empty).

Change-Id: I05a77e0682017839b34e74241eefb98fb788eab5
Signed-off-by: Ghada El-Zoghbi <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "1.7_STABLE" branch: https://reviews.mahara.org/3199

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/3199
Committed: http://gitorious.org/mahara/mahara/commit/8def023b7fd5c22f617c8f0fb71201259b46b263
Submitter: Aaron Wells (<email address hidden>)
Branch: 1.7_STABLE

commit 8def023b7fd5c22f617c8f0fb71201259b46b263
Author: Ghada El-Zoghbi <email address hidden>
Date: Tue Nov 5 11:51:34 2013 +1100

Bug1075760: reporting objectional material with no message doesn't get sent to admin with digest emails

Email digest table has a not null contraint for the message field:
1. Force the user to enter something in the objectionable comment.
2. Other areas: if a user enteres a message (i.e. in a forum)
which is made up of html (i.e. a smiley face),
the message gets 'cleaned' by stripping html tags.
This leaves it empty and fails when trying to insert into the
email digest table.
Clean the message with html2text instead of str_shorten_html.
3. As a last resort, before inserting into the email digest table,
make sure there is at least a space in the message field (if it's empty).

Change-Id: I05a77e0682017839b34e74241eefb98fb788eab5
Signed-off-by: Ghada El-Zoghbi <email address hidden>

Aaron Wells (u-aaronw)
no longer affects: mahara/1.9
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.