Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(provisioning_api): Translate exceptions shown in the frontend #43234

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jan 31, 2024

Summary

This exception messages are used by the front end to be displayed to the user, using hint exceptions would be quite breaking as hint exceptions are handled as HTTP error 500 for OCS controllers.
But I think it should be ok to simply translate the messages as for programmatically usage you should not use the message but the status code.

Also fixed some minor deprecation issue.

Checklist

@susnux susnux added bug 3. to review Waiting for reviews feature: language l10n and translations php Pull requests that update Php code labels Jan 31, 2024
@susnux susnux added this to the Nextcloud 29 milestone Jan 31, 2024
@@ -1432,7 +1412,7 @@ public function removeFromGroup(string $userId, string $groupid): DataResponse {

if (count($userSubAdminGroups) <= 1) {
// Subadmin must not be able to remove a user from all their subadmin groups.
throw new OCSException('Not viable to remove user from the last group you are SubAdmin of', 105);
throw new OCSException($this->l10n->t('Not viable to remove user from the last group you are SubAdmin of'), 105);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you use "SubAdmin" or "subadmin". Please align all occurences. My vote goes to "sub-admin"
btw. I do not get the meaning of this sentence:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you use "SubAdmin" or "subadmin". Please align all occurences. My vote goes to "sub-admin"

Done ✅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw. I do not get the meaning of this sentence

If I understand this correctly a sub-admin is not allowed to remove a user from all groups that user is sub-admin of, meaning the user must stay sub-admin of at least one groupe (maybe @nickvergessen, as the author, can help)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think so, to avoid users that are managed by no one

@susnux susnux force-pushed the fix/provisioning-exception-msgs branch 2 times, most recently from 46b36b7 to 5b5da71 Compare January 31, 2024 13:43
@susnux susnux force-pushed the fix/provisioning-exception-msgs branch from 5b5da71 to 8a25bee Compare January 31, 2024 16:01
@susnux susnux dismissed rakekniven’s stale review January 31, 2024 16:02

Made wording consistent "sub-admin", please re-review

@susnux susnux dismissed nickvergessen’s stale review January 31, 2024 16:03

Reverted to deprecated function, please re-review

@susnux susnux force-pushed the fix/provisioning-exception-msgs branch from 8a25bee to 4ea985b Compare January 31, 2024 18:57
@susnux susnux requested a review from Pytal January 31, 2024 18:58
@susnux
Copy link
Contributor Author

susnux commented Jan 31, 2024

@Pytal also added translations for the missing exceptions - at least if it makes sense.

…eplace some deprecations

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux force-pushed the fix/provisioning-exception-msgs branch from 4ea985b to a025611 Compare February 1, 2024 13:02
@susnux susnux enabled auto-merge February 1, 2024 13:02
@susnux susnux merged commit 937a6a8 into master Feb 1, 2024
134 checks passed
@susnux susnux deleted the fix/provisioning-exception-msgs branch February 1, 2024 15:55
@blizzz blizzz mentioned this pull request Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug feature: language l10n and translations php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OCSExption "Cannot remove yourself from the admin group" is not translatable
4 participants