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

Hide forbidden actions from issue modal (fix etalab/data.gouv.fr#22) #1128

Merged
merged 1 commit into from Sep 18, 2017
Merged

Hide forbidden actions from issue modal (fix etalab/data.gouv.fr#22) #1128

merged 1 commit into from Sep 18, 2017

Conversation

noirbizarre
Copy link
Contributor

This PR does 2 things:

  • ensure that issue modal only display buttons that the user can use
  • provide a default error handler for the admin part (right now, only handling 403)

@noirbizarre noirbizarre added this to the 1.1.7 milestone Sep 12, 2017
@noirbizarre noirbizarre requested a review from a team September 12, 2017 15:16
const notif = {type: 'danger', icon: 'exclamation-circle'};
if (error.status === 403) {
notif.title = this._('Operation not permitted');
notif.details = this._('You are not allowed to perform this operation');
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure to understand how it is displayed in context?

A person could get to see this message even though no button/action lead to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, this is a generic handler (handle only 403 but it's a start and it needs improvements) that "can" be used on any operation without the need for a specific error handler.
This one simply display the error in the notification zone (the toast).
But this is displayed only on error on actions triggered by the user (See: https://github.com/opendatateam/udata/pull/1128/files#diff-506081ce406eac251a8b297d56b75664R129)

Note: the current situation is that most the API operation don't have error handling. This allows future bugfixes/improvements... to take advantage of this helper and/or make it handle more generic cases.

@noirbizarre noirbizarre merged commit 7c113c5 into opendatateam:master Sep 18, 2017
@noirbizarre noirbizarre deleted the dgfr-22-issue-actions-permissions branch September 18, 2017 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants