Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Unread / mention badge broke with Mattermost 2.0 #86

Open
teetrinkers opened this issue Feb 18, 2016 · 13 comments
Open

Unread / mention badge broke with Mattermost 2.0 #86

teetrinkers opened this issue Feb 18, 2016 · 13 comments

Comments

@teetrinkers
Copy link
Contributor

With Mattermost 2.0, the unread / mention badge on the dock icon and in the menu bar does not appear. The problem is in mattermost-observer.js:

var list = document.querySelector('.sidebar--left');

In Mattermost 2.0, the sidebar still has the 'sidebar--left' class, but list is null, so it seems that at DOMContentLoaded the DOM isn't in the state we expect. A simple fix is to listen for changes to 'body' instead of '.sidebar--left'. Do you know a better solution? Is there some React event emitted by Mattermost that we could use instead of DOMContentLoaded?

@ninja-
Copy link
Collaborator

ninja- commented Feb 18, 2016

As I mentioned earlier - since this is a hack anyway please read from ChannelStore

@LongLiveCHIEF
Copy link
Contributor

yeah, @ninja- has been trying to get us realize the obvious all along... we're going to have breaking changes every time there's an update or patch. Furthermore, since we can't control which version of mattermost our users are going to be connecting to, there's no way to guarantee functionality for anything in our client.

We've been digging into mattermost's api, but there's really nothing there to work with at the moment. For the time being, I can't see the value in putting any more time into matterfront, until there's a proper api supporting the things matterfront adds value to.

We should probably even consider adding a cautionary message to the README that this is a very unstable product, and we can't support it.

@enahum
Copy link

enahum commented Feb 18, 2016

What will u need to have in the apis to manage this issue in the long term?

On Thursday, 18 February 2016, Brian Vanderbusch notifications@github.com
wrote:

yeah, @ninja- https://github.com/ninja- has been trying to get us
realize the obvious all along... we're going to have breaking changes every
time there's an update or patch. Furthermore, since we can't control which
version of mattermost our users are going to be connecting to, there's no
way to guarantee functionality for anything in our client.

We've been digging into mattermost's api, but there's really nothing there
to work with at the moment. For the time being, I can't see the value in
putting any more time into matterfront, until there's a proper api
supporting the things matterfront adds value to.

We should probably even consider adding a cautionary message to the README
that this is a very unstable product, and we can't support it.


Reply to this email directly or view it on GitHub
#86 (comment)
.

@LongLiveCHIEF
Copy link
Contributor

@enahum, great question, and thanks for following and soliciting requirements. The answer will depend on evolving needs of the native client, but I can take a stab at getting a MVP list together by this afternoon.

@geekytime fyi...

@enahum
Copy link

enahum commented Feb 18, 2016

Great. Let me know when u have it, then lets see what we can do

On Thursday, 18 February 2016, Brian Vanderbusch notifications@github.com
wrote:

@enahum https://github.com/enahum, great question, and thanks for
following and soliciting requirements. The answer will depend on evolving
needs of the native client, but I can take a stab at getting a MVP list
together by this afternoon.

@geekytime https://github.com/geekytime fyi...


Reply to this email directly or view it on GitHub
#86 (comment)
.

@ninja-
Copy link
Collaborator

ninja- commented Feb 18, 2016

@LongLiveCHIEF from my experience you should be pretty stable with ChannelStore for now. As you remember I started coding slack-style integration api(the client sending setUnreadCounts etc. to the desktop wrapper) which would be inside mattermost. It works good but I don't have a way of upstreaming it to mattermost, unless you want to support me on this ?

@enahum, great question, and thanks for following and soliciting requirements. The answer will depend on evolving needs of the native client, but I can take a stab at getting a MVP list together by this afternoon.

I am pretty sure I'd cover all your needs here.

@LongLiveCHIEF
Copy link
Contributor

@ninja- you ok if I make you a collaborator on this project?

@ninja-
Copy link
Collaborator

ninja- commented Feb 22, 2016

@LongLiveCHEF that's ok with me. I'd help mostly with organization of work and roadmaps at this point.

@LongLiveCHIEF
Copy link
Contributor

That's fine. We're going through turmoil on this one ourselves at the moment. Other alternatives that are easier to work with have come online, and it's difficult to justify sinking too much time into this.

@enahum
Copy link

enahum commented Feb 23, 2016

By wrapping this https://github.com/HackerHappyHour/matterfront/blob/534426c8bdcba2ab04f09de0e9c81f91c5226ea0/src/browser/mattermost-observer.js#L6 in a setTimeout it gets fixed.

document.addEventListener("DOMContentLoaded", function() {
  // observe the DOM for mutations, specifically the .ps-container
  // which contains all the sidebar channels
  setTimeout(function() {
    var MutationObserver = window.MutationObserver;
    var list = document.querySelector('.sidebar--left');

    var observer = new MutationObserver(function(mutations) {
      if (mutations.length) {
        notifyHost();
      }
    });

    if (list) {
      observer.observe(list, {
        subtree: true,
        attributes: true,
        childList: true
      });
    }

    reportThemeData();
    ipc.on("refreshThemeData", reportThemeData);
  }, 0);
});

@LongLiveCHIEF
Copy link
Contributor

hacking a very hacky hack is a little too much. When you start using setTimeouts with an observer, you know you're doing something wrong.

At the moment, we've suspended development of this product, and I don't plan to accept merge requests because there is just too high of a possibility of this being used as a mitm.

I'm event contemplating offering the community the chance to adopt/migrate this elsewhere before making it unavailable here. IDK where this will go in the coming week or two, so just asking everyone to sit tight for the moment.

Thanks!

@teetrinkers
Copy link
Contributor Author

Just out of curiosity, which alternatives are you investigating?

@LongLiveCHIEF
Copy link
Contributor

Not the right place for that type of discussion. Sorry :-(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants