Return a function to update a friendship between two parties

@api private
489953
function (m1, m2, fship) {
    var query = {_id: m1};
    query[pathName] = {$elemMatch: {_id: m2}};

    var updater = {$set: {}};
    updater.$set[pathName+".$.status"] = fship.status;

    return _update(query, updater, fship);
  }
593585
function update(values, returning) {
    var ret,
        obj = this._single.update || {};
    this._method = 'update';
    if (typeof values === 'string') {
      obj[values] = returning;
      if (arguments.length > 2) {
        ret = arguments[2];
      }
    } else {
      var i = -1,
          keys = Object.keys(values);
      if (this._single.update) {
        debug('Update called multiple times with objects.');
      }
      while (++i < keys.length) {
        obj[keys[i]] = values[keys[i]];
      }
      ret = arguments[1];
    }
    if (!isEmpty(ret)) {
      this.returning(ret);
    }
    this._single.update = obj;
    return this;
  }
397956
def _update_method(self, oldmeth, newmeth):
        """"""
        # XXX What if im_func is not a function?
        if hasattr(oldmeth, 'im_func') and hasattr(newmeth, 'im_func'):
            self._update(None, None, oldmeth.im_func, newmeth.im_func)
        elif hasattr(oldmeth, '__func__') and hasattr(newmeth, '__func__'):
            self._update(None, None, oldmeth.__func__, newmeth.__func__)
        return oldmeth
67939
function FoundFriend (params) {
  var self = this
  if (!(self instanceof FoundFriend)) return new FoundFriend(params)

  self.displayName = params['display']
  self.username = params['name']
  self.isPrivate = !!params['type']
}
1151707
def do_update(pool,request,models):
  ""
  return {k:fkapply(models,pool,process_update,missing_update,k,v) for k,v in request.items()}
75903
function (book, name, selectedGroups, callbackFunction) {
        book = findBookFromGroups(book)
        var nameEmailIndex = kb.any(book, ns.vcard('nameEmailIndex'))

        var uuid = UI.utils.genUuid()
        var person = kb.sym(book.dir().uri + 'Person/' + uuid + '/index.ttl#this')
        var doc = person.doc()

        // Sets of statements to different files
        var agenda = [ // Patch the main index to add the person
          [ $rdf.st(person, ns.vcard('inAddressBook'), book, nameEmailIndex), // The people index
            $rdf.st(person, ns.vcard('fn'), name, nameEmailIndex) ]
        ]

        // @@ May be missing email - sync that differently

        // sts.push(new $rdf.Statement(person, DCT('created'), new Date(), doc));  ??? include this?
        for (var gu in selectedGroups) {
          var g = kb.sym(gu)
          var gd = g.doc()
          agenda.push([ $rdf.st(g, ns.vcard('hasMember'), person, gd),
            $rdf.st(person, ns.vcard('fn'), name, gd)
          ])
        }

        var updateCallback = function (uri, success, body) {
          if (!success) {
            console.log("Error: can't update " + uri + ' for new contact:' + body + '\n')
            callbackFunction(false, "Error: can't update " + uri + ' for new contact:' + body)
          } else {
            if (agenda.length > 0) {
              console.log('Patching ' + agenda[0] + '\n')
              updater.update([], agenda.shift(), updateCallback)
            } else { // done!
              console.log('Done patching. Now reading back in.\n')
              UI.store.fetcher.nowOrWhenFetched(doc, undefined, function (ok, body) {
                if (ok) {
                  console.log('Read back in OK.\n')
                  callbackFunction(true, person)
                } else {
                  console.log('Read back in FAILED: ' + body + '\n')
                  callbackFunction(false, body)
                }
              })
            }
          }
        }

        UI.store.fetcher.nowOrWhenFetched(nameEmailIndex, undefined, function (ok, message) {
          if (ok) {
            console.log(' People index must be loaded\n')
            updater.put(doc, [
              $rdf.st(person, ns.vcard('fn'), name, doc),
              $rdf.st(person, ns.rdf('type'), ns.vcard('Individual'), doc) ],
              'text/turtle', updateCallback)
          } else {
            console.log('Error loading people index!' + nameEmailIndex.uri + ': ' + message)
            callbackFunction(false, 'Error loading people index!' + nameEmailIndex.uri + ': ' + message + '\n')
          }
        })
      }
