Browse Source

Replace getTrueName by the Eloquent attribute

pull/617/head
Timothée Jaussoin 8 years ago
parent
commit
9dc2f112ab
  1. 41
      app/Contact.php
  2. 2
      app/Roster.php
  3. 2
      app/widgets/Blog/blog.tpl
  4. 2
      app/widgets/Chat/Chat.php
  5. 2
      app/widgets/Chat/_chat_empty.tpl
  6. 2
      app/widgets/CommunityAffiliations/CommunityAffiliations.php
  7. 14
      app/widgets/CommunityAffiliations/_communityaffiliations.tpl
  8. 4
      app/widgets/CommunityAffiliations/_communityaffiliations_config_content.tpl
  9. 4
      app/widgets/CommunityAffiliations/_communityaffiliations_subscriptions.tpl
  10. 2
      app/widgets/Config/Config.php
  11. 4
      app/widgets/ContactActions/_contactactions_add.tpl
  12. 2
      app/widgets/ContactActions/_contactactions_drawer.tpl
  13. 2
      app/widgets/ContactDisco/_contactdisco.tpl
  14. 2
      app/widgets/Invitations/_invitations_from.tpl
  15. 4
      app/widgets/Login/login.tpl
  16. 4
      app/widgets/Menu/Menu.php
  17. 2
      app/widgets/Post/_post_comments_external.tpl
  18. 2
      app/widgets/Presence/_presence.tpl
  19. 1
      app/widgets/Roster/roster.tpl
  20. 4
      app/widgets/Syndication/Syndication.php
  21. 2
      app/widgets/Visio/visio.tpl

41
app/Contact.php

@ -155,47 +155,6 @@ class Contact extends Model
return $place;
}
public function getTrueName()
{
$truename = '';
if (isset($this->rostername))
$rostername = str_replace('\40', '', $this->rostername);
else
$rostername = '';
if (
isset($this->rostername)
&& $rostername != ''
&& !filter_var($rostername, FILTER_VALIDATE_EMAIL)
)
$truename = $rostername;
elseif (
isset($this->fn)
&& $this->fn != ''
&& !filter_var($this->fn, FILTER_VALIDATE_EMAIL)
)
$truename = $this->fn;
elseif (
isset($this->nickname)
&& $this->nickname != ''
&& !filter_var($this->nickname, FILTER_VALIDATE_EMAIL)
)
$truename = $this->nickname;
elseif (
isset($this->name)
&& $this->name != ''
&& !filter_var($this->name, FILTER_VALIDATE_EMAIL)
)
$truename = $this->name;
else {
$truename = explodeJid($this->id);
$truename = $truename['username'];
}
return $truename;
}
public function getTruenameAttribute()
{
if ($this->fn) return $this->fn;

2
app/Roster.php

@ -102,7 +102,7 @@ class Roster extends Model
public function getTruenameAttribute()
{
if ($this->name) return $this->name;
if ($this->name && !filter_var($this->name, FILTER_VALIDATE_EMAIL)) return $this->name;
if ($this->contact && $this->contact->truename) {
return $this->contact->truename;
}

2
app/widgets/Blog/blog.tpl

@ -17,7 +17,7 @@
{if="$contact"}
<p>
<a href="{$c->route('blog', $contact->jid)}">
{$c->__('blog.title', $contact->getTrueName())}
{$c->__('blog.title', $contact->truename)}
</a>
</p>
{if="$contact->description"}

2
app/widgets/Chat/Chat.php

@ -64,7 +64,7 @@ class Chat extends \Movim\Widget\Base
$presences = getPresences();
$presence = $presences[$contact->value];
Notification::append('presence', $contact->getTrueName(), $presence, $avatar, 4);
Notification::append('presence', $contact->truename, $presence, $avatar, 4);
}
}
}*/

2
app/widgets/Chat/_chat_empty.tpl

@ -26,7 +26,7 @@
<i class="zmdi zmdi-account"></i>
</span>
{/if}
<p class="line">{$value->getTrueName()}</p>
<p class="line">{$value->truename}</p>
<p class="line">{$value->jid}</p>
</li>
{/loop}

