Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
49b313e3
Verified
Commit
49b313e3
authored
3 years ago
by
tastytea
Committed by
Nicolas Werner
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Hidden events: Make save-function reusable for global account data
parent
f7ca41bc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
resources/qml/dialogs/HiddenEventsDialog.qml
+1
-1
1 addition, 1 deletion
resources/qml/dialogs/HiddenEventsDialog.qml
src/ui/RoomSettings.cpp
+16
-8
16 additions, 8 deletions
src/ui/RoomSettings.cpp
src/ui/RoomSettings.h
+2
-1
2 additions, 1 deletion
src/ui/RoomSettings.h
with
19 additions
and
10 deletions
resources/qml/dialogs/HiddenEventsDialog.qml
+
1
−
1
View file @
49b313e3
...
...
@@ -121,7 +121,7 @@ ApplicationWindow {
if
(
!
toggleSticker
.
checked
)
{
events
.
push
(
"
m.sticker
"
);
}
roomSettings
.
saveHiddenEventsSettings
(
events
);
roomSettings
.
saveHiddenEventsSettings
(
events
,
roomSettings
.
roomId
);
hiddenEventsDialog
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
src/ui/RoomSettings.cpp
+
16
−
8
View file @
49b313e3
...
...
@@ -427,9 +427,8 @@ RoomSettings::openEditModal()
}
void
RoomSettings
::
saveHiddenEventsSettings
(
const
QSet
<
QString
>
events
)
RoomSettings
::
saveHiddenEventsSettings
(
const
QSet
<
QString
>
&
events
,
const
QString
&
roomId
)
{
// TODO: Make this reusable for global account settings.
mtx
::
events
::
account_data
::
nheko_extensions
::
HiddenEvents
hiddenEvents
;
hiddenEvents
.
hidden_event_types
=
{
EventType
::
Reaction
,
EventType
::
CallCandidates
,
EventType
::
Unsupported
};
...
...
@@ -438,12 +437,21 @@ RoomSettings::saveHiddenEventsSettings(const QSet<QString> events)
mtx
::
events
::
getEventType
(
event
.
toStdString
()));
}
const
auto
roomid
=
roomid_
.
toStdString
();
http
::
client
()
->
put_room_account_data
(
roomid
,
hiddenEvents
,
[
&
roomid
](
mtx
::
http
::
RequestErr
e
)
{
if
(
e
)
{
nhlog
::
net
()
->
error
(
"Failed to update room account data in {}: {}"
,
roomid
,
*
e
);
}
});
if
(
!
roomId
.
isEmpty
())
{
const
auto
rid
=
roomId
.
toStdString
();
http
::
client
()
->
put_room_account_data
(
rid
,
hiddenEvents
,
[
&
rid
](
mtx
::
http
::
RequestErr
e
)
{
if
(
e
)
{
nhlog
::
net
()
->
error
(
"Failed to update room account data with hidden events in {}: {}"
,
rid
,
*
e
);
}
});
}
else
{
http
::
client
()
->
put_account_data
(
hiddenEvents
,
[](
mtx
::
http
::
RequestErr
e
)
{
if
(
e
)
{
nhlog
::
net
()
->
error
(
"Failed to update account data with hidden events: {}"
,
*
e
);
}
});
}
}
void
...
...
This diff is collapsed.
Click to expand it.
src/ui/RoomSettings.h
+
2
−
1
View file @
49b313e3
...
...
@@ -109,7 +109,8 @@ public:
Q_INVOKABLE
void
enableEncryption
();
Q_INVOKABLE
void
updateAvatar
();
Q_INVOKABLE
void
openEditModal
();
Q_INVOKABLE
void
saveHiddenEventsSettings
(
QSet
<
QString
>
events
);
Q_INVOKABLE
void
saveHiddenEventsSettings
(
const
QSet
<
QString
>
&
events
,
const
QString
&
roomId
=
{});
Q_INVOKABLE
void
changeAccessRules
(
int
index
);
Q_INVOKABLE
void
changeNotifications
(
int
currentIndex
);
Q_INVOKABLE
bool
eventHidden
(
QString
event
)
const
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment