mirror of https://github.com/zulip/zulip.git
populate_db: Make double-unsubscribes not a fatal error.
(imported from commit 4dadb28f9c310659ddd780e98da70da55ace7187)
This commit is contained in:
parent
95c39cbc76
commit
02b7bcf1a4
|
@ -464,8 +464,13 @@ def restore_saved_messages():
|
||||||
continue
|
continue
|
||||||
elif old_message["type"] == "subscription_removed":
|
elif old_message["type"] == "subscription_removed":
|
||||||
stream_key = (realms[old_message["domain"]].id, old_message["name"])
|
stream_key = (realms[old_message["domain"]].id, old_message["name"])
|
||||||
subscribers.setdefault(stream_recipients[stream_key].id,
|
user_id = users[old_message["user"]].id
|
||||||
set()).remove(users[old_message["user"]].id)
|
subscribers.setdefault(stream_recipients[stream_key].id, set())
|
||||||
|
try:
|
||||||
|
subscribers[stream_recipients[stream_key].id].remove(user_id)
|
||||||
|
except KeyError:
|
||||||
|
print "Error unsubscribing %s from %s: not subscribed" % (
|
||||||
|
old_message["user"], old_message["name"])
|
||||||
pending_subs[(stream_recipients[stream_key].id,
|
pending_subs[(stream_recipients[stream_key].id,
|
||||||
users[old_message["user"]].id)] = False
|
users[old_message["user"]].id)] = False
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue