OpenSprites-next icon indicating copy to clipboard operation
OpenSprites-next copied to clipboard

Messages/Alerts

Open bates64 opened this issue 9 years ago • 22 comments

Just like scratch. No idea how we should implement this: @MegaApuTurkUltra ideas? I feel like simply pushing to db.User.find(...).messages won't be robust enough

bates64 avatar Jul 03 '16 21:07 bates64

Well we can have a message queue under the user schema. Different events would generate messages for that queue. We can utilize node's EventEmitter to have a robust events system.

MegaApuTurkUltra avatar Jul 03 '16 21:07 MegaApuTurkUltra

For commenting on resources you mean? What word filter would we implement?

Arinerron avatar Jul 03 '16 21:07 Arinerron

@Arinerron Not just for commenting, but yeah. There's already a wordfilter in place - porter from the old os. Try swearing in your about me

bates64 avatar Jul 03 '16 21:07 bates64

I think we need to add a couple more words :P

jamesd-uk avatar Jul 03 '16 21:07 jamesd-uk

@nanalan Ehh, I'll just trust you :P

Arinerron avatar Jul 03 '16 21:07 Arinerron

@The-Cheese-Eater commit them then

bates64 avatar Jul 03 '16 21:07 bates64

67ef23fff5b7c9d827568ebfd9de939d364f7aa9

jamesd-uk avatar Jul 03 '16 21:07 jamesd-uk

We should use Scratch's swear remover. Theirs works much better, and then we can be sure Scratch approves if we use the same technology for filtering as them.

Arinerron avatar Jul 03 '16 22:07 Arinerron

@Arinerron we're using exactly the same filter as llk/s2forums.

bates64 avatar Jul 03 '16 22:07 bates64

@nanalan Really? Scratch's filter is that bad at catching them? I remember a comment on @thisandagain's profile about which filter they used for commenting, and I'm fairly certain it wasn't how we are doing it :P

Arinerron avatar Jul 04 '16 01:07 Arinerron

The filter shown in llk/s2forums is not what we use in production.

thisandagain avatar Jul 05 '16 12:07 thisandagain

@thisandagain Oh, oops... What filter would you recommend we use? :smiley:

bates64 avatar Jul 05 '16 19:07 bates64

Didn't OpenSprites previously use a big list of swear words? I remember seeing a link somewhere in the old repo.

Tymewalk avatar Jul 05 '16 22:07 Tymewalk

@Tymewalk Yes, and that's what we're using now. It's the same as llk/s2forums, but apparently that's not what they use in production...

bates64 avatar Jul 06 '16 06:07 bates64

Ideas:

Message schema

type: enum [comment, download, collection_add, forum_activity],
subtype: enum [resource, collection, profile, forum_section, forum_topic],
where: {
    kind: what schema this links to,
    item: ObjectId to wherever this is located
}
when: Date

(more info can be gained from the ObjectId link to generate the message)

Alert schema

from: String (moderator name)
message: String
when: Date

I'll turn the current User model into an OpenSprites model like I did with Resource and Collection and then we can add this :package:

MegaApuTurkUltra avatar Jul 13 '16 03:07 MegaApuTurkUltra

Also, instead of spamming users messages for each individual action that occurs (like Scratch), we should collapse messages in the queue

Example:

  • SampleText, Bob, and 10 others downloaded Archive the Cat
  • Nanalan added 10 things to your collection ADD EVERYTHING COLLECTION!!!1

We should also have settings for what types of messages to display (filter by type and subtype fields we have in the schema)

MegaApuTurkUltra avatar Jul 13 '16 16:07 MegaApuTurkUltra

A filter would be nice. Which 'phase' would be better for filtering things out, though? Backend or frontend? (out of curiousity)

rumanti avatar Jul 14 '16 12:07 rumanti

Probably the server.

bates64 avatar Jul 14 '16 16:07 bates64

Rule #1 of web programming is that you never trust the client.

If we let the client do filtering, haxx0rs would submit unfiltered content

MegaApuTurkUltra avatar Jul 14 '16 20:07 MegaApuTurkUltra

@MegaApuTurkUltra I thought @Rumanti meant the client doing something like this?

const res = await ajax.get('/messages')
const filter = { type: 'comment' }
let msgs = res.filter(msg => msg.type === filter.type) // here!
// do something to parse the mesages into htmk
document.querySelector('#messages').innerHTML = msgs

If we let the client do filtering, haxx0rs would submit unfiltered content

...but they don't submit anything, right?

bates64 avatar Jul 15 '16 10:07 bates64

Oh, I was confused because we were talking about bad word filtering in this thread 😜

We should do it on the server to avoid sending unnecessary data to the client though

MegaApuTurkUltra avatar Jul 15 '16 13:07 MegaApuTurkUltra

But if we can do it on the client, it'd basically be instant - and it can be in a single page rather than forcing the page to go to/ajax.get /messages?type=comment

bates64 avatar Jul 15 '16 15:07 bates64