[p2pu-dev] Two way communication for notifications and messaging
Dirk Uys
dirk at p2pu.org
Fri Jun 1 13:26:28 UTC 2012
Thanks, having a look at ack atm!
On Fri, Jun 1, 2012 at 3:07 PM, Jos Flores <josmasflores at gmail.com> wrote:
> Dirk, thanks for the walkthrough, it does make sense.
>
> I've noticed you recommend grep... have you tried ack? it's really cool!
> I use grep very little since I discovered it :)
>
> cheers,
> José
>
> On 1 June 2012 09:57, Dirk Uys <dirk at p2pu.org> wrote:
>> No problem. At the moment the notification code isn't in one place
>> (something we can work on).
>>
>> I'm going to start explaining from the point where the email is sent
>> to the user and work my way backwards to where notifications are
>> generated. Please tell me if this ends up being confusing
>>
>> Emails are sent to a user by calling
>> django.contrib.auth.models.User.email_user
>> (https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.email_user)
>>
>> email_user() is called by an async celery task SendNotification
>> (https://github.com/p2pu/lernanta/blob/master/lernanta/apps/users/tasks.py#L25)
>>
>> SendNotification tasks can be created in multiple places:
>>
>> There is a signal
>> (https://github.com/p2pu/lernanta/blob/master/lernanta/apps/content/models.py#L245)
>> that fires when tasks are created or modified. This signal then calls
>> a function called send_email_notification
>> (https://github.com/p2pu/lernanta/blob/master/lernanta/apps/content/models.py#L213)
>> that creates SendNotifications tasks.
>>
>> Another example is sent_creation_notification
>> (https://github.com/p2pu/lernanta/blob/master/lernanta/apps/projects/models.py#L270)
>> thats part of projects.models.Project. This function is called from
>> the create function
>> (https://github.com/p2pu/lernanta/blob/master/lernanta/apps/projects/models.py#L270/)
>> that in turn gets called in the create view
>> (https://github.com/p2pu/lernanta/blob/master/lernanta/apps/projects/views.py#L189)
>>
>> I'm not sure at what other places SendNotification tasks are created,
>> but you can grep to code base to find out. grep -r SendNotification *
>>
>> The fact that the places where SendNotification tasks are created are
>> spread all over isn't a problem in itself, but at the moment checks
>> for notification preference also seem spread out a bit. For example
>> task updates (https://github.com/p2pu/lernanta/blob/master/lernanta/apps/content/models.py#L234).
>> It also makes it difficult to implement batching of notifications.
>>
>> Than being said, I think that notification may be one of the first
>> parts of Lernanta that we can put into a separate module without too
>> much surgery on the whole code base.
>>
>> Cheers
>> d
>>
>> On Fri, Jun 1, 2012 at 10:28 AM, Jos Flores <josmasflores at gmail.com> wrote:
>>> Hey Dirk,
>>>
>>> I know nothing about the topic but curious about where the
>>> notifications code is and how it works... could you point me towards
>>> it?
>>>
>>> cheers,
>>> José
>>>
>>>
>>> On 1 June 2012 09:01, Dirk Uys <dirk at p2pu.org> wrote:
>>>> Hi
>>>>
>>>> I've been thinking a little bit about two way interaction for
>>>> messaging and notifications. On the software side of things I don't
>>>> foresee too much trouble, but on the config side of things I'm a
>>>> little uncertain.
>>>>
>>>> Our primary MX record points to google, then @lists.p2pu.org points to
>>>> the service we use for the mailing list. I guess we could use
>>>> something like @site.p2pu.org? I see that github uses
>>>> @reply.github.com with something that looks like a one time token.
>>>>
>>>> Is there any specific mail server that anyone would suggest? I have
>>>> always skipped the talk about mail servers when reading linux sysadmin
>>>> docs :)
>>>>
>>>> Cheers
>>>> d
>>>>
>>>> ps. I apologize for the thinking as I type email
>>>> _______________________________________________
>>>> p2pu-dev mailing list
>>>> p2pu-dev at lists.p2pu.org
>>>> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>>> _______________________________________________
>>> p2pu-dev mailing list
>>> p2pu-dev at lists.p2pu.org
>>> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>> _______________________________________________
>> p2pu-dev mailing list
>> p2pu-dev at lists.p2pu.org
>> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
> _______________________________________________
> p2pu-dev mailing list
> p2pu-dev at lists.p2pu.org
> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
More information about the p2pu-dev
mailing list