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 Fullname Support to User Profiles #2608

Merged

Conversation

annapurna-gupta
Copy link
Contributor

Fixes #1282

@@ -56,18 +70,20 @@ def setupUi(self, addUserDialog):
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

self.retranslateUi(addUserDialog)
self.buttonBox.accepted.connect(addUserDialog.accept)
self.buttonBox.rejected.connect(addUserDialog.reject)
self.buttonBox.accepted.connect(addUserDialog.accept) # type: ignore
Copy link
Member

Choose a reason for hiding this comment

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

why is there a # type: ignore now?

usually this is not in a pyuic5 autogenerated file

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 will check this and revert it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this have been reverted now or was this created by the conversion process?

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 think this is created by the conversion process, because i don't remember doing it manually, should i remove this?

Copy link
Member

Choose a reason for hiding this comment

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

it is maybe OS dependent, I can reproduce it.

 pyuic5 --version
Python User Interface Compiler 5.15.9 for Qt version 5.15.8

pyuic5 ui_add_user_dialog.ui > ../qt5/ui_add_user_dialog.py
reimarbauer@MBP-von-Reimar ui % grep -i type ../qt5/ui_add_user_dialog.py
        self.buttonBox.accepted.connect(addUserDialog.accept) # type: ignore
        self.buttonBox.rejected.connect(addUserDialog.reject) # type: ignore

@ReimarBauer
Copy link
Member

try to alter a test that now also the fullname is checked if one was added

@annapurna-gupta
Copy link
Contributor Author

try to alter a test that now also the fullname is checked if one was added

i am sorry, i didn't understand...can you please explain

@ReimarBauer
Copy link
Member

ReimarBauer commented Jan 26, 2025

image

Where we currenly have Change Avatar, there should be an "Edit"
The Edit should be used to change the Avatar and the Full Name. Changing the e-mail is currently not allowed by user action.

@annapurna-gupta
Copy link
Contributor Author

image

Where we currenly have Change Avatar, there should be an "Edit" The Edit should be used to change the Avatar and the Full Name. Changing the e-mail is currently not allowed by user action.

Screenshot 2025-01-26 172121
Whenever I try to add a user, an error is displayed.

@annapurna-gupta
Copy link
Contributor Author

image

Where we currenly have Change Avatar, there should be an "Edit" The Edit should be used to change the Avatar and the Full Name. Changing the e-mail is currently not allowed by user action.

Is it possible to create a new issue for this change? I would be happy to work on it.

@ReimarBauer
Copy link
Member

image
Where we currenly have Change Avatar, there should be an "Edit" The Edit should be used to change the Avatar and the Full Name. Changing the e-mail is currently not allowed by user action.

Is it possible to create a new issue for this change? I would be happy to work on it.
yes, after the half feature is added, currently someone will ask where is the fullname...

@ReimarBauer
Copy link
Member

try to alter a test that now also the fullname is checked if one was added

i am sorry, i didn't understand...can you please explain

We have now changed the API and the model. The CI runs should cover the changes. The tests are all in your fork too
https://github.com/annapurna-gupta/MSS/tree/feature/add-fullname-nickname/tests

We should have at least a test which covers adding a fullname on user creation
e.g. https://github.com/annapurna-gupta/MSS/blob/feature/add-fullname-nickname/tests/_test_msui/test_mscolab.py#L178

@ReimarBauer
Copy link
Member

@annapurna-gupta Eric has a good documentation about pytest https://pytest-with-eric.com/
There some more sources on the net https://realpython.com/pytest-python-testing/
on pyvideo you do find many https://pyvideo.org/tag/pytest/

@annapurna-gupta
Copy link
Contributor Author

@annapurna-gupta Eric has a good documentation about pytest https://pytest-with-eric.com/
There some more sources on the net https://realpython.com/pytest-python-testing/
on pyvideo you do find many https://pyvideo.org/tag/pytest/

Thanks for the pytest resources! I couldn’t work on the issue as my college practicals were going on.

@annapurna-gupta
Copy link
Contributor Author

annapurna-gupta commented Feb 3, 2025

Hi @ReimarBauer , I’ve pushed PR, please review it...meanwhile, I’ll fix the tests.

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

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

have a look on the signature of add_user and improve it and add tests which use fullname

export QT_QPA_PLATFORM=offscreen
pytest -k test_url_combo
ERROR tests/_test_msui/test_mscolab.py::Test_Mscolab_connect_window::test_url_combo - TypeError: add_user() missing 1 required positional argument: 'fullname'

@annapurna-gupta
Copy link
Contributor Author

@ReimarBauer can you please review the changes.

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

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

see comments and also look into the tests output of the CI

@annapurna-gupta
Copy link
Contributor Author

see comments and also look into the tests output of the CI

Could you please guide me on how to fix the migration script issue? Once that is resolved, I will fix the CI results.

@ReimarBauer
Copy link
Member

ReimarBauer commented Feb 7, 2025

