holmesal / shortwave

2 stars 0 forks source link

@mentions #159

Open holmesal opened 10 years ago

holmesal commented 10 years ago

So messages currently look like this:

{
  "type": String,
  "content": Dictionary,
  "owner": String,
  ".priority": Unix time in milliseconds
} 

I propose we add a "mentions" property on the top level, which contains a key-value mapping of the users mentioned. Key should be the string name used in the @mention, and value should be the uid of the user it maps to.

It would look like this in a message:

{
  "type": String,
  "content": Dictionary,
  "owner": String,
  "mentions": {
    "Matthew": "facebook:1234567890",
    "Dan A.": "facebook:9478463873"
  },
  ".priority": Unix time in milliseconds
} 

What say you @DogsForArms?

@matthewkulp what do you think about different ways to @mention by name? For example, @alex (if there is only one alex), @AlexW or @Alex W. if there are two, etc?

holmesal commented 10 years ago

Actually, I'm thinking about inverting that mentions object, so the keys are the uids and the values are the strings used to refer to them. It definitely makes it a little easier to filter when deciding whether to send a push notification.

So it would look like this:

{
  "type": String,
  "content": Dictionary,
  "owner": String,
  "mentions": {
    "facebook:1234567890": "Matthew",
    "facebook:9478463873": "Dan A."
  },
  ".priority": Unix time in milliseconds
} 
holmesal commented 9 years ago

Updated based on convo today:

{
  "type": String,
  "content": Dictionary,
  "owner": String,
  "mentions": [
    {
      "substring": String,
      "uuid": String
    }
  ],
  ".priority": Unix time in milliseconds
} 
DogsForArms commented 9 years ago

Implemented on android. Substring may either be @Username or @FirstnameLastname, I am not sure yet!