Implemented summary/sensitive note compose.

This commit is contained in:
Nick Gerakines 2020-04-19 14:41:44 -04:00
parent d46adf9237
commit de1b5d31b1
No known key found for this signature in database
GPG Key ID: 33D43D854F96B2E4
3 changed files with 43 additions and 3 deletions

View File

@ -21,6 +21,10 @@
{{- range .recipients -}}
<input type="hidden" name="recipient" value="{{ . }}"/>
{{- end -}}
<div class="form-group">
<label for="createNoteSummary">Summary</label>
<input type="text" class="form-control" id="createNoteSummary" name="summary">
</div>
<div class="form-group">
<label for="createNoteContent">Content</label>
<input type="text" class="form-control" id="createNoteContent" name="content" required>
@ -29,6 +33,20 @@
<label for="createNoteUpload">Attach</label>
<input type="file" class="form-control-file" id="createNoteUpload" name="upload[]">
</div>
<div class="form-row">
<div class="form-group col-md-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="true" id="createNoteSensitive"
name="sensitive">
<label class="form-check-label" for="createNoteSensitive">
Sensitive
</label>
<small id="createNoteSensitiveHelp" class="form-text text-muted">
Marks the post as sensitive, using the object summary as the warning.
</small>
</div>
</div>
</div>
<input type="submit" class="btn btn-dark" name="submit" value="Create Note"/>
</form>
</div>

View File

@ -52,6 +52,20 @@
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" value="true" id="createNoteSensitive"
name="sensitive">
<label class="form-check-label" for="createNoteSensitive">
Sensitive
</label>
<small id="createNoteSensitiveHelp" class="form-text text-muted">
Marks the post as sensitive, using the object summary as the warning.
</small>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="createNoteMediaType">Media Type</label>

View File

@ -127,11 +127,13 @@ func (h handler) createNote(c *gin.Context) {
parseMentions := true
// mediaType := "text/html"
language := "en"
summary := ""
summary := c.PostForm("summary")
threadContext := c.PostForm("thread_context")
inReplyTo := c.PostForm("inReplyTo")
content := c.PostForm("content")
sensitive, _ := strconv.ParseBool(c.PostForm("sensitive"))
// localObjectPrefix := fmt.Sprintf("https://%s/object/", h.domain)
if advanced {
@ -142,7 +144,6 @@ func (h handler) createNote(c *gin.Context) {
parseMentions, _ = strconv.ParseBool(c.PostForm("parseMentions"))
// mediaType = c.PostForm("mediaType")
language = c.PostForm("language")
summary = c.PostForm("summary")
}
if len(threadContext) == 0 {
@ -210,7 +211,12 @@ func (h handler) createNote(c *gin.Context) {
createNoteID := storage.NewV4()
createNote := storage.EmptyPayload()
createNote["@context"] = "https://www.w3.org/ns/activitystreams"
createNote["@context"] = []interface{}{
"https://www.w3.org/ns/activitystreams",
map[string]string{
"sensitive": "as:sensitive",
},
}
createNote["actor"] = string(userActorID)
createNote["id"] = activityURL
createNote["published"] = publishedAt
@ -225,6 +231,8 @@ func (h handler) createNote(c *gin.Context) {
note["content"] = string(html)
note["mediaType"] = "text/html"
note["sensitive"] = sensitive
source := storage.EmptyPayload()
source["content"] = content
source["mediaType"] = "markdown"