Instance (un)block endpoint

And hide the block button for the local instance
This commit is contained in:
Bat
2018-09-08 20:07:55 +01:00
parent c1e0b6c306
commit f1d5865a16
4 changed files with 24 additions and 9 deletions
+5 -2
View File
@@ -68,8 +68,11 @@ impl Instance {
get!(instances);
find_by!(instances, find_by_domain, public_domain as String);
pub fn block(&self) {
unimplemented!()
pub fn toggle_block(&self, conn: &PgConnection) {
diesel::update(self)
.set(instances::blocked.eq(!self.blocked))
.get_result::<Instance>(conn)
.expect("Couldn't block/unblock instance");
}
pub fn has_admin(&self, conn: &PgConnection) -> bool {