зеркало из https://github.com/nextcloud/spreed.git
Merge pull request #5667 from nextcloud/enh/noid/matterbridge-set-names
Show name for bridged messages
This commit is contained in:
Коммит
ddda9be34b
|
@ -67,6 +67,7 @@ title: Constants
|
|||
* `users` - Logged-in users
|
||||
* `guests` - Guest users (attendee type `guests` and `emails`)
|
||||
* `bots` - Used by commands (actor-id is the used `/command`) and the changelog conversation (actor-id is `changelog`)
|
||||
* `bridged` - Users whose messages are bridged in by the [Matterbridge integration](matterbridge.md)
|
||||
|
||||
## Signaling modes
|
||||
* `internal` No external signaling server is used
|
||||
|
|
|
@ -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,10 +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()];
|
||||
|
@ -94,7 +99,7 @@ class MessageParser {
|
|||
|
||||
$message->setActor(
|
||||
$comment->getActorType(),
|
||||
$comment->getActorId(),
|
||||
$actorId,
|
||||
$displayName
|
||||
);
|
||||
}
|
||||
|
|
|
@ -160,6 +160,9 @@ class ChatController extends AEnvironmentAwareController {
|
|||
if ($actorDisplayName) {
|
||||
$this->guestManager->updateName($this->room, $this->participant, $actorDisplayName);
|
||||
}
|
||||
} elseif ($this->userId === MatterbridgeManager::BRIDGE_BOT_USERID && $actorDisplayName) {
|
||||
$actorType = Attendee::ACTOR_BRIDGED;
|
||||
$actorId = str_replace(["/", "\""], "", $actorDisplayName);
|
||||
} else {
|
||||
$actorType = Attendee::ACTOR_USERS;
|
||||
$actorId = $this->userId;
|
||||
|
@ -553,6 +556,9 @@ class ChatController extends AEnvironmentAwareController {
|
|||
$attendee = $this->participant->getAttendee();
|
||||
$isOwnMessage = $message->getActorType() === $attendee->getActorType()
|
||||
&& $message->getActorId() === $attendee->getActorId();
|
||||
|
||||
// Special case for if the message is a bridged message, then the message is the bridge bot's message.
|
||||
$isOwnMessage = $isOwnMessage || ($message->getActorType() === Attendee::ACTOR_BRIDGED && $attendee->getActorId() === MatterbridgeManager::BRIDGE_BOT_USERID);
|
||||
if (!$isOwnMessage
|
||||
&& (!$this->participant->hasModeratorPermissions(false)
|
||||
|| $this->room->getType() === Room::ONE_TO_ONE_CALL)) {
|
||||
|
|
|
@ -387,6 +387,7 @@ class MatterbridgeManager {
|
|||
$serverUrl = $part['server'];
|
||||
} else {
|
||||
$serverUrl = preg_replace('/\/+$/', '', $this->urlGenerator->getAbsoluteURL(''));
|
||||
$content .= " SeparateDisplayName = true" ."\n";
|
||||
// TODO remove that
|
||||
//$serverUrl = preg_replace('/https:/', 'http:', $serverUrl);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ class Attendee extends Entity {
|
|||
public const ACTOR_GUESTS = 'guests';
|
||||
public const ACTOR_EMAILS = 'emails';
|
||||
public const ACTOR_CIRCLES = 'circles';
|
||||
public const ACTOR_BRIDGED = 'bridged';
|
||||
|
||||
public const PUBLISHING_PERMISSIONS_NONE = 0;
|
||||
public const PUBLISHING_PERMISSIONS_AUDIO = 1;
|
||||
|
|
|
@ -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'
|
||||
|
@ -89,7 +90,8 @@ export default {
|
|||
|
||||
disableMenu() {
|
||||
// disable the menu if accessing the conversation as guest
|
||||
return this.$store.getters.getActorType() === 'guests'
|
||||
// or the message sender is a bridged user
|
||||
return this.$store.getters.getActorType() === 'guests' || this.authorType === ATTENDEE.ACTOR_TYPE.BRIDGED
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -304,12 +304,14 @@ export default {
|
|||
* @param {string} message1.id The ID of the new message
|
||||
* @param {string} message1.actorType Actor type of the new message
|
||||
* @param {string} message1.actorId Actor id of the new message
|
||||
* @param {string} message1.actorDisplayName Actor displayname of the new message
|
||||
* @param {string} message1.systemMessage System message content of the new message
|
||||
* @param {int} message1.timestamp Timestamp of the new message
|
||||
* @param {null|object} message2 The previous message
|
||||
* @param {string} message2.id The ID of the second message
|
||||
* @param {string} message2.actorType Actor type of the previous message
|
||||
* @param {string} message2.actorId Actor id of the previous message
|
||||
* @param {string} message2.actorDisplayName Actor display name of previous message
|
||||
* @param {string} message2.systemMessage System message content of the previous message
|
||||
* @param {int} message2.timestamp Timestamp of the second message
|
||||
* @returns {boolean} Boolean if the messages should be grouped or not
|
||||
|
@ -333,8 +335,10 @@ export default {
|
|||
}
|
||||
|
||||
if (!message1IsSystem // System messages are grouped independent from author
|
||||
&& (message1.actorType !== message2.actorType // Otherwise the type and id need to match
|
||||
|| message1.actorId !== message2.actorId)) {
|
||||
&& ((message1.actorType !== message2.actorType // Otherwise the type and id need to match
|
||||
|| message1.actorId !== message2.actorId)
|
||||
|| (message1.actorType === ATTENDEE.ACTOR_TYPE.BRIDGED // Or, if the message is bridged, display names also need to match
|
||||
&& message1.actorDisplayName !== message2.actorDisplayName))) {
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ export const ATTENDEE = {
|
|||
GROUPS: 'groups',
|
||||
CIRCLES: 'circles',
|
||||
BOTS: 'bots',
|
||||
BRIDGED: 'bridged',
|
||||
},
|
||||
BRIDGE_BOT_ID: 'bridge-bot',
|
||||
CHANGELOG_BOT_ID: 'changelog',
|
||||
|
|
Загрузка…
Ссылка в новой задаче