Skip to content

Fix navigation between all users and journal users#4671

Merged
ajrbyers merged 7 commits into
masterfrom
b-4667-press-users-link-bugfix
Mar 25, 2025
Merged

Fix navigation between all users and journal users#4671
ajrbyers merged 7 commits into
masterfrom
b-4667-press-users-link-bugfix

Conversation

@joemull

@joemull joemull commented Mar 20, 2025

Copy link
Copy Markdown
Member

Fixes #4667 - bug report.
Fixes #4577 - underlying problem.

Adds an additional menu for links back from the press to the journal level:

image

"Test A" in this screenshot is the name of the press.

@joemull

joemull commented Mar 20, 2025

Copy link
Copy Markdown
Member Author

@Astronaut-resting Is it alright if I assign you for first review of this? It fixes the link from the journal level to the press level, and also adds a box at the press level with links back to the journal users pages.

@Astronaut-resting Astronaut-resting left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

looks good!

@joemull joemull requested a review from mauromsl March 20, 2025 17:01
@joemull

joemull commented Mar 20, 2025

Copy link
Copy Markdown
Member Author

Ah, I had a thought about this one: we may need to ensure the list of journal links is sorted A-Z.

Comment on lines +50 to +52
{% comment %} The above URLs are hardcoded because there is no other
way to form a press URL dynamically on a journal page at the moment,
or to form a journal URL dynamically on a press page.{% endcomment %}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we do have one: see fqdn.external_journal_url.

Comment thread src/press/tests/test_views.py Outdated
Comment on lines +42 to +87
@override_settings(URL_CONFIG='domain')
def test_link_from_journal_users_to_all_users_domain(self):
self.client.force_login(self.press_manager)
self.journal_one.domain = 'one.example.org'
self.journal_one.save()
response = self.client.get(
'/user/all/',
SERVER_NAME=self.journal_one.domain,
)
content = response.content.decode()
self.assertIn(f'{self.press.domain}/user/all/', content)

@override_settings(URL_CONFIG='path')
def test_link_from_journal_users_to_all_users_path(self):
self.client.force_login(self.press_manager)
response = self.client.get(
'/user/all/',
SERVER_NAME=self.journal_one.domain,
)
content = response.content.decode()
self.assertIn(f'{self.press.domain}/user/all/', content)

@override_settings(URL_CONFIG='domain')
def test_link_from_all_users_to_journal_users_domain(self):
self.client.force_login(self.press_manager)
self.journal_one.domain = 'one.example.org'
self.journal_one.save()
response = self.client.get(
'/user/all/',
SERVER_NAME=self.press.domain,
)
content = response.content.decode()
self.assertIn(f'one.example.org/user/all/', content)

@override_settings(URL_CONFIG='path')
def test_link_from_all_users_to_journal_users_path(self):
self.client.force_login(self.press_manager)
response = self.client.get(
'/user/all/',
SERVER_NAME=self.press.domain,
)
content = response.content.decode()
self.assertIn(
f'{self.press.domain}/{self.journal_one.code}/user/all/',
content
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While I appreciate the existance of tests, these types of tests we are introducing here look more like acceptance tests than unit tests. They are relatively slow and they are just testing that you've put the correct URL on the template, so I don't think we should include them as long as we use the correct template tag to generate urls and that the tag itself is properly unittested.

@joemull

joemull commented Mar 24, 2025

Copy link
Copy Markdown
Member Author

Thanks for your updates Mauro. Before you review this Andy, I will fix a typo and also sort the journals A-Z.

@joemull joemull self-assigned this Mar 24, 2025
@joemull joemull force-pushed the b-4667-press-users-link-bugfix branch from e6dc7cf to 8f40daf Compare March 25, 2025 12:42
@joemull joemull assigned ajrbyers and unassigned joemull Mar 25, 2025

@ajrbyers ajrbyers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good - though added a comment about an potentially unused method.

Comment thread src/press/models.py Outdated
@ajrbyers ajrbyers assigned joemull and unassigned ajrbyers Mar 25, 2025
@joemull joemull requested a review from ajrbyers March 25, 2025 13:24
@joemull joemull assigned ajrbyers and unassigned joemull Mar 25, 2025
@ajrbyers ajrbyers merged commit 142163e into master Mar 25, 2025
@ajrbyers ajrbyers deleted the b-4667-press-users-link-bugfix branch March 25, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix bug that prevents movement between press and journal levels Reversing press URLs on journal sites in path mode

4 participants