Fix Hamburger and iOS App Icon badge number when marking channel as unread (#3705)

* Fix Hamburger and App Icon badge number when marking channel as unread

* Temp mm-redux commit hash

* Update mm-redux commit hash
This commit is contained in:
Elias Nahum 2019-12-16 07:30:04 -03:00
parent 491c8e8a15
commit a34c7e3341
No known key found for this signature in database
GPG key ID: E038DB71E0B61702
3 changed files with 12 additions and 24 deletions

View file

@ -3,8 +3,7 @@
import {createSelector} from 'reselect';
import {getCurrentChannelId, getUnreadsInCurrentTeam} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentTeamId, getTeamMemberships} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentChannelId, getUnreads} from 'mattermost-redux/selectors/entities/channels';
const emptyDraft = {
draft: '',
@ -45,23 +44,12 @@ export function getProfileImageUri(state) {
}
export const getBadgeCount = createSelector(
getCurrentTeamId,
getTeamMemberships,
getUnreadsInCurrentTeam,
(currentTeamId, myTeamMembers, {mentionCount, messageCount}) => {
let mentions = mentionCount;
let messages = messageCount;
const members = Object.values(myTeamMembers).filter((m) => m.team_id !== currentTeamId);
members.forEach((m) => {
mentions += (m.mention_count || 0);
messages += (m.msg_count || 0);
});
getUnreads,
({mentionCount, messageCount}) => {
let badgeCount = 0;
if (mentions) {
badgeCount = mentions;
} else if (messages) {
if (mentionCount) {
badgeCount = mentionCount;
} else if (messageCount) {
badgeCount = -1;
}

10
package-lock.json generated
View file

@ -2338,9 +2338,9 @@
},
"dependencies": {
"core-js": {
"version": "2.6.10",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.10.tgz",
"integrity": "sha512-I39t74+4t+zau64EN1fE5v2W31Adtc/REhzWN+gWRRXg6WH5qAsZm62DHpQ1+Yhe4047T55jvzz7MUqF/dBBlA=="
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz",
"integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg=="
},
"regenerator-runtime": {
"version": "0.11.1",
@ -7821,8 +7821,8 @@
}
},
"mattermost-redux": {
"version": "github:mattermost/mattermost-redux#3fac9150fac5f8157817215173db827334a94c9b",
"from": "github:mattermost/mattermost-redux#3fac9150fac5f8157817215173db827334a94c9b",
"version": "github:mattermost/mattermost-redux#be71db9d788a749782c9c97e3d58d3a9231194a4",
"from": "github:mattermost/mattermost-redux#be71db9d788a749782c9c97e3d58d3a9231194a4",
"requires": {
"form-data": "2.5.1",
"gfycat-sdk": "1.4.18",

View file

@ -24,7 +24,7 @@
"intl": "1.2.5",
"jail-monkey": "2.3.0",
"jsc-android": "241213.1.0",
"mattermost-redux": "github:mattermost/mattermost-redux#3fac9150fac5f8157817215173db827334a94c9b",
"mattermost-redux": "github:mattermost/mattermost-redux#be71db9d788a749782c9c97e3d58d3a9231194a4",
"mime-db": "1.42.0",
"moment-timezone": "0.5.27",
"prop-types": "15.7.2",