Esempio n. 1
0
def CommentAttitude_create(sender, instance, created, **kwargs):
    if created and isinstance(instance, CommentAttitude):
        mMs.CounterOperate(instance.ObjectID, 'Like' if instance.Point == 1 else 'Dislike', '+')
        mMs.AddNotification('CAL' if instance.Point == 1 else 'CAD', instance.ObjectID, instance.Publisher, instance.ObjectID.Publisher)
    elif (not created) and isinstance(instance, CommentAttitude):
        mMs.CounterOperate(instance.ObjectID, 'Like' if int(instance.Point) == 1 else 'Dislike', '+')
        mMs.CounterOperate(instance.ObjectID, 'Like' if abs(int(instance.Point) - 1) == 1 else 'Dislike', '-')
        mMs.AddNotification('CAL' if instance.Point == 1 else 'CAD', instance.ObjectID, instance.Publisher, instance.ObjectID.Publisher)
Esempio n. 2
0
def comment_create(sender, instance, created, **kwargs):
    if created and isinstance(instance, CommentInfo):
        mMs.CounterOperate(instance.TopicID, 'Comment', '+')
        mMs.CounterOperate(
            instance.Publisher, 'TRCount' if instance.TopicID.Type == 'Topic' else 'SRCount', '+')
        if instance.TopicID.Type == 'Topic':
            mMs.AddNotification('TCR' if instance.Parent else 'TC', instance, instance.Publisher, instance.Parent.Publisher if instance.Parent else instance.TopicID.Publisher)
        else:
            mMs.AddNotification('SCR' if instance.Parent else 'SC', instance, instance.Publisher, instance.Parent.Publisher if instance.Parent else instance.TopicID.Publisher)
Esempio n. 3
0
def rollcalldialogue_create(sender, instance, created, **kwargs):
    if created and isinstance(instance, RollCallDialogue):
        mMs.CounterOperate(instance.RollCallID, 'Comment', '+')
        mMs.CounterOperate(instance.Publisher, 'RRCount', '+')
        if not instance.RollCallID.Publisher == instance.Publisher:
            mMs.AddNotification('RD', instance.RollCallID, instance.Publisher, instance.RollCallID.Target)
Esempio n. 4
0
def rollcall_create(sender, instance, created, **kwargs):
    if created and isinstance(instance, RollCallInfo):
        mMs.CounterOperate(instance.Publisher, 'RCount', '+')
        mMs.AddNotification('R', instance, instance.Publisher, instance.Target)
Esempio n. 5
0
def topic_create(sender, instance, created, **kwargs):
    if created and isinstance(instance, TopicInfo):
        mMs.CounterOperate(
            instance.Publisher, 'TCount' if instance.Type == 'Topic' else 'SCount', '+')
        for item in QRC('UserLink.objects.filter(UserBeLinked=%s)', None, instance.Publisher):
            mMs.AddNotification('TP' if instance.Type == 'Topic' else 'SP', instance, instance.Publisher, item.UserLinking)
Esempio n. 6
0
def userlink_create(sender, instance, created, **kwargs):
    if created and isinstance(instance, UserLink):
        mMs.CounterOperate(instance.UserBeLinked, 'FansCount', '+')
        mMs.CounterOperate(instance.UserLinking, 'FocusCount', '+')
        mMs.AddNotification('L', instance, instance.UserLinking, instance.UserBeLinked)