Commit Graph

275 Commits

Author SHA1 Message Date
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
Sara Arjona
d89d0d6593 MDL-63466 core_message: Added format_conversation_messages helper
The format_conversation_messages function has been added. It returns
the messages and the array of users who have sent any of these
messages.
2018-10-24 09:38:10 +08:00
Jake Dallimore
042d804453 MDL-63466 core_message: added a test helper class
Providing util methods for api and externallib testing.
2018-10-24 09:27:34 +08:00
Jake Dallimore
2a2b86f123 MDL-63466 core_message: add helper method for fetching member info
The aim is to use this to standardise the member information we return
from several methods in the API, such as get_conversations,
get_conversation_messages, get_conversation_members, and in search
methods.
2018-10-24 09:23:30 +08:00
David Monllao
4abe3d250f MDL-63408 messaging: Remove duplicated field 2018-10-23 13:44:52 +02:00
Andrew Nicols
0ff384dbf1 Merge branch 'MDL-63548_master' of git://github.com/markn86/moodle 2018-10-23 10:25:54 +08:00
Mark Nelson
abf7a261a9 MDL-63548 core_message: added api::can_mark_all_messages_as_read 2018-10-23 09:52:14 +08:00
Andrew Nicols
67b813514c Merge branch 'MDL-63408_master' of git://github.com/markn86/moodle 2018-10-23 08:50:40 +08:00
Andrew Nicols
9c6ccfd93b Merge branch 'MDL-63213-master-2' of https://github.com/snake/moodle 2018-10-22 10:54:56 +08:00
Andrew Nicols
7b73fd183c Merge branch 'MDL-63691_master' of git://github.com/markn86/moodle 2018-10-22 10:52:13 +08:00
Mark Nelson
cbf9e41c2d MDL-63408 core_message: remove no longer needed code
We only allow the functionality of adding/removing
members on group conversations, which will never have
a conversation hash.
2018-10-22 10:26:30 +08:00
Mark Nelson
83e3a4fe26 MDL-63408 core_message: add check to ensure it is a group conversation 2018-10-22 10:26:21 +08:00
Amaia Anabitarte
623048af81 MDL-63408 core_message: New functions to manage conversation members
New functions created to add, remove and count conversation members
2018-10-22 10:26:10 +08:00
Mark Nelson
f2ac0a3e5b MDL-63691 core_message: added api::create_conversation 2018-10-22 10:21:28 +08:00
Mark Nelson
e66b915c40 MDL-63691 core_message: added api::can_create_group_conversation 2018-10-22 10:21:27 +08:00
Mark Nelson
a66ae84911 MDL-63691 core_message: deprecate create_conversation_between_users 2018-10-22 10:21:27 +08:00
Jake Dallimore
b8ff2c4481 MDL-63213 core_message: update get_conversations to support favourites
Added the type param here, which will be used in MDL-63549.
2018-10-22 09:43:33 +08:00
Andrew Nicols
c3918bfee9 MDL-63289 message: Remove unused global 2018-10-22 08:31:04 +08:00
Sara Arjona
e5eba802d5 MDL-63289 message: Deprecate is_user_non_contact_blocked method
This function has been deprecated and no other function has been
added to replace it. It was only called from can_post_message, so
its code has been moved there.
2018-10-20 08:36:24 +02:00
Sara Arjona
7983fb830e MDL-63289 message: Bypass privacy user preferences for teachers
Created capability 'moodle/site:messageanyuser' to allow
bypass user privacy preferences for messaging participants in a course,
even when some of them has blocked the teacher.
2018-10-20 08:35:17 +02:00
David Monllao
32b01d2b02 Merge branch 'MDL-63214-master' of git://github.com/sarjona/moodle 2018-10-17 15:55:44 +02:00
Sara Arjona
f7dfa9ba3e MDL-63214 message: Add privacy preferences to filter who can message
Add new messaging profile preferences to allow users to choose who
can message them:
- By default, users can select between 'My contacts only' and 'My
contacts and anyone in my courses'
- When $CFG->messagingallusers is enabled, a new option is displayed
also: 'Anyone on the site'. For users who have selected this option,
if $CFG->messagingallusers is disabled, the behaviour will be changed
to 'My contacts and anyone in my courses'
2018-10-17 11:52:57 +02:00
Mark Nelson
15663b0bec MDL-63547 core_message: can_delete_conversation expects a conversationid 2018-10-17 12:05:16 +08:00
Mark Nelson
263ad98436 MDL-63547 core_message: deprecated api::delete_conversation() 2018-10-17 12:05:16 +08:00
Mark Nelson
08cb8a34f9 MDL-63547 core_message: updated api::can_delete_message 2018-10-17 12:05:16 +08:00
Mark Nelson
14de10c463 MDL-63547 core_message: updated message_deleted event to support groups 2018-10-17 12:05:16 +08:00
Mark Nelson
0d203bbf8d MDL-63211 core_message: respect new setting 'messagingallusers' 2018-10-03 11:58:39 +08:00
Mark Nelson
c886e2c94d MDL-63211 core_message: deprecated api::is_user_blocked 2018-10-03 11:58:39 +08:00
Mark Nelson
be016b0144 MDL-63211 core: added notification when contact request is made 2018-10-03 11:58:39 +08:00
Mark Nelson
f219eac7b4 MDL-63211 core: update core to use new APIs 2018-10-03 11:51:29 +08:00
Mark Nelson
742c27b3e8 MDL-63211 core_message: updated privacy provider 2018-10-03 11:51:29 +08:00
Mark Nelson
0b3eadcd96 MDL-63211 core_message: deprecated functions and added new API 2018-10-03 11:35:26 +08:00
Marina Glancy
442f12f81a MDL-62742 core: rename coursecat->core_course_category
Also rename course_in_list -> core_course_list_element
Deprecate class coursecat_sortable_records
2018-08-28 11:36:23 +02:00
Dmitrii Metelkin
66f145efd1 MDL-62899 search: add document icons 2018-08-07 17:40:57 +10:00
Mark Nelson
cd9ecbd81c MDL-62709 core_message: convert NULL format types in task 2018-06-14 13:18:46 +08:00
David M Penner
8791c50d64 MDL-62709 core_message: fix for silently ignored errors in task 2018-06-14 12:20:42 +08:00
Mark Nelson
04cd1b3f31 MDL-61919 core_message: implement privacy provider 2018-05-03 20:44:05 +08:00
Mark Nelson
78348dfc4e MDL-61255 core_message: added helper function to detect legacy messages 2018-04-10 17:28:52 +08:00
Mark Nelson
84f6a716b2 MDL-61255 core_message: migrate data from the 'message_popup' table 2018-04-10 17:26:43 +08:00
Mark Nelson
41bc5aa587 MDL-61255 core_message: created task to handle migration of data 2018-04-10 15:17:01 +08:00
Mark Nelson
5aac33c785 MDL-36941 core_message: dont query DB unnecessarily checking read status 2018-03-23 12:30:31 +08:00
Mark Nelson
99248f6177 MDL-36941 core_message: fixed minor CiBoT complaints 2018-03-23 12:30:31 +08:00
Mark Nelson
e159b53b5b MDL-36941 core_message: improved performance of helper::get_messages()
Improved the query to use the 'convhash' field as well as adding an index.

