-
Notifications
You must be signed in to change notification settings - Fork 65
Display tags as sorting items in the community panel #401
Conversation
👍 This seems like the correct path, saving the necessary info in cache between sync requests. |
Providing motivation: "Pinning" of rooms the way Riot does with Favorites (which uses room tags) is the one thing I'm missing from nheko to use it as a daily driver these days. Very excited for this feature :) |
I tried rebasing this before continuing to advance, and the compiler now complains with:
Has something been changed recently regarding the way dependencies are handled... ? edit: Ah, nevermind, mtxclient switched to using boost's variant. |
Yes the |
Okay, here is basic tag support. A generic "tag" icon is used for tags in the community tab. I think that, for a minimally ergonomic UI, this needs to be added:
|
bf4a930
to
f46e1b2
Compare
I have setup basic icons for favourite and lowpriority rooms. They are probably not the best possible, but improving them is just a matter of changing the PNG files, and I guess this wouldn't block this PR? Regarding the tooltip, I've gone for the convention:
Does that sound good? Regarding the last point, I don't know how it is possible to manually order the elements in the vertical bar. Any hints somebody? |
I've just tested the favourite & low priority tags and it works great! Not sure how we can test custom tags. Is there any other way than manually making the API calls? The icons are not a blocker as they could be easily changed if something better comes up. Sorting will have to be done manually (removing & re-positioning the widgets in the layout) as far as I know. There is something similar here. |
Allowing for creation of room tags doesn't seem that tricky, and would be a major win over Riot :) |
Unfortunately, not afaik. I'm also in favour of adding such an interface to nheko, but I'll reserve that for a future PR if that's okay. For now, it's possible to add a tag to a room with the following curl command:
You need to fill in:
|
Woops, looks like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for your work.
I've highlighted some small refactorings
src/CommunitiesList.cpp
Outdated
} | ||
|
||
contentsLayout_->insertWidget(contentsLayout_->count() - 1, communities_["world"].data()); | ||
for (auto item : header) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a member function or a lambda for those calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you referring to the fact that contentsLayout_->insertWidget(contentsLayout_->count() - 1, item);
is a long call and that it implies a lot of repetition?
I realized I could simply remove the final "Stretch" item and insert it back in the layout at the end, rather than insert all widgets "one before the end". Would that be okay too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was referring to that repetition. I'm fine with any solution that doesn't have a lot of duplication.
src/CommunitiesListItem.cpp
Outdated
if (groupId_ == "world") | ||
setToolTip(tr("All rooms")); | ||
else if (is_tag()) { | ||
QString tag = groupId_.right(groupId_.size() - 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have this 4
number derived from the tag:
string somehow. Currently it seems like a magic number if you only read a part of the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is adding a comment explaining it enough, or should I replace it by strlen("tag:")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen it in 2-3 places so maybe it would be better to use something like strlen
.
(with apologies for commenting from the sidelines:) If you're going to do custom room tags in the future, please write up a brief concept document and think through the user workflows first, and ideally sync up with Riot and their possible plans. It doesn't seem tricky because the technical bits are easy, but "going with the code flow" on these kinds of features is a slippery slope towards a fragmented ecosystem and bad user experience. Thanks for your work either way, really looking forward to the release that includes this! |
@Valodim Regarding that, I had already pushed a few month ago for a better specification of the semantics of tags in the client-server spec: https://matrix.org/docs/spec/client_server/r0.4.0.html#id154, I believe this already sets a good basis for relative uniformity, do you think more is needed? |
@Valodim Not sure what you mean by code flow? Custom tags are supported by the spec so we're just taking advantage of an otherwise under-appreciated feature. To elaborate a little more, this feature will allow arbitrary grouping of rooms under a namespace (i.e |
@mujx I believe this last commit should address your comments. |
Oh, I didn't know there were namespaces for tags yet! Yeah that should work nicely, and great to hear there is initiative wrt spec work, too. Relating to my previous comment, this seems like a use case that other clients may want to support. A vendor-neutral namespace with well defined semantics for the workflows you want to cover would facilitate that. Perhaps the |
This PR adds the basics or room tagging functionality, for #80.
Currently, it only adds a
tags
field toRoomInfo
containing the list of associated tags, discarding any metadata they convey. I would like some feedback about whether this is the correct route for implementing this state tracking before inserting more elaborate logic in there.