Ce sujet a été marqué résolu par son auteur, le 12 Avril 2013 à 02:09
Notifications show one avatar

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Messages: 1 670
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Messages: 1 841
Re: Notifications show one avatar
« Réponse #1, le 1er Avril 2013 à 20:30 »
@Nao: Can you make the avatar formatting etc. changes universal instead of applying to individual Notififier::getText? I've intended the function to always return raw text without any formatting since it can be used for other places as well. Or share your formatting code and I can make it universal.
The way it's meant to be

Nao

  • Dadman with a boy
  • Messages: 16 082
Re: Notifications show one avatar
« Réponse #2, le 1er Avril 2013 à 21:04 »
Oh, you mean the code in plugin.php..? It's a WIP. Not ready for consumption...

I'm busy IRL today, I only uploaded my code here because it actually works, and I wanted to gather feedback on whether you guys liked it or not... Not the design (which is really, really tentative) or anything, but the basic functionality:
- HTML no longer holds any data;
- only the unread count;
- clicking the notifs area will load all notifications through Ajax;
- polling is every minute on active tabs, every 10 minutes on inactive tabs;
- polling only provides updated unread count and forces an Ajax reload on notifs click (i.e. even that doesn't carry extra bandwidth requirements...)
Posté : 1er Avril 2013 à 21:04

PS @Dragooon I don't have your bug..?
Re: Notifications show one avatar
« Réponse #3, le 1er Avril 2013 à 21:05 »
PPS: what happens if I merge a post with an earlier one that has a notification attached to it..? I guess it loses it, right..?

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Messages: 1 841
Re: Notifications show one avatar
« Réponse #4, le 1er Avril 2013 à 21:10 »
@Nao: I was talking about the avatar stuff, that's done via modifying plugin.php's getText right? Or?
Citation de Nao le 1er Avril 2013 à 21:05
PPS: what happens if I merge a post with an earlier one that has a notification attached to it..? I guess it loses it, right..?
I'm not sure, it shouldn't?

Nao

  • Dadman with a boy
  • Messages: 16 082
Re: Notifications show one avatar
« Réponse #5, le 2 Avril 2013 à 23:34 »
Yes, it is.

Let me fetch my code...

Code: [Sélectionner]
public function getText(Notification $notification)
{
global $txt, $memberContext;

$data = $notification->getData();
if (empty($memberContext[$data['member']['id']]['avatar']))
loadMemberAvatar($data['member']['id'], true);
return sprintf($txt['wementions_notification'], !empty($memberContext[$data['member']['id']]['avatar']) ? $memberContext[$data['member']['id']]['avatar']['image'] : '', $data['member']['name'], $data['subject']);
}

Also, I've just uploaded an updated version of script.js which allows you to close the popup by clicking anywhere else. Very, VERY oddly, I had many difficulties to pull it off, because of some peculiarities in the way it's shown in the first place.

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Messages: 1 841
Re: Notifications show one avatar
« Réponse #6, le 3 Avril 2013 à 07:09 »
Wouldn't it be a better idea to move it into Notifications template and do it besides the text? That way we don't need to do it for every notifier and it gives us more flexibility.

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Messages: 1 670

Nao

  • Dadman with a boy
  • Messages: 16 082