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
0ec7be30
Verified
Commit
0ec7be30
authored
3 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Fix hiding rooms from a space
parent
71129d4e
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
src/timeline/CommunitiesModel.cpp
+7
-1
7 additions, 1 deletion
src/timeline/CommunitiesModel.cpp
src/timeline/RoomlistModel.cpp
+42
-12
42 additions, 12 deletions
src/timeline/RoomlistModel.cpp
src/timeline/RoomlistModel.h
+1
-0
1 addition, 0 deletions
src/timeline/RoomlistModel.h
with
50 additions
and
13 deletions
src/timeline/CommunitiesModel.cpp
+
7
−
1
View file @
0ec7be30
...
...
@@ -214,7 +214,13 @@ CommunitiesModel::toggleTagId(QString tagId)
if
(
tagId
.
startsWith
(
"tag:"
))
{
auto
idx
=
tags_
.
indexOf
(
tagId
.
mid
(
4
));
if
(
idx
!=
-
1
)
emit
dataChanged
(
index
(
idx
),
index
(
idx
),
{
Hidden
});
emit
dataChanged
(
index
(
idx
+
1
+
spaceOrder_
.
size
()),
index
(
idx
+
1
+
spaceOrder_
.
size
()),
{
Hidden
});
}
else
if
(
tagId
.
startsWith
(
"space:"
))
{
auto
idx
=
spaceOrder_
.
indexOf
(
tagId
.
mid
(
6
));
if
(
idx
!=
-
1
)
emit
dataChanged
(
index
(
idx
+
1
),
index
(
idx
+
1
),
{
Hidden
});
}
emit
hiddenTagsChanged
();
...
...
This diff is collapsed.
Click to expand it.
src/timeline/RoomlistModel.cpp
+
42
−
12
View file @
0ec7be30
...
...
@@ -51,6 +51,7 @@ RoomlistModel::roleNames() const
{
IsInvite
,
"isInvite"
},
{
IsSpace
,
"isSpace"
},
{
Tags
,
"tags"
},
{
ParentSpaces
,
"parentSpaces"
},
};
}
...
...
@@ -93,6 +94,14 @@ RoomlistModel::data(const QModelIndex &index, int role) const
list
.
push_back
(
QString
::
fromStdString
(
t
));
return
list
;
}
case
Roles
::
ParentSpaces
:
{
auto
parents
=
cache
::
client
()
->
getParentRoomIds
(
roomid
.
toStdString
());
QStringList
list
;
for
(
const
auto
&
t
:
parents
)
list
.
push_back
(
QString
::
fromStdString
(
t
));
return
list
;
}
default
:
return
{};
}
...
...
@@ -122,6 +131,14 @@ RoomlistModel::data(const QModelIndex &index, int role) const
return
false
;
case
Roles
::
Tags
:
return
QStringList
();
case
Roles
::
ParentSpaces
:
{
auto
parents
=
cache
::
client
()
->
getParentRoomIds
(
roomid
.
toStdString
());
QStringList
list
;
for
(
const
auto
&
t
:
parents
)
list
.
push_back
(
QString
::
fromStdString
(
t
));
return
list
;
}
default
:
return
{};
}
...
...
@@ -514,6 +531,14 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons
for
(
const
auto
&
t
:
tags
)
if
(
hiddenTags
.
contains
(
t
))
return
false
;
}
else
if
(
!
hiddenSpaces
.
empty
())
{
auto
parents
=
sourceModel
()
->
data
(
sourceModel
()
->
index
(
sourceRow
,
0
),
RoomlistModel
::
ParentSpaces
)
.
toStringList
();
for
(
const
auto
&
t
:
parents
)
if
(
hiddenSpaces
.
contains
(
t
))
return
false
;
}
return
true
;
...
...
@@ -528,30 +553,35 @@ FilteredRoomlistModel::filterAcceptsRow(int sourceRow, const QModelIndex &) cons
for
(
const
auto
&
t
:
tags
)
if
(
t
!=
filterStr
&&
hiddenTags
.
contains
(
t
))
return
false
;
}
else
if
(
!
hiddenSpaces
.
empty
())
{
auto
parents
=
sourceModel
()
->
data
(
sourceModel
()
->
index
(
sourceRow
,
0
),
RoomlistModel
::
ParentSpaces
)
.
toStringList
();
for
(
const
auto
&
t
:
parents
)
if
(
hiddenSpaces
.
contains
(
t
))
return
false
;
}
return
true
;
}
else
if
(
filterType
==
FilterBy
::
Space
)
{
auto
roomid
=
sourceModel
()
->
data
(
sourceModel
()
->
index
(
sourceRow
,
0
),
RoomlistModel
::
RoomId
)
.
toString
();
auto
parents
=
sourceModel
()
->
data
(
sourceModel
()
->
index
(
sourceRow
,
0
),
RoomlistModel
::
ParentSpaces
)
.
toStringList
();
auto
tags
=
sourceModel
()
->
data
(
sourceModel
()
->
index
(
sourceRow
,
0
),
RoomlistModel
::
Tags
)
.
toStringList
();
auto
contains
=
[](
const
std
::
vector
<
std
::
string
>
&
v
,
const
std
::
string
&
str
)
{
for
(
const
auto
&
e
:
v
)
if
(
e
==
str
)
return
true
;
return
false
;
};
auto
parents
=
cache
::
client
()
->
getParentRoomIds
(
roomid
.
toStdString
());
if
(
!
contains
(
parents
,
filterStr
.
toStdString
()))
if
(
!
parents
.
contains
(
filterStr
))
return
false
;
else
if
(
!
hiddenTags
.
empty
())
{
for
(
const
auto
&
t
:
tags
)
if
(
hiddenTags
.
contains
(
t
))
return
false
;
}
else
if
(
!
hiddenSpaces
.
empty
())
{
for
(
const
auto
&
t
:
parents
)
if
(
hiddenSpaces
.
contains
(
t
))
return
false
;
}
return
true
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/timeline/RoomlistModel.h
+
1
−
0
View file @
0ec7be30
...
...
@@ -38,6 +38,7 @@ public:
IsInvite
,
IsSpace
,
Tags
,
ParentSpaces
,
};
RoomlistModel
(
TimelineViewManager
*
parent
=
nullptr
);
...
...
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