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 new feedback api #11162

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open

Conversation

stevenwinship
Copy link
Contributor

What this PR does / why we need it: In SPA, users are allowed to send feedback to contacts of a collection, dataset or file.
Input would include subject, message, from (email autocomplete if login, or filled out by guest users).

In Native API, it has a similar API endpoint sending feedback to contact, but it is under admin path, and it returns contacts' email that could be sensitive. Send Feedback To Contact(s)

Which issue(s) this PR closes: #11129

  • Closes # 11129

Special notes for your reviewer:

Suggestions on how to test this:

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?: Included

Additional documentation: config and native-api additions

@stevenwinship stevenwinship self-assigned this Jan 16, 2025
@stevenwinship stevenwinship added GREI Re-arch Issues related to the GREI Dataverse rearchitecture FY25 Sprint 14 FY25 Sprint 14 (2025-01-02 - 2025-01-15) FY25 Sprint 15 FY25 Sprint 15 (2025-01-15 - 2025-01-29) Type: Feature a feature request Size: 30 A percentage of a sprint. 21 hours. (formerly size:33) SPA.Q4.9 Collection Page: Contact SPA.Q1 Not related to any specific Q1 feature labels Jan 16, 2025
@coveralls
Copy link

coveralls commented Jan 16, 2025

Coverage Status

coverage: 24.389% (+1.6%) from 22.751%
when pulling 9f8a9e1 on 11129-send-feedback-to-contacts
into d70de2c on develop.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

1 similar comment

This comment has been minimized.

JsonNumber jsonNumber = jsonObject.getJsonNumber("targetId");
DvObject feedbackTarget = null;
if (jsonNumber != null) {
feedbackTarget = dvObjSvc.findDvObject(jsonNumber.longValue());
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably out of scope, but how hard would it be to support finding Dataverses by alias and datasets/files by persistent id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably not hard but it would require a documentation change that makes the api under /admin different from this new one. Would it be more confusing to have the json files differ between the 2 APIs?

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'll make the change

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

@POST
@AuthRequired
@Consumes("application/json")
public Response submitFeedback(@Context ContainerRequestContext crc, JsonObject jsonObject) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be helpful to get the json as a string and then parse it within the try so that you can give the user better feedback. I tried it with invalid json and I get a 500 error and an empty response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea

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 made the change to pass in a string and validate it

This comment has been minimized.

1 similar comment

This comment has been minimized.

@stevenwinship stevenwinship self-assigned this Jan 28, 2025

This comment has been minimized.

@stevenwinship stevenwinship removed their assignment Jan 28, 2025
}

// feedbackTarget and idtf are both null this is a support feedback and is ok
if (feedbackTarget == null && idtf != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to say && (idtf != null || jsonNumber != null) because now if the jsonNumber doesn't return a dvObject it will go to general support, which we probably don't want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. the idtf used to have a string version of the jsonNumber but now it doesn't

// idtf will hold the "targetId" or the "identifier". If neither is set then this is a general feedback to support
String idtf = jsonNumber != null ? jsonNumber.toString() : jsonObject.containsKey("identifier") ? jsonObject.getString("identifier") : null;

Copy link
Contributor

@sekmiller sekmiller left a comment

Choose a reason for hiding this comment

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

Just one more small logic change (when there's no feedback target) and I think we're good to go.

Copy link

📦 Pushed preview images as

ghcr.io/gdcc/dataverse:11129-send-feedback-to-contacts
ghcr.io/gdcc/configbaker:11129-send-feedback-to-contacts

🚢 See on GHCR. Use by referencing with full name as printed above, mind the registry name.

Copy link
Contributor

@sekmiller sekmiller left a comment

Choose a reason for hiding this comment

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

OK. Looks good. Thanks for the updates.

@sekmiller sekmiller removed their assignment Jan 29, 2025
@cmbz cmbz added the FY25 Sprint 16 FY25 Sprint 16 (2025-01-29 - 2025-02-12) label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FY25 Sprint 14 FY25 Sprint 14 (2025-01-02 - 2025-01-15) FY25 Sprint 15 FY25 Sprint 15 (2025-01-15 - 2025-01-29) FY25 Sprint 16 FY25 Sprint 16 (2025-01-29 - 2025-02-12) GREI Re-arch Issues related to the GREI Dataverse rearchitecture Size: 30 A percentage of a sprint. 21 hours. (formerly size:33) SPA.Q1 Not related to any specific Q1 feature SPA.Q4.9 Collection Page: Contact Type: Feature a feature request
Projects
Status: Ready for QA ⏩
Development

Successfully merging this pull request may close these issues.

4 participants