The Notification Model - Part IV
So it's been a half year after the last article I talked about the Notification Model in this blog.

I just realized that the life cycle of node.js is just too damn fast. I remembered the first nodejs version I used was something like 0.10.2 or so. And now it's v5.5.0! Even though I could say I like being in the front line of tech, it is still too hard for me to keep up. Because of this I have hard times rewriting some of the framework again and again.

In the 0.10.2 version the code was purely written on ES5. And for a better integration on future I've decided to move on to ES6. But currently the whole Js language is still in the "transition" state and is pretty messy because of those *partial support* thingy. I think I should also rewrite the front-end framework as well.

But there is so much left to do!

TODO @ Rosemary

Migration

Style / layout

Layout

Article

User

Featured

ErrorPages

404

403

500

General pages

About

User

AstroEdit

You have <N> article in draft message

Models

Users

Redirect back to previous page after login

Controllers

Utils

BBCode Transcriptor

Sound

Swf ( Deprecated )

AlbumView

Design

Contact

Parallax images

Fur-like stripes

So laggy! ( Somewhat related to css animations )

Flowers?

Vector Svg?

Responsive

BotanJs

Components

SiteFile

Lazy loading ( use element.getBoundingClientRect )

Bug fixes

AstroEdit

Sometimes the draft id is not switch back to original article id

Fix the typing issue on constantly going back to top of the page

Tag changes does not trigger the save button

Support for TAB button when inputting html and codes.

Replace back escaped "[" & "]" characters

Alt + Enter should not create new line on inputing MessageBox

MessageBox

Do not go to top of the page when show

Tag 404 bugs

ArticleSummarizer

Get Paragraph > sentence > word boundary if possible

SiteLibrary with non-image should be stripped

Features impl

WebFrame

Add Process Timeout

AstroEdit

Audio Listing in site-library

Add an article link snippet

Codes need to replace box the "[" and "]" after editing

Index page

How?

Add ellipses for long content

Does not work well with english title

SiteLibrary

Image should define width height


Now let's jump directly into today's topic, the actual implementation of the Notification Model.

Concept

As I said previously the new model might vary due to the different nature of the database used. This document-oriented thing of mongodb requires you to define a document model. The model is defined in the application. Thus the data stored inside the database does not contain schema nor table relationship, fields are also loosely typed too. ( Actually everything is just a JavaScript Object. )

I haven't figured out what is the advantage of neglecting the relationship of the documents yet. If the model is stored within the application. So the query optimization is often shifted to the application side. Here I use mongoose because I don't have confidence to handle the optimization myself.

Below is the current model of how I think this whole notification thing should work:

If you have read through the previous articles. There is not much left to say.

Another thing worth to mention that this blog is actually multi-user. Unfortunately Aaron does not do blog ( actually he blogged once ). But I have to be prepared that someday he might change his mind and I want to be prepared and make him feels welcome. So I keep the multi-user supporting bit.

And that's why the name "Notification Center". It is a central manager that handles user's subscription and dispatch notifications. There was originally 4 types of notification in cranberry. But now I have kept back the "Article Publish" & "Article Update" since it requires the user to be logged in.

( But they are still useful. I have an idea that we could store the email as verification of a loose account for guests. Since the emails are kept secret. )

On the half way through I realize that a "filter" is needed as I do not want the notification to be shown up by my own action. I don't need to be notify as I am the one who toke such action.

Demo gif

Since I could not demonstrate the final result. I've recorded a gif to give you the impression of how it works. I didn't click the settings bit because if I click anyone of them. I would be unsubscribe from all of it's sub notifications. It is basically switching ON & OFF. I wonder if this is a ambiguous feature as I don't want to turn them off ... whats the point of making it?

Click to view the animation.
Profile picture
斟酌 鵬兄
Mon Feb 08 2016 23:22:41 GMT+0000 (Coordinated Universal Time)
Last modified: Sun Apr 10 2022 12:54:14 GMT+0000 (Coordinated Universal Time)
Comments
No comments here.
Do you even comment?
website: 
Not a valid website
Invalid email format
Please enter your email
*Name: 
Please enter a name
Submit
抱歉,Google Recaptcha 服務被牆掉了,所以不能回覆了