30 Commits

Author SHA1 Message Date
Huong Nguyen
73769bdd4f
Merge branch 'MDL-79573-master-int' of https://github.com/mickhawkins/moodle 2023-10-06 13:04:36 +07:00
Michael Hawkins
acc48db386
MDL-79573 communication: Load form data for the correct provider fields 2023-10-06 11:10:09 +08:00
Ilya Tregubov
2b4041f93c
Merge branch 'MDL-79586-master' of https://github.com/safatshahin/moodle 2023-10-06 10:25:39 +08:00
Michael Hawkins
329a9e97d2
MDL-79573 communication: Support new records for each provider type
Previously, we replaced information in the same communication record
in the database, now there will be a unique record per provider.
This ensures when switching between different providers, the correct
actions such as room member management can be actioned for the correct
provider.

This also includes the required updates for the instances to no
longer assume a provider must be enabled to be relevant. Specifying a
provider is optional to fetch a specific provider instance, the default
will use the currently enabled provider.
2023-10-06 09:54:32 +08:00
Safat
75cae1dede MDL-79586 communication: Restrict the use of non-configured providers 2023-10-05 16:53:50 +11:00
Andrew Nicols
99c1543aa8
MDL-79581 communication: Context is a mandatory field
The API was incorrectly assuming that all uses of the API were for a
course, and that the instanceid of the communication instance was a
course id. These assumptions are both entirely wrong.

The API is intended to support a range of uses including use at the
site, user, and activity levels.

Furthermore, if a group were to be used, then the instanceid should be
of that group's id, and therefore the contextid would need to be fetched
or that group's course instead.

The only solution here is to add a new contextid field to the table, and
implement it all parts of the API.
2023-10-04 20:37:57 +08:00
Andrew Nicols
9739399741
Merge branch 'MDL-78750-master-int' of https://github.com/stevandoMoodle/moodle 2023-09-27 14:09:13 +08:00
meirzamoodle
6246db3d30 MDL-79100 core_communication: Update communication-related lang strings 2023-09-26 12:12:38 +07:00
Stevani Andolo
d644c3d89d MDL-78750 communication_matrix: Dynamic settings 2023-09-26 09:55:54 +08:00
Huong Nguyen
bd323aede7
Merge branch 'MDL-78129-master' of https://github.com/andrewnicols/moodle 2023-09-22 10:29:54 +07:00
Andrew Nicols
84cfc8beeb
MDL-78129 communication: Fix all phpcs isuses
This is a brand new subsystem, plugin-type, and plugin. They are written
from the ground up by us. They should not contain any coding style
violations.
2023-09-22 11:08:04 +08:00
Andrew Nicols
148e779651
Merge branch 'MDL-78649-master' of https://github.com/meirzamoodle/moodle 2023-09-21 22:25:14 +08:00
Safat
3e47253787
MDL-78129 core_communication: Add update membership api 2023-09-21 13:28:20 +08:00
meirzamoodle
bebd10c5a5 MDL-78649 core_communication: Clarify form provider method name 2023-09-08 16:50:54 +07:00
meirzamoodle
129d8afa39 MDL-78649 core_communication: Fix missing provider form fields types 2023-09-08 16:50:50 +07:00
Michael Hawkins
bfbb314e2f
MDL-78619 communication: De-couple room & user management and API fix
Management fix: Although rooms and room users are implemented as
separate provider interfaces, there were still assumptions that
adding/removing rooms would require user handling. Where room_provider
was implemented but room_user_provider was not, that would then result
in either unnecessary ad-hoc tasks, or tasks failing with errors. Now,
checks are in place to avoid these scenarios.

API fix: Previously save_form_data() was being called on the old
provider instead of the newly enabled one, so when switching between
providers the settings would not be correctly applied and the provider
may not function. Now, the object is reloaded and the data is saved correctly.
2023-08-27 23:06:22 +08:00
Andrew Nicols
914686bc5e
MDL-77917 communication_matrix: Support server API versions
This commit brings in support for multiple versions of the Matrix
specification.

A Matrix server is compromised of a number of individually versioned API
endpoints, for example:

    /_matrix/client/v3/createRoom
    /_matrix/client/v3/rooms/:roomid/joined_members
    /_matrix/media/v1/create

The combination of a large number of these individually versioned
endpoints forms a Matrix Specification version.

For example:

* the /_matrix/media/v1/create endpoint was created for version 1.7 of the
  specification, and does not exist in earlier versions.
* in the future a new behaviour or parameter may be created for the
  `createRoom` endpoint and a new endpoint created at:

    /_matrix/client/v4/createRoom

A single server can support multiple versions of the Matrix
specification. The server declares the versions of the specification
that it supports using a non-versioned endpoint at
`/_matrix/client/versions`.

As a Matrix client, Moodle should:
* query the server version endpoint
* determine the combination of mutually supported Matrix specification
  versions
* create a client instance of the highest-supported version of the
  specification.

For example, if Moodle (Matrix client) and a remote server have the
following support:

```
Moodle:      1.1  1.2  1.3  1.4  1.5  1.6  1.7
Server:  r0  1.1  1.2  1.3  1.4  1.5  1.6
```

The versions in common are 1.1 through 1.6, and version 1.6 would be
chosen.

To avoid duplication and allow for support of future features more
easily, the Moodle client is written as:
* a set of classes named `v1p1` through `v1p7` (currently) which extend
  the `matrix_client` abstract class; and
* a set if PHP traits which provide the implementation for individual
  versioned endpoints.

Each client version then imports any relevant traits which are present
in that version of the Matrix Specification. For example versions 1.1 to
1.6 do _not_ have the `/_matrix/media/v1/create` endpoint so they do not
import this trait. This trait was introduced in version 1.7, so the
trait is included from that version onwards.

In the future, if an endpoint is created which conflicts with an
existing endpoint, then it would be easy to create a new client version
which uses the existing common traits, and adds the new trait.

Each endpoint is written using a `command` class which extends the
Guzzle implementation of the PSR-7 Request interface. This command
class adds support for easy creation of:
* path parameters within the URI
* query parameters
* body parameters

This is done to avoid complex patterns of Request creation which are
repeated for every client endpoint.
2023-08-24 11:59:25 +08:00
Huong Nguyen
aeeb1653c0
Merge branch 'MDL-78553-master' of https://github.com/davewoloszyn/moodle 2023-08-03 09:44:24 +07:00
David Woloszyn
317251a978 MDL-78553 core_communication: Move settings to their own page 2023-08-03 12:36:04 +10:00
Andrew Nicols
8b97071c94
MDL-78738 core_communication: Set avatar from a stored_file
We should always use a stored_file instance to set the avatar, and never
a data uri. Especially where the datauri is from Moodle itself.

This change requires a number of changes in associated locations.

I am not adding this change to any upgrade notes as this is a
master-only feature.

Note: I have removed some tests and will not consider fixing them
because I will be entirely removing that test file in a subsequent issue
(MDL-77917).
2023-08-01 19:50:14 +08:00
David Woloszyn
162c9fdd66 MDL-77356 communication: Update avatar filename and avatar synced 2023-06-30 10:38:40 +10:00
Andrew Nicols
54f2722a7b
Merge branch 'MDL-78523-master' of https://github.com/safatshahin/moodle 2023-06-24 23:39:37 +08:00
Safat
d785ff6f57 MDL-78523 core_communication: Safe disable of communication plugins 2023-06-22 12:19:44 +10:00
Safat
3f48306385 MDL-76704 core_communication: Default setting for communication provider 2023-06-21 14:46:32 +10:00
Safat
04b7c496f0 MDL-77357 core_communication: Add api for provider form fields 2023-06-01 00:39:03 +10:00
David Woloszyn
5bad9bd064 MDL-77252 course: Show notification depending on room status 2023-05-17 10:22:24 +10:00
David Woloszyn
d38cc920c5 MDL-77252 core_communication: Get room status and notifications 2023-05-17 10:06:11 +10:00
Safat
019f74f8b6 MDL-77576 core_communication: Implement privacy api 2023-05-11 13:35:17 +10:00
Safat
ca1e5d0beb MDL-77576 core_communication: Add core communication api
This commit will implement the base api for core
communication. This will include the room creation,
room membership, room access url and all associated
api and related interfaces.

Originally implemented as MDL-76702, MDL-76703 and MDL-76705.

Co-Authored-By: David Woloszyn <david.woloszyn@moodle.com>
Co-Authored-By: Safat Shahin <safat.shahin@moodle.com>
2023-05-11 13:35:16 +10:00
Huong Nguyen
163b4134df MDL-77576 core: Register new communication sub-system
Create a new subsystem for communication and create
associated experimental settings to safely use the
new subsystem.

Originally implemented as MDL-76699.

Co-Authored-By: Huong Nguyen <huongnv13@gmail.com>
2023-05-05 14:41:28 +10:00