116 Commits

Author SHA1 Message Date
Pau Ferrer Ocaña
d74bd798b6 MDL-67853 message: Remove on/offline settings on message preferences 2022-01-27 15:22:15 +01:00
cescobedo
3c6ad8ac09 MDL-72616 blocks: Remove block_quiz_results 2021-10-27 06:23:04 +02:00
Joseph Baxter
c66c299939 MDL-70046 message: handle call processor failure
* ensure message_send returns false if message not sent
* digests only clear queue on success
* notifications requeue failed messages
2021-08-31 10:36:54 +01:00
David Monllaó
b63c0b9079 Merge branch 'MDL-60680-master' of git://github.com/jleyva/moodle 2019-04-25 18:55:45 +02:00
Juan Leyva
333d11c9fc MDL-60680 notifications: New customdata field
New field to store custom data for message processors.
2019-04-23 13:15:24 +02:00
Sara Arjona
734b198fd3 MDL-64715 message: add support for self conversations
Added new MESSAGE_CONVERSATION_TYPE_SELF type for self-conversations
and upgraded legacy self-conversations to the new type, removing
repeated members in the message_conversation_members table.
Besides, from now, a self-conversation will be created by default for
all the existing users.

All the self-conversations have been also starred and a default message
will be displayed always to explain how to use them.
2019-04-15 20:17:54 +02:00
cescobedo
3a5afbf5f1 MDL-65015 core_message: add trusttext cleaning to messaging 2019-04-07 10:56:53 +02:00
Jake Dallimore
86e274d929 MDL-63724 core_message: move message redirection into helper function 2018-11-12 10:09:27 +08:00
Jake Dallimore
52f9cf205e MDL-63724 core_message: add send_message_to_conversation() to api 2018-11-12 10:09:27 +08:00
Jake Dallimore
0eddf920be MDL-63724 core_message: add conversation support to message_send()
Added a test confirming that processors are called for each member
and that a single event is fired.
2018-11-12 10:09:27 +08:00
Andrew Nicols
74138e927c Revert "MDL-63466 core_message: rename cache for last message time"
This reverts commit f978593d6c3b98db5b3feb29448a642b4f540edc.
2018-10-26 14:54:01 +08:00
Andrew Nicols
4699b8bc41 Revert "MDL-63466 core_message: removed get_last_message_time_created_cache_key"
This reverts commit 4f22d7f23b022c143910a9a136fecbd325dce356.
2018-10-26 14:53:58 +08:00
Mark Nelson
4f22d7f23b MDL-63466 core_message: removed get_last_message_time_created_cache_key 2018-10-24 09:39:59 +08:00
Mark Nelson
f978593d6c MDL-63466 core_message: rename cache for last message time 2018-10-24 09:39:42 +08:00
Sara Arjona
fb04293bb1 MDL-63466 core_message: Add conversation support to get_messages
- The get_conversation_messages has been added to the API and the WS
with the conversation identifier (convid) instead of the userto,
to let get conversation messages and the members involved.
- The cache has been also reviewed, to use the convid instead of the
[userfrom, userto] keys.
- The get_most_recent_conversation_messages has been added to the API
to update the cache when needed.
2018-10-24 09:39:05 +08:00
Mark Nelson
f2ac0a3e5b MDL-63691 core_message: added api::create_conversation 2018-10-22 10:21:28 +08:00
David Mudrák
39d2c68856 MDL-61742 messaging: Do not send messages from inactive providers
Before this patch, we only checked that the given provider has been
configured in the user or system preferences. However, if the provider's
component is disabled, it does not even appear in these preferences.
Additionally, there was no check that the message / notification
provider is among providers allowed to be consumed by the recipient.

The patch checks that the message origin is among providers returned by
the message_get_providers_for_user() so disabled plugins can't act as
sources of messages and users can't receive messages from providers they
do not have capability for. This mitigates the risk of abusing a plugin
as a source of spam, for example.

