mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #43300
[Bug 1703608] Re: Institution addUserAsMember lang logic is flawed
Hi Nelson, Cecilia and I had a closer look at your change and as far as
we can see it concerns the institution confirmation message. Cecilia is
making that clearer in the commit message.
If you want to pull the patch and make the change that she suggested,
you can do so by pulling the patch directly from Gerrit. If you leave
the changeID in place, it will make a new patchset in the review rather
than an entirely new patch.
There are a few more messages that are concerned if you want to correct
them as well: Bug 1705162.
What to test:
1. Install 4 language packs besides having the default English one. Unless English is specifically mentioned as language to test with, do not use it as one of the languages and allow users to be in multiple institutions.
2. Do not change the site admin's language.
3. Select language 1 (L1) for the site.
4. Set up Institution A with language 2 (L2).
5. Set up Institution B with language 4 (L4).
Test scenarios from here on:
A)
6. Set up another user on the site in "No institution" and do not set their language. Leave the language on the default setting, i.e. that should be the site setting.
7. As site admin, add the user to Institution A.
8. Expected result: The institution confirmation notification is sent in L2.
B)
6. Set up another user on the site and do not set their language. Leave the language on the default setting, i.e. that should be the site setting.
7. Change the language of the site admin account to language 3 (L3).
8. As site admin, add the user to Institution 2.
9. Expected result: The institution confirmation notification is sent in L2.
C)
6. Set up another user on the site and change their language to L3.
7. As site admin (being on L1 or English), add the user to Institution A.
8. Expected result: The institution confirmation notification is sent in L3 as that is the user's chosen language preference.
D)
5. Set up another user in Institution B and leave the account settings on the default language.
6. As site admin (being on L1 or English), add the user to Institution A.
7. Expected result: The institution confirmation notification is sent in L2.
E)
5. Set up another user in Institution B and change the account settings to use L3, i.e. not the institution's language.
6. As site admin (being on L1 or English), add the user to Institution A.
7. Expected result: The institution confirmation notification is sent in L3.
F)
6. Set up another user in "No institution" and do not change their language preference.
6. Set up an institution admin in Institution A and change their personal language to L1.
7. As institution admin, invite the user to your institution. The invitation message is not displayed in L2 or L3 but that is something to resolve in bug 1705162.
8. As user, accept the invitation.
9. Expected result: The institution confirmation notification is sent in L2.
G)
6. Set up another user in "No institution" and change their language to L3.
6. Set up an institution admin in Institution A and change their personal language to L1.
7. As institution admin, invite the user to your institution. The invitation message is not displayed in L2 or L3 but that is something to resolve in bug 1705162.
8. As user, accept the invitation.
9. Expected result: The institution confirmation notification is sent in L3.
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1703608
Title:
Institution addUserAsMember lang logic is flawed
Status in Mahara:
In Progress
Bug description:
The logic in charge of selecting the lang for the message does not work as expected.
The condition:
if ($lang = get_account_preference($user->id, 'lang')) {
// The user has a preset lang preference so we will use this
}
else if ($this->lang != 'default') {
// The user hasn't been added yet, so we have to manually use this institution's lang
$lang = $this->lang;
}
else {
$lang = get_user_language($user->id);
}
gets always sent in english if the site default lang is french.
To reproduce it:
You set another language than english as default language. You an institution with default lang and then you add a user (his lang preference is not setting) into this institution. He is going to receive an english message in that case and also in the case that the institution language is explicitly set to the additional lang.
That is corrected with the following:
$lang = get_account_preference($user->id, 'lang');
if ($lang == 'default') {
// The user has not a preset lang preference so we will use the institution if it has one.
$institution_lang = get_record_sql(
"SELECT value FROM {institution_config} ic where ic.institution= ? and ic.field = 'lang' ",
[$this->name],
IGNORE_MULTIPLE
);
$this->lang = $institution_lang->value? $institution_lang->value: 'default';
if ($this->lang != 'default') {
// The user hasn't been added yet, so we have to manually use this institution's lang
$lang = $this->lang;
}
else {
$lang = get_config('lang')? get_config('lang'): '';
}
}
We have also opened a PR in github:
https://github.com/MaharaProject/mahara/pull/7
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1703608/+subscriptions
References