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

[WIP] messages: Add a prompt for muted streams and topics. #2721

Closed
wants to merge 1 commit into from

Conversation

trueskawka
Copy link
Member

Purpose

This PR creates a prompt that appears when a user tries to send a message to a stream or topic they've muted and asks them if they want to unmute it (yes/no) - in response to #2083.

Description

This is mostly based on existing functionality for a similar prompt for @all/@everyone mentions. I've considered rewriting them into a single function, but decided against it, since we have a util.is_all_or_everyone_mentioned and we're using it both when the @mention is completed and when the user sends a message - with muted streams/topics I'm not sure we want to check them as soon as the user unfocuses the field (but we can also rewrite it to support this).

The main differences are thus:

  • the stream/topic muted status is checked when the user tries to send a message,
  • there is no additional error prompt, since the util.is_all_or_everyone_mentioned additional prompt works with checking the status when the @mention is completed,
  • agreeing to this prompt changes muted/unmuted status of a stream/topic.

WIP

@timabbott @showell

  • Is this the implementation we're looking for in terms of usability and consistency?
  • Node tests are failing, since I was unable to gracefully import js/subs and js/muting (now I've realized I probably should use var muting = require('js/muting.js');). Is this the right place to test this feature or should I move it to node_tests/muting.js? I guess we could argue both approaches, as this is a feature both for composing messages and muting.
  • We currently don't have Casper tests for muting features and I was wondering if it should be a part of this PR, or should we think about creating a whole group of Casper tests for muting.
  • This PR requires refactoring and refining.

Create a prompt that asks user if they want to unmute a stream
or topic they want to post a message to.

Fixes zulip#2083.
@showell
Copy link
Contributor

showell commented Dec 16, 2016

For node testing, I would mock out the 'subs.js' calls by doing something like this:

set_global('subs', {});

And then in specific tests you can do something like this:

var toggle_arg;
subs.toggle_home = function (arg) {toggle_arg = arg;};
do_stuff();
var expected_arg = <whatever>;
assert.equal(toggle_args, expected_args);

@showell
Copy link
Contributor

showell commented Dec 16, 2016

Regarding Casper tests, obviously they would be nice to have, but I think they could be done as a follow-up issue. We do want to add as much node testing as possible here, so I would focus on structuring the code so that it's easy to test some of the individual moving parts with node tests. I've only kind of skimmed the code so far, but it seems reasonably well structured, but perhaps as you go deeper on the node tests, you'll find areas where you may want to move responsibilities to node-friendly modules.

if (user_acknowledged_muted_context === undefined ||
user_acknowledged_muted_context === false) {
unmute_context = [ "stream", stream_name ];
// this is only checked on send, whereas @all/@everyone mention is checked
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this comment a copy/paste error?

@timabbott
Copy link
Sponsor Member

@trueskawka this PR seems to have gotten lost in the chaos of GCI; want to rebase it and address Steve's comments so we can merge it?

@zulipbot
Copy link
Member

Hello @trueskawka, a Zulip maintainer reviewed this pull request over a week ago, but you haven't updated your pull request since. Please take a look at the requested changes and update your pull request accordingly.

Thank you for your valuable contributions to Zulip!

@zulipbot
Copy link
Member

zulipbot commented Aug 1, 2017

Heads up @trueskawka, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

@zulipbot-test
Copy link

Hello @trueskawka, a Zulip maintainer reviewed this pull request over a week ago, but you haven't updated your pull request since. Please take a look at the requested changes and update your pull request accordingly.

Thank you for your valuable contributions to Zulip!

@zulipbot
Copy link
Member

Hello @trueskawka, a Zulip maintainer reviewed this pull request over 7 days ago, but you haven't updated your pull request since. Please take a look at the requested changes and update your pull request accordingly.

Thank you for your valuable contributions to Zulip!

@zulipbot
Copy link
Member

zulipbot commented Nov 21, 2017

Heads up @trueskawka, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

@zulipbot
Copy link
Member

zulipbot commented Dec 4, 2017

Hello @trueskawka, a Zulip maintainer reviewed this pull request over 10 days ago, but you haven't updated your pull request since. Please take a look at the requested changes and update your pull request accordingly.

Thank you for your valuable contributions to Zulip!

@zulipbot-test
Copy link

Hello @trueskawka, a Zulip maintainer reviewed this pull request over 10 days ago, but you haven't updated your pull request since. Please take a look at the requested changes and update your pull request accordingly.

Thank you for your valuable contributions to Zulip!

@timabbott
Copy link
Sponsor Member

@trueskawka do you intend to pick this up soon?

@timabbott
Copy link
Sponsor Member

Closing as a version of this was integrated in #24246. I hope you're doing well @trueskawka!

@timabbott timabbott closed this Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants