Skip to content

Show the uploaded file name in submission upload notifications - #6057

Open
milanmajchrak wants to merge 1 commit into
DSpace:mainfrom
dataquest-dev:bitstream-name-in-upload-notifications
Open

Show the uploaded file name in submission upload notifications#6057
milanmajchrak wants to merge 1 commit into
DSpace:mainfrom
dataquest-dev:bitstream-name-in-upload-notifications

Conversation

@milanmajchrak

Copy link
Copy Markdown
Contributor

Description

Drop three files into a submission and you get three identical "Upload successful" toasts. If one of them fails, there's no way to tell which. This makes each notification name its file. When we don't have a name to show, you get the old generic message, same as before.

Instructions for Reviewers

What changed:

  • ds-uploader gets a second output, onCompleteItemWithFile, carrying { response, fileName? }. The old onCompleteItem still fires first and still emits the bare response, so the three other places using the uploader don't notice anything.
  • onUploadError is typed as UploaderError now instead of any, and the upload notification keys all moved into one small getNotificationContent() helper.
  • Two new keys in en.json5. Locales that don't have them yet fall back to the generic message instead of printing a raw submission.sections.upload.* key — that's what the default interpolate param is doing.

To try it: drop two or three files into the Upload section and check each toast names the right one. For the size-limit path you need dspace.upload.max configured, otherwise the feature is simply off and the test tells you nothing.

Before, both files give you the same message:

Before

After:

After

Checklist

  • Created against main — no, this one is a backport onto dtq-dev.
  • Small — 51 lines of actual code across 4 files, the rest is specs and i18n.
  • Follows our coding conventions.
  • Passes ESLint — green in CI.
  • No circular dependencies — green in CI.
  • TypeDoc on everything new.
  • Specs — 24 new ones. CI went from 5467 to 5491 passing, nothing else moved.
  • Accessibility — the notification component isn't touched, so it's the same role="alert" region and the same escaped rendering path, only the text differs. I haven't put a screen reader on it.
  • i18n keys, no hardcoded English.
  • How to test it — above.
  • No new dependencies.
  • Nothing new to document.

Written with some help from Claude Code.

Dropping several files into a submission produced identical "Upload
successful" toasts, so a single failure inside a batch was impossible to
attribute. Each notification now names the file it refers to, falling back
to the existing generic messages when no client-side name is available.

The uploader gains an additive `onCompleteItemWithFile` output carrying the
parsed response together with the file name. The existing `onCompleteItem`
is retained and still emits the bare response first, so the other consumers
of `ds-uploader` are unaffected. `onUploadError` is retyped from `any` to
the existing `UploaderError`, and a single `getNotificationContent()` helper
is now the only place an upload notification key appears.

Locales that have not translated the two new keys render the generic message
via the `default` interpolate param that MissingTranslationHelper already
honours, rather than a raw dotted key.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lgeggleston

Copy link
Copy Markdown
Contributor

@milanmajchrak thanks for submitting this improvement to usability!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 🙋 Needs Reviewers Assigned

Development

Successfully merging this pull request may close these issues.

2 participants