Skip to content

Link Sharing / New User Management #760

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

Merged
merged 13 commits into from
Sep 3, 2019
Merged

Link Sharing / New User Management #760

merged 13 commits into from
Sep 3, 2019

Conversation

feliks-montez
Copy link
Contributor

@feliks-montez feliks-montez commented Aug 12, 2019

Overview

This is a large addition that replaces the user-management-app module, now called the share-with-others module. It adds the additional feature of allowing project owners to invite new members via a reusable invite link. All user/permissions management has been moved to a single modal that can be opened from anywhere within a lexicon project. All permissions/members changes are updated in real time.

See the trello card.

Current UI

Desktop

image
image
image

Mobile

image
image

Frontend features

  • Add ProjectRole, ProjectRoles, and LexRoles typings to reflect project roles on the backend in ProjectRoles.php and LexRoles.php.
  • Adds ProjectService methods to correspond to the API calls added in Back end for link sharing #759.

UI Features

The following features are implemented but not clearly understood from the screenshot.

  • After typing in an email address and clicking send, the proper callbacks fire to invite the user via an email and assigns them the permission level specified by the dropdown.
  • The Reusable Invite Link feature works and is appropriately tied to the backend inviteToken methods. Anyone who accesses link will be added to the project as a member under the role specified by the dropdown.
  • Clicking on one of the disabled link textboxes auto-selects the URL for easy copying.
  • The Filter Members box is functional and has an X that can be clicked to clear it.
  • When the Anyone (no-sign-in-required) is disabled, it is greyed out and does not automatically highlight the URL when clicked. Otherwise, it looks and behaves normally.
  • The user list is populated from the DB.
  • The Xs remove members from the project.
  • Share buttons have been added; one in right of the navbar and one replaces the old User Management button in the cog dropdown.
  • The dropdowns next to members allow changing of the member's role in the project.
  • Allow others to share checkbox at the bottom allows non-manager members to access a limited version of the sharing dialog:
    image

Backend Features

  • sendInvite now allows specification of which role to assign to the invited user.
  • sendInvite now checks to make sure the invitingUser has authority to invite based on project.allowSharing and its own role authority.
  • useInviteToken from Back end for link sharing #759 now checks to see if the user accessing the invite link is already a member of the project. Before, if you accessed it as the owner, you could accidentally demote yourself.

Yet Unimplemented

  • Does not display/allow accepting of join requests.
  • Anyone, no-sign-in-required feature
  • List publicly on languageforge.org checkbox at bottom of modal

Issues

  • The following error is displayed every time the modal loads:
    error-sharing

  • Depending on phone size, it could be hard to tell that the members list scrolls.

  • Done button may be off-screen for mobile.

  • Uses LexRole in UserCommands.php, which is not an exclusively LF file. The code is written in such a way so as not to interfere with SF, but present nonetheless.

  • I've noticed that ProjectCommands::updateUserRole allows updating to even non-existent roles.


This change is Reviewable

@feliks-montez feliks-montez force-pushed the feature/sharingDialog branch from ff03cf4 to 04aab02 Compare August 12, 2019 06:18
Copy link
Collaborator

@megahirt megahirt left a comment

Choose a reason for hiding this comment

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

This is looking really great! I have a number of comments below. This PR will become the main feature PR including changes to the PHP back-end.

Reviewed 21 of 21 files at r1.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @feliks-montez)


src/angular-app/bellows/shared/model/user.model.ts, line 1 at r1 (raw file):

export class User {

in a future commit, we will need to ensure that the TS models follow the PHP models exactly. Fine that for now this is stubbed out.


src/angular-app/languageforge/lexicon/lexicon.scss, line 1 at r1 (raw file):

@import 'editor/editor';

It looks to me like all of these additions are specific to the modal. Let's move these out of lexicon.scss and put them in /share-with-others/share-with-others.scss


src/angular-app/languageforge/lexicon/lexicon.scss, line 6 at r1 (raw file):

@import '../../../angular-app/bellows/apps/activity/activity.scss';

.inline-form {

.inline-form seems to me like a generic class that you could be affecting the CSS of other inputs/forms in the application and you wouldn't know it. I'm guessing this query selector should be made more specific, perhaps with another class name or id ?


src/angular-app/languageforge/lexicon/lexicon-app.component.html, line 9 at r1 (raw file):

    <div data-ui-view></div>

    <i class="fa fa-share-alt" data-ng-click="$ctrl.openShareWithOthersModal()"></i>

I can't see from the screenshot where the Share button is located. Can you post one? Also, we should change the menu item text link from "User Management" to "Share With Others" and have it launch the modal, would you agree?


src/angular-app/languageforge/lexicon/shared/share-with-others/_permissions-dropdown.scss, line 0 at r1 (raw file):
Delete this file please.


src/angular-app/languageforge/lexicon/shared/share-with-others/share-with-others.modal.html, line 7 at r1 (raw file):

  </div>
  <div class="modal-body">
    <user-management-app></user-management-app>

Per our conversation, you can keep <user-management> and move the non-user functions up to the modal component level (this one)


src/angular-app/languageforge/lexicon/shared/share-with-others/user-management-app.component.ts, line 65 at r1 (raw file):

  }

  queryUserList(): angular.IPromise<any> {

I would like to refactor/rename this method at some point. I never liked the 'queryUserList` name.

Copy link
Collaborator

@megahirt megahirt left a comment

Choose a reason for hiding this comment

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

I also note that we talked about UI layout changes for the mobile version, since that is not currently displaying properly

Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @feliks-montez)

@megahirt
Copy link
Collaborator

@feliks-montez feliks-montez force-pushed the feature/sharingDialog branch 6 times, most recently from fca5203 to 49041c5 Compare August 13, 2019 11:13
Copy link
Contributor Author

@feliks-montez feliks-montez left a comment

Choose a reason for hiding this comment

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

Reviewable status: 8 of 25 files reviewed, 7 unresolved discussions (waiting on @feliks-montez and @megahirt)


src/angular-app/languageforge/lexicon/lexicon.scss, line 1 at r1 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

It looks to me like all of these additions are specific to the modal. Let's move these out of lexicon.scss and put them in /share-with-others/share-with-others.scss

Done.


src/angular-app/languageforge/lexicon/lexicon.scss, line 6 at r1 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

.inline-form seems to me like a generic class that you could be affecting the CSS of other inputs/forms in the application and you wouldn't know it. I'm guessing this query selector should be made more specific, perhaps with another class name or id ?

Done.


src/angular-app/languageforge/lexicon/lexicon-app.component.html, line 9 at r1 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

I can't see from the screenshot where the Share button is located. Can you post one? Also, we should change the menu item text link from "User Management" to "Share With Others" and have it launch the modal, would you agree?

Done.


src/angular-app/languageforge/lexicon/shared/share-with-others/_permissions-dropdown.scss, line at r1 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

Delete this file please.

Done.


src/angular-app/languageforge/lexicon/shared/share-with-others/share-with-others.modal.html, line 7 at r1 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

Per our conversation, you can keep <user-management> and move the non-user functions up to the modal component level (this one)

Done. After talking with Ira, I feel pretty good about the current layout of this. If you have more thoughts, let me know.


src/angular-app/languageforge/lexicon/shared/share-with-others/user-management-app.component.ts, line 65 at r1 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

I would like to refactor/rename this method at some point. I never liked the 'queryUserList` name.

Done.

@feliks-montez feliks-montez force-pushed the feature/sharingDialog branch from 4319a26 to 2704262 Compare August 14, 2019 05:10
Copy link
Collaborator

@megahirt megahirt 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 so far! Let's keep this PR as the one that will integrate the server-side

Reviewed 20 of 25 files at r2.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @feliks-montez)


src/angular-app/bellows/shared/model/user.model.ts, line 10 at r2 (raw file):

  avatar_ref?: string;
  avatarUrl?: string;
  isInvitee?: boolean;

The user management app has specific code that helps determine if an user is an "invitee" or not. Check out this user management code and I think you'll find that we don't need the invitee flag on the user. At least that's what my memory says.


src/angular-app/languageforge/lexicon/shared/share-with-others/permissions-dropdown.component.html, line 15 at r2 (raw file):

    <div class="dropdown-divider" ng-if="$ctrl.allowDelete"></div>
    <li class="dropdown-item" role="menuitem" ng-if="$ctrl.allowDelete">
      <div ng-click="$ctrl.onDeleteTarget({$event: {target: $ctrl.target}})" class="text-danger">remove member from project</div>

How about just "Remove"?


src/angular-app/languageforge/lexicon/shared/share-with-others/share-with-others.modal.html, line 7 at r1 (raw file):

Previously, feliks-montez (Feliks Montez) wrote…

Done. After talking with Ira, I feel pretty good about the current layout of this. If you have more thoughts, let me know.

ok sounds good.


src/Site/views/languageforge/theme/default/sass/_global.scss, line 44 at r2 (raw file):

  }

  #shareBtn {

you defined #shareBtn twice in this file. Let's keep it under a single definition.


src/Site/views/languageforge/theme/default/sass/_global.scss, line 272 at r2 (raw file):

  }

  #shareBtn {

you defined #shareBtn twice in this file. Let's keep it under a single definition.

Copy link
Contributor

@irahopkinson irahopkinson left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @feliks-montez and @megahirt)


src/angular-app/bellows/shared/model/user.model.ts, line 10 at r2 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

The user management app has specific code that helps determine if an user is an "invitee" or not. Check out this user management code and I think you'll find that we don't need the invitee flag on the user. At least that's what my memory says.

Nope. At conference earlier this year we fixed a nasty security bug because we did not have the isInvitee flag and different bits of the code were inferring that status different ways. We migrated all existing data so the flag is now the authoritative and correct way to check this status.

@feliks-montez feliks-montez changed the title Link Sharing / New User Management UI (Frontend only) Link Sharing / New User Management Aug 14, 2019
@feliks-montez feliks-montez force-pushed the feature/sharingDialog branch 3 times, most recently from 423ce1e to da9aefb Compare August 15, 2019 03:50
@megahirt megahirt marked this pull request as ready for review August 15, 2019 09:08
@feliks-montez feliks-montez force-pushed the feature/sharingDialog branch 3 times, most recently from 0b6c660 to 3772629 Compare August 17, 2019 03:32
*add basic sharing modal
*working ui-only invite-by-email component
*set fixed width for permissions dropdowns
*move both invite methods to the same component
* add share button to test modal
* basic user list w/ permissions
* add `avatar_ref` to the attributes returned in the users DTO
* include `avatar_ref` in php test
* add disabled option to permissions dropdown
* refactor structure to be more angular
* modal is now a component
* main files moved inside feature folder
* add x's to delete members & re-align
* don't display X's on you or the owner
* grey out based on permissions selected
* adjust margins/padding
* expand description for public listing
* improve mobile view
* allow removal of members in dropdown & fix UI
* fix member deletion
* fix permissions dropdown display
* remove spacers for invite permissions
* move styles to separate stylesheet
append email-invited user to members list on 'send'
* move share button to main navbar
* PR review adjustments
* replace `User Management` in cog dropdown with `Share With Others`
* more specific .inline-form selector
* remove unused user-permission-list component
* rename to user-management
* move checkboxes to main sharing modal
* refactor `queryUserList()` to `loadMemberData()`
* cleanup refactor of `user-management` component
* verify that an inviter has authority & frontend email inviting
* fix permissions errors in `inviteUser` tests
* front and back end data model updates
* add ProjectRole, ProjectRoles, LexRoles to reflect DB models
* add inviteToken to sessionData.project DTO
* add frontend mirror methods for inviteToken
* return blank string if no invite token
refactor permissions-dropdown component
* rename permissions-dropdown to role-dropdown
* fix greyout fields
* connect UI reusable invite link to backend
* don't change an existing member's role if they use the invite link
* add PHP unit test
* fix project_manager key in frontend model
* show sharing button for project managers
* hide unimplemented features
* improve manager icon & show email instead of username
*implement allowSharing checkbox
* displays a reduced sharing dialog to non-manager members when project.allowSharing is true

*fix various bugs
  * don't try to send invites to blank emails
  * allowSharing checkbox initial load

*adjust & test backend permissions for non-manager member invites
* refactor to not use `=` binding
* center "owner" text with dropdowns
@feliks-montez feliks-montez force-pushed the feature/sharingDialog branch from 3772629 to 7f0838b Compare August 17, 2019 05:23
Copy link
Contributor Author

@feliks-montez feliks-montez left a comment

Choose a reason for hiding this comment

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

Reviewable status: 8 of 37 files reviewed, 5 unresolved discussions (waiting on @feliks-montez and @megahirt)


src/Site/views/languageforge/theme/default/sass/_global.scss, line 44 at r2 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

you defined #shareBtn twice in this file. Let's keep it under a single definition.

One of them is under a @media query for mobile.


src/Site/views/languageforge/theme/default/sass/_global.scss, line 272 at r2 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

you defined #shareBtn twice in this file. Let's keep it under a single definition.

Same as above.


src/angular-app/languageforge/lexicon/shared/share-with-others/permissions-dropdown.component.html, line 15 at r2 (raw file):

Previously, megahirt (Christopher Hirt) wrote…

How about just "Remove"?

Done.

feliks-montez and others added 5 commits August 17, 2019 17:52
Also:
- Fix position of dropdown menus (aligned right) so it fits on mobile
- Fix size of email input for Firefox on small screens
- Previously only part of the menu item was clickable
- The pointer now changes to hand, as with other menus
- Icons added to each menu item
…ents

[PR to another branch] Improvements to the sharing dialog
Copy link
Collaborator

@megahirt megahirt left a comment

Choose a reason for hiding this comment

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

Great work @feliks-montez @Andrewdt97 @Nateowami ! This is being merged :) There are several todos which @Nateowami has called out in his previous PR that we'll look to tighten up post-merge. Thanks all!

Reviewed 25 of 31 files at r3, 5 of 5 files at r4.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @feliks-montez)


src/Site/views/languageforge/theme/default/sass/_global.scss, line 44 at r2 (raw file):

Previously, feliks-montez (Feliks Montez) wrote…

One of them is under a @media query for mobile.

ok got it, thanks.


src/Site/views/languageforge/theme/default/sass/_global.scss, line 272 at r2 (raw file):

Previously, feliks-montez (Feliks Montez) wrote…

Same as above.

ok I see that now. Thanks.

Copy link
Collaborator

@megahirt megahirt left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @feliks-montez)

Copy link
Collaborator

@megahirt megahirt left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@megahirt megahirt merged commit 79a8f1f into master Sep 3, 2019
@megahirt megahirt deleted the feature/sharingDialog branch September 3, 2019 08:04
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.

4 participants