Skip to content

Add a 'Jump to latest' button in mobile and desktop view and also adj…#39

Merged
ImTheKai merged 1 commit intohackorum-dev:mainfrom
ImTheKai:jump-to-latest
Feb 4, 2026
Merged

Add a 'Jump to latest' button in mobile and desktop view and also adj…#39
ImTheKai merged 1 commit intohackorum-dev:mainfrom
ImTheKai:jump-to-latest

Conversation

@ImTheKai
Copy link
Collaborator

@ImTheKai ImTheKai commented Feb 4, 2026

…ust the style of merge topic and this new button to match the existing style, so it's clear these are actual buttons

.thread-actions data-controller="thread-actions" [email protected] data-thread-actions-read-all-url-value=read_all_topic_path(@topic, format: :json)
button.button-secondary data-action="click->thread-actions#markAllRead" Mark all messages read
- last_message = @messages.last
- if user_signed_in? || last_message.present?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would make this user_signed_in? && last_message.present?

and then the last if, which isn't dependent on the user, only last_message, could be one lever higher.

Overall a lot simpler because we need less nested conditions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can make it easier, but don't we have three conditions?

  • both buttons when user_signed_in? && last_message.present?
  • only “Mark all messages read” when signed in
  • only “Jump to latest” when not signed in

Copy link
Collaborator

Choose a reason for hiding this comment

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

First button: both conditions
Second button: only the has message condition

And the "thread action attrs" require no additional condition, that was just part of the mark all read button and worked fine previously

Copy link
Collaborator

Choose a reason for hiding this comment

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

(strictly speaking we never display threads with 0 messages, so we don't really need the "has message" condition, but it's a good safety net)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Gotcha, adjusted - please check again

…ust the style of merge topic and this new button to match the existing style, so it's clear these are actual buttons

Signed-off-by: Kai Wagner <[email protected]>
@ImTheKai ImTheKai merged commit ceb8eea into hackorum-dev:main Feb 4, 2026
4 checks passed
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.

2 participants