implement notification system




Awesome questions: 
1. Given a card, who's watching it?
2. Given a user, what cards are they watching?

|card|+*watchers — Pointer of account-holders

|type card|+*watchers notifies when cards of that type change (we think we're ok with losing a way to watch one cardtype card)

when a card is changed:
check its +*watchers and the +*watchers of its type
email to "+*email address" of each account-holder listed
use a changes link that goes to the particular edit that triggered the email

update includer timestamps when includee edited so that people get emails when a plus card in a form is edited

Also see:
expand_more +spec
Feature: Notifications       Background:     Given I log in as Joe User        Scenario: Anonymous User     Given I log out     When I go to the ...

text in right corner of footer:
watch — when not getting emails about changes, click to "get emails about changes to |cardname|"
unwatch — when getting emails about changes — click to "stop getting emails about changes to |cardname|"
quoted appears when hovering over the links
  • On cards of a type being watched, corner text is "watching |Cardtype| cards" and |Cardtype| links to the cardtype card.
  • On Cardtype cards, corner text is "un/watch |Cardtype name| cards" and "get/stop getting emails about changes to |Cardtype name| cards". (And if "Cardtype" itself is being watched then "watching Cardtype cards | " is prepended)
Tried corner text always being visible, went with having it visible only when hovering over the footer.


accept card defs for type (so that we can Wagneer a web-based list of cards you're watching)


From email address defaults to WagnBot's email address. Overridden by *notify+*from


Ethan McCutchen edited "John Abbe+bio"



"John Abbe+bio" was edited by Ethan McCutchen at |time|. You can also see what changed.


"John_Abbe+bio" was updated by Ethan McCutchen at |time|.


"John_Abbe+bio" was created by Ethan McCutchen at |time|.


The card:

[changes link to diff seemed too ugly to show]




On English (John):

√*watchers+*rform (soft) - Pointer

√*watchers+*options - {"type": "User"}

*watching+*rform (hard) - {"plus": ["*watcher", {"refer_to": "_self"} ] } - awaits accept card defs for type*account+*rform - add +*watching

Who's watching what - {"referred_to_by": {"right": "*watchers"}, "append": "*watching"}






If _user+*notify (Toggle) is off, they don't get email

add a way on account cards' Options tab to turn off receiving emails



(This is a new general mechanism for triggering something when a card is edited. This describes a narrow case that would be all we implemented for automtically updating watchlists, as Early Steps wants.)

"authors+*trigger" - something like:

{"update": [ {"left": "_left", "right": "*watchers"}, "_self"] }

Then upon changing "To the Moon+authors", WagnBot adds/removes items that were added/removed on +authors on "To the Moon+*watchers"


Search cards

+*item_watchers — notifies when cards that search returns change (gets searches, but loses ease of notify-me-the-moment-it-changes

e.g. +*type cards+*item_watchers



more raw notes:



expand_less +discussion

Would the system pre-defining cards like daily, weekly, etc. be a namespace problem? Flipping it around, what a resource to users if those cards meant and did intuitive things? One could implement the e-mail in a Ruby card. Far beyond notification, this opens up Ruby cards as a plug-in-like system that could, just for example, pull from various web services - e.g., a card that shows all my Flickr photos tagged with everything i've put in my "favorite Flickr tags" Pointer card.

--John Abbe.....Mon Jul 07 00:18:29 -0700 2008

(actually written when this ticket was first created)

Once we implement notification system, if you add "InvitationRequest+*type cards" to your +*watchlist, Wagn will notify you when someone requests an account. Does this replace existing system notifying Admin, and/or extension of that to email multiple users?

Would be nice to be able to get the notification immediately.

--John Abbe.....Fri Jul 11 02:45:58 -0700 2008

If notifications are implemented as a search, then we'll get feeds automatically. Otherwise, we'll want to generate feeds for them anyway.

  --John Abbe.....Sun Mar 01 00:48:51 -0800 2009

The bare bones version is up on staging (dwagn) now. love to start collecting feedback.  I went through the following options in thinking about how to manage the updates:

1.  run a notification job at intervals, and log the job, so next time you can grab all the changes since the last job.

2. put the changes in a queue at edit time and pull items out of the queue as they're mailed.

3. just send directly when the card is changed.


I ended up with 3 because that was the simplest to code.  It also provides the most instant updates.  We should be aware that this could cause slowness if lots of folks are watching a card, but for now erring on the side of simplicity.

  --Lewis Hoffman.....Mon Jun 22 13:52:43 -0700 2009

when closing this, make sure to ticket next steps - searches i want to be notified of are in John Abbe+not yet watching

  --John Abbe.....Wed Jul 08 10:46:30 -0700 2009

Design gaps about cardtypes:


If you're watching "Pointer" what goes in each Pointer's footer? We want some indication that you are watching the card, and a way to unwatch it (but it should be clear that you're unwatching *all* Pointers not just this one.)


If you're watching "Cardtype" what do you want to see in the footer of "Pointer". In addition to the above, you also still want to be able to watch/unwatch Pointer cards.

  --John Abbe.....Mon Jul 27 11:08:51 -0700 2009

the interface is slightly different for cardtype cards-- ie. for Pointer it says 'watch Pointers' instead of just 'watch', and the mouseover should tell you that it's watching all pointers as well. right now we don't have a way of watching just the Pointer card itself- that may be an issue but I think we discussed and decided for now just to watch all cardtypes when you want updates on a particular cardtype card.

  --Lewis Hoffman.....Mon Jul 27 11:24:58 -0700 2009

That's all fine. The problems are these:


If i'm watching "Pointer", then on any particular Pointer card, i see "unwatch" in the corner. Clicking on it does nothing. What do we want here? We could have "watching" as a non-link, and "(see Pointer)" as a link.


If i'm watching Cardtype cards, then on a particular Cardtype card - say, Pointer - i see "unwatch Pointers" in the corner. Clicking it does nothing, unless my name was in Pointer+*watchers in which case it is removed, but i still see "unwatch Pointers". What do we want here? Perhaps unlinked text that says either "watching" or "not watching" followed by "(see Cardtype)" as a link? And then a vertical pipe, followed by the "un/watch Pointers" as a link? (This shows whether the Pointer card itself is being watched, and offers the interface to watch/unwatch all cards of type Pointer.)

  --John Abbe.....Mon Jul 27 12:50:27 -0700 2009

Tracking things already Skyped to Lewis:


If a card name is in the trash, notification upon creating a card by that name is described as "updated" - would like it to still be "created".


When a card is deleted, would be nice if notification said that rather than "updated".


Notification is sent when a card's type is changed *to* a watched type (cool!) but not when it's changed from to something else. - happening on this release or not? (watching Early Steps may not get what they want without this.)

  --John Abbe.....Mon Jul 27 20:20:37 -0700 2009

And Ethan suggested putting *watchers in the Config tab.

  --John Abbe.....Mon Jul 27 20:25:28 -0700 2009 is of type newtype, but the footer says, "watching Oldtype cards". "Oldtype" may have been an earlier name of the "newtype" card, but it doesn't exist now.


On i see "| unwatch newtype cards" — the "|" should go away unless the text about watching Cardtype cards is there.

  --John Abbe.....Tue Jul 28 16:45:26 -0700 2009

Config subtab design update:


We also want to migrate the new *account+*from if the old one has not been edited (and there's an upgrade note about this for those who have edited it).

  --John Abbe.....Wed Aug 05 11:37:27 -0700 2009


  - extraneous "|"

  - "deleted" on delete

  - email footer with info about card being watched & unwatch link

  - Watching section on config tab



  - notify when changing type away from watched type to unwatched type.

  - "added" instead of "updated" when recreating trashed card

  - "Oldtype" bug mentioned above.


  --Lewis Hoffman.....Thu Aug 06 15:11:23 -0700 2009



only seeing two minor issues at this point:

1. in emails about multi-edits, there's an extra blank bullet item at the beginning of list of relative inclusions edited

2. would be a little clearer if the text for unwatching cards of a given type changed from "[Unwatch] to stop receiving these emails." to "[Unwatch |cardtype name| cards] to stop receiving these emails" ?

  --John Abbe.....Thu Aug 06 16:17:20 -0700 2009

3. There are some extra spaces around some words (e.g. "updated") in the emails.


4. Did we mean to lose the date/time stamp in the email? (May be making it harder to debug the issue of getting notification of some old updates).

  --John Abbe.....Mon Aug 17 14:16:09 -0700 2009

5. If Mary creates A and watches it, and then Joe edits A+B, (and +B is in A), then Mary gets a message that A was changed, *by her* (the last editor of A). We want to say the change was by Joe, right? Not sure how to do that exactly and have it make sense, seems like it will involve reorganizing the email text a bit...will ponder.

  --John Abbe.....Mon Aug 17 20:32:59 -0700 2009

Kinda wish there was an easy way to get notification for all cards, but haven't thought of a Wagn-y way of doing it yet.

  --John Abbe.....Mon Aug 17 20:39:07 -0700 2009

6.? Gerry ran into First Watch fails, and i think it's just a migration issue. We need to make sure that *watchers+*rform (Pointer) gets added to existing Wagns when they upgrade. Make sense?

  --John Abbe.....Thu Aug 20 12:22:52 -0700 2009

7. If you're not signed in when you double-click the Unwatch link in an email, you get asked to sign in, but signing in does not unwatch you (and takes you to /home rather than the card in question). Having it take you to the relevant card would be nice at least in the short term if unwatching you completely is hard enough to not do for the point release...

  --John Abbe.....Thu Aug 20 12:36:11 -0700 2009

Perhaps we should start moving remaining issues into separate tickets and close this one?

  --Ethan McCutchen.....Fri Aug 21 13:01:18 -0700 2009

My thought was to do that after the point release, but i'm open to doing it sooner if you like.

  --John Abbe.....Fri Aug 21 13:09:11 -0700 2009

8. The email's URLs for have a "www" at the beginning of the URL. This is inconsistent at best, and if it happens on other Wagns may break at worst. E.g. doesn't work.

  --John Abbe.....Fri Aug 21 13:35:12 -0700 2009

I agree being consistent would be good, but also its good to

setup DNS and Web servers so that both and both work.

  --James Thompson.....Fri Aug 21 23:04:27 -0700 2009

> 3. just send directly when the card is changed.


>I ended up with 3 because that was the simplest to code. It also provides the most instant >updates. We should be aware that this could cause slowness if lots of folks are watching a card, >but for now erring on the side of simplicity.


Sending immediately works fine when there aren't many people watching, but it doesn't scale. On my wiki (not wagn based), as the audience grew, page updates with lots of watchers took forever to update because it had to wait for all of the emails to be sent. I changed it to a queue, and it greatly improved page udpate times.

  --James Thompson.....Fri Aug 21 23:08:43 -0700 2009

#5. I now have it reporting as updated by Joe (editor of plus card)

   no other adjustments yet.

  --Lewis Hoffman.....Tue Sep 08 09:54:21 -0700 2009

#1. I think this *might* be fixed? I fixed some weirdness around that at some point. sorry so vague.

#2. mmm... being lazy on this one.

#3. I don't see this in my HTML versions in gmail.. the spacing is def. weird in plaintext.

#4. we weren't handling timezones, and figured the user's email client would do a better job of that.

#5. per previous comment, this one got a patch!

#6. there is a migration that adds *watchers+*rform. I integrated a change Gerry provided after he encountered this problem.

#7. yeah redirecting to unwatching requires a change to our history stack. but we need the link to be to unwatch, so the suggestion of just going to the card isn't any easier. We decided to punt on this one on purpose. probably worth making a new ticket for this one.

#8. www is canonical now on (to fix subdomain/login issues with IE), so that's actually what we want. if you see extraneous www's in front of other subdomains that's bad.

  --Lewis Hoffman.....Tue Sep 08 10:55:52 -0700 2009

also, I finally added the *account+*rform migration to add the watchlist.

  --Lewis Hoffman.....Tue Sep 08 10:57:22 -0700 2009

#1 (bullets) Not fixed. Cosmetic, but would definitely be nice to fix.

#2&3 will ticket separately

#4 I can let it go. Was helpful for debugging spurious notifications.

#5 Works - muy awesome!

#6 cool

#7 will ticket separately

#8 thx for the explanation. any reason not to open a ticket to make "" work?

  --John Abbe.....Tue Sep 08 12:03:14 -0700 2009

New tickets:

remove extra spaces in notification emails

clarify email text for unwatching cardtypes


make wildcards work in mapping

  --John Abbe.....Tue Sep 08 12:58:51 -0700 2009

hooray! finally closed!

I think there is a ticket for a history stack rewrite already.

  --Ethan McCutchen.....Sat Apr 21 19:21:14 +0000 2012