diff --git a/common/relations.go b/common/relations.go new file mode 100644 index 00000000..4f278d4e --- /dev/null +++ b/common/relations.go @@ -0,0 +1,28 @@ +package common + +import qgen "github.com/Azareal/Gosora/query_gen" + +type BlockStore interface { + IsBlockedBy(blocker int, blockee int) (bool, error) +} + +type DefaultBlockStore struct { +} + +func NewDefaultBlockStore(acc *qgen.Accumulator) (*DefaultBlockStore, error) { + return &DefaultBlockStore{}, acc.FirstError() +} + +func (s *DefaultBlockStore) IsBlockedBy(blocker int, blockee int) (bool, error) { + return false, nil +} + +type FriendStore interface { +} + +type DefaultFriendStore struct { +} + +func NewDefaultFriendStore(acc *qgen.Accumulator) (*DefaultFriendStore, error) { + return &DefaultFriendStore{}, acc.FirstError() +} diff --git a/router_gen/routes.go b/router_gen/routes.go index 5b2a79d0..31f9c5ac 100644 --- a/router_gen/routes.go +++ b/router_gen/routes.go @@ -88,9 +88,12 @@ func userRoutes() *RouteGroup { MView("routes.Convo", "/user/convo/", "extraData"), Action("routes.ConvosCreateSubmit", "/user/convos/create/submit/"), //Action("routes.ConvosDeleteSubmit", "/user/convos/delete/submit/", "extraData"), - Action("routes.ConvosCreateReplySubmit", "/user/convo/create/submit/","extraData"), - Action("routes.ConvosDeleteReplySubmit", "/user/convo/delete/submit/","extraData"), + Action("routes.ConvosCreateReplySubmit", "/user/convo/create/submit/", "extraData"), + Action("routes.ConvosDeleteReplySubmit", "/user/convo/delete/submit/", "extraData"), Action("routes.ConvosEditReplySubmit", "/user/convo/edit/submit/", "extraData"), + + //MView("routes.RelationsBlockCreate","/user/block/create/","extraData") + //Action("routes.RelationsBlockCreateSubmit","/user/block/create/submit/","extraData") ) } @@ -249,8 +252,8 @@ func panelRoutes() *RouteGroup { View("panel.Groups", "/panel/groups/"), View("panel.GroupsEdit", "/panel/groups/edit/", "extraData"), View("panel.GroupsEditPromotions", "/panel/groups/edit/promotions/", "extraData"), - Action("panel.GroupsPromotionsCreateSubmit", "/panel/groups/promotions/create/submit/","extraData"), - Action("panel.GroupsPromotionsDeleteSubmit", "/panel/groups/promotions/delete/submit/","extraData"), + Action("panel.GroupsPromotionsCreateSubmit", "/panel/groups/promotions/create/submit/", "extraData"), + Action("panel.GroupsPromotionsDeleteSubmit", "/panel/groups/promotions/delete/submit/", "extraData"), View("panel.GroupsEditPerms", "/panel/groups/edit/perms/", "extraData"), Action("panel.GroupsEditSubmit", "/panel/groups/edit/submit/", "extraData"), Action("panel.GroupsEditPermsSubmit", "/panel/groups/edit/perms/submit/", "extraData"), diff --git a/routes/convos.go b/routes/convos.go index d0a9ce4e..207edc30 100644 --- a/routes/convos.go +++ b/routes/convos.go @@ -156,12 +156,9 @@ func ConvosCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.R if err != nil { return c.LocalError(p.GetErrorPhrase("id_must_be_integer"), w, r, user) } - - err = c.Convos.Delete(cid) - if err != nil { + if err := c.Convos.Delete(cid); err != nil { return c.InternalError(err, w, r) } - http.Redirect(w, r, "/user/convos/", http.StatusSeeOther) return nil }*/ @@ -269,7 +266,7 @@ func ConvosEditReplySubmit(w http.ResponseWriter, r *http.Request, user c.User, if !user.Perms.UseConvos { return c.NoPermissions(w, r, user) } - js := (r.PostFormValue("js") == "1") + js := r.PostFormValue("js") == "1" post := &c.ConversationPost{ID: cpid} err = post.Fetch() @@ -309,3 +306,23 @@ func ConvosEditReplySubmit(w http.ResponseWriter, r *http.Request, user c.User, } return nil } + +func RelationsBlockCreate(w http.ResponseWriter, r *http.Request, user c.User, h *c.Header, spid string) c.RouteError { + accountEditHead("create_block", w, r, &user, h) + pid, err := strconv.Atoi(spid) + if err != nil { + return c.LocalError(p.GetErrorPhrase("id_must_be_integer"), w, r, user) + } + puser, err := c.Users.Get(pid) + if err == sql.ErrNoRows { + return c.LocalError("The user you're trying to block doesn't exist.", w, r, user) + } else if err != nil { + return c.InternalError(err, w, r) + } + pi := c.Account{h, "dashboard", "create_block", puser} + return renderTemplate("account", w, r, h, pi) +} + +func RelationsBlockCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User, h *c.Header, spid string) c.RouteError { + return nil +} \ No newline at end of file