2
app/widgets/CommunityAffiliations/CommunityAffiliations.php

@ -163,6 +163,8 @@ class CommunityAffiliations extends \Movim\Widget\Base
{
if (!$this->validateServerNode($origin, $node)) return;
(new CommunityHeader)->ajaxUnsubscribe($origin, $node);
$d = new Delete;
$d->setTo($origin)->setNode($node)
->request();

14
app/widgets/CommunityAffiliations/_communityaffiliations.tpl

@ -43,10 +43,10 @@
</span>
{else}
<span class="primary icon bubble color {$contact->jid|stringToColor}">
{$contact->getTrueName()|firstLetterCapitalize}
{$contact->truename|firstLetterCapitalize}
</span>
{/if}
<p>{$contact->getTrueName()}</p>
<p>{$contact->truename}</p>
<p>{$contact->jid}</p>
</li>
{/loop}
@ -69,17 +69,17 @@
</span>
{else}
<span class="primary icon bubble color {$contact->jid|stringToColor}">
{$contact->getTrueName()|firstLetterCapitalize}
{$contact->truename|firstLetterCapitalize}
</span>
{/if}
<p>{$contact->getTrueName()}</p>
<p>{$contact->truename}</p>
<p>{$contact->jid}</p>
</li>
{/loop}
</ul>
{/if}
{if="$subscriptions"}
{if="$subscriptions->isNotEmpty()"}
<ul class="list card active thin">
<li class="subheader">
<p>{$c->__('communityaffiliation.subscriptions')}</p>
@ -95,10 +95,10 @@
</span>
{else}
<span class="primary icon bubble small color {$value->jid|stringToColor}">
{$value->contact->getTrueName()|firstLetterCapitalize:true}
{$value->contact->truename|firstLetterCapitalize:true}
</span>
{/if}
<p class="normal">{$value->contact->getTrueName()}</p>
<p class="normal">{$value->contact->truename}</p>
{else}
<span class="primary icon bubble small color {$value->jid|stringToColor}">
{$value->jid|firstLetterCapitalize:true}

4
app/widgets/CommunityAffiliations/_communityaffiliations_config_content.tpl

@ -14,7 +14,7 @@
</span>
{else}
<span class="primary icon bubble color {$contact->jid|stringToColor}">
{$contact->getTrueName()|firstLetterCapitalize}
{$contact->truename|firstLetterCapitalize}
</span>
{/if}
<form name="{$contact->jid}">
@ -41,7 +41,7 @@
</select>
</div>
{/if}
<label for="role">{$contact->getTrueName()} role</label>
<label for="role">{$contact->truename} role</label>
</div>
</form>
</li>

4
app/widgets/CommunityAffiliations/_communityaffiliations_subscriptions.tpl

@ -13,12 +13,12 @@
</span>
{else}
<span class="primary icon bubble color {$contact->jid|stringToColor}">
{$contact->getTrueName()|firstLetterCapitalize}
{$contact->truename|firstLetterCapitalize}
</span>
{/if}
<p class="normal line">
<a href="{$c->route('contact', $value->jid)}">
{$contact->getTrueName()}
{$contact->truename}
</a>
</p>
<p>

2
app/widgets/Config/Config.php

@ -39,6 +39,8 @@ class Config extends \Movim\Widget\Base
$me->setConfig($package->content);
$me->save();
$this->refreshConfig();
Notification::append(null, $this->__('config.updated'));
}

4
app/widgets/ContactActions/_contactactions_add.tpl

@ -9,11 +9,11 @@
</span>
{else}
<span class="primary icon bubble color {$contact->id|stringToColor}">
{$contact->getTrueName()|firstLetterCapitalize}
{$contact->truename|firstLetterCapitalize}
</span>
{/if}
<p class="line">
{$contact->getTrueName()}
{$contact->truename}
</p>
<p>{$contact->id}</p>
</li>

2
app/widgets/ContactActions/_contactactions_drawer.tpl

