Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badge on the pinned messages header icon #16226

Open
mattermod opened this issue Nov 7, 2020 · 14 comments · May be fixed by #21996
Open

Badge on the pinned messages header icon #16226

mattermod opened this issue Nov 7, 2020 · 14 comments · May be fixed by #21996

Comments

@mattermod
Copy link
Contributor

Summary: Add a badge to the pinned post icon to inform users of new pinned posts they haven't read

Note this is blocked on this PR: mattermost/mattermost-webapp#7030

Proposed Solution

  • Depends on https://mattermost.atlassian.net/browse/MM-28017
  • Adds a dot badge next to the pinned icon
  • Uses the ‘Active’ theme color for the badge
  • If there's new pinned posts in the channel since the last time you opened the pinned post view (RHS), show the dot. Note that when a server upgrades to the version with this change, only show the dot for new pinned posts after the upgrade (not existing pinned posts before the server upgrade). This is to avoid the dot appearing in every channel once a server is upgraded.

![](Channel Header - Pinned - Badge.png|width=100%)

Figma design file

Figma clickable prototype


If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

New contributors please see our Developer's Guide.

JIRA: https://mattermost.atlassian.net/browse/MM-24067

@tclain
Copy link

tclain commented Nov 10, 2020

interested to contribute ! Any specific hint on how to start ? (components, data supporting this feature ?)

@amyblais
Copy link
Member

Please join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.

Please also see our Developer's Guide.

@esethna
Copy link
Contributor

esethna commented May 13, 2021

@tclain how's this one going?

@bitsapien
Copy link

I'd like to pick this up !

@bitsapien
Copy link

I've identified 2 events when this state (new pinned post) would be shown or needs updation:

  1. When the channel is "made visible" for the first time after loading the app.
  2. When the channel has already been opened once, and someone pins a post.

I'm currently trying to implement the event 2 here.
I noticed that the webapp receives an event called POST_EDITED when the above event occurs, I believe that can be used to set this new state on the app.
I'm currently trying to figure what this "RHS" thing is, I also notice it to be part of the issue ticket. Any help on that ?

@bitsapien
Copy link

I figured what the RHS thing is, the right hand panel that opens up on clicking the "pinned post" button. Please ignore the above question.

Any feedback on the direction I'm taking, would be useful though.

@hmhealey
Copy link
Member

hmhealey commented Aug 9, 2021

Yep, those both sound correct for when the badge would need to be updated. I'm a bit surprised that action causes a POST_EDITED event since I thought that was only for when the user edits the text of a post or the message attachment on a post, but that shouldn't cause any problems regardless.

@bitsapien
Copy link

bitsapien commented Aug 9, 2021

The solution for this:

Track unread pinned posts on the server

Add a property lastViewedPinnedPosts to the ChannelMember model.
Add a property lastPinnedPostAt to the Channel model.

Use these properties on the client to determine if there are unread pinned posts :
Channel.lastPinnedPostAt > ChannelMember.lastViewedPinnedPosts ? 'show badge' : 'hide badge'

On first load of the channel on the client

The lastPinnedPostAt would be loaded via the /api/v4/channels/:channel-id/stats API and is made available at the state path entities.channels[id].stats.lastPinnedPostAt

The lastViewedPinnedPosts should be loaded via an API (this is yet to be figured out) and will be available at the state path views.channel.lastViewedChannelPinnedPosts[id]
// TODO: How to make this happen ?

On POST_EDITED event that pins a new post to the channel.

  • Update the entities.channels[id].stats.lastPinnedPostAt
  • Sync ChannelMember.lastViewedPinnedPostAt to the server via an API ? (yet to be figured out which one.)

On channel member clicking on the pinned posts button to reveal the pinned posts

  • Update client state views.channel.lastViewedChannelPinnedPosts[id] to current time.
  • Sync this to the server via PUT [ChannelMemberSubRoute]/last_viewed_pinned_posts

@esethna
Copy link
Contributor

esethna commented Aug 10, 2021

@hmhealey if you have thoughts on this implementation? ^

@hmhealey
Copy link
Member

Yep, we've been chatting 1-on-1 about it as well

@esethna
Copy link
Contributor

esethna commented Oct 4, 2021

@bitsapien let us know if you'd like to take this for hacktoberfest? :)

@hmhealey hmhealey added Difficulty/3:Hard Hard ticket Tech/Go Server and removed Difficulty/2:Medium Medium ticket labels Oct 5, 2021
@sk409
Copy link

sk409 commented Nov 6, 2022

I would like to work on this issue.

@esethna
Copy link
Contributor

esethna commented Dec 21, 2022

@sk409 how's this ticket going? Can we help at all?

@sk409
Copy link

sk409 commented Dec 23, 2022

@esethna
I worked on other mattermost‘s PR to resolve conflicts.
I‘m still working on this issue and I will submit PR within 2 or 3 weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment