lloeki / matterfront

Mattermost frontend app for OS X, Windows and Linux
MIT License
152 stars 27 forks source link

Unread / mention badge broke with Mattermost 2.0 #86

Open teetrinkers opened 8 years ago

teetrinkers commented 8 years ago

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- commented 8 years ago

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

LongLiveCHIEF commented 8 years ago

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 commented 8 years ago

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 https://github.com/HackerHappyHour/matterfront/issues/86#issuecomment-185825846 .

LongLiveCHIEF commented 8 years ago

@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 commented 8 years ago

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 https://github.com/HackerHappyHour/matterfront/issues/86#issuecomment-185830923 .

ninja- commented 8 years ago

@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 commented 8 years ago

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

ninja- commented 8 years ago

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

LongLiveCHIEF commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

Just out of curiosity, which alternatives are you investigating?

LongLiveCHIEF commented 8 years ago

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