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

Add commenting for fuel suppliers #414

Merged

Conversation

plasticviking
Copy link
Contributor

This pull request introduces the commenting feature for fuel suppliers.

Changelog highlights:

  • Added natural key lookups for User, Role, Permission, Credit Trade Status, and Type to ease test fixture creation
  • Exhaustive testing suite to validate permissions are applied as specified by business logic
  • Created a new test fixture with more production-like government roles to test finer-grained permissions
  • Refactored commenting permissions to allow client and server to share the same logic (the server passes allowable commenting actions as part of a credit trade API response)
  • Tooltips/disabled statuses for action buttons when commenting mode is active

plasticviking and others added 30 commits June 15, 2018 09:25
Changelog:
- Model created
- Serializers created and adjuste
- privileged_access boolean field to control API visibility of comments

Todo:
- Create new permission (VIEW|EDIT)_PRIVILIGED_COMMENT
- Create route/viewSet to save comments
- Wire up the frontend
- Unit tests
Testing mostly finished now. A few more test cases to include for
completeness.

Pending:
- Wire up the frontend
- A handful of additional api test cases
API is now built and has thorough unit-testing
roles_permissions_v0.3.0.json
Adjusted permission class to use `'key' in dict` format rather than
dict.has_key('key').

Confirmed working with Python 3.6.4
Added front-end code to show Credit Balance of the selected organization for IDIR Users
Added a check on the user's permission before showing the balance of the organization
Updated test_api_custom so it follows pep8 coding style a bit better
Added MinSerializer for Organization to reduce the amount of data (and add security) coming in for Credit Trades
Added Declined indicator in the breadcrumbs
Rescinded as a Flag, instead of Status
# Conflicts:
#	backend/api/fixtures/test_credit_trade_comments.json
#	backend/api/models/CreditTrade.py
#	backend/api/models/CreditTradeComment.py
#	backend/api/models/CreditTradeHistory.py
#	backend/api/models/User.py
#	backend/api/permissions/CreditTradeComment.py
#	backend/api/serializers/CreditTrade.py
#	backend/api/serializers/CreditTradeHistory.py
#	backend/api/services/CreditTradeService.py
#	backend/api/test_api.py
#	backend/api/test_api_credit_trade_comment.py
#	backend/api/test_credit_trades.py
#	backend/api/viewsets/CreditTrade.py
#	backend/nose.cfg
#	frontend/src/credit_transfers/CreditTransferViewContainer.js
#	frontend/src/credit_transfers/components/CreditTransferDetails.js
#	frontend/src/credit_transfers/components/CreditTransferFormButtons.js
#	frontend/src/credit_transfers/components/CreditTransferProgress.js
#	frontend/src/credit_transfers/components/CreditTransferTable.js
disabled={props.disabled.BTN_SIGN_2_2}
title={props.permissions.BTN_SIGN_2_2
disabled={props.isCommenting || props.disabled.BTN_SIGN_2_2}
title={props.isCommenting ? Lang.TEXT_COMMENT_DIRTY : (props.permissions.BTN_SIGN_2_2
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know that eslint will complain about the nested ternary, but it's the most concise way to do this, and the parens make precedence unambiguous.

@plasticviking plasticviking added this to the RELEASE v0.3.1 milestone Jun 29, 2018
…r-fuel-suppliers

# Conflicts:
#	backend/api/serializers/CreditTrade.py
@kuanfandevops
Copy link
Collaborator

Do you have a Trello card for this?

@plasticviking
Copy link
Contributor Author

Closes issue #395 (Trello card 688 https://trello.com/c/tGlVgY8P)

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you adjust the filename for this so it's incremented by 1? Just to avoid two 15's

@amichard
Copy link
Contributor

amichard commented Jul 3, 2018

Some notes I noticed while I was testing this:

During the review step, when I have the option to recommend and not recommend, I can't see the comment button. Am I missing some fixtures? (I can see it fine during the approval/decline step)
screen shot 2018-07-03 at 8 33 19 am

During the approval step, I noticed that there's no space between "Decline to Approve" and "Approve" buttons.
screen shot 2018-07-03 at 8 34 11 am

@plasticviking
Copy link
Contributor Author

plasticviking commented Jul 3, 2018

@amichard I'll check that out. It's something to do with the spacing being different when the button is in disabled state. I haven't added any special rules so I'll dig into it.

Regarding the buttons not appearing in review state, that's a business logic rule. Per Justin analysts should be able to comment when in signed 2/2 and reviewed and directors should only be able to comment when in reviewed.

I created test fixture users for my test cases that have either RECOMMEND or (DECLINE|APPROVE) credit transfer but not both, in order to test the logic.

- button styling
- migration file names
- also snuck in a column rename per comment on Trello card bcgov#688
@plasticviking
Copy link
Contributor Author

@amichard All review comments addressed in latest push

Copy link
Contributor

@amichard amichard left a comment

Choose a reason for hiding this comment

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

Looks good!

@kuanfandevops kuanfandevops merged commit 3df1803 into bcgov:master Jul 3, 2018
kuanfandevops pushed a commit that referenced this pull request Jul 3, 2018
This fixes the issue brought in by #414 Add commenting for fuel suppliers
kuanfandevops pushed a commit that referenced this pull request Sep 19, 2019
…pliers.

Changelog highlights:

Added natural key lookups for User, Role, Permission, Credit Trade Status, and Type to ease test fixture creation
Exhaustive testing suite to validate permissions are applied as specified by business logic
Created a new test fixture with more production-like government roles to test finer-grained permissions
Refactored commenting permissions to allow client and server to share the same logic (the server passes allowable commenting actions as part of a credit trade API response)
Tooltips/disabled statuses for action buttons when commenting mode is active
kuanfandevops pushed a commit that referenced this pull request Sep 19, 2019
This fixes the issue brought in by #414 Add commenting for fuel suppliers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants