diff options
author | Azul <azul@leap.se> | 2013-04-24 12:11:56 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-04-24 12:11:56 +0200 |
commit | f9fad55a61e867533083f489ec36817fd76ebad8 (patch) | |
tree | 1b339cff7a03c9e3b9a749cfd98d8519dbf970ab /users/app/models/user.rb | |
parent | fb66f8e30d302b7230d22112aebe2fcb4912c3f0 (diff) |
renamed and fixed pgp_key view
Diffstat (limited to 'users/app/models/user.rb')
-rw-r--r-- | users/app/models/user.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/users/app/models/user.rb b/users/app/models/user.rb index 62c5054..5c849f0 100644 --- a/users/app/models/user.rb +++ b/users/app/models/user.rb @@ -51,7 +51,20 @@ class User < CouchRest::Model::Base load_views(own_path.join('..', 'designs', 'user')) view :by_login view :by_created_at - end + view :pgp_key_by_handle, + map: <<-EOJS + function(doc) { + if (doc.type != 'User') { + return; + } + emit(doc.login, doc.public_key); + doc.email_aliases.forEach(function(alias){ + emit(alias.username, doc.public_key); + }); + } + EOJS + + end # end of design class << self alias_method :find_by_param, :find |