matterhorn-chat / matterhorn

A feature-rich Unix terminal client for the Mattermost chat system
BSD 3-Clause "New" or "Revised" License
1.02k stars 75 forks source link

Groups teams with activity together on the left #787

Closed thlc closed 1 year ago

thlc commented 1 year ago

Hi,

At my company, we use teams a lot (like 30+), which means they don't all fit on the screen. When there is activity on a channel in a team that is not visible on the screen, I can miss it unless i'm being highlighted.

Would it be possible to add a configurable option to put all team with activity all together on the left, before all other teams? Kind of like how it works for Direct Messages, where the nicks get up in the list in pink.

Thanks! Thomas

jtdaugherty commented 1 year ago

Hi @thlc - I have written up a patch to support this with a new configuration file setting on the feature/team-unread-first-setting branch. It'll go out in the next release, but if you are able to try it out in the mean time, let me know if you run into any issues.

thlc commented 1 year ago

Hi @jtdaugherty , thanks a lot for implementing this feature! I have compiled the code from the feature/team-unread-first-setting branch. It's the first time I'm compiling this project and I'm unfamiliar with Haskell, but following the building instruction worked fine.

I imported my config.ini, and right after connecting, it crashed with the following error message:

matterhorn: src/Matterhorn/Config.hs:(383,5)-(429,12): Missing field in record construction configTeamListSorting

This is due to the fact that teamListSorting was missing from my config.ini. I added: teamListSorting = unread-first and the client started correctly. Maybe some kind of default behavior if the option isn't specified would be nice for upgrading users.

However, the teams sorting is the same, just like it would be in default mode (i.e. I can't seem to make it work ;-)). Could it be due to the fact that the mattermost-api submodule is still in 50200.13.0? Would I need to checkout a specific branch in it?

What I am running:

matterhorn 50200.17.0 (feature/team-unread-first-setting@6a6c39e)
mattermost-api 50200.13.0 (HEAD@bc52297)       

Thanks, Thomas

jtdaugherty commented 1 year ago

Hey @thlc - I fixed that bug on develop after I did the merge, sorry I didn't mention that. Give it a try on develop now.

thlc commented 1 year ago

On develop it's OK if I start matterhorn without teamListSorting in the config.ini file now, thanks!

But still, I can't get the feature to work at all:

% grep teamListSorting config.ini                        
teamListSorting = unread-first
% ./run.sh --version
matterhorn 50200.17.0 (develop@51d013f)
 using mattermost-api 50200.13.0 (HEAD@bc52297)

Am I missing something?

jtdaugherty commented 1 year ago

When you say you "can't get the feature to work at all", what are you observing? Could you post a (partial) screenshot?

thlc commented 1 year ago

I meant it doesn't change anything regarding how teams are sorted in the top row. I've made a screenshot, sorry I had to hide some customers name.

As you can see, teams with unread notifications (highlighted in blue) aren't moved to the left.

Screenshot_2023-04-15_08-42-27

jtdaugherty commented 1 year ago

Okay, thanks for the screenshot. Since you are using a custom build, would you be willing to make a small change to help me debug? In src/Matterhorn/Config.hs, on or around line 433, change the value of configTeamListSorting from TeamListSortDefault to TeamListSortUnreadFirst. Then run build.sh and let me know if the behavior has changed.

thlc commented 1 year ago

I did so, but no change in behavior, still running like it's in "default" mode.

P.S. : i tried with both the unread-first and nothing in config.ini, with no change.

jtdaugherty commented 1 year ago

Thank you. I pushed what I believe is a fix for the problem in e6221a57550ecc1a340e1fa4e06bd71dfa26aa20. Would you be willing to pull develop and try this again?

thlc commented 1 year ago

Unfortunately, even on e6221a5 it doesn't work any better. If there is anything I can do to help you debugging this, let me know. Thanks again for the time invested in that feature, I really appreciate it.

jtdaugherty commented 1 year ago

Thanks, @thlc. When you are running Matterhorn, what build information does the help screen (F1) report at the top of the screen? For example, I have

matterhorn 50200.17.0 (develop@e6221a5)
mattermost-api 50200.13.0 (develop@273adac)
thlc commented 1 year ago

It shows:

matterhorn 50200.17.0 (develop@e6221a5) 
mattermost-api 50200.13.0 (HEAD@bc52297)

I've rebuilt it, checking out develop under submodules/mattermost-api, it now shows:

matterhorn 50200.17.0 (develop@e6221a5)
mattermost-api 50200.13.0 (develop@273adac)

but it doesn't change much unfortunately.

jtdaugherty commented 1 year ago

Thanks! I'm glad nothing changed, because the mattermost-api difference should not be affecting this issue. Thanks for confirming the version you're running. I'll investigate further.

jtdaugherty commented 1 year ago

(Also, to be clear, the mattermost-api and matterhorn version numbers need only match on the first component. The rest are not kept in sync and cannot be synchronized in any case.)

jtdaugherty commented 1 year ago

@thlc I pushed an additional fix. I'd love to know if it works for you now.

Something I should note about this feature: because the team list ordering is now dynamic (i.e. more dynamic than it already was based on the /move-team-{left,right} commands), that means that once you visit all of the channels in a team with unread messages, the team you're in may shift to another location in the team list, i.e., it moves back to its default position based on the usual criteria (is it explicitly ordered? If not, sort alphabetically). This may or may not be disorienting, so I wanted to mention it. (This is also what happens with DM channels when they are unread and then get restored to their original DM list position once read.)

thlc commented 1 year ago

@jtdaugherty it works with your latest changes! Thanks a lot! I'll be using it as of now, and I'll send you my feedback ;-)

jtdaugherty commented 1 year ago

Okay, great! In that case I will now consider this resolved. It'll go out in the next release.