From f24feb20024fd003421f8cb15661e542c4a5db03 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Sat, 20 Mar 2021 00:13:39 -0700 Subject: [PATCH] MessageUpdate should only update the content This commit changes MessageUpdate so that it only updates the message content. Updating the username should be up to MessageCreate's Author. --- cchat.go | 4 +++- repository/gob/repository.gob | Bin 38068 -> 38176 bytes repository/main.go | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cchat.go b/cchat.go index 10f794b..c042da3 100644 --- a/cchat.go +++ b/cchat.go @@ -523,7 +523,9 @@ type MessageHeader interface { // behaves similarly to MessageCreate, except all fields are optional. The // frontend is responsible for checking which field is not empty and check it. type MessageUpdate interface { - MessageCreate + MessageHeader + + Content() text.Rich } // MessagesContainer is a view implementation that displays a list of messages diff --git a/repository/gob/repository.gob b/repository/gob/repository.gob index 517000110bb5959b579ce7c00dea00f37d7a1332..035a1011380608b557824949d8f32068ebf7da0f 100644 GIT binary patch delta 34 qcmdn8l4-#zrVX2N7;`so&WYk@@kmWfnQT~TH~E~j$!77Ixe@^VdJVq- delta 28 kcmZ3mifPMArVX2N7#TNj&WYk@b1q6vEJ@v5U$amG0II?ZcmMzZ diff --git a/repository/main.go b/repository/main.go index 9353a5e..ba9fcdb 100644 --- a/repository/main.go +++ b/repository/main.go @@ -1602,12 +1602,20 @@ var Main = Packages{ }, { Comment: Comment{` MessageUpdate is the interface for a message update (or edit) - event. It behaves similarly to MessageCreate, except all fields - are optional. The frontend is responsible for checking which - field is not empty and check it. + event. It is only responsible for updating a message's content. + The author's name should be updated using MessageCreate's + Author. `}, Name: "MessageUpdate", - Embeds: []EmbeddedInterface{{InterfaceName: "MessageCreate"}}, + Embeds: []EmbeddedInterface{{InterfaceName: "MessageHeader"}}, + Methods: []Method{ + GetterMethod{ + method: method{Name: "Content"}, + Returns: []NamedType{{ + Type: MakeQual("text", "Rich"), + }}, + }, + }, }, { Comment: Comment{` MessageDelete is the interface for a message delete event.