зеркало из https://github.com/nextcloud/spreed.git
Set avatar correctly
Signed-off-by: Gary Kim <gary@garykim.dev>
This commit is contained in:
Родитель
aaf51b70b2
Коммит
b885469c6c
|
@ -26,6 +26,7 @@ namespace OCA\Talk\Chat;
|
|||
|
||||
use OCA\Talk\Events\ChatMessageEvent;
|
||||
use OCA\Talk\Exceptions\ParticipantNotFoundException;
|
||||
use OCA\Talk\MatterbridgeManager;
|
||||
use OCA\Talk\Model\Attendee;
|
||||
use OCA\Talk\Model\Message;
|
||||
use OCA\Talk\Participant;
|
||||
|
@ -73,12 +74,14 @@ class MessageParser {
|
|||
protected function setActor(Message $message): void {
|
||||
$comment = $message->getComment();
|
||||
|
||||
$actorId = $comment->getActorId();
|
||||
$displayName = '';
|
||||
if ($comment->getActorType() === Attendee::ACTOR_USERS) {
|
||||
$user = $this->userManager->get($comment->getActorId());
|
||||
$displayName = $user instanceof IUser ? $user->getDisplayName() : $comment->getActorId();
|
||||
} elseif ($comment->getActorType() === Attendee::ACTOR_BRIDGED) {
|
||||
$displayName = $comment->getActorId();
|
||||
$actorId = MatterbridgeManager::BRIDGE_BOT_USERID;
|
||||
} elseif ($comment->getActorType() === Attendee::ACTOR_GUESTS) {
|
||||
if (isset($guestNames[$comment->getActorId()])) {
|
||||
$displayName = $this->guestNames[$comment->getActorId()];
|
||||
|
@ -96,7 +99,7 @@ class MessageParser {
|
|||
|
||||
$message->setActor(
|
||||
$comment->getActorType(),
|
||||
$comment->getActorId(),
|
||||
$actorId,
|
||||
$displayName
|
||||
);
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ class ChatController extends AEnvironmentAwareController {
|
|||
if ($actorDisplayName) {
|
||||
$this->guestManager->updateName($this->room, $this->participant, $actorDisplayName);
|
||||
}
|
||||
} else if ($this->userId === MatterbridgeManager::BRIDGE_BOT_USERID) {
|
||||
} elseif ($this->userId === MatterbridgeManager::BRIDGE_BOT_USERID) {
|
||||
$actorType = Attendee::ACTOR_BRIDGED;
|
||||
$actorId = str_replace(["/", "\""], "", $actorDisplayName);
|
||||
} else {
|
||||
|
|
|
@ -395,7 +395,7 @@ class MatterbridgeManager {
|
|||
$content .= sprintf(' Login = "%s"', $part['login']) . "\n";
|
||||
$content .= sprintf(' Password = "%s"', $part['password']) . "\n";
|
||||
$content .= ' PrefixMessagesWithNick = true' . "\n";
|
||||
$content .= ' RemoteNickFormat="[{PROTOCOL}] <{NICK}>"' . "\n\n";
|
||||
$content .= ' RemoteNickFormat="[{PROTOCOL}] <{NICK}> "' . "\n\n";
|
||||
} elseif ($type === 'mattermost') {
|
||||
// remove protocol from server URL
|
||||
if (preg_match('/^https?:/', $part['server'])) {
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
|
||||
<script>
|
||||
import Avatar from '@nextcloud/vue/dist/Components/Avatar'
|
||||
import { ATTENDEE } from '../../../constants'
|
||||
|
||||
export default {
|
||||
name: 'AuthorAvatar',
|
||||
|
@ -73,7 +74,7 @@ export default {
|
|||
return this.authorType === 'bots' && this.authorId === 'changelog'
|
||||
},
|
||||
isUser() {
|
||||
return this.authorType === 'users'
|
||||
return this.authorType === 'users' || this.authorType === ATTENDEE.ACTOR_TYPE.BRIDGED
|
||||
},
|
||||
isDeletedUser() {
|
||||
return this.authorType === 'deleted_users'
|
||||
|
|
Загрузка…
Ссылка в новой задаче