# Chrome extension Discourse v0.2

**URL:** https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555
**Category:** Extras
**Tags:** rest-api
**Created:** [June 28, 2015, 7:16pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555 "2015-06-28T19:16:26Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![alep](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alep/32/120750_2.png) [@alep](https://meta.discourse.org/u/alep)
#### Post date: [June 28, 2015, 7:16pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/1 "2015-06-28T19:16:26Z")

</div>

[Chrome extension for discourse](https://chrome.google.com/webstore/detail/discourse/okmkhbdimfnmdhpclfbamachjcpcgcmi) is at v0.2: thanks to [djfarrelly](https://twitter.com/djfarrelly) collaboration, it shows notification list with a popup ! You can install it from [here](https://chrome.google.com/webstore/detail/discourse/okmkhbdimfnmdhpclfbamachjcpcgcmi)

---

<div class="post-metadata">

### Author: ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)
#### Post date: [June 28, 2015, 7:29pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/2 "2015-06-28T19:29:59Z")

</div>

Nice! I don’t suppose it’d be possible to make it distinguish between ordinary notifications and private message notifications? (i.e. blue vs green notifications). Or alternatively set it to only show PM notifications.

Thing is, I don’t want to be distracted every time I receive a like or there’s activity in a topic I follow, but if there’s a PM waiting for a reply from me, that deserves my attention.

Edit: I suggest renaming the app to “Discourse Notifications”

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [June 28, 2015, 7:30pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/3 "2015-06-28T19:30:22Z")

</div>

Errrrm , you may need to rethink the name. “Discourse” is already taken 😉

---

<div class="post-metadata">

### Author: ![alep](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alep/32/120750_2.png) [@alep](https://meta.discourse.org/u/alep)
#### Post date: [June 28, 2015, 7:37pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/4 "2015-06-28T19:37:38Z")

</div>

> [@erlend\_sh](#):
>
> Nice! I don’t suppose it’d be possible to make it distinguish between ordinary notifications and private message notifications? (i.e. blue vs green notifications). Or alternatively set it to only show PM notifications.

Not now, but sure, I already thought about it and I think that it can be useful.  
My idea is to choose the activation in the option page with a checkbox  
Thank you for the reporting and any feedback is welcome 😉

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [June 28, 2015, 8:33pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/5 "2015-06-28T20:33:12Z")

</div>

Agreed please change the name to Discourse notifications, or something like that.

---

<div class="post-metadata">

### Author: ![alep](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alep/32/120750_2.png) [@alep](https://meta.discourse.org/u/alep)
#### Post date: [June 28, 2015, 9:34pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/6 "2015-06-28T21:34:19Z")

</div>

Done. I’ve changed the name using your advice “Discourse Notifications”, see [here](https://chrome.google.com/webstore/detail/discourse-notifications/okmkhbdimfnmdhpclfbamachjcpcgcmi).  
Are there any problems with the icon ? and with github repo name ?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [June 28, 2015, 9:55pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/7 "2015-06-28T21:55:12Z")

</div>

The rule to follow is

“Will anyone confuse my software with an officially built piece of software”

---

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [June 29, 2015, 4:29am UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/8 "2015-06-29T04:29:41Z")

</div>

@alep, a really nice and tiny thing!

A few propositions

1. It would be nice if we could authorize the plugin to multiple Discourse instances!

2. Once authorized, it would either show a few icons in the Chrome toolbar OR show the summary of new notifications and then detailed per-item list once you click the icon.

3. Instead of showing the default Discource icon, show the icon of the setup the plugin is logged in.

---

<div class="post-metadata">

### Author: ![alep](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alep/32/120750_2.png) [@alep](https://meta.discourse.org/u/alep)
#### Post date: [June 29, 2015, 7:14am UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/9 "2015-06-29T07:14:40Z")

</div>

> [@meglio](#):
>
> @alep, a really nice and tiny thing!
> 
> A few propositions
> 
> 1. It would be nice if we could authorize the plugin to multiple Discourse instances!
> 
> 2. Once authorized, it would either show a few icons in the Chrome toolbar OR show the summary of new notifications and then detailed per-item list once you click the icon.
> 
> 3. Instead of showing the default Discource icon, show the icon of the setup the plugin is logged in.

1. Multi-site support is on my todo list ;), but now I’m going to add it to features list on github.  
I thought to implement it showing each notifications group with an accordion menu.

2. I don’t know if one single chrome extension can shows multiple icons on the toolbar, I will investigate.

3. Good idea !

Thanks for all the feedback ! 👍

---

<div class="post-metadata">

### Author: ![kuchaev\_iv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kuchaev_iv/32/114921_2.png) [@kuchaev\_iv](https://meta.discourse.org/u/kuchaev_iv)
#### Post date: [June 29, 2015, 8:05am UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/10 "2015-06-29T08:05:54Z")

</div>

What about some sharing capabilities? Something like share this page to Discourse which will post a link to.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [June 29, 2015, 5:51pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/11 "2015-06-29T17:51:43Z")

</div>

> [@alep](#):
>
> Multi-site support is on my todo list , but now I’m going to add it to features list on github.I thought to implement it showing each notifications group with an accordion menu.

You should request the “data on all sites” permission and automatically add sites you visit when `window.Discourse` exists and `window.Discourse.User.current()` is truthy. Don’t poll `/notifications?silent=true` - use the message bus instead. You’ll need to handle the case when the message bus position gets reset.

Also, how about “Notifications for Discourse” for the title?

---

<div class="post-metadata">

### Author: ![alep](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alep/32/120750_2.png) [@alep](https://meta.discourse.org/u/alep)
#### Post date: [July 2, 2015, 8:58pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/12 "2015-07-02T20:58:09Z")

</div>

> [@kuchaev\_iv](#):
>
> What about some sharing capabilities? Something like share this page to Discourse which will post a link to.

Can be the following a valid example ?  
I am on the url [www.example.com](http://www.example.com), right click on the page and the contextual menù has the “share with discourse site” item. Clicking it will open the page to create a new post with a preformatted page link.  
Other than right click could be a semi transparent icon always present in the bottom right corner of the page or in the chrome omnibox or with a new menu item clicking the extension icon.

---

<div class="post-metadata">

### Author: ![alep](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alep/32/120750_2.png) [@alep](https://meta.discourse.org/u/alep)
#### Post date: [July 2, 2015, 9:15pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/13 "2015-07-02T21:15:54Z")

</div>

> [@riking](#):
>
> You should request the “data on all sites” permission and automatically add sites you visit when window.Discourse exists and window.Discourse.User.current() is truthy.

I think that only the user can add a site in the future multi-site support feature.  
If the extension automatically add sites, I think it could be annoying. Eventually an option could be present to enable the extension to propose a list of the visited discourse site and the user can finally choose to activate them.

> Don’t poll /notifications?silent=true - use the message bus instead.

The extension already using MessageBus.  
/notifications?silent=true is used only on boot to get the user id. It is the only method I have discovered to get the user id as I explained in this [post](https://meta.discourse.org/t/discourse-chrome-extension-to-show-unread-count/27853/15) , because I did not found the documentation. I’ve asked about it. It exists ?

> Also, how about “Notifications for Discourse” for the title?

I’ve changed the title as suggested by @codinghorror.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [July 2, 2015, 9:24pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/14 "2015-07-02T21:24:52Z")

</div>

AFAIK these 3 are equivalent, maybe you could use one?

```plaintext
Discourse.User.currentProp("id");
Discourse.User.current().get("id");
Discourse.User.current().id;

```

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [July 2, 2015, 10:34pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/15 "2015-07-02T22:34:48Z")

</div>

The last one will fail on certain browsers or if an observer is set up on it.

---

<div class="post-metadata">

### Author: ![alep](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alep/32/120750_2.png) [@alep](https://meta.discourse.org/u/alep)
#### Post date: [July 3, 2015, 6:56am UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/16 "2015-07-03T06:56:32Z")

</div>

> [@Mittineague](#):
>
> AFAIK these 3 are equivalent, maybe you could use one?
> 
> Discourse.User.currentProp(“id”);  
> Discourse.User.current().get(“id”);  
> Discourse.User.current().id;

Thank you for the advice, but I think that it may not be possible:  
Discourse object is present in the discourse site environment, but the chrome extension has its own environment where Discourse object does not exist.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [July 3, 2015, 5:36pm UTC](https://meta.discourse.org/t/chrome-extension-discourse-v0-2/30555/17 "2015-07-03T17:36:54Z")

</div>

Well, just collect the user ID during site detection then and sendMessage() to the extension page or send it over some other way.
