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

PLT-4332 Position field for Users #4632

Merged
merged 16 commits into from
Dec 14, 2016
Merged

Conversation

grundleborg
Copy link
Contributor

@grundleborg grundleborg commented Nov 22, 2016

Summary

Adds a Position field to users, editable in the Account Settings general tab, and displayed below the name in the profile popover.

Ticket Link

#4188

https://mattermost.atlassian.net/browse/PLT-4332

Issues

  • Need to decide on if/how to integrate this change with other authentication systems.
  • When to update the API docs (given this new field isn't in a released version of MM yet)?

Checklist

  • Added or updated unit tests (required for all new features)
  • Added API documentation (required for all new APIs)
  • All new/modified APIs include changes to the drivers
  • Has enterprise changes: https://github.com/mattermost/enterprise/pull/71
  • Has UI changes
  • Includes text changes and localization file updates
  • Touches critical sections of the codebase (auth, upgrade, etc.)

@coreyhulen coreyhulen added the 2: Dev Review Requires review by a developer label Nov 22, 2016
enahum
enahum previously requested changes Nov 22, 2016
@@ -3760,6 +3760,10 @@
"translation": "Invalid nickname"
},
{
"id": "model.user.is_valid.position.app_error",
"translation": "Invalid position"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should be more specific on why this field is invalid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How does "Invalid Position: maximum length is 128 characters." sound?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

if (this.props.activeSection === 'position') {
let extraInfo;
let submit = null;
if ((this.props.user.auth_service === 'ldap' || this.props.user.auth_service === Constants.SAML_SERVICE) && global.window.mm_config.PositionAttributeSet === 'true') {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is the case, we should add this to SAML and LDAP, if not we should remove this and add it later in case it applies

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'm going to raise this question on pre-release as I'm not sure of the answer myself.

Choose a reason for hiding this comment

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

Sorry, what is the question here? @grundleborg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yangchen1 sorry, there isn't actually a question there! It was "Should the position field be populated automatically from external auth providers, like other fields are?". I think we've come to the conclusion that the answer is yes.

Choose a reason for hiding this comment

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

Ah OK, great! :) That sounds right.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

describe = (
<FormattedMessage
id='user.settings.general.emptyPosition'
defaultMessage="Click 'Edit' to add your position"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this string says much, is it related to your job position? maybe discuss this with a PM?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deferring to a PM on this one.

Choose a reason for hiding this comment

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

@grundleborg If it isn't clear, let's say Click 'Edit' to add your job title / position.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@jwilander jwilander added 1: PM Review Requires review by a product manager and removed 2: Dev Review Requires review by a developer labels Nov 22, 2016
@enahum
Copy link
Contributor

enahum commented Nov 22, 2016

Changing this to be reviewed by a PM first cause this qualifies as a new feature

@grundleborg grundleborg added the Setup Old Test Server Triggers the creation of a test server label Nov 23, 2016
@yangchen1
Copy link

Overall looks good! Thanks @grundleborg I forgot to include the character limit in the spec, which should be no more than 35 characters including spaces. Otherwise it goes too out of the box here:

image

Also, this is probably not related to this PR, but clicking the profile picture seems to not display the position field, but clicking people's username does - it should probably show for both.

@grundleborg grundleborg added Setup Old Test Server Triggers the creation of a test server and removed Setup Old Test Server Triggers the creation of a test server labels Nov 23, 2016
@grundleborg
Copy link
Contributor Author

@yangchen1 fixed the limit to be 35 characters instead. You can also now see the Position attribute setting in LDAP and SAML settings pages of Admin Console.

@enahum enahum added Setup Old Test Server Triggers the creation of a test server and removed Setup Old Test Server Triggers the creation of a test server labels Nov 23, 2016
@yangchen1
Copy link

@grundleborg to add automatic truncation if LDAP position is longer than 35 characters

@grundleborg
Copy link
Contributor Author

@yangchen1 fixed.

@yangchen1
Copy link

Looks good! :) 👍

@jasonblais jasonblais added 2: Dev Review Requires review by a developer and removed 1: PM Review Requires review by a product manager Setup Old Test Server Triggers the creation of a test server labels Dec 5, 2016
@@ -188,7 +188,8 @@
"SkipCertificateVerification": false,
"QueryTimeout": 60,
"MaxPageSize": 0,
"LoginFieldName": ""
"LoginFieldName": "",
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this so it is with the other attributes?

@crspeller
Copy link
Member

Discussion on pre-release: https://pre-release.mattermost.com/core/pl/iabmurbjx7y1z8u8off1mkcsjy

Let's make the back-end implementation be a custom field so we can expand on this later.

@@ -50,6 +50,7 @@ func NewSqlUserStore(sqlStore *SqlStore) UserStore {
table.ColMap("NotifyProps").SetMaxSize(2000)
table.ColMap("Locale").SetMaxSize(5)
table.ColMap("MfaSecret").SetMaxSize(128)
table.ColMap("Position").SetMaxSize(35)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would set it to something more std like 64 chars then limit in the UI or via checks. We do this all over the place because we change our minds so often on size. That way the DB doesn't need to change, just a random constant somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will change this to 64 char hard limit in DB, with validation/UI limit of 35 char.

@grundleborg
Copy link
Contributor Author

@crspeller Sorry, UI fail. Was suposed to say that to @enahum and to add to your one that we decided against custom fields in dev meeting.

Copy link
Contributor

@enahum enahum left a comment

Choose a reason for hiding this comment

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

other than @crspeller and @coreyhulen comments

@enahum
Copy link
Contributor

enahum commented Dec 13, 2016

also I think it needs a rebase

@grundleborg
Copy link
Contributor Author

@crspeller @coreyhulen rebased and fixed both your review comments.

@coreyhulen coreyhulen added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a developer labels Dec 13, 2016
@coreyhulen
Copy link
Contributor

Feel free to merge once build is complete.

@grundleborg
Copy link
Contributor Author

Please could someone with the necessary permissions merge this?

@enahum enahum merged commit 8406e85 into mattermost:master Dec 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants