summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-07-04 15:40:54 +0200
committerAzul <azul@leap.se>2014-07-05 10:21:07 +0200
commit87e9ccbcdf4f99dd898b0715750092a27fff7e94 (patch)
tree9e49a287c6e95d92323253d899afa367a6f1e14e /app/models
parent24d108e15c38ca572d5339a39cb110d9067c0b3d (diff)
Enable unblocking handles in identities tab
There's an identities tab now for admins that will allow unblocking blocked handles. It should be easy to expand for aliases and forwards and other types of actions such as editing.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/identity.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/models/identity.rb b/app/models/identity.rb
index e7b5785..e09d7f2 100644
--- a/app/models/identity.rb
+++ b/app/models/identity.rb
@@ -95,6 +95,18 @@ class Identity < CouchRest::Model::Base
}
end
+ def status
+ return :blocked if disabled?
+ case destination
+ when address
+ :main_email
+ when /@#{APP_CONFIG[:domain]}\Z/i,
+ :alias
+ else
+ :forward
+ end
+ end
+
def enabled?
self.user_id
end
@@ -103,6 +115,14 @@ class Identity < CouchRest::Model::Base
!enabled?
end
+ def actions
+ if enabled?
+ [] # [:show, :edit]
+ else
+ [:destroy]
+ end
+ end
+
def disable
self.destination = nil
self.user_id = nil