= Mute button = We want to add a mute button to bug pages ([[https://bugs.launchpad.net/launchpad/+bug/204980|Bug 204980]]), so that people can create a direct subscription with a bug_notification_level of NOTHING without having to know that such a thing actually exists. Of course, this isn't quite as straightforward as it first seemed, so here's my brain dump after what I'm going to disingenuously call an investigation. What little work I did can be found in this (abandoned-but-can-be-resurrected-later) branch: `lp:~gmb/launchpad/add-mute-button-bug-204980` == Problems to solve == * You can't actually have a NOTHING subscription, at least as far as the validation for `Bug:+subscribe` is concerned. If you add a NOTHING subscription using the mute button in the above branch both the +subscribe page and the new advanced Form``Overlay will break as a result. * '''Solution''': Fix the validation to allow - but not present to the user - for NOTHING subscriptions. ([[https://bugs.launchpad.net/launchpad/+bug/721400|Bug]]). * Muting a bug is actually a case of adding a NOTHING subscription, so we need to make sure that the current subscribe link '''doesn't''' show "Edit subscription" after someone has muted their bug. * '''Solution''': Update the Bug Context``Menu entry for the +subscribe link to make it take NOTHING subscriptions into account. ([[https://bugs.launchpad.net/launchpad/+bug/721410|Bug]]) * Also, when you've got a NOTHING subscription, the 'mute' link should actually read 'Unmute' and should remove your direct subscription when clicked. * '''Solution''': The Bug Context``Menu entry for the mute link should also take existing NOTHING subscriptions into account (part of the original bug, I think). * For the sake of simplicity, we shouldn't allow muting direct subscriptions at this point (because we'd then have to track their old Bug``Notification``Level for when people unmuted them). * We need to refactor the JS in the subscribe_current_user() function so that we can re-use it for muting subscriptions. In my branch I just called subscribe_current_user() from inside my onClick handler for the mute link, but that causes a spinner to appear in place of the Subscribe link, reading 'Subscribing...' which is just plain confusing. * '''Solution''': split the add-a-subscription bits of subscribe_current_user() out from the futz-with-ui bits ([[https://bugs.launchpad.net/launchpad/+bug/721411|Bug]]).