mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Allow unsubscribing from shared blogs
Only personal blogs from non-contacts can be removed. This also adds integration tests that check if blogs can actually be removed. Closes #579
This commit is contained in:
@@ -4,6 +4,7 @@ import android.app.Activity;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import org.briarproject.android.controller.DbControllerImpl;
|
||||
import org.briarproject.android.controller.handler.ResultExceptionHandler;
|
||||
import org.briarproject.android.controller.handler.ResultHandler;
|
||||
import org.briarproject.api.blogs.Blog;
|
||||
import org.briarproject.api.blogs.BlogManager;
|
||||
@@ -175,6 +176,27 @@ public class BlogControllerImpl extends DbControllerImpl
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void canDeleteBlog(final GroupId g,
|
||||
final ResultExceptionHandler<Boolean, DbException> resultHandler) {
|
||||
runOnDbThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (groupId == null) {
|
||||
resultHandler.onResult(false);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
resultHandler.onResult(blogManager.canBeRemoved(groupId));
|
||||
} catch (DbException e) {
|
||||
if (LOG.isLoggable(WARNING))
|
||||
LOG.log(WARNING, e.toString(), e);
|
||||
resultHandler.onException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBlog(final ResultHandler<Boolean> resultHandler) {
|
||||
runOnDbThread(new Runnable() {
|
||||
|
||||
Reference in New Issue
Block a user