aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mastodon/mastodon.go1
-rw-r--r--mastodon/status.go3
-rw-r--r--service/service.go9
-rw-r--r--service/transport.go3
-rw-r--r--templates/about.tmpl4
-rw-r--r--templates/postform.tmpl4
6 files changed, 22 insertions, 2 deletions
diff --git a/mastodon/mastodon.go b/mastodon/mastodon.go
index 194ca30..ca2089c 100644
--- a/mastodon/mastodon.go
+++ b/mastodon/mastodon.go
@@ -198,6 +198,7 @@ type Toot struct {
SpoilerText string `json:"spoiler_text"`
Visibility string `json:"visibility"`
ContentType string `json:"content_type"`
+ QuoteID string `json:"quote_id"`
}
// Mention hold information for mention.
diff --git a/mastodon/status.go b/mastodon/status.go
index d009a7f..34f8727 100644
--- a/mastodon/status.go
+++ b/mastodon/status.go
@@ -264,6 +264,9 @@ func (c *Client) PostStatus(ctx context.Context, toot *Toot) (*Status, error) {
if toot.ContentType != "" {
params.Set("content_type", toot.ContentType)
}
+ if toot.QuoteID != "" {
+ params.Set("quote_id", toot.QuoteID)
+ }
var status Status
err := c.doAPI(ctx, http.MethodPost, "/api/v1/statuses", params, &status, nil)
diff --git a/service/service.go b/service/service.go
index d88273f..2275dfb 100644
--- a/service/service.go
+++ b/service/service.go
@@ -922,7 +922,7 @@ func (s *service) Signout(c *client) (err error) {
}
func (s *service) Post(c *client, content string, replyToID string,
- format string, visibility string, isNSFW bool,
+ format string, visibility string, isNSFW bool, isQuote bool,
files []*multipart.FileHeader) (id string, err error) {
var mediaIDs []string
@@ -934,9 +934,16 @@ func (s *service) Post(c *client, content string, replyToID string,
mediaIDs = append(mediaIDs, a.ID)
}
+ var quoteID string
+ if isQuote {
+ quoteID = replyToID
+ replyToID = ""
+ }
+
tweet := &mastodon.Toot{
Status: content,
InReplyToID: replyToID,
+ QuoteID: quoteID,
MediaIDs: mediaIDs,
ContentType: format,
Visibility: visibility,
diff --git a/service/transport.go b/service/transport.go
index 1b1a10e..e0372bd 100644
--- a/service/transport.go
+++ b/service/transport.go
@@ -307,10 +307,11 @@ func NewHandler(s *service, verbose bool, staticDir string) http.Handler {
format := c.r.FormValue("format")
visibility := c.r.FormValue("visibility")
isNSFW := c.r.FormValue("is_nsfw") == "true"
+ isQuote := c.r.FormValue("is_quote") == "true"
quickReply := c.r.FormValue("quickreply") == "true"
files := c.r.MultipartForm.File["attachments"]
- id, err := s.Post(c, content, replyToID, format, visibility, isNSFW, files)
+ id, err := s.Post(c, content, replyToID, format, visibility, isNSFW, isQuote, files)
if err != nil {
return err
}
diff --git a/templates/about.tmpl b/templates/about.tmpl
index 580c68d..d160e33 100644
--- a/templates/about.tmpl
+++ b/templates/about.tmpl
@@ -78,6 +78,10 @@
<td> <kbd>N</kbd> </td>
</tr>
<tr>
+ <td> Quote reply </td>
+ <td> <kbd>Q</kbd> </td>
+ </tr>
+ <tr>
<td> Post attachments </td>
<td> <kbd>A</kbd> </td>
</tr>
diff --git a/templates/postform.tmpl b/templates/postform.tmpl
index 5ee1a51..321851a 100644
--- a/templates/postform.tmpl
+++ b/templates/postform.tmpl
@@ -30,6 +30,10 @@
</select>
<input type="checkbox" id="nsfw-checkbox" name="is_nsfw" value="true" accesskey="N" title="NSFW (N)">
<label for="nsfw-checkbox"> NSFW </label>
+ {{if .ReplyContext}}
+ <input type="checkbox" id="quote-checkbox" name="is_quote" value="true" {{if .ReplyContext.ForceVisibility}}disabled{{end}} accesskey="Q" title="Quote (Q)">
+ <label for="quote-checkbox"> Quote </label>
+ {{end}}
</div>
<div class="form-field-s">
<input id="post-file-picker" type="file" name="attachments" multiple accesskey="A" title="Attachments (A)">