mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-24 20:18:53 +03:00
Multiple changes
More consistent language with similar description strings Add manpage entry Add /unignore Add ignore & decline button in the invite page Add invite rejection to all ignore methods
This commit is contained in:
parent
4695bbb340
commit
bfdf87a92d
8 changed files with 60 additions and 11 deletions
|
@ -229,6 +229,14 @@ Inserts `┯━┯╭( º _ º╭)`
|
||||||
*/sovietflip*::
|
*/sovietflip*::
|
||||||
Inserts `ノ┬─┬ノ ︵ ( \\o°o)\\`
|
Inserts `ノ┬─┬ノ ︵ ( \\o°o)\\`
|
||||||
|
|
||||||
|
=== User management
|
||||||
|
|
||||||
|
*/ignore* _<username>_::
|
||||||
|
Ignore a user, invites from them are also rejected.
|
||||||
|
|
||||||
|
*/unignore* _<username>_::
|
||||||
|
Stops ignoring a user.
|
||||||
|
|
||||||
=== Advanced
|
=== Advanced
|
||||||
|
|
||||||
*/clear-timeline*::
|
*/clear-timeline*::
|
||||||
|
|
|
@ -277,6 +277,16 @@ Item {
|
||||||
|
|
||||||
onClicked: Rooms.declineInvite(roomPreview.roomid)
|
onClicked: Rooms.declineInvite(roomPreview.roomid)
|
||||||
}
|
}
|
||||||
|
FlatButton {
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
text: qsTr("decline invite and ignore user")
|
||||||
|
visible: roomPreview && roomPreview.isInvite
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
var inviter = TimelineManager.getGlobalUserProfile(roomPreview.inviterUserId)
|
||||||
|
inviter.ignored = true
|
||||||
|
}
|
||||||
|
}
|
||||||
FlatButton {
|
FlatButton {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: qsTr("leave")
|
text: qsTr("leave")
|
||||||
|
|
|
@ -99,6 +99,8 @@ CommandCompleter::data(const QModelIndex &index, int role) const
|
||||||
return QStringLiteral("/converttoroom");
|
return QStringLiteral("/converttoroom");
|
||||||
case Ignore:
|
case Ignore:
|
||||||
return QStringLiteral("/ignore");
|
return QStringLiteral("/ignore");
|
||||||
|
case Unignore:
|
||||||
|
return QStringLiteral("/unignore");
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -174,6 +176,8 @@ CommandCompleter::data(const QModelIndex &index, int role) const
|
||||||
return QStringLiteral("/converttoroom");
|
return QStringLiteral("/converttoroom");
|
||||||
case Ignore:
|
case Ignore:
|
||||||
return QStringLiteral("/ignore <@userid>");
|
return QStringLiteral("/ignore <@userid>");
|
||||||
|
case Unignore:
|
||||||
|
return QStringLiteral("/unignore <@userid>");
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -248,7 +252,9 @@ CommandCompleter::data(const QModelIndex &index, int role) const
|
||||||
case ConvertToRoom:
|
case ConvertToRoom:
|
||||||
return tr("Convert this direct chat into a room.");
|
return tr("Convert this direct chat into a room.");
|
||||||
case Ignore:
|
case Ignore:
|
||||||
return tr("Ignores a user.");
|
return tr("Ignore a user.");
|
||||||
|
case Unignore:
|
||||||
|
return tr("Stop ignoring a user.");
|
||||||
default:
|
default:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
ConvertToDm,
|
ConvertToDm,
|
||||||
ConvertToRoom,
|
ConvertToRoom,
|
||||||
Ignore,
|
Ignore,
|
||||||
|
Unignore,
|
||||||
COUNT,
|
COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,8 @@ InputBar::updateTextContentProperties(const QString &t)
|
||||||
QStringLiteral("goto"),
|
QStringLiteral("goto"),
|
||||||
QStringLiteral("converttodm"),
|
QStringLiteral("converttodm"),
|
||||||
QStringLiteral("converttoroom"),
|
QStringLiteral("converttoroom"),
|
||||||
QStringLiteral("ignore")};
|
QStringLiteral("ignore"),
|
||||||
|
QStringLiteral("unignore")};
|
||||||
bool hasInvalidCommand = !commandName.isNull() && !validCommands.contains(commandName);
|
bool hasInvalidCommand = !commandName.isNull() && !validCommands.contains(commandName);
|
||||||
bool hasIncompleteCommand = hasInvalidCommand && '/' + commandName == t;
|
bool hasIncompleteCommand = hasInvalidCommand && '/' + commandName == t;
|
||||||
|
|
||||||
|
@ -940,15 +941,9 @@ InputBar::command(const QString &command, QString args)
|
||||||
} else if (command == QLatin1String("converttoroom")) {
|
} else if (command == QLatin1String("converttoroom")) {
|
||||||
utils::removeDirectFromRoom(this->room->roomId());
|
utils::removeDirectFromRoom(this->room->roomId());
|
||||||
} else if (command == QLatin1String("ignore")) {
|
} else if (command == QLatin1String("ignore")) {
|
||||||
QSharedPointer<UserProfile> user(
|
this->setArgIgnored(args, true);
|
||||||
new UserProfile(QString(), args, TimelineViewManager::instance()));
|
} else if (command == QLatin1String("unignore")) {
|
||||||
connect(user.get(), &UserProfile::failedToFetchProfile, [args] {
|
this->setArgIgnored(args, false);
|
||||||
MainWindow::instance()->showNotification(tr("Failed to fetch user %1").arg(args));
|
|
||||||
});
|
|
||||||
connect(user.get(), &UserProfile::globalUsernameRetrieved, [user](const QString &user_id) {
|
|
||||||
Q_UNUSED(user_id)
|
|
||||||
user->setIgnored(true);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -956,6 +951,23 @@ InputBar::command(const QString &command, QString args)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InputBar::setArgIgnored(const QString &user, const bool ignored)
|
||||||
|
{
|
||||||
|
QSharedPointer<UserProfile> profile(
|
||||||
|
new UserProfile(QString(), user, TimelineViewManager::instance()));
|
||||||
|
connect(profile.get(), &UserProfile::failedToFetchProfile, [user] {
|
||||||
|
MainWindow::instance()->showNotification(tr("Failed to fetch user %1").arg(user));
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(profile.get(),
|
||||||
|
&UserProfile::globalUsernameRetrieved,
|
||||||
|
[profile, ignored](const QString &user_id) {
|
||||||
|
Q_UNUSED(user_id)
|
||||||
|
profile->setIgnored(ignored);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
|
MediaUpload::MediaUpload(std::unique_ptr<QIODevice> source_,
|
||||||
const QString &mimetype,
|
const QString &mimetype,
|
||||||
const QString &originalFilename,
|
const QString &originalFilename,
|
||||||
|
|
|
@ -283,6 +283,8 @@ private:
|
||||||
|
|
||||||
void updateTextContentProperties(const QString &t);
|
void updateTextContentProperties(const QString &t);
|
||||||
|
|
||||||
|
void setArgIgnored(const QString &user, const bool ignored);
|
||||||
|
|
||||||
QTimer typingRefresh_;
|
QTimer typingRefresh_;
|
||||||
QTimer typingTimeout_;
|
QTimer typingTimeout_;
|
||||||
TimelineModel *room;
|
TimelineModel *room;
|
||||||
|
|
|
@ -197,6 +197,8 @@ public:
|
||||||
return instance_;
|
return instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FilteredRoomlistModel *instance() { return instance_; }
|
||||||
|
|
||||||
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
|
||||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &) const override;
|
bool filterAcceptsRow(int sourceRow, const QModelIndex &) const override;
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,14 @@ UserProfile::setIgnored(bool ignore)
|
||||||
.arg(userid, QString::fromStdString(e->matrix_error.error)));
|
.arg(userid, QString::fromStdString(e->matrix_error.error)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (ignore) {
|
||||||
|
const QHash<QString, RoomInfo> invites = cache::invites();
|
||||||
|
|
||||||
|
for (auto room = invites.keyBegin(), end = invites.keyEnd(); room != end; room++) {
|
||||||
|
FilteredRoomlistModel::instance()->declineInvite(*room);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue