Skip to content

Commit 8fe94ec

Browse files
author
Laur0r
authoredApr 21, 2022
Merge pull request #95 from learnweb/update/m40
Update for Moodle 4.0
2 parents 1607ec7 + 80ffd75 commit 8fe94ec

8 files changed

+85
-25
lines changed
 

‎.github/workflows/moodle-ci.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ jobs:
99
strategy:
1010
matrix:
1111
php: ['7.4']
12-
moodle-branch: ['MOODLE_311_STABLE']
12+
moodle-branch: ['MOODLE_400_STABLE']
1313
database: ['pgsql']
1414

1515
steps:
1616
- name: Start PostgreSQL
17-
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6
17+
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:10
1818

1919
- name: Check out repository code
2020
uses: actions/checkout@v2
@@ -107,18 +107,18 @@ jobs:
107107
strategy:
108108
fail-fast: false
109109
matrix:
110-
php: ['7.3', '7.4']
111-
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE']
110+
php: ['7.4']
111+
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE', 'MOODLE_400_STABLE']
112112
database: ['mariadb', 'pgsql']
113113

114114
steps:
115115
- name: Start MariaDB
116116
if: matrix.database == 'mariadb'
117-
run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10.5
117+
run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10
118118

119119
- name: Start PostgreSQL
120120
if: matrix.database == 'pgsql'
121-
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6
121+
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:10
122122

123123
- name: Check out repository code
124124
uses: actions/checkout@v2
@@ -170,4 +170,4 @@ jobs:
170170

171171
- name: Behat features
172172
if: ${{ always() }}
173-
run: moodle-plugin-ci behat --profile chrome
173+
run: moodle-plugin-ci behat --auto-rerun 0

‎.github/workflows/moodle-release.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#
2+
# Whenever a new tag starting with "v" is pushed, add the tagged version
3+
# to the Moodle Plugins directory at https://moodle.org/plugins
4+
#
5+
# revision: 2021070201
6+
# Changed to be released on Github release with the release notes.
7+
#
8+
name: Releasing in the Plugins directory
9+
10+
on:
11+
release:
12+
types: [published]
13+
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
jobs:
19+
release-at-moodle-org:
20+
runs-on: ubuntu-latest
21+
env:
22+
PLUGIN: mod_moodleoverflow
23+
CURL: curl -s
24+
ENDPOINT: https://moodle.org/webservice/rest/server.php
25+
TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }}
26+
FUNCTION: local_plugins_add_version
27+
28+
steps:
29+
- name: Call the service function
30+
id: add-version
31+
run: |
32+
TAGNAME="${{ github.event.release.tag_name }}"
33+
BODY="${{ github.event.release.body }}"
34+
ZIPURL="${{ github.event.release.zipball_url }}"
35+
RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \
36+
--data-urlencode "wsfunction=${FUNCTION}" \
37+
--data-urlencode "moodlewsrestformat=json" \
38+
--data-urlencode "frankenstyle=${PLUGIN}" \
39+
--data-urlencode "zipurl=${ZIPURL}" \
40+
--data-urlencode "vcssystem=git" \
41+
--data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
42+
--data-urlencode "vcstag=${TAGNAME}" \
43+
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
44+
--data-urlencode "altdownloadurl=${ZIPURL}" \
45+
--data-urlencode "releasenotes=${BODY}" \
46+
--data-urlencode "releasenotesformat=4")
47+
echo "::set-output name=response::${RESPONSE}"
48+
- name: Evaluate the response
49+
id: evaluate-response
50+
env:
51+
RESPONSE: ${{ steps.add-version.outputs.response }}
52+
run: |
53+
jq <<< ${RESPONSE}
54+
jq --exit-status ".id" <<< ${RESPONSE} > /dev/null

‎lib.php

+7
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@
9292
* @return mixed true if the feature is supported, null if unknown
9393
*/
9494
function moodleoverflow_supports($feature) {
95+
global $CFG;
96+
97+
if (defined('FEATURE_MOD_PURPOSE')) {
98+
if ($feature == FEATURE_MOD_PURPOSE) {
99+
return MOD_PURPOSE_COLLABORATION;
100+
}
101+
}
95102

96103
switch ($feature) {
97104
case FEATURE_MOD_INTRO:

‎pix/monologo.svg

+1
Loading

‎tests/behat/behat_mod_moodleoverflow.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,14 @@ public function i_reply_post_from_moodleoverflow_with($postsubject, $moodleoverf
100100
protected function add_new_discussion($moodleoverflowname, TableNode $table, $buttonstr) {
101101

102102
// Navigate to moodleoverflow.
103-
$this->execute('behat_general::click_link', $this->escape($moodleoverflowname));
103+
$this->execute('behat_navigation::i_am_on_page_instance', [$this->escape($moodleoverflowname),
104+
'moodleoverflow activity']);
104105
$this->execute('behat_forms::press_button', $buttonstr);
105106

106107
// Fill form and post.
107108
$this->execute('behat_forms::i_set_the_following_fields_to_these_values', $table);
108-
$this->execute('behat_forms::press_button', get_string('posttomoodleoverflow', 'moodleoverflow'));
109+
$this->execute('behat_forms::press_button', get_string('posttomoodleoverflow',
110+
'moodleoverflow'));
109111
$this->execute('behat_general::i_wait_to_be_redirected');
110112
}
111113
}

‎tests/behat/edit_post_student.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Feature: Students can edit or delete their moodleoverflow posts within a set tim
1818
| activity | name | intro | course | idnumber |
1919
| moodleoverflow | Test moodleoverflow name | Test moodleoverflow description | C1 | moodleoverflow |
2020
And I log in as "student1"
21-
And I follow "C1"
21+
And I am on "Course 1" course homepage
2222
And I add a new discussion to "Test moodleoverflow name" moodleoverflow with:
2323
| Subject | Moodleoverflow post subject |
2424
| Message | This is the body |

‎tests/behat/track_read_posts.feature

+8-12
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ Feature: A teacher can set one of 3 possible options for tracking read moodleove
1515
| user | course | role |
1616
| student1 | C1 | student |
1717
And I log in as "admin"
18-
And I am on site homepage
19-
And I follow "Course 1"
20-
And I turn editing mode on
18+
And I am on "Course 1" course homepage with editing mode on
2119

2220
Scenario: Tracking moodleoverflow posts off
2321
Given the following "activities" exist:
@@ -49,21 +47,20 @@ Feature: A teacher can set one of 3 possible options for tracking read moodleove
4947
And I follow "Test moodleoverflow name"
5048
And I follow "Don't track unread posts"
5149
And I wait to be redirected
52-
And I follow "Course 1"
50+
And I am on "Course 1" course homepage
5351
And I should not see "1 unread post"
5452
And I follow "Test moodleoverflow name"
5553
And I follow "Track unread posts"
5654
And I wait to be redirected
5755
And I click on "1" "link" in the "Admin User" "table_row"
58-
And I follow "Course 1"
56+
And I am on "Course 1" course homepage
5957
And I should not see "1 unread post"
6058

6159
@javascript
6260
Scenario: Tracking moodleoverflow posts forced
6361
Given the following config values are set as admin:
6462
| allowforcedreadtracking | 1 | moodleoverflow |
65-
And I am on site homepage
66-
And I follow "Course 1"
63+
And I am on "Course 1" course homepage
6764
Given the following "activities" exist:
6865
| activity | name | intro | course | idnumber | trackingtype |
6966
| moodleoverflow | Test moodleoverflow name | Test moodleoverflow description | C1 | moodleoverflow | 2 |
@@ -78,14 +75,13 @@ Feature: A teacher can set one of 3 possible options for tracking read moodleove
7875
And I follow "1 unread post"
7976
And I should not see "Don't track unread posts"
8077
And I follow "Test post subject"
81-
And I follow "Course 1"
78+
And I am on "Course 1" course homepage
8279
And I should not see "1 unread post"
8380

8481
Scenario: Tracking moodleoverflow posts forced (with force disabled)
8582
Given the following config values are set as admin:
8683
| allowforcedreadtracking | 1 | moodleoverflow |
87-
And I am on site homepage
88-
And I follow "Course 1"
84+
And I am on "Course 1" course homepage
8985
Given the following "activities" exist:
9086
| activity | name | intro | course | idnumber | trackingtype |
9187
| moodleoverflow | Test moodleoverflow name | Test moodleoverflow description | C1 | moodleoverflow | 2 |
@@ -102,11 +98,11 @@ Feature: A teacher can set one of 3 possible options for tracking read moodleove
10298
And I follow "Test moodleoverflow name"
10399
And I follow "Don't track unread posts"
104100
And I wait to be redirected
105-
And I follow "Course 1"
101+
And I am on "Course 1" course homepage
106102
And I should not see "1 unread post"
107103
And I follow "Test moodleoverflow name"
108104
And I follow "Track unread posts"
109105
And I wait to be redirected
110106
And I click on "1" "link" in the "Admin User" "table_row"
111-
And I follow "Course 1"
107+
And I am on "Course 1" course homepage
112108
And I should not see "1 unread post"

‎version.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
defined('MOODLE_INTERNAL') || die();
2929

3030
$plugin->component = 'mod_moodleoverflow';
31-
$plugin->version = 2021111700;
32-
$plugin->release = 'v3.11-r2';
33-
$plugin->requires = 2018051703;
31+
$plugin->version = 2022041800;
32+
$plugin->release = 'v4.0-r1';
33+
$plugin->requires = 2020061500; // Requires Moodle 3.9+.
3434
$plugin->maturity = MATURITY_STABLE;
3535
$plugin->dependencies = array();

0 commit comments

Comments
 (0)