@ -30,7 +30,7 @@
<span class="control icon active" onclick="MovimUtils.reload('{$c->route('contact', $contact->id)}')">
<i class="zmdi zmdi-account"></i>
</span>
<p>{$contact->getTrueName()}</p>
<p>{$contact->truename}</p>
<p>{$contact->id}</p>
</li>
</ul>

2
app/widgets/ContactDisco/_contactdisco.tpl

@ -23,7 +23,7 @@
{/if}
<p class="normal line">
{$value->getTrueName()}
{$value->truename}
{if="!empty($value->description)"}
<span class="second" title="{$value->description|strip_tags}">
{$value->description|strip_tags|truncate:80}

2
app/widgets/Invitations/_invitations_from.tpl

@ -32,7 +32,7 @@
<i class="zmdi zmdi-account"></i>
</span>
<p class="line normal">
{$c->__('invitations.wants_to_talk', $value->getTrueName())}
{$c->__('invitations.wants_to_talk', $value->truename)}
</p>
<p>{$value->jid}</p>
</li>

4
app/widgets/Login/login.tpl

@ -31,11 +31,11 @@
</span>
{else}
<span class="primary icon bubble color {$contact->jid|stringToColor}">
{$contact->getTrueName()|firstLetterCapitalize}
{$contact->truename|firstLetterCapitalize}
</span>
{/if}
<p></p>
<p class="all">{$c->__('form.invite_chatroom', $contact->getTrueName())} - {$invitation->resource}</p>
<p class="all">{$c->__('form.invite_chatroom', $contact->truename)} - {$invitation->resource}</p>
</li>
</ul>
{/if}

4
app/widgets/Menu/Menu.php

@ -59,7 +59,7 @@ class Menu extends \Movim\Widget\Base
$contact = \App\Contact::firstOrNew(['id' => $post->aid]);
Notification::append(
'news',
$contact->getTrueName(),
$contact->truename,
$post->title,
$contact->getPhoto('s'),
2
@ -76,7 +76,7 @@ class Menu extends \Movim\Widget\Base
if (!$post->isMine()) {
Notification::append(
'news',
$contact->getTrueName(),
$contact->truename,
$title,
$contact->getPhoto('s'),
2,

2
app/widgets/Post/_post_comments_external.tpl

@ -29,7 +29,7 @@
<span class="info" title="{$value->published|strtotime|prepareDate}">
{$value->published|strtotime|prepareDate:true,true}
</span>
{$value->getContact()->getTrueName()}
{$value->getContact()->truename}
</p>
{if="!$value->isLike()"}
<p class="all">

2
app/widgets/Presence/_presence.tpl

@ -19,6 +19,6 @@
<i class="zmdi zmdi-sign-in"></i>
</span>
<p class="line bold normal" onclick="MovimUtils.reload('{$c->route('contact', $me->jid)}')">
{$me->getTrueName()}
{$me->truename}
</p>
</li>

1
app/widgets/Roster/roster.tpl

@ -1,3 +1,4 @@
<div id="roster" class="tabelem spin" title="{$c->__('page.contacts')}">
{$c->prepareItems()}
</div>
<br />

4
app/widgets/Syndication/Syndication.php

@ -48,10 +48,10 @@ class Syndication extends \Movim\Widget\Base
$alternate->setAttribute('rel', 'alternate');
if ($contact != null) {
$feed->appendChild($dom->createElement('title', __('feed.title', $contact->getTrueName())));
$feed->appendChild($dom->createElement('title', __('feed.title', $contact->truename)));
$feed->appendChild($author = $dom->createElement('author'));
$author->appendChild($dom->createElement('name', $contact->getTrueName()));
$author->appendChild($dom->createElement('name', $contact->truename));
$author->appendChild($dom->createElement('uri', $this->route('blog', $from)));
$feed->appendChild($dom->createElement('logo', $contact->getPhoto('l')));

2
app/widgets/Visio/visio.tpl

@ -25,7 +25,7 @@
{/if}
<p class="normal center ">
{$contact->getTrueName()}
{$contact->truename}
</p>
<p class="normal state center"></p>
</li>

Loading…
Cancel
Save