Skip to content

Conversation

@im-shubham-vish
Copy link
Contributor

@im-shubham-vish im-shubham-vish commented Sep 12, 2024

Description

Fixes #1602

Insufficient collection information when submitting an article.

Instructions for Reviewers

Sometimes, the collections returned by the collection browser are indistinguishable because their names are identical to other collections and their parent communities.
For example, suppose you have two communities named "Institution A" and "Institution B," each with a subcommunity named "Reports." Both subcommunities have a collection called "Research Reports." If I want to submit an item to "Institution B > Reports > Research Reports," it's impossible to differentiate between the "Reports" subcommunity in "Institution A" and "Institution B" when searching for the "Research Reports" collection.
Expected Behavior
Instead of displaying only the name of the parent community, the interface should display the full hierarchy, similar to how it's done in XMLUI.

List of Changes in this PR:

• Added a method getHierarchicalName in sidebar-search-list-element.component.ts that returns the hierarchical name. Now, parentTitle calls getHierarchicalName instead of getParentTitle.
• Added a method createInstanceFromDSpaceObject responsible for creating an instance of DSpaceObject.
• Removed the maxlines argument from sidebar-search-list-element.component.html.
• Added some CSS to the content class in truncatable-part.component.scss.

Steps to Test and Reproduce the Behavior:

  1. Create two top-level communities named "A" and "B."
  2. Create a subcommunity named "Reports" under each top-level community.
  3. Create a collection named "Research Reports" within each "Reports" subcommunity.
  4. Try to submit an item to "B > Reports > Research Reports" and ensure that the full hierarchical name is displayed.

@tdonohue tdonohue added bug usability component: submission 1 APPROVAL pull request only requires a single approval to merge labels Sep 12, 2024
@tdonohue
Copy link
Member

@im-shubham-vish : Thanks for the PR. Just a note that this is failing lint formatting checks. You can see those locally by running npm run lint. They are also visible in this PR if you look at the "Files changed" tab. Some of these may be fixed automatically if you run npm run lint-fix

We require all PRs to pass lint formatting checks.

@EikLoe
Copy link
Member

EikLoe commented Sep 27, 2024

Hi @im-shubham-vish ,
thanks for you PR! I tested it locally and it worked perfectly. I just noticed, you kept the parentTitle$ variable in the TypeScript file. Is there a reason for it? Because as far as I can see, you don't need it any more or do I miss something?
Also, you might adjust the spec test in the sidebar-search-list-element.component.spec.ts in order to test the hierarchicalTitle$ instead of the parentTitle$.

@im-shubham-vish
Copy link
Contributor Author

Hi @Leano1998,
Sorry for the late reply & thanks for your feedback! You're right we have no use case left for parentTitle$. So I've adjusted all over the possible places to use hierarchicalTitle$ instead of the parentTitle$ including spec test files.

Please recheck once and let me know in case you've any feedback.

Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

@im-shubham-vish : Thanks for this PR. I gave it a test today, and the basic functionality is working for me. I've verified, I see the entire hierarchy in the popup for "New -> Community", "New -> Collection" and "New -> Item". Here's what it looks like to me

hierarchy-communities

The only issues that I have with this PR is the way in which you've duplicated the same test over and over in several of the spec files. I think it'd be much cleaner & smaller if you moved these tests to a single location...and Codecov (our test verification tool) would also likely stop complaining that it cannot find your tests.

If you can get your tests updated, I think this would be ready to merge.

