DSpace / dspace-angular

DSpace User Interface built on Angular.io
https://wiki.lyrasis.org/display/DSDOC8x/
BSD 3-Clause "New" or "Revised" License
130 stars 427 forks source link

grant-deny-request-copy.component.html: Cannot read properties of null (reading 'decisionDate') #2390

Closed saschaszott closed 1 year ago

saschaszott commented 1 year ago

Bug Description

Preliminary Note: Unfortunately, I was not able to reproduce this bug on the DSpace demo instance since the email delivery is disabled (I did not receive request-a-copy emails). Perhaps someone who is able to receive request-a-copy emails can try to reproduce this bug?

The request-a-copy email contains a paragraph

To answer, click https://somedomain.tld/request-a-copy/. Whether you choose to grant or deny the request, we think that it''s in your best interest to respond.

If the author opens the link, he/she is requested to log in. After the successful login, a white page with title Document copy request is shown (you can find a screenshot below).

image

The JS console contains error messages

ERROR TypeError: Cannot read properties of null (reading 'decisionDate')
    at GrantDenyRequestCopyComponent_div_0_div_4_Template (grant-deny-request-copy.component.html:4:11)
    at executeTemplate (core.mjs:9717:1)
    at refreshView (core.mjs:9580:1)
    at refreshEmbeddedViews (core.mjs:10731:1)
    at refreshView (core.mjs:9604:1)
    at refreshEmbeddedViews (core.mjs:10731:1)
    at refreshView (core.mjs:9604:1)
    at refreshComponent (core.mjs:10777:1)
    at refreshChildComponents (core.mjs:9376:1)
    at refreshView (core.mjs:9630:1)

The error is caused by this line

<div *ngIf="!itemRequestRD.payload.decisionDate">

in the template file src/app/request-copy/grant-deny-request-copy/grant-deny-request-copy.component.html. I can confirm that itemRequest.payload is null.

The GET request to https://dsbackend.tld/server/api/tools/itemrequests/<token> returns the expected result, e.g.

{
  "id" : 8,
  "decisionDate" : null,
  "expires" : null,
  "requestDate" : "2023-07-21T13:23:23.220+00:00",
  "token" : "2413ce949d784a79bc9f8824dbd42dbc",
  "acceptRequest" : false,
  "allfiles" : false,
  "type" : "itemrequest",
  "bitstreamId" : "b68ffc13-95bf-457c-8886-948e92beb187",
  "itemId" : "5ea06922-85d8-4b40-87a6-e1448adedc84",
  "requestEmail" : "doe@example.com",
  "requestName" : "Testuser",
  "requestMessage" : "Das ist eine Testnachricht.",
  "_links" : {
    "bitstream" : {
      "href" : "http://localhost:8080/server/api/tools/itemrequests/8/bitstream"
    },
    "item" : {
      "href" : "http://localhost:8080/server/api/tools/itemrequests/8/item"
    },
    "self" : {
      "href" : "http://localhost:8080/server/api/tools/itemrequests/8"
    }
  }
}
tdonohue commented 1 year ago

@saschaszott : Could you verify which version of DSpace you are reproducing this on? This bug sounds like a possible duplicate of #2195...and that was fixed in 7.6.

saschaszott commented 1 year ago

Thank you, @tdonohue . I was not aware of this bugfix. It is fixed in DS 7.6.