Signed-off-by: Gary Kim <gary@garykim.dev>
This commit is contained in:
Gary Kim 2021-05-27 17:00:01 -04:00
Родитель aaf51b70b2
Коммит b885469c6c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9349B59FB54594AC
4 изменённых файлов: 8 добавлений и 4 удалений

Просмотреть файл

@ -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'