Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking on username inserts ID instead of matrix.to username #828

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions client/chatedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,19 @@ void ChatEdit::cancelCompletion()

bool ChatEdit::isCompletionActive() { return !completionMatches.isEmpty(); }

void ChatEdit::insertRaw(QString text)
{
// Similar in behavior to ChatEdit::insertMention
// (see below) except that it inserts
// raw text only.
// Used to insert uri in @username:homeserver
// format

auto cursor = textCursor();
cursor.insertText(text);
cursor.insertText(QStringLiteral(" ")); // extra space after name
}

void ChatEdit::insertMention(QString author, QUrl url)
{
// The order of inserting text below is such to be convenient for the user
Expand Down
1 change: 1 addition & 0 deletions client/chatedit.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ChatEdit : public KChatEdit
void cancelCompletion();
bool isCompletionActive();

void insertRaw(QString text);
void insertMention(QString author, QUrl url);

public slots:
Expand Down
4 changes: 1 addition & 3 deletions client/chatroomwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,7 @@ void ChatRoomWidget::setHudHtml(const QString& htmlCaption,
void ChatRoomWidget::insertMention(Quotient::User* user)
{
Q_ASSERT(currentRoom() != nullptr);
m_chatEdit->insertMention(
user->displayname(currentRoom()),
Quotient::Uri(user->id()).toUrl(Quotient::Uri::MatrixToUri));
m_chatEdit->insertRaw(user->id());
m_chatEdit->setFocus();
}

Expand Down
Loading