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

Modify/don't provide 'Reply' option for messages that can't be replied to #3811

Merged
merged 2 commits into from
Feb 4, 2020

Conversation

agrawal-d
Copy link
Member

@agrawal-d agrawal-d commented Jan 16, 2020

Fixes #3810

  • Instead of removing the reply option in an announcement stream, I have modified it to show 'Navigate to topic', since one might still want to go to the topic narrow, where the reply option is already disabled.
  • Option remains 'Reply' is the app user is an admin.
  • Also removes reply option in group PMs.

Screenshots

image
image

@agrawal-d agrawal-d changed the title Announcements Don't provide/Modify 'Reply' option for messages that can't be replied to Jan 16, 2020
@agrawal-d agrawal-d changed the title Don't provide/Modify 'Reply' option for messages that can't be replied to Don't provide/modify 'Reply' option for messages that can't be replied to Jan 16, 2020
@agrawal-d agrawal-d changed the title Don't provide/modify 'Reply' option for messages that can't be replied to Modify/don't provide 'Reply' option for messages that can't be replied to Jan 16, 2020
@agrawal-d
Copy link
Member Author

@ray-kraesig please review.

Comment on lines 204 to 234
if (isAnnouncementOnly) {
reply.title = 'Navigate to topic';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This will permanently modify reply.title – it'll never be "Reply" again, or at least, not until the application is shut down and restarted.

(The fact that all these action-description-objects are mutable is a bug, not a feature. Please don't exploit it.)

@@ -47,6 +47,7 @@
"Narrow to conversation": "Narrow to conversation",
"Reply": "Reply",
"Add a reaction": "Add a reaction",
"Navigate to topic":"Navigate to topic",
Copy link
Contributor

Choose a reason for hiding this comment

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

Space after the colon, for consistency. (Ditto for en_GB.)

if (!isAnOutboxMessage(message) && !isTopicNarrow(narrow) && !isPrivateNarrow(narrow)) {
if (isAnnouncementOnly) {
if (!isAnOutboxMessage(message) && !isTopicNarrow(narrow) && !isPrivateOrGroupNarrow(narrow)) {
if (isAnnouncementOnly && !ownIsAdmin) {
Copy link
Contributor

Choose a reason for hiding this comment

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

These two changes need to be in separate commits.

@@ -75,6 +75,7 @@ export type BackgroundData = $ReadOnly<{
mute: MuteState,
ownEmail: string,
ownUserId: number,
ownIsAdmin: boolean,
Copy link
Contributor

Choose a reason for hiding this comment

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

isAdmin will do. (The own affix here is of questionable utility anyway, IMO, even where it's grammatical.)

Also, please make sure the ordering of properties is consistent here and below.

Copy link
Member

Choose a reason for hiding this comment

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

(The own affix here is of questionable utility anyway, IMO, even where it's grammatical.)

I think it's important for "email" and "user id" and "user". There are lots and lots of places we have a variable (or parameter or property) named email or userId or user, and they normally mean "(the email or ID of) the user this widget, or this scrap of data, is about". When it's instead "the user that is looking at the app", that has a very different feel and it's good to make the contrast explicit.

I agree it's not helpful for "is admin", and probably most other possible names.

@agrawal-d
Copy link
Member Author

@ray-kraesig have pushed some changes.

@agrawal-d
Copy link
Member Author

Blocked until #3795 is merged.

@agrawal-d
Copy link
Member Author

agrawal-d commented Feb 1, 2020

#3795 has been merged :-)
@ray-kraesig please review this, thanks!

@rk-for-zulip
Copy link
Contributor

Code is good. Some commit-message issues:

  • Both commit summaries are section: uncapitalized sentence with a period., which is neither the preferred Zulip official standard (capitalization required) nor the less-preferred git.git style (no period).
  • The second commit doesn't actually have anything to do with Don't provide 'Reply' option for messages that can't be replied to #3810 and shouldn't say it fixes it.
  • The second commit's message says it eliminates "Reply" in topic narrows... but that's already true in master.

The first and second are uninteresting (if it were just those two I would do the copyediting myself before merging), but the third is odd enough that I have to ask what the intent was there.

Currently, it is possible to select the 'Reply' option from action
sheet when in an announcement-only narrow, even if the user is not
an admin.

Modify 'Reply' option based on whether the user is an administrator.

Fixes zulip#3810.
@agrawal-d
Copy link
Member Author

agrawal-d commented Feb 4, 2020

Thanks for reviewing.
For your second point - I thought the second commit's message made sense because it is removing the Reply option in a place where it shouldn't be possible to reply - group private messages. I have removed it now.

For your third point - I made a mistake 😓 - Instead of documenting the change I made, I documented the entire feature.

I have reworded both the commit messages.

Remove the 'Reply' option from messageActionSheet when the user is
in a group private message narrow.
@rk-for-zulip
Copy link
Contributor

For your second point - I thought the second commit's message made sense because it is removing the Reply option in a place where it shouldn't be possible to reply - group private messages. I have removed it now.

It's entirely possible to reply to a group PM, though – you can still type into the compose box and send a message and have it be seen; it's just that the current "Reply" option doesn't have an effect there.

(This contrasts with announcement-only streams, where even if you send a message to the server it won't be accepted.)

For your third point - I made a mistake - Instead of documenting the change I made, I documented the entire feature.

I figured that was all it was, but I had to ask.

I have reworded both the commit messages.

Missed the commit summary on the second one, though. 🙂 Amended, and merging. Thanks!

@rk-for-zulip rk-for-zulip merged commit 4d3cec3 into zulip:master Feb 4, 2020
@agrawal-d agrawal-d deleted the announcements branch February 4, 2020 20:36
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks @agrawal-d , and thanks @ray-kraesig for the review!

This doesn't actually quite work, because of a subtle issue: the logic is in terms of the current narrow, but the question of whether the user can reply is about the specific message. And we have a lot of possible types of narrows, several of which cut across streams (and across PM conversations): starred messages, @-mentions, searches, and the "All messages" view. (There's also the all-PMs narrow.)

The result is that after this change, we still offer "Reply" even for messages in announcement-only streams, if you're looking at them through one of those narrows.

The right fix for this will involve some different plumbing for the data, which means a good bit of the code involved will be different from this. So I'm going to revert the main commit from this PR and reopen the issue; then we can make another go at it.

The key thing we'll want in the plumbing to make v2 of this is: instead of a prop like isAnnouncementOnly, let's add streams to the BackgroundData type. Then in constructMessageActionButtons, we can use the message (not the narrow) to look up the Stream object there, and read off is_announcement_only.

Comment on lines +229 to 235
if (!isAnOutboxMessage(message) && !isTopicNarrow(narrow) && !isPrivateOrGroupNarrow(narrow)) {
if (isAnnouncementOnly && !isAdmin) {
buttons.push('narrowToTopic');
} else {
buttons.push('reply');
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This is too many conditionals in one place 🙂 -- it's more than the reader, in particular the author, can reasonably keep track of in their head.

One symptom of that is that this causes "Narrow to topic" to appear only for non-outbox messages. That doesn't make sense.

This also leaves "Reply" in place when the message is in an announcement-only stream, any time you're in a narrow that isn't specific to the stream. You could be in the all-messages narrow; or starred messages, @-mentions, or a search.

Comment on lines 191 to 196
showActionSheet(target === 'header', dispatch, showActionSheetWithOptions, _, {
backgroundData,
message,
narrow,
isAnnouncementOnly,
});
Copy link
Member

Choose a reason for hiding this comment

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

One bonus of using backgroundData for the plumbing: it saves us from making a longer and longer list here of things we just pass through without change. (That was part of the origin of the backgroundData object in this message-list code.)

gnprice added a commit that referenced this pull request Feb 4, 2020
… narrow."

This reverts commit 674f9a2 (#3811).

That commit fixed only some cases of #3810: it relies on the current
narrow rather than the specific message, and so it misses relevant
messages when we're in a starred narrow, a search, etc.  The right fix
will involve plumbing a different set of data down through these
layers, rather than `isAnnouncementOnly`, so it'll be simpler to do
that fresh than starting from here.
@gnprice
Copy link
Member

gnprice commented Feb 4, 2020

Reverted that commit, as 8f58f46.

Maskedman99 pushed a commit to Maskedman99/zulip-mobile that referenced this pull request Feb 12, 2020
… narrow."

This reverts commit 674f9a2 (zulip#3811).

That commit fixed only some cases of zulip#3810: it relies on the current
narrow rather than the specific message, and so it misses relevant
messages when we're in a starred narrow, a search, etc.  The right fix
will involve plumbing a different set of data down through these
layers, rather than `isAnnouncementOnly`, so it'll be simpler to do
that fresh than starting from here.
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.

Don't provide 'Reply' option for messages that can't be replied to
3 participants