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

Follow narrows from old->new stream names #4722

Closed
wants to merge 2 commits into from

Conversation

jmandel
Copy link
Contributor

@jmandel jmandel commented May 8, 2017

This is to address #4713. As I mentioned there, there may not be much worth keeping in this approach, but feedback would be welcome!

@smarx
Copy link

smarx commented May 8, 2017

Automated message from Dropbox CLA bot

@jmandel, it looks like you've already signed the Dropbox CLA. Thanks!

@@ -2331,7 +2331,7 @@ def test_subscriber(self):
def test_gather_subscriptions(self):
# type: () -> None
"""
gather_subscriptions returns correct results with only 3 queries
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that the 3 in this comment was already out of sync (was really 4 already).

@jmandel jmandel force-pushed the forward-narrows branch 2 times, most recently from 40fd583 to 541d8ad Compare May 9, 2017 18:46
// (it's already tracking a page load), we process on a future tick.
// We set the "replace_state" parameter true to avoid polluting history.
setTimeout(function () {
hashchange.save_narrow(operators, true);
Copy link
Member

Choose a reason for hiding this comment

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

hmm, ideally, we'd be able to do this by rewriting the narrow in the hashchange.js on-page-load code path, rather than loading the old narrow and then flickering it to the new state.

Copy link
Contributor Author

@jmandel jmandel May 10, 2017

Choose a reason for hiding this comment

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

This loads the new narrow directly (the Filter has been intercepted and updated by the time we reach this line, in the first call to narrow.activate). It's just the hash that updates in the next tick; the data are already loaded. In testing this, I don't see any flicker.

I've looked at moving this logic to onload (have this implemented locally; can share), but some concerns:

  • hashchange.js is indeed thorny. I don't love adding more logic to the changing_hash detection
  • moving logic to onload means that typing an old stream name into the search box won't forward it; this leads to an inconsistency where Zulip displays an empty result set when a user types an old stream name into the search box (e.g. "stream:OldName"), but the upon hitting Ctrl-R the forward happens, the URL updates, and content appears.

Thoughts @timabbott ?

Copy link
Member

Choose a reason for hiding this comment

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

I see, if it's just the hash that's updating in the next tick, that's pretty invisible and fine. I just don't want a flicker from the "stream doesn't exist" notice and back.

BTW http://zulip.readthedocs.io/en/latest/hashchange-system.html may be useful reading if you haven't found it, but I 100% agree that the system is thorny and could benefit from a restructuring.

@showell what are your thoughts? If you have time to take over this review in general, that'd be great.

Copy link
Contributor Author

@jmandel jmandel May 11, 2017

Choose a reason for hiding this comment

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

Yeah, I borrowed the word "thorny" from that doc (very helpful orientatation, by the way) :)

In any case, to confirm: the "stream doesn't exist" message never appears in this implementation, when following an old alias to an new stram name. @showell, would love your review!

J M added 2 commits May 11, 2017 19:02
Remove aliases for re-created streams

Add missing migration

Simplify logic now that old names can only appear once

Bump query count now that we .delete()

node tests

Pass tests

Smarter alias detection

Clean up js

Use underscore for map/filter

Update stream_data.js

Remove outdated aliases to new steram name
@jmandel jmandel force-pushed the forward-narrows branch from 48d07b2 to 7fcdf9b Compare May 11, 2017 17:05
@showell
Copy link
Contributor

showell commented May 11, 2017

I added some comments to the issue here. Let's discuss this on chat before getting too deep into the details of the PR.

@zulipbot
Copy link
Member

Heads up @jmandel, we just merged some commits (latest: e6cc0ff) 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.

@timabbott
Copy link
Member

@showell @jmandel what's the status on this? I know we merged various things related to this project...

@showell
Copy link
Contributor

showell commented Jun 2, 2017

There are three components to this fix:

  • have the front end deal with multiple names (completed, and in use for live-update scenarios)
  • have the back end persist old stream names and send to client
  • do any hash redirecting

The 2nd/3rd items here are yet to be done, and they're somewhat covered in this PR.

@showell showell closed this Jun 2, 2017
@showell
Copy link
Contributor

showell commented Jun 2, 2017

Unless @jmandel objects, I think we should close this for now, since it will still be linked back from the original issue. The PR has useful bits, but my work right before PyCon makes some of the JS-side stuff no longer needed.

@jmandel
Copy link
Contributor Author

jmandel commented Jun 2, 2017

Yeah, no problem! I wish I had more time to see this through :/

@showell
Copy link
Contributor

showell commented Jun 2, 2017

Oops, I didn't mean to close this earlier, but I'll leave it closed based on Josh's comments. We'll probably get to this some time this summer, especially as some of our summer folks get up to speed on live-update issues.

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.

5 participants