stats4sd / aec_portfolio

A proof of concept for the AEC Consortium Project Management / Assessment System
GNU General Public License v3.0
0 stars 0 forks source link

Add User feedback #160

Closed dave-mills closed 1 year ago

dave-mills commented 1 year ago

This fixes #151.

User Feedback

This PR does a number of things:

Data Handling

  1. It creates a new UserFeedback model, with related UserFeedbackType and UserFeedbackComment models.

    • a user feedback entry can be linked to a user (optional).
    • it always has a "type" (e.g. "bug", "feature request" or "general feedback")
    • it can have many comments (which are comments added by Site managers or admins).
  2. User Feedback items can also have media items attached to it. Spatie's Media Library + Pro are installed to handle this.

  3. User Feedback items are created through a Vue component form via the main front end.

  4. The CRUD controller is only for site managers / admins to review the feedback and edit to add their own comments.

Front End

The Videos link is now replaced with a Support link. This takes the user to a new page with different support options:

CleanShot 2023-07-20 at 17 06 22@2x

The General Support tab describes how to get support. Point 2 (Instutional Support) is different based on the current user's role. For Institutional Assessors and Members, this section lists the Institutional Admins for the current institution, with the suggestion that they can contact those admins for "internal" support.

The Training resources tab links to and embeds the YouTube Videos.

The User Feedback tab contains a contact form for users to share feedback with Site Managers.

CRUD Panel

Right now, you need to manually go to /admin/user-feedback to get to the CRUD panel. This will change when we re-enable the sidebar / CRUD panel links for Site Managers + Admins.

CleanShot 2023-07-20 at 17 13 50@2x

The table shows the key details of the feedback item. There is a details_row that shows the message, any attachments and any added manager comments. The Edit function enables addition / editing of all attached comments.

TODO + FUTURE

TODO Now:

Possible updates in future

I think all these issues are beyond the scope of what we should be doing at this stage. I believe the current implimentation fits the terms in the Tech Spec document and works well enough to allow users of the platform to formally register bugs, reequests or comments, and for us (Site managers) to review all the submitted feedback in one central location.

dave-mills commented 1 year ago

Extra: I added a new permission for this: "manage user feedback", and have given this to Site Managers and Site Admins.

I also realised that we don't have a sensible way of managing changes to roles and permissions as the system develops. The RoleSeeder seems like a sensible place, so I rewrote that to use "updateOrCreate" when creating roles and permissions, and to be human-readable in the assignment of permissions to roles.

This way we can manage changes to permissions within the system by updating this file and re-running this single Seeder when we deploy to live. This file also now acts as a self-documenting list of which roles have which permissions.

TODO: add this seeder to the deployment script.

dan-tang-ssd commented 1 year ago

Pulled latest code, installed laravel media library pro. npm run dev successfully.

I logged in as an institutional admin and performed testing.

For user account belongs to multiple institutions, user needs to select an institution after login. Before selecting an institution, it is good that user will be diverted to select institution when click on "Dashboard", "My Institution", "Initiatives".

image

However, error occurred if user clicks on "Support" or "My Account". Looks like it is caused by assuming there is a selected institution.

Can we also diver user to select institution for these two pages?

image

image

image

image

dan-tang-ssd commented 1 year ago

I have submitted a user feedback as an institutional admin.

Then I login as site admin in another broswer, go to /admin/user-feedback before selecting an institution. When I click on the file attachment of user feedback, it diverts to select institution. It works well to download attachement file if an institution has been selected before.

Um... I think we probably no need to fix it here. As we will have a new sidebar for site admin and site manager later on. We can divert user to select an institution before entering user-feedback CRUD panel.

image

image

image

dave-mills commented 1 year ago

Can we also diver user to select institution for these two pages

Good spot. I've put those routes into the right place so they're also affected by the "select organisation" middleware. Now, you'll get asked to select an organisation if none is current selected before reaching the Support or Account pages.

(This will also become easier to manage once merged in with the latest version, that has the "change institution" option in the top-right for users with multiple institutions)

dave-mills commented 1 year ago

I have submitted a user feedback as an institutional admin.

Then I login as site admin in another broswer, go to /admin/user-feedback before selecting an institution. When I click on the file attachment of user feedback, it diverts to select institution. It works well to download attachement file if an institution has been selected before.

Um... I think we probably no need to fix it here. As we will have a new sidebar for site admin and site manager later on. We can divert user to select an institution before entering user-feedback CRUD panel.

I agree.

dan-tang-ssd commented 1 year ago

I logged in as site admin, view the user feedback submitted by institutional admin. In CRUD list view, it shows user feedback type is "Bug", which is correct.

But in edit view, user feedback type is empty...

image

image

dan-tang-ssd commented 1 year ago

I submit a user feedback without linking to a user, it works.

In user feedback CRUD panel, there are two user feedbacks now. I tried to search by keyword in message, failed... I also failed to search by partial user email address... Um... which data items it searches for actually...?

image

image

image

dave-mills commented 1 year ago

In user feedback CRUD panel, there are two user feedbacks now. I tried to search by keyword in message, failed... I also failed to search by partial user email address... Um... which data items it searches for actually...?

The search on these crud panels never works well until we actually set it up. I consider it a "nice to have" here, rather than a requirement, so I'm ok with it not working for now.

dan-tang-ssd commented 1 year ago

Deployment is completed in staging env. Manually imported user_feedback_types records into staging database.

Testing is performed partially as I do not have site admin / site manager login details to access /admin/user-feedback CRUD panel.


Screen shots:

User feedback with file attachment can be submitted successfully image

image

One user_feedbacks record added in database image

Two media records added for 2 file attachments in database image


My account role is institutional admin, this role does not have permission to access /admin/user-feedback CRUD panel.

Error occurred when I try to access /admin/user-feedback image

As we connected AEC staging env to Laravel Flare. It sends alert email when error occured image

We can view more details and context in Laravel Flare web site. E.g. URL, user, which program triggered the error, routing, PHP version, Laravel version, etc

Note: If someone is going to access those unauthorized pages, we will receive alert email(s) from Laravel Flare.

image

image

image

image