Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add room-leave event #370

Merged
merged 6 commits into from
Apr 16, 2017
Merged

add room-leave event #370

merged 6 commits into from
Apr 16, 2017

Conversation

lijiarui
Copy link
Member

@lijiarui lijiarui commented Mar 28, 2017

fix #250

@huan
Copy link
Member

huan commented Mar 29, 2017

Sorry, i cannot merge this because your PR didn't pass any of CI test.

@lijiarui
Copy link
Member Author

Yes, it cannot be merge now, because I should fix #364 first.

And I have fix room.member(), please help to merge it first, thanks

@huan
Copy link
Member

huan commented Mar 29, 2017

Sorry, I have no time to help you about this recently. You need to do it by yourself.

@huan huan changed the title fix #250 Bot should be noticed when it was removed from a room #250 Mar 31, 2017
@coveralls
Copy link

coveralls commented Apr 5, 2017

Coverage Status

Changes Unknown when pulling f0c8176 on lijiarui:room_leave into ** on Chatie:master**.

@lijiarui
Copy link
Member Author

lijiarui commented Apr 5, 2017

@zixia maybe it has done...

Copy link
Member

@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please think of member() method more.

let leaverContact: Contact | null, removerContact: Contact | null
if (leaver === this.userId) {
leaverContact = Contact.load(this.userId)
removerContact = room.member({alias: remover}) || room.member({name: remover})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the formal query filter name, instead of using an alias.

removerContact = room.member({roomAlias: remover}) || room.member({name: remover})

I will more prefer to write this piece of code in this way:

removerContact = room.member(remover)

Because Room.member() should do the job for translate the string name to a Contact inside a room.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using room.member() is not strict here, because roomAlias(alias) here is useless, bot just recognize contactAlias and name, if we use roomAlias, then when someone's roomAlias is the same as other's name in the room. it will get the contact we don't mean go get.

So, maybe the new change I commit is the better way. we should may the code easier for developer, but more strict here.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 77076c7 on lijiarui:room_leave into ** on Chatie:master**.

Copy link
Member

@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please think deeper about the purpose of member() method.

}
} else {
removerContact = Contact.load(this.userId)
leaverContact = room.member({contactAlias: remover}) || room.member({name: leaver})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to use member(name) here for better encapsulation.

Copy link
Member

@huan huan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I believe it will works.

@huan
Copy link
Member

huan commented Apr 10, 2017

Please get 2 more approving from other contributors as well, then I could be able to merge this.

Thanks!

@huan
Copy link
Member

huan commented Apr 10, 2017

@lijiarui This is the way of my favorite for using room.member(), which have already used many times in the code base:

https://github.com/Chatie/wechaty/blob/master/src/puppet-web/firer.ts#L319

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 3e29a82 on lijiarui:room_leave into ** on Chatie:master**.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 3e29a82 on lijiarui:room_leave into ** on Chatie:master**.

@huan
Copy link
Member

huan commented Apr 11, 2017

The shorter, the better.

@lijiarui lijiarui changed the title Bot should be noticed when it was removed from a room #250 add room-leave event Apr 13, 2017
Copy link
Contributor

@JasLin JasLin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it' good for me

@huan
Copy link
Member

huan commented Apr 16, 2017

Thanks all!

I can merge this PR now, Cheers!

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

Successfully merging this pull request may close these issues.

add room-bot-leave event
5 participants