describe('JournalIssueSidebarSearchListElementComponent',
createSidebarSearchListElementTests(JournalIssueSidebarSearchListElementComponent, object, parent, 'parent title', 'title', '5 - 7'),
);
function getExpectedHierarchicalTitle(parentObj: Collection, obj: ItemSearchResult): Observable<string> {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not a fan of the repetition of the same getExpectedHierarchicalTitle() function in every test that is based off sidebar-search-list-element.

Why not move all this logic to the sidebar-search-list-element.component.spec.ts? It seems to me that single spec file could be updated to ensure it now checks properly for the hierarchical title instead of the single object's title. That way you don't have to copy this function into 9 other spec files.

* and build a heirarchical name by concating the parent's names
*/
getParentTitle(): Observable<string> {
getHierarchicalName(): Observable<string> {
Copy link
Member

Choose a reason for hiding this comment

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

As noted by CodeCov validation below (see the "files changed" tab in GitHub), you are missing specs for the changes to this sidebar-search-list-element.component.ts. Ideally, we should have tests in sidebar-search-list-element.component.spec.ts which verify the behavior of this new getHierarchicalName() method.

Copy link
Member

@tdonohue tdonohue Apr 24, 2025

Choose a reason for hiding this comment

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

My prior feedback has NOT been addressed on this getHierarchicalName() method. We need to add new tests to sidebar-search-list-element.component.spec.ts which prove that this method is properly building the hierarchical name at all times. Otherwise, there is a risk that it will accidentally break in the future & we won't realize it.

@github-actions
Copy link

Hi @im-shubham-vish,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@im-shubham-vish
Copy link
Contributor Author

@tdonohue Thanks for the feedback! I have implemented your suggestions and pushed the changes.

Please review and let me know if you have any further feedback.

@tdonohue tdonohue self-requested a review April 15, 2025 14:20
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

@im-shubham-vish : Thanks for the updates. I got back to this PR today. It still works when I test it manually. However, the tests don't appear to be running at all. I don't see the output of the tests when I run npm test, or in the GitHub logs. Are you getting these tests to run?

Overall, this code works. But, I still don't see the tests working properly. It's important to have new & working tests so that this code doesn't break in the future. See my inline comments below.

createSidebarSearchListElementTests(JournalSidebarSearchListElementComponent, object, parent, 'parent title', 'title', '1234, 5678'),
);
const expectedHierarchicalTitle = getExpectedHierarchicalTitle(parent, object);
if (expectedHierarchicalTitle) {
Copy link
Member

Choose a reason for hiding this comment

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

This if clause in all tests appears to be skipping the test. When I run these tests locally (or look at the logs of the tests in GitHub), I cannot find any proof of the "JournalSidebarSearchListElementComponent" test being run below.

Are you sure these tests are running? Could we remove this if statement to prove they work?

* and build a heirarchical name by concating the parent's names
*/
getParentTitle(): Observable<string> {
getHierarchicalName(): Observable<string> {
Copy link
Member

@tdonohue tdonohue Apr 24, 2025

Choose a reason for hiding this comment

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

My prior feedback has NOT been addressed on this getHierarchicalName() method. We need to add new tests to sidebar-search-list-element.component.spec.ts which prove that this method is properly building the hierarchical name at all times. Otherwise, there is a risk that it will accidentally break in the future & we won't realize it.

if (expectedHierarchicalTitle) {
expectedHierarchicalTitle.subscribe((hierarchicalTitle: string) => {
describe('JournalSidebarSearchListElementComponent', () => {
createSidebarSearchListElementTests(JournalSidebarSearchListElementComponent, object, parent, hierarchicalTitle, 'title', '1234, 5678');
Copy link
Member

Choose a reason for hiding this comment

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

Since all of these tests call createSidebarSearchListElementTests, couldn't we move the call to getExpectedHierarchicalTitle() into that existing createSidebarSearchListElementTests method? I don't see why we need to have the if or the subscribe above? Is there something I'm missing here?

@im-shubham-vish
Copy link
Contributor Author

@tdonohue We have incorporated the suggestions. Kindly review and if you have any feedbacks let us know.

@PitbaranK
Copy link

@tdonohue,
Kindly help us by reviewing and merging the changes in this pull request.
If you have any feedback or suggestions, please feel free to share — we’re happy to connect and make any necessary adjustments.

@tdonohue tdonohue self-requested a review June 23, 2025 16:10
@PitbaranK
Copy link

PitbaranK commented Aug 18, 2025

@tdonohue,
Could you please help us understand if we are missing anything, as this PR is still not proceeding further even after incorporating the requested changes?

@EikLoe,
Could you kindly take another look and get back on the same? Reference : #3327 (comment)

@PitbaranK
Copy link

@tdonohue,
Thanks for the review. We have incorporated all the changes requested #3327 (review). Kindly review and close the change requested.

@github-actions
Copy link

Hi @im-shubham-vish,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

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

Labels

1 APPROVAL pull request only requires a single approval to merge bug component: submission usability

Projects

Status: 👀 Under Review

Development

Successfully merging this pull request may close these issues.

Insufficient collection information when submitting an article

4 participants