summaryrefslogtreecommitdiff
path: root/src/admin.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/admin.clj')
-rw-r--r--src/admin.clj15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/admin.clj b/src/admin.clj
index 76e690a..e5d3e04 100644
--- a/src/admin.clj
+++ b/src/admin.clj
@@ -66,10 +66,6 @@ LIMIT 1
*mute-refresh-period-sec*
nil))
-(defn mute-status [session]
- (if-vip
- (println session)))
-
(defn parse-pos-interval [time unit]
(let [t (maybe-parse-int time 0)
u (lower-case unit)]
@@ -106,25 +102,28 @@ WHERE mute_id = ?
AND cancelled = false
")
-(defn cancel-mute! [mute-id admin-id]
+(defn cancel-mute! [mute-id admin-id reason]
(let [mute (fetch-mute mute-id)
active (nor (:expired mute) (:cancelled mute))
qry "mute_id = ? AND cancelled = false
AND (set_on + duration) > now()"]
(cond (not mute) (resp-error "INVALID_MUTE_ID")
(not active) (resp-error "EXPIRED_MUTE")
+ (not reason) (resp-error "NO_REASON")
:else (assert-update
(do-update :mutes [qry mute-id]
- {:cancelled true
- :cancel_admin_id admin-id})
+ {:cancelled true
+ :cancel_admin_id admin-id
+ :cancel_reason reason})
(resp-success "OK")
(resp-error "UPDATE_ERROR")))))
(defn handle-cancel-mute! [session params]
(if-vip
(let [mute-id (maybe-parse-int (params :mute_id) 0)
+ reason (params :reason)
admin-id (session :user_id)]
- (cancel-mute! mute-id admin-id))))
+ (cancel-mute! mute-id admin-id reason))))
(defn format-mute [mute]
(format (str "I'm sorry, you've been muted for %s. "