Look into the content of the added file. We we will have only 1 version 10.0.0 release.
So we want only 1 migration file.

Your new file is not needed.

Move the changes to the existing mig script for version 10.0.0.

@annapurna-gupta
Copy link
Contributor Author

Look into the content of the added file. We we will have only 1 version 10.0.0 release. So we want only 1 migration file.

Your new file is not needed.

Move the changes to the existing mig script for version 10.0.0.

okk

@annapurna-gupta
Copy link
Contributor Author

@ReimarBauer could you please look at the changes and the workflow error.

@annapurna-gupta
Copy link
Contributor Author

annapurna-gupta commented Feb 13, 2025

@ReimarBauer could you please take a look in this pr.

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

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

see comments

@annapurna-gupta
Copy link
Contributor Author

Hi @ReimarBauer, i have made the requested changes.

@ReimarBauer
Copy link
Member

Thx I look later today.

@annapurna-gupta
Copy link
Contributor Author

Thx I look later today.

btw what is your time zone.

Copy link
Member

@ReimarBauer ReimarBauer left a comment

Choose a reason for hiding this comment

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

Thx

@ReimarBauer
Copy link
Member

@matrss please do a final review :)

@ReimarBauer
Copy link
Member

Thx I look later today.

btw what is your time zone.

MEZ

@ReimarBauer
Copy link
Member

@annapurna-gupta please look at the merge conflict and solve it

@annapurna-gupta
Copy link
Contributor Author

@annapurna-gupta please look at the merge conflict and solve it

done

Comment on lines 253 to 254
fullname = " ".join(fullname.split()) # Removes extra spaces from fullname
result_with_regex = slugify(fullname, regex_pattern=r"[^a-zA-Z\s\-]")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems rather restrictive, my own name would not be allowed according to these rules. Why is the name validated against these rules at all?

There are a lot of falsehoods that people believe about the structure of names: https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/. In the end those falsehoods boil down to "a software must allow an arbitrary UTF-8 string of arbitrary (or at least sufficient) length as a name to not inadvertently declare a real name as 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.

You're right, I think I shouldn't restrict the full name, I should pass it as it is.

@@ -56,18 +70,20 @@ def setupUi(self, addUserDialog):
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

self.retranslateUi(addUserDialog)
self.buttonBox.accepted.connect(addUserDialog.accept)
self.buttonBox.rejected.connect(addUserDialog.reject)
self.buttonBox.accepted.connect(addUserDialog.accept) # type: ignore
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this have been reverted now or was this created by the conversion process?

@ReimarBauer
Copy link
Member

This is maybe a difference on the OS where it is created. At least I can reproduce it on my MBP too.

pyuic5 --version
Python User Interface Compiler 5.15.9 for Qt version 5.15.8
pyuic5 ui_add_user_dialog.ui > ../qt5/ui_add_user_dialog.py

reimarbauer@MBP-von-Reimar ui % grep -i type ../qt5/ui_add_user_dialog.py
        self.buttonBox.accepted.connect(addUserDialog.accept) # type: ignore
        self.buttonBox.rejected.connect(addUserDialog.reject) # type: ignore

@annapurna-gupta
Copy link
Contributor Author

annapurna-gupta commented Feb 27, 2025

@matrss could you please review the changes.

@ReimarBauer
Copy link
Member

Likly you want to ask @matrss or?

Comment on lines 252 to 257
if fullname == "":
return {"success": True, "processed_name": fullname}
if any(char.isalpha() for char in fullname):
return {"success": True, "processed_name": fullname}
else:
return {"success": False, "message": "Full name must contain at least one letter"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the rationale for the remaining restrictions?

Copy link
Contributor Author

@annapurna-gupta annapurna-gupta Feb 27, 2025

Choose a reason for hiding this comment

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

What is the rationale for the remaining restrictions?

I thought a full name shouldn't contain only numbers or special characters..i will remove it.

@annapurna-gupta
Copy link
Contributor Author

Likly you want to ask @matrss or?

yes..sorry for the confusion..

Copy link
Collaborator

@matrss matrss left a comment

Choose a reason for hiding this comment

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

LGTM now, thank you!

A next step should be to make the fullname changeable after registration. Existing user accounts should be able to make use of this feature too.

@annapurna-gupta
Copy link
Contributor Author

annapurna-gupta commented Feb 28, 2025

LGTM now, thank you!

A next step should be to make the fullname changeable after registration. Existing user accounts should be able to make use of this feature too.

I got you, and @ReimarBauer has already suggested changing the avatar button to an edit button that will allow editing the full name and changing the avatar. I think it would be better to create a separate issue for this, and I will definitely work on it. Since updating the avatar button might take some time, and I need to start working on my proposal, I’ll work on this in the meantime or maybe after the proposal period.

@ReimarBauer ReimarBauer merged commit da81953 into Open-MSS:develop Mar 3, 2025
6 of 8 checks passed
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.

user profile options
3 participants