forked from GNUsocial/gnu-social
correctly show the source of messages in a message list
This commit is contained in:
parent
f500d4ea5b
commit
3b19b63bab
@ -156,44 +156,6 @@ class MailboxAction extends CurrentUserDesignAction
|
|||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the source of the message
|
|
||||||
*
|
|
||||||
* Returns either the name (and link) of the API client that posted the notice,
|
|
||||||
* or one of other other channels.
|
|
||||||
*
|
|
||||||
* @param string $source the source of the message
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
|
|
||||||
function showSource($source)
|
|
||||||
{
|
|
||||||
$source_name = _($source);
|
|
||||||
switch ($source) {
|
|
||||||
case 'web':
|
|
||||||
case 'xmpp':
|
|
||||||
case 'mail':
|
|
||||||
case 'omb':
|
|
||||||
case 'api':
|
|
||||||
$this->element('span', 'device', $source_name);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$ns = Notice_source::staticGet($source);
|
|
||||||
if ($ns) {
|
|
||||||
$this->elementStart('span', 'device');
|
|
||||||
$this->element('a', array('href' => $ns->url,
|
|
||||||
'rel' => 'external'),
|
|
||||||
$ns->name);
|
|
||||||
$this->elementEnd('span');
|
|
||||||
} else {
|
|
||||||
$this->element('span', 'device', $source_name);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mailbox actions are read only
|
* Mailbox actions are read only
|
||||||
*
|
*
|
||||||
|
@ -121,7 +121,7 @@ abstract class MessageListItem extends Widget
|
|||||||
$this->out->elementStart('span', 'source');
|
$this->out->elementStart('span', 'source');
|
||||||
// FIXME: bad i18n. Device should be a parameter (from %s).
|
// FIXME: bad i18n. Device should be a parameter (from %s).
|
||||||
$this->out->text(_('from'));
|
$this->out->text(_('from'));
|
||||||
$this->out->element('span', 'device', $this->out->showSource($this->message->source));
|
$this->showSource($this->message->source);
|
||||||
$this->out->elementEnd('span');
|
$this->out->elementEnd('span');
|
||||||
}
|
}
|
||||||
$this->out->elementEnd('div');
|
$this->out->elementEnd('div');
|
||||||
@ -129,6 +129,44 @@ abstract class MessageListItem extends Widget
|
|||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the source of the message
|
||||||
|
*
|
||||||
|
* Returns either the name (and link) of the API client that posted the notice,
|
||||||
|
* or one of other other channels.
|
||||||
|
*
|
||||||
|
* @param string $source the source of the message
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function showSource($source)
|
||||||
|
{
|
||||||
|
$source_name = _($source);
|
||||||
|
switch ($source) {
|
||||||
|
case 'web':
|
||||||
|
case 'xmpp':
|
||||||
|
case 'mail':
|
||||||
|
case 'omb':
|
||||||
|
case 'api':
|
||||||
|
$this->out->element('span', 'device', $source_name);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$ns = Notice_source::staticGet($source);
|
||||||
|
if ($ns) {
|
||||||
|
$this->out->elementStart('span', 'device');
|
||||||
|
$this->out->element('a', array('href' => $ns->url,
|
||||||
|
'rel' => 'external'),
|
||||||
|
$ns->name);
|
||||||
|
$this->out->elementEnd('span');
|
||||||
|
} else {
|
||||||
|
$this->out->element('span', 'device', $source_name);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the profile to show in the message item
|
* Return the profile to show in the message item
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user