Unit test is fixed and extended. When the $CFG->messaging is disabled,
no messages between users should be sent (I can't understand why the
unit test was written in an opposite way). Added assertions for the
raised debugging message.
2018-08-31 12:15:30 +02:00
Adrian Greeve
cc4952e997 MDL-55449 messages: Remove support for stdClass messages.
This also makes message_sent::create_from_ids() $courseid
parameter required.
2018-08-07 11:04:22 +08:00
Mark Nelson
b2cd17e6a9 MDL-36941 core: added 'convhash' field to quickly get conversations 2018-03-23 12:30:28 +08:00
Mark Nelson
548936a6c9 MDL-36941 core_message: mark notification/messages takes stdClass
This avoid unnecessary DB calls.
2018-03-23 12:30:27 +08:00
Mark Nelson
883ce42127 MDL-36941 core: convert existing api to use new table structure
Also deprecated the following functions -

1. message_move_userfrom_unread2read - It is not necessary
   for us to mark a message as read on user deletion.
2. message_get_blocked_users - Horrible logic used to
   determine if a user is blocked via reference on some
   randomly chosen 'isblocked' variable.
3. message_get_contacts - The same as above. This can be
   done in a much nicer way.
4. message_mark_message_read - We want two functions to do
   this to avoid confusing messages and notifications.
5. message_can_delete_message - This assumed the variable
   $message contained the 'useridto' property, which
   was present in the old table structure. We do not want
   future usages where a query is done on the new table
   and is simply passed as this won't contain this property.
6. message_delete_message - Same as above.
2018-03-23 12:30:27 +08:00
Mark Nelson
685daf1aed MDL-58650 core_message: always use 'popup' processor for messages 2017-05-02 15:46:48 +08:00
Mark Nelson
ffd7798c96 MDL-56139 core: changes after peer review
- No longer use the Fibonacci sequence for delaying the timeout.
  It is too aggressive.
- The backoff_timer AMD module now expects the callback AND the
  backoff function to be passed to the constructor.
- Added ability to specify polling frequency in config.php.
- Added helper function to return the cache key.
- Reworded the parameters for clarity.
2016-11-16 10:22:52 +08:00
Ryan Wyllie
fb1469d84f MDL-56139 message: ajax poll for new messages in message area 2016-11-16 10:22:33 +08:00
Eloy Lafuente (stronk7)
a29bcf7819 MDL-47162 core_message: debug whenever courseid is missing
Instead of silently defaulting to SITEID when courseid (coming
from message_send()/\core\message\manager::send_message()) is missing,
now a debugging message is shown to allow developers to fix their
messages to, always, include courseid.

