Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

settings: Add option to mark read on scroll only in conversation views #5469

Merged
merged 6 commits into from
Sep 2, 2022

Conversation

chrisbobbe
Copy link
Contributor

@chrisbobbe chrisbobbe commented Aug 18, 2022

Thanks to the handy new InputRowRadioButtons component we added in edf5322, this is now a quick user-visible feature we can check off the list.

Screenshots below.

Fixes: #5241
Replaces: #5294

@chrisbobbe
Copy link
Contributor Author

Before:

After:

@chrisbobbe
Copy link
Contributor Author

chrisbobbe commented Aug 18, 2022

I see that the right-facing arrows aren't lined up. Let's check back in after #5446 is merged; I expect that to go in the right direction towards fixing that (see screenshots there), and may even be the right, complete fix. Marking as blocked on #5446, but we can still review wording, etc., in the meantime.

@chrisbobbe chrisbobbe added the blocked on other work To come back to after another related PR, or some other task. label Aug 18, 2022
Comment on lines -167 to +175
<IconRight size={kRightArrowIconSize} color={BRAND_COLOR} />
<IconRight size={kRightArrowIconSize} color={themeData.color} />
Copy link
Member

Choose a reason for hiding this comment

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

What's the effect of this first commit -- is there an existing screen where it changes something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, the edit-stream screen. Here's a before-and-after:

Copy link
Member

Choose a reason for hiding this comment

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

Great, thanks. Seems good.

@gnprice
Copy link
Member

gnprice commented Aug 31, 2022

#5446 has been merged, so I think the next step is to rebase atop that and see how that alignment looks.

@gnprice gnprice removed the blocked on other work To come back to after another related PR, or some other task. label Aug 31, 2022
@chrisbobbe chrisbobbe force-pushed the pr-mark-read-conversation-views branch 2 times, most recently from 56c1e95 to d224289 Compare September 1, 2022 01:02
@chrisbobbe
Copy link
Contributor Author

chrisbobbe commented Sep 1, 2022

#5446 has been merged, so I think the next step is to rebase atop that and see how that alignment looks.

Yep, I agree. I haven't yet checked the alignment in this latest revision—for now, this just resolves rebase conflicts, and adds two commits on top that convert to using Flow enums now that #5444 has landed. We can see how we like that for this use case. 🙂 For now I have to run, though.

@chrisbobbe chrisbobbe force-pushed the pr-mark-read-conversation-views branch from d224289 to b6b5074 Compare September 2, 2022 01:49
@chrisbobbe
Copy link
Contributor Author

I haven't yet checked the alignment in this latest revision

OK, and done that for my new revision; I think we're good with the alignment. 🙂 Here's the before-and-after:

@gnprice
Copy link
Member

gnprice commented Sep 2, 2022

Thanks for the revision! Will take a look at the code momentarily.

@alya, do you have any thoughts on the text in the new screen? See the lower-right screenshot in the first comment above.

Comment on lines 378 to 381
export enum MarkMessagesReadOnScroll {
Always = 0,
Never = 1,
ConversationViewsOnly = 3,
Copy link
Member

Choose a reason for hiding this comment

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

Hmm -- why skip 2? Do the values end up mattering?

Comment on lines 90 to 89
migrations: { version: 52 },
...base37,
Copy link
Member

Choose a reason for hiding this comment

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

This will clobber migrations, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, I should switch the order of these two lines.

dispatch(setGlobalSettings({ doNotMarkMessagesAsRead: value }));
dispatch(
setGlobalSettings({
markMessagesReadOnScroll: MarkMessagesReadOnScroll.cast(value),
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, awkward to have to do this. (Also the static casts (…: number) above.)

It looks like the root of this is that we say key={item.key} in SelectableOptionsScreen, passing these keys as React key pseudoprops. Ideally the type accepted there could be like "string, or number, or any enum of string or number", but there's no way to express the "any enum" part:
https://flow.org/en/docs/enums/using-enums/#toc-generic-enums
so it isn't.

I think in light of this bit I'd lean toward skipping the enum here, and sticking with the disjoint union of strings. There isn't a lot that we gain in this instance from the enum. But this price for using an enum isn't too bad, either.

Using the handy new InputRowRadioButtons component we added in
edf5322.

Fixes: zulip#5241
I checked, and no consumers were separately setting any padding on a
component where this was being used. (If one did, then we'd want to
investigate to see if this changed what padding was applied, e.g.,
because of how more-specific attributes prevail over less-specific
ones.)
Now, there's less clicking required to check, by reading code, that
the three components NestedNavRow, SwitchRow, and
InputRowRadioButtons will look reasonably uniform. That's nice when
they're all seen together, as they are when they make a list of
settings on the settings screen (with the last of these being a
newcomer there; see recent commits).

This also continues our progress toward removing the constants in
miscStyles.
And also for SelectableOptionsScreen, which this uses.

These now match SelectableOptionRow, which has already been
accepting `number`.
@chrisbobbe chrisbobbe force-pushed the pr-mark-read-conversation-views branch from b6b5074 to 63f46eb Compare September 2, 2022 22:42
@chrisbobbe chrisbobbe marked this pull request as ready for review September 2, 2022 22:42
@chrisbobbe
Copy link
Contributor Author

Thanks for the review! Revision pushed.

@gnprice gnprice merged commit 63f46eb into zulip:main Sep 2, 2022
@gnprice
Copy link
Member

gnprice commented Sep 2, 2022

Thanks! Looks good -- merging.

@alya, if you have any thoughts on the settings text, happy to make a change.

@chrisbobbe chrisbobbe deleted the pr-mark-read-conversation-views branch September 2, 2022 23:00
@alya
Copy link
Collaborator

alya commented Sep 11, 2022

Sorry I missed the question earlier! I started a thread about tweaking the hint on CZO.

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.

Option to mark as read only in conversation views
3 participants