Skip to content

add the MutualBlock flag #155

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

Merged
merged 4 commits into from
Sep 16, 2016
Merged

add the MutualBlock flag #155

merged 4 commits into from
Sep 16, 2016

Conversation

dimaspirit
Copy link
Contributor

Made/Proposed changes:
(Don’t use general words, describe changes in details)

  • You can choose a type of blocked logic (Privacy List).
    There is 2 type:
  • Block in one way. When you blocked, but you can write to blocked user.
  • Block in 2 way. When you blocked and anyone can write to another user.

Does the documentation need an update?

  1. https://quickblox.com/developers/Web_XMPP_Chat_Sample#Create_a_privacy_list_or_edit_existing_list
    Add the flag.
// In all cases, blocked user can't write to you.
var users = [
  {user_id: 34, action: "deny", mutualBlock: true}, // it's means you can't write to user (34)
  {user_id: 18, action: "allow"} // it's means you can write to user (18)
];

@soulfly
Copy link
Contributor

soulfly commented Sep 13, 2016

I propose to optimise this code, remove duplicates.
We can use nested functions for this.

for example:

function createPrivacyItem(order){
    iq.c('item', {
      type: 'jid',
      value: userJid,
      action: userAction,
      order: order
    }).c('message', {
    }).up().c('presence-in', {
    }).up().c('presence-out', {
    }).up().c('iq', {
    }).up().up();
}

createPrivacyItem(i+1);
createPrivacyItem(i+2);

and also

function createPrivacyItemMutual(order){
  iq.c('item', {
      type: 'jid',
      value: userJid,
      action: userAction,
      order: order
    }).up();
}

createPrivacyItemMutual(i+1);
createPrivacyItemMutual(i+2);

userJid = self.helpers.jidOrUserId(parseInt(userId, 10));
userMuc = self.helpers.getUserNickWithMucDomain(userId);
mutualBlock = listObj[userId].mutualBlock;

function createPrivacyItem(order){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To carry out the function declaration of the loop.
It looks weird

optymize createPrivacyItem() and createPrivacyItemMutal() privat methods.
@IegorKozakov IegorKozakov merged commit 8aa5d3d into gh-pages Sep 16, 2016
@dimaspirit dimaspirit deleted the privacyListFix branch September 21, 2016 09:49
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.

4 participants