Browse Source

runtime: proposals: Remove thread_id from the posts.

Shamil Gadelshin 4 years ago
parent
commit
a64d3f3460

+ 1 - 2
runtime-modules/proposals/discussion/src/lib.rs

@@ -155,7 +155,7 @@ decl_storage! {
         /// Map thread id and post id to corresponding post.
         pub PostThreadIdByPostId:
             double_map hasher(blake2_128_concat) T::ThreadId, hasher(blake2_128_concat) T::PostId =>
-                DiscussionPost<MemberId<T>, T::ThreadId>;
+                DiscussionPost<MemberId<T>>;
 
         /// Count of all posts that have been created.
         pub PostCount get(fn post_count): u64;
@@ -206,7 +206,6 @@ decl_module! {
             let new_post = DiscussionPost {
                 author_id: post_author_id,
                 edition_number : 0,
-                thread_id,
             };
 
             let post_id = T::PostId::from(new_post_id);

+ 0 - 1
runtime-modules/proposals/discussion/src/tests/mod.rs

@@ -51,7 +51,6 @@ fn assert_thread_content(thread_entry: TestThreadEntry, post_entries: Vec<TestPo
             <PostThreadIdByPostId<Test>>::get(thread_entry.thread_id, post_entry.post_id);
         let expected_post = DiscussionPost {
             author_id: 1,
-            thread_id: thread_entry.thread_id,
             edition_number: post_entry.edition_number,
         };
 

+ 1 - 4
runtime-modules/proposals/discussion/src/types.rs

@@ -22,13 +22,10 @@ pub struct DiscussionThread<ThreadAuthorId, BlockNumber, MemberId> {
 /// Post for the discussion thread
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
 #[derive(Encode, Decode, Default, Clone, PartialEq, Eq)]
-pub struct DiscussionPost<PostAuthorId, ThreadId> {
+pub struct DiscussionPost<PostAuthorId> {
     /// Author of the post.
     pub author_id: PostAuthorId,
 
-    /// Parent thread id for this post
-    pub thread_id: ThreadId,
-
     /// Defines how many times this post was edited. Zero on creation.
     pub edition_number: u32,
 }