Also fixed issue where 'timeread' was hardcoded as 0.
2018-03-23 12:30:30 +08:00
Mark Nelson
74ad60bfbe MDL-36941 core_message: deprecated 'api::mark_all_read_for_user' 2018-03-23 12:30:30 +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
376a79c242 MDL-36941 core: added events for notifications 2018-03-23 12:30:27 +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
sam marshall
66e3702680 MDL-55356 core_search: Change existing search areas to new API
This change considers all existing search areas in Moodle and makes
necessary changes.

Custom change to course search, supported by helper in base.php:

* course/classes/search/mycourse.php

Custom change to message search:

* message/classes/search/message_received.php
* message/classes/search/message_sent.php

Custom change to user search:

* user/classes/search/user.php

Custom changes to module areas, supported by helper in base_mod.php:

* mod/book/classes/search/chapter.php
* mod/data/classes/search/entry.php
* mod/forum/classes/search/post.php
* mod/glossary/classes/search/entry.php
* mod/survey/classes/search/activity.php
* mod/wiki/classes/search/collaborative_page.php

(Note: the unit tests do not exhaustively check every context type
for these, given that's mainly handled by the helper function
which was already tested in the base_activity test.)

Handled by block base class (no change):

* blocks/html/classes/search/content.php

Handled by activity base class (no change):

* mod/assign/classes/search/activity.php
* mod/book/classes/search/activity.php
* mod/chat/classes/search/activity.php
* mod/choice/classes/search/activity.php
* mod/data/classes/search/activity.php
* mod/feedback/classes/search/activity.php
* mod/folder/classes/search/activity.php
* mod/forum/classes/search/activity.php
* mod/glossary/classes/search/activity.php
* mod/imscp/classes/search/activity.php
* mod/label/classes/search/activity.php
* mod/lesson/classes/search/activity.php
* mod/lti/classes/search/activity.php
* mod/page/classes/search/activity.php
* mod/quiz/classes/search/activity.php
* mod/resource/classes/search/activity.php
* mod/scorm/classes/search/activity.php
* mod/url/classes/search/activity.php
* mod/wiki/classes/search/activity.php
* mod/workshop/classes/search/activity.php
2017-10-11 17:17:09 +01:00