kandanapp / kandan

Kandan is an Open Source Alternative to HipChat
GNU Affero General Public License v3.0
2.72k stars 408 forks source link

Added options to modifier callbacks, fixed music player playback on scroll #385

Closed JangoSteve closed 9 years ago

JangoSteve commented 9 years ago

There was a bug in the music player, which would cause audio files to play when loading previous messages as the user scrolled up. Managed to trace this to the music player modifer, which gets called on activity rendering, both when the message is created, and when the message is loaded from previous activities.

I fixed this by passing the options from Views.ChannelPane through to the Views.ShowActivity, which in turn passes options to the Modifiers.process() function, which in turn passes the options to the modifier callbacks as a third argument.

Then the music player modifier checks for the new silence_music option, which is passed when called from the loadMoreActivities() function.

Also, the music player modifier previously checked for if true and Kandan.Data.Channels.activeChannelId()? before playing the audio file. After looking through the entire git blame history of that line, apparently the if true part has been there since a rewrite of the plugin a ways back. It doesn't look like it's ever been functional, so I'm guessing it was just left over from debugging and they forgot to remove it before committing, and just no one has ever removed it. I.e. it was never functional in any way, so I removed that now too.

scouttyg commented 9 years ago

Looks good, thanks for the in depth analysis.