Page MenuHomePhabricator

mw.notify notifications can't be removed/hidden programmatically
Closed, ResolvedPublic

Description

Use case:

  • The user opens VisualEditor
  • The user types something that looks like wikitext
  • VE notices and displays an mw.notify bubble with autoHide:false
  • The user leaves VE by clicking on the Read tab
  • The editor is torn down and we go back to view mode, but the bubble persists

I would like to be able to remove this bubble when the editor is torn down, but mw.notification doesn't expose an API for this. There is a .close() method on Notification, but there's no way to get the Notification object created by mw.notify().


Version: 1.22.0
Severity: enhancement

Details

Reference
bz51338

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:55 AM
bzimport set Reference to bz51338.

I had this problem in Gerrit change 5130. Had to depend on mediawiki.notification, add a 'return notif' to the mw.notification.notify function and use that instead of mw.notify.

I'd say that this is expected behavior and a "feature" of the shorthand. Just like you can't have a message parsed by just doing mw.msg(), you have to use mw.message().whatever() instead.

Alex's solution makes sense at a glance.

(In reply to comment #2)

I'd say that this is expected behavior and a "feature" of the shorthand. Just
like you can't have a message parsed by just doing mw.msg(), you have to use
mw.message().whatever() instead.

Alex's solution makes sense at a glance.

Returning the Notification object would fix this, yes. Unfortunately, that change is still pending review.

Change 74407 had a related patch set uploaded by Alex Monk:
Return Notification object from mw.notification.notify

https://gerrit.wikimedia.org/r/74407

Change 74407 merged by jenkins-bot:
mediawiki.notification: Expose close method to hide a Notification

https://gerrit.wikimedia.org/r/74407