Browse Source

Merge pull request #1934 from annando/1510-better-notification

Let the notification look more like the follow dialog
pull/1936/head
Tobias Diekershoff 7 years ago
parent
commit
9f68676db6
  1. 19
      mod/notifications.php
  2. 3
      view/templates/intros.tpl

19
mod/notifications.php

@ -1,5 +1,7 @@
<?php
include_once("include/bbcode.php");
include_once("include/contact_selectors.php");
include_once("include/Scrape.php");
function notifications_post(&$a) {
@ -138,7 +140,8 @@ function notifications_content(&$a) {
$r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`,
`gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`,
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`,
`gcontact`.`network` AS `gnetwork`
FROM `intro`
LEFT JOIN `contact` ON `contact`.`id` = `intro`.`contact-id`
LEFT JOIN `gcontact` ON `gcontact`.`nurl` = `contact`.`nurl`
@ -152,6 +155,7 @@ function notifications_content(&$a) {
$tpl = get_markup_template("intros.tpl");
foreach($r as $rr) {
if($rr['fid']) {
$return_addr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
@ -206,7 +210,20 @@ function notifications_content(&$a) {
));
}
$header = $rr["name"];
$ret = probe_url($rr["url"]);
if ($rr['gnetwork'] == "")
$rr['gnetwork'] = $ret["network"];
if ($ret["addr"] != "")
$header .= " <".$ret["addr"].">";
$header .= " (".network_to_name($rr['gnetwork']).")";
$notif_content .= replace_macros($tpl, array(
'$header' => htmlentities($header),
'$str_notifytype' => t('Notification type: '),
'$notify_type' => (($rr['network'] !== NETWORK_OSTATUS) ? t('Friend/Connect Request') : t('New Follower')),
'$dfrn_text' => $dfrn_text,

3
view/templates/intros.tpl

@ -1,9 +1,8 @@
<h2>{{$header}}</h2>
<div class="intro-wrapper" id="intro-{{$contact_id}}" >
<p class="intro-desc">{{$str_notifytype}} {{$notify_type}}</p>
<a class="intro-url-link" id="intro-url-link-{{$contact_id}}" href="{{$url}}" ><div class="intro-fullname" id="intro-fullname-{{$contact_id}}" >{{$fullname}}</div></a>
<img id="photo-{{$contact_id}}" class="intro-photo" src="{{$photo}}" width="175" height=175" title="{{$fullname|escape:'html'}}" alt="{{$fullname|escape:'html'}}" />
<dl><dt>{{$url_label}}</dt><dd><a target="blank" href="{{$url}}">{{$url}}</a></dd></dl>
{{if $location}}<dl><dt>{{$location_label}}</dt><dd>{{$location}}</dd></dl>{{/if}}

Loading…
Cancel
Save