mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 12:38:48 +03:00
Add regex to remove replies in notifications
This commit is contained in:
parent
c693d54598
commit
37acdad928
3 changed files with 16 additions and 5 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <QDBusPendingReply>
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
#include <QRegularExpression>
|
||||
#include <QTextDocumentFragment>
|
||||
|
||||
#include <functional>
|
||||
|
@ -176,9 +177,12 @@ NotificationsManager::formatNotification(const mtx::events::collections::Timelin
|
|||
.replace("<em>", "<i>")
|
||||
.replace("</em>", "</i>")
|
||||
.replace("<strong>", "<b>")
|
||||
.replace("</strong>", "</b>");
|
||||
.replace("</strong>", "</b>")
|
||||
.replace(QRegularExpression("(<mx-reply>.+\\<\\/mx-reply\\>)"), "");
|
||||
|
||||
return QTextDocumentFragment::fromHtml(mtx::accessors::formattedBodyWithFallback(e))
|
||||
return QTextDocumentFragment::fromHtml(
|
||||
mtx::accessors::formattedBodyWithFallback(e).replace(
|
||||
QRegularExpression("(<mx-reply>.+\\<\\/mx-reply\\>)"), ""))
|
||||
.toPlainText();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "Manager.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QTextDocumentFragment>
|
||||
|
||||
#include "EventAccessors.h"
|
||||
|
@ -8,5 +9,8 @@
|
|||
QString
|
||||
NotificationsManager::formatNotification(const mtx::events::collections::TimelineEvents &e)
|
||||
{
|
||||
return QTextDocumentFragment::fromHtml(mtx::accessors::formattedBodyWithFallback(e)).toPlainText();
|
||||
return QTextDocumentFragment::fromHtml(
|
||||
mtx::accessors::formattedBodyWithFallback(e).replace(
|
||||
QRegularExpression("(<mx-reply>.+\\<\\/mx-reply\\>)"), ""))
|
||||
.toPlainText();
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "notifications/Manager.h"
|
||||
#include "wintoastlib.h"
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QTextDocumentFragment>
|
||||
|
||||
#include "EventAccessors.h"
|
||||
|
@ -80,6 +81,8 @@ NotificationsManager::removeNotification(const QString &, const QString &)
|
|||
QString
|
||||
NotificationsManager::formatNotification(const mtx::events::collections::TimelineEvents &e)
|
||||
{
|
||||
return QTextDocumentFragment::fromHtml(mtx::accessors::formattedBodyWithFallback(e)).toPlainText();
|
||||
return QTextDocumentFragment::fromHtml(
|
||||
mtx::accessors::formattedBodyWithFallback(e).replace(
|
||||
QRegularExpression("(<mx-reply>.+\\<\\/mx-reply\\>)"), ""))
|
||||
.toPlainText();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue