This topic was marked solved by its starter, on April 12th, 2013, 02:09 AM
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
  • Posts: 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.
  • Posts: 1,841
Re: Notifications show one avatar
« Reply #1, on April 1st, 2013, 08:30 PM »
@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
  • Posts: 16,082
Re: Notifications show one avatar
« Reply #2, on April 1st, 2013, 09:04 PM »
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...)
Posted: April 1st, 2013, 09:04 PM

PS @Dragooon I don't have your bug..?
Re: Notifications show one avatar
« Reply #3, on April 1st, 2013, 09:05 PM »
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.
  • Posts: 1,841
Re: Notifications show one avatar
« Reply #4, on April 1st, 2013, 09:10 PM »
@Nao: I was talking about the avatar stuff, that's done via modifying plugin.php's getText right? Or?
Quote from Nao on April 1st, 2013, 09:05 PM
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
  • Posts: 16,082
Re: Notifications show one avatar
« Reply #5, on April 2nd, 2013, 11:34 PM »
Yes, it is.

Let me fetch my code...

Code: [Select]
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.
  • Posts: 1,841
Re: Notifications show one avatar
« Reply #6, on April 3rd, 2013, 07:09 AM »
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
  • Posts: 1,670

Nao

  • Dadman with a boy
  • Posts: 16,082