diff --git a/gno/p/basedao/render.gno b/gno/p/basedao/render.gno index 9aa832c0c6..27bf3162c9 100644 --- a/gno/p/basedao/render.gno +++ b/gno/p/basedao/render.gno @@ -16,7 +16,7 @@ const ( PROPOSAL_HISTORY_PATH = "history" MEMBER_DETAIL_PATH = "member/{address}" PROPOSAL_DETAIL_PATH = "proposal/{id}" - FALLBACK_DISPLAY_NAME = "Anon" + FALLBACK_DISPLAY_NAME = "Anon" ) func (d *DAO) initRenderingRouter() { diff --git a/gno/r/govdao/govdao.gno b/gno/r/govdao/govdao.gno index 76860750da..1ec4ce4547 100644 --- a/gno/r/govdao/govdao.gno +++ b/gno/r/govdao/govdao.gno @@ -7,6 +7,7 @@ import ( "gno.land/p/teritori/role_manager" "gno.land/r/demo/profile" "gno.land/r/teritori/ghverify" + "gno.land/r/teritori/social_feeds" ) const ( @@ -32,9 +33,6 @@ func init() { {Address: "g126gx6p6d3da4ymef35ury6874j6kys044r7zlg", Roles: []string{Tier1}}, {Address: "g1ld6uaykyugld4rnm63rcy7vju4zx23lufml3jv", Roles: []string{Tier2}}, {Address: "g1r69l0vhp7tqle3a0rk8m8fulr8sjvj4h7n0tth", Roles: []string{Tier2}}, - {Address: "g1ns5vfj5app8sqqgc5jzst79rmahws8p9asfryd", Roles: []string{Tier3}}, - {Address: "g1jkfwvm7pxr65r75tnyzt0s8k6cfjjdh7533q35", Roles: []string{Tier3}}, - {Address: "g16jv3rpz7mkt0gqulxas56se2js7v5vmc6n6e0r", Roles: []string{Tier3}}, } dao = basedao.New(&basedao.Config{ Name: "GovDAO", @@ -48,6 +46,7 @@ func init() { Members: basedao.NewMembersStore(initialRoles, initialMembers), SetProfileString: profile.SetStringField, GetProfileString: profile.GetStringField, + NoEvents: true, }) // XXX: t1Supermajority won't work because daocond.RoleThreshold uses events @@ -68,6 +67,10 @@ func init() { Handler: basedao.NewEditProfileHandler(profile.SetStringField, nil), Condition: supermajority, }, + { + Handler: social_feeds.NewCreatePostDaokitHandler(), + Condition: supermajority, + }, } for _, r := range resources { dao.Core.SetResource(r) diff --git a/gno/r/social_feeds/messages_daokit.gno b/gno/r/social_feeds/messages_daokit.gno new file mode 100644 index 0000000000..fd7dcb00d9 --- /dev/null +++ b/gno/r/social_feeds/messages_daokit.gno @@ -0,0 +1,37 @@ +package social_feeds + +import ( + "gno.land/p/demo/ufmt" + "gno.land/p/teritori/daokit" +) + +const MsgCreatePostDaokitKind = "gno.land/r/teritori/social_feeds.CreatePost" + +type MsgCreatePostDaokit struct { + FeedID FeedID + ParentID PostID + Category uint64 + Metadata string +} + +func (m *MsgCreatePostDaokit) String() string { + buf := "" + buf += ufmt.Sprintf("Create post in feed %s", m.FeedID.String()) + if m.ParentID != 0 { + buf += ufmt.Sprintf(" as a reply to post %s", m.ParentID.String()) + } + buf += ufmt.Sprintf(" with category %d", m.Category) + buf += ufmt.Sprintf(" and metadata %s", m.Metadata) + return buf +} + +func NewCreatePostDaokitHandler() daokit.MessageHandler { + return daokit.NewMessageHandler(MsgCreatePostDaokitKind, func(msg interface{}) { + message := msg.(*MsgCreatePostDaokit) + CreatePost(message.FeedID, message.ParentID, message.Category, message.Metadata) + }) +} + +func NewCreatePostDaokitMsg(payload *MsgCreatePostDaokit) daokit.ExecutableMessage { + return daokit.NewMessage(MsgCreatePostDaokitKind, payload) +}