mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 05:50:22 +00:00
Fix event trigger bug
This commit is contained in:
parent
15a23d131e
commit
2c8040a6ca
3 changed files with 13 additions and 7 deletions
|
@ -17,6 +17,8 @@ $(function() {
|
|||
|
||||
function event(type, json) {
|
||||
console.log(json);
|
||||
console.log(type);
|
||||
|
||||
switch (type) {
|
||||
|
||||
case "network":
|
||||
|
|
|
@ -24,8 +24,7 @@ models.Users = Backbone.Collection.extend({
|
|||
}
|
||||
);
|
||||
|
||||
// Iterate all the modes and move users with these
|
||||
// modes to the top of the collection.
|
||||
// Move users with these modes to the top.
|
||||
var modes = ["+", "@"];
|
||||
for (var i in modes) {
|
||||
this.models = _.remove(this.models, function(user) {
|
||||
|
@ -108,8 +107,11 @@ models.Network = Backbone.Model.extend({
|
|||
channels: new models.Channels,
|
||||
});
|
||||
|
||||
this.get("channels").on("message user", function() { this.trigger(action, data); }, this);
|
||||
this.get("channels").on("all", function(action, data) {
|
||||
if (action == "message"
|
||||
|| action == "user") {
|
||||
return this.trigger(action, data);
|
||||
}
|
||||
this.trigger("channel", {
|
||||
target: this.get("id"),
|
||||
type: "channel",
|
||||
|
|
|
@ -87,7 +87,9 @@ function input(json) {
|
|||
channel.get("name")
|
||||
);
|
||||
case "msg":
|
||||
channel.addMessage({message: _.tail(args, 2)});
|
||||
channel.addMessage({
|
||||
message: _.tail(args, 2).join(" ")
|
||||
});
|
||||
break;
|
||||
|
||||
case "server":
|
||||
|
|
Loading…
Reference in a new issue