1143402
function Update(subject, source) {
    if (!(this instanceof Update)) {
        return new Update(subject, source);
    }
    this.id = uuid.v4();
    this.timestamp = Date.now();

    // Populate subject
    subject = subject || {};
    this.address = subject.address;
    this.incarnationNumber = subject.incarnationNumber;
    this.status = subject.status;

    // Populate source
    source = source || {};
    this.source = source.address;
    this.sourceIncarnationNumber = source.incarnationNumber;
}
525333
function update(user, callback) {
      var cb = callback || angular.noop;

      return User.update(user,
        function (user) {
          return cb(user);
        },
        function (err) {
          return cb(err);
        }).$promise;
    }
474342
def remove_friendship(user)
      friend_ids.delete(user.id)
      user.inverse_friend_ids.delete(self.id)
      inverse_friend_ids.delete(user.id)
      user.friend_ids.delete(self.id)
      pending_friend_ids.delete(user.id)
      user.pending_inverse_friend_ids.delete(self.id)
      pending_inverse_friend_ids.delete(user.id)
      user.pending_friend_ids.delete(self.id)
      self.save && user.save
    end
450269
def update(self, friendly_name):
        
        data = values.of({'FriendlyName': friendly_name, })

        payload = self._version.update(
            'POST',
            self._uri,
            data=data,
        )

        return FunctionInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            sid=self._solution['sid'],
        )
1090121
function update(item, model, data, funcParams) {
    var working = [];
    var definedByData = [];

    _.forEach(data, function(value, key) {
        if (_.isFunction(value)) {
            working.push(Promise.resolve(value()).then(function(val) {
                item[key] = val;
            }));
        } else item[key] = value;
        definedByData.push(value);
    });

    _.forEach(model.itemDef, function(value, key) {
        if (value && value.__precalc) {
            var func = value.__precalc, previousVal = data[key];
            working.push(Promise.resolve(func.call(item, previousVal, funcParams || {})).then(function(val) {
                item[key] = (val && val._stWrapped) ? val.val : val;
            }));
        } // if the property has not been set from the itemDef yet. This allows item def properties to be changed
        else if (!_.has(item, key) || definedByData.indexOf(key) !== -1) item[key] = value;
    });

    return Promise.all(working);
}
1221410
function createConversationUpdate(args, membersAdded, membersRemoved) {
    let conversationUpdateActivity = createActivity({
        type: activitytypes.conversationupdate,
        recipient: args[args.botId],
        conversationId: args.conversation.id
    });
    conversationUpdateActivity.membersAdded = membersAdded || [];
    conversationUpdateActivity.membersRemoved = membersRemoved || [];
    conversationUpdateActivity.timestamp = getIncrementedDate(100);
    return conversationUpdateActivity;
}
718237
def addFriend(user)
      method = 'addFriend'
      type = true
      args = {:user=>user}
      return_object type,method,args,true
    end
821570
function(m1, m2, fship) {
    return this.findOneAndUpdate({
      _id: m1,
      [pathName]: { $elemMatch: { _id: m2 } },
    }, {
      $set: {
        [`${pathName}.$.status`]: fship.status,
      },
    }, { new: false })
      .then(() => fship);
  }
513797
async function one2many (source, model, args = [], t) {
  let sourceId = `${this.name}Id`
  let previous = await this.models[model].findAll({
    where: {[sourceId]: source.id},
    transaction: t
  })
  let deletedIds = []
  let currentIds = args.map(i => i.id)

  previous.forEach(i => {
    if (!currentIds.includes(i.id)) {
      deletedIds.push(i.id)
    }
  })
  if (deletedIds.length !== 0) {
    await this.models[model].update({[sourceId]: null}, {
      where: {id: {[Op.in]: deletedIds}},
      transaction: t
    })
  }

  for (let arg of args) {
    if (!arg.hasOwnProperty(sourceId)) {
      arg[sourceId] = source.id
    }
  }

  await util.insertOrUpdate(this.models[model], args, t)
}
715862
function updateBoolean(name) {
  name = ' ' + name;
  function update(value) {
    switch (value) {
      case true:
      case 'true':
        return name;
    }
    return '';
  }
  update[UID] = true;
  return update;
}
956684
def can_unblock?(friendable)
      blocked? && self.blocker_id == friendable.id && friendable.class.to_s == Amistad.friend_model
    end