Raw creation of events via message_sent::create() missing other[courseid]
leads to coding exception since now (there shouldn't be any legacy use, as far as
they are always created via create_from_ids() when sending a message.

Updated upgrade.txt notes a little bit, added references the 3.6 final
deprecation issue (MDL-55449) and covered with unit tests.
2016-10-28 00:30:02 +02:00
Amanda Doughty
cc350fd9c8 MDL-47162 core_message: Add course id to message eventdata 2016-10-27 18:11:27 +02:00
Ryan Wyllie
3274d5ca66 MDL-54708 message: add backend APIs for notifications popover 2016-10-07 16:26:40 +08:00
Russell Smith
1fcf0ca8a5 MDL-35628 performance: Remove dirname() where possible.
dirname() is a slow function compared with __DIR__ and using
'/../'.  Moodle has a large number of legacy files that are included
each time a page loads and is not able to use an autoloader as it is
functional code.  This allows those required includes to perform as
best as possible in this situation.
2016-06-10 08:06:49 +10:00
Ankit Agarwal
c6f45ef884 MDL-48212 messages: support the new class in message apis 2015-01-26 08:15:33 +05:30
Petr Skoda
349f98ad3e MDL-45941 implement support for message sending from DB transactions and fix other problems
This patch includes following fixes:
 - messages may be now sent when database transactions active
 - consistent return status on failure from message_send(), false is
   returned only when message not created in message(_read)? table,
   processor failure results in debugging message only and messages
   are not marked as read
 - message_sent is triggered always with id from message table
 - logic for marking messages as viewed was standardised
 - message_viewed event is triggered consistently
 - improved performance when fetching user preferences
 - full unit tests coverage for send_message() function
 - fixed multiple other smaller issues discovered by unit tests
2014-06-17 16:09:43 +12:00
Juan Leyva
5e12b369af MDL-44954 messages: Fixed save notifications with the notification flag 2014-04-07 12:19:52 +02:00
Mark Nelson
53e4c89d8e MDL-44704 core_message: always use system context when triggering a message_sent event 2014-03-20 20:35:56 -07:00
Mark Nelson
f6a4a90e70 MDL-40913 core_message: fixed triggering the 'message_sent' event when the 'noreply' address is used 2014-03-13 18:33:25 +01:00
Mark Nelson
ab1bc5d222 MDL-40913 core_message: replaced 'write' add_to_log call with an event 2014-03-07 15:15:43 -08:00
Rajesh Taneja
fd0f7ac5c2 MDL-33618 Messages: Added support to disable message provider 2013-11-21 09:40:34 +08:00
Rajesh Taneja
3bcf6b3cdd MDL-31560 Messages: Added support for noreply and support users
This is used by messaging system for sending/receiving message
to/from noreply or support user. message_send api will now use
core_user class to get noreply or support user and then
send/receive message depending on user state.
2013-09-13 16:13:26 +08:00
Petr Škoda
b0d1d941c9 MDL-40220 use new core_component::get_component_directory() 2013-07-16 22:42:37 +02:00
Petr Škoda
56da374e1e MDL-40220 use new core_component::normalize_component() 2013-07-16 22:41:00 +02:00
Andrew Davis
766fd0d92f MDL-34454 core_message: removed a deprecated function
Conflicts:

	lib/deprecatedlib.php
2013-07-09 14:11:07 +08:00
Sam Hemelryk
007bfe8b4d MDL-25290 conversion: Converted config to use MUC 2013-01-07 19:22:40 +13:00
Dan Poltawski
86ebf41545 Merge branch 'MDL-30871-master' of git://github.com/FMCorz/moodle 2012-11-20 11:47:17 +08:00
Dan Poltawski
5f7b0f2bdc MDL-30545 messaging - remove DISTINCT from union statement 2012-11-13 22:34:36 +08:00
Dan Poltawski
5c4685f0ad MDL-30545 - messagelib: use $DB->sql_concat() 2012-11-13 15:11:14 +08:00
Frederic Massart
ba4c451f53 MDL-30871 enrol: Flat file does not fail when notifications are enabled 2012-10-30 11:03:12 +08:00
Tim Hunt
2cf5ab1028 MDL-30545 messaging prefs: show all relevant message providers.
Some message providers have an associated capability. For example
the mod/quiz:emailconfirmsubmission capability. At the moment,
we only show the preferences for the capabilities that the user
has in the system context.

That does not work for the example capability above. Typically
the capability will be overridden in one quiz, to allow for
Students, and the user will have the Student role in the course
context. Therefore, this message type does not appear on the
preferences page.

This fix corrects the logic, so that all message types that are
to the current user are displayed.
2012-10-23 18:41:43 +08:00
Petr Škoda
4c9e03f0ac MDL-36031 implement message redirection for unit testing 2012-10-13 20:00:54 +02:00
Ankit Agarwal
194ab42205 MDL-34535 message: userto should use is_number instead of is_init 2012-08-14 14:41:00 +08:00
Adrian Greeve
b0c6dc1cac MDL-34465 - lib - Replacing get_context_instance with context_XXXX::instance (group 8) 2012-07-27 10:10:46 +08:00
Rajesh Taneja
f55cf492eb MDL-31031 messages: deprecated message_get_my_providers function to be removed in 2.5 2012-07-23 13:06:07 +08:00
Ruslan Kabalin
7fcd3c30fd MDL-33019: Check that message providers' plugins are enabled and exist 2012-05-23 10:47:08 +01:00