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

user_settings: Add settings to configure sending typing notifications and read receipts #19200

Merged
merged 7 commits into from Oct 8, 2021

Conversation

chdinesh1089
Copy link
Collaborator

@chdinesh1089 chdinesh1089 commented Jul 9, 2021

Currently added only typing notifications settings. Will add a commit for read receipts soon.(added)

Testing plan:
Verified through UI.

GIFs or screenshots:
image
image

Comment on lines 72 to 56
send_stream_typing_notifications: $t({
defaultMessage: "Display whether I'm typing messages in streams to other users",
}),
send_private_typing_notifications: $t({
defaultMessage: "Display whether I'm typing private messages to recipients",
}),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It might be worthwhile to rephrase these but I'm unsure what would be nicer.

Copy link
Member

@andersk andersk Jul 11, 2021

Choose a reason for hiding this comment

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

It’s easy to misparse “to” as “messages to” rather than “display to”. I propose

  • Let subscribers see when I’m typing messages in streams
  • Let recipients see when I’m typing private messages
  • Let senders see when I’ve read private messages

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Those sound good to me. Changed.

Let senders see when I’ve read private messages

Made this 'Let other users see when I've read messages' as we are allowing everyone who has access to the message to see read receipts.

Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to drop the “private”? And I think we need to be more specific than “other users”—maybe “participants”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, as we show read receipts in streams too. (#18935 is the PR for that, and there's some discussion at czo here)

Changed 'other users' to 'participants'. It is more specific but sounds a bit odd to me (probably it's just me. I think we can stick to it).

Copy link
Collaborator

@sahil839 sahil839 left a comment

Choose a reason for hiding this comment

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

Left one minor comment, otherwise LGTM.

static/js/settings_account.js Outdated Show resolved Hide resolved
@chdinesh1089 chdinesh1089 force-pushed the privacy-settings branch 4 times, most recently from 61553e9 to 54f6814 Compare July 11, 2021 19:24
static/js/settings.js Outdated Show resolved Hide resolved
@chdinesh1089
Copy link
Collaborator Author

@timabbott I think we can make the send_private_typing_notifications setting functional here. Should we just ignore typing notifications from clients in the server with a json_success like we do with presence or should we also add js code to not send typing notification requests from the web app?

@chdinesh1089
Copy link
Collaborator Author

Rebased as the settings endpoints merge is done. Asked the above question at https://chat.zulip.org/#narrow/stream/101-design/topic/privacy.2Fsecurity.20settings/near/1234961 to allow more discussion.

@chdinesh1089
Copy link
Collaborator Author

@timabbott This is ready for review. Could you have a look?

Should we just ignore typing notifications from clients in the server with a json_success like we do with presence or should we also add js code to not send typing notification requests from the web app?

Did both. I think reducing the number of requests sent to the server would definitely help a bit.

static/js/typing.js Outdated Show resolved Hide resolved
if not user_profile.send_stream_typing_notifications:
return json_success(
{
"msg": "Sharing stream typing notifications turned off. This request will be ignored."
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Does it make sense to do it this way? The other option of raising an error might break things in other clients.

Also, this string might benefit a bit from rephrasing it to be more concise.

Copy link
Sponsor Member

@timabbott timabbott Jul 28, 2021

Choose a reason for hiding this comment

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

Can you ask about this question in the "api design" stream?

I would probably prefer to raise an error if the client sent one of these notices in violation of the configuration; we should just make sure to check with client developers that doing so will not break anything.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed to raise errors.

(for later reference: link to the discussion: https://chat.zulip.org/#narrow/stream/378-api-design/topic/typing.20notifications.20endpoint

description: |
Present if `update_display_settings` is present in `fetch_event_types`.

Whether the user has chosen to send typing notifications in private messages.
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

These should have API changelog entries, **Changes** notes, etc.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Also we should have "typing notifications" link to the /help/ docs for the feature.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't seem to have a /help page for typing notifications. I think we only have API docs and developer docs (We'll probably have to tweak this once we merge stream typing notifications PR)

I guess we should add one soon?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh! we actually have /help page for typing notifications but it is hidden as a subsection in status-and-availability.

Linked "typing notifications" to those docs and rebased the PR to match to bump latest API_FEATURE_LEVEL.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

I added links to that in all of the places we talk about them, for clarity.

@timabbott
Copy link
Sponsor Member

I think this will be mergeable with the API documentation changes I suggested, some copy-editing, and doing something to hide the settings UI checkboxes where the feature itself isn't merged yet when not in a development environment. E.g. an if development_only check in the template would probably be fine (and then we can add those to the PRs for the not yet finished features).

@chdinesh1089 chdinesh1089 force-pushed the privacy-settings branch 2 times, most recently from 845f77c to a99190a Compare July 30, 2021 19:52
@chdinesh1089
Copy link
Collaborator Author

Thanks for the review! Made the changes. Added an if page_params.development_environment in the template to hide unmerged features.

@chdinesh1089 chdinesh1089 force-pushed the privacy-settings branch 2 times, most recently from cefbd1d to 4a82ce8 Compare August 3, 2021 17:21
Comment on lines 9847 to 9852
send_private_typing_notifications:
type: boolean
description: |
Present if `update_display_settings` is present in `fetch_event_types`.

Whether the user has chosen to send [typing notifications](/help/status-and-availability#typing-notifications)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should these be moved to user_settings object above? Do we want to keep a copy here too with text like the following?

  **Changes**: Deprecated in Zulip 5.0 (feature level 89). Clients
  connecting to newer servers should declare the `user_settings_object`
  client capability and access the `user_settings` object.

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Good question, but I don't think it's necessary -- we already make clear in the top-level description that clients will need the user_settings_object capability.

This isn't necessary as `settings_checkbox.hbs` template used
for presence enabled setting in `account_settings.hbs` takes
care of checking/unchecking this checkbox.
From 430c5cb, we do not send events for settings added after
introduction of `user_settings` event.

This test wasn't considering that and started failing on
adding new user_settings.
From 430c5cb, in `fetch_initial_state_data`,
we only include legacy settings in the top level of
`state` and the newer ones are stored in `state['user_settings']`.
That should've had a corresponding change in apply_event().

Also, fixed a test related to this logic.
Note: These are not functional in enabling/disabling sending of
typing notifications with this commit.

Refactored the privacy settings update to keep the code less
duplicated along with making the addition of new settings easier.
Changes the view code to skip sending typing events
when these settings are disabled. Returns a json success
response with a msg.
This will be useful to let users enable/disable
sharing read receipts once we add that feature.

Note: Added "I've" to IGNORED_PHRASES in
tools/lib/capitalization.py to avoid capitalization
errors for the label text of this setting.
@timabbott
Copy link
Sponsor Member

Merged, after a somewhat extended pass of:

  • Renumbering migrations/feature levels.
  • Tweaking the OpenAPI documentation to be more consistent with our style (E.g. always ending sentences with a .).
  • Tweaking the error messages to have a more consistent style

I don't think I made any functional changes. Thanks for doing this! Now we just need to finish implementing the "Read receipts" and "stream typing notifications" features.

For the typing notifications one, I'd really appreciate your doing a bit of a writeup on the strategy for how you managed the issues around potential for duplicated code, since that's the thing I've been stuck on in thinking about that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants