Compare commits

..

No commits in common. "e924503f2d135208519ddad2e95adeff90d78bda" and "a678b620a18172e37d0eb5f321a9f7cb95e1db04" have entirely different histories.

7 changed files with 11 additions and 51 deletions

View File

@ -200,11 +200,9 @@ func (c *Client) UnReaction(ctx context.Context, id string, emoji string) (*Stat
} }
// Reblog is reblog the toot of id and return status of reblog. // Reblog is reblog the toot of id and return status of reblog.
func (c *Client) Reblog(ctx context.Context, id string, visibility string) (*Status, error) { func (c *Client) Reblog(ctx context.Context, id string) (*Status, error) {
var status Status var status Status
params := url.Values{} err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/reblog", id), nil, &status, nil)
params.Set("visibility", visibility)
err := c.doAPI(ctx, http.MethodPost, fmt.Sprintf("/api/v1/statuses/%s/reblog", id), params, &status, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -162,11 +162,9 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID,
} }
title = "The Whole Known Network" title = "The Whole Known Network"
case "tag": case "tag":
if len(tag) > 0 { statuses, err = c.GetTimelineHashtag(c.ctx, tag, false, &pg)
statuses, err = c.GetTimelineHashtag(c.ctx, tag, false, &pg) if err != nil {
if err != nil { return err
return err
}
} }
title = "Tag timeline" title = "Tag timeline"
@ -205,9 +203,6 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID,
if len(instance) > 0 { if len(instance) > 0 {
v.Set("instance", instance) v.Set("instance", instance)
} }
if len(tag) > 0 {
v.Set("tag", tag)
}
if len(listId) > 0 { if len(listId) > 0 {
v.Set("list", listId) v.Set("list", listId)
} }
@ -220,9 +215,6 @@ func (s *service) TimelinePage(c *client, tType, instance, listId, maxID,
if len(instance) > 0 { if len(instance) > 0 {
v.Set("instance", instance) v.Set("instance", instance)
} }
if len(tag) > 0 {
v.Set("tag", tag)
}
if len(listId) > 0 { if len(listId) > 0 {
v.Set("list", listId) v.Set("list", listId)
} }
@ -1060,8 +1052,8 @@ func (s *service) UnReact(c *client, id string, emoji string) (count int64, err
return return
} }
func (s *service) Retweet(c *client, id string, visibility string) (count int64, err error) { func (s *service) Retweet(c *client, id string) (count int64, err error) {
st, err := c.Reblog(c.ctx, id, visibility) st, err := c.Reblog(c.ctx, id)
if err != nil { if err != nil {
return return
} }

View File

@ -381,8 +381,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
retweet := handle(func(c *client) error { retweet := handle(func(c *client) error {
id, _ := mux.Vars(c.r)["id"] id, _ := mux.Vars(c.r)["id"]
rid := c.r.FormValue("retweeted_by_id") rid := c.r.FormValue("retweeted_by_id")
visibility := c.r.FormValue("retweet_visibility") _, err := s.Retweet(c, id)
_, err := s.Retweet(c, id, visibility)
if err != nil { if err != nil {
return err return err
} }
@ -774,8 +773,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
fRetweet := handle(func(c *client) error { fRetweet := handle(func(c *client) error {
id, _ := mux.Vars(c.r)["id"] id, _ := mux.Vars(c.r)["id"]
visibility := c.r.FormValue("retweet_visibility") count, err := s.Retweet(c, id)
count, err := s.Retweet(c, id, visibility)
if err != nil { if err != nil {
return err return err
} }

View File

@ -97,8 +97,7 @@ function handleRetweetForm(id, f) {
updateActionForm(id, forms[i], reverseActions[action]); updateActionForm(id, forms[i], reverseActions[action]);
} }
var retweetVisibility = document.querySelector('input[id="retweet_visibility-'+id+'"]:checked').value; var body = "csrf_token=" + encodeURIComponent(csrfToken);
var body = "csrf_token=" + encodeURIComponent(csrfToken) + "&retweet_visibility=" + encodeURIComponent(retweetVisibility);
var contentType = "application/x-www-form-urlencoded"; var contentType = "application/x-www-form-urlencoded";
http("POST", "/fluoride/" + action + "/" + id, http("POST", "/fluoride/" + action + "/" + id,
body, contentType, function(res, type) { body, contentType, function(res, type) {

View File

@ -22,7 +22,6 @@
<a class="nav-link" href="/search" accesskey="6" title="Search (6)">search</a> <a class="nav-link" href="/search" accesskey="6" title="Search (6)">search</a>
</div> </div>
<div> <div>
<a class="nav-link" href="/timeline/tag">tag</a>
<a class="nav-link" href="/lists" accesskey="7" title="Lists (7)">lists</a> <a class="nav-link" href="/lists" accesskey="7" title="Lists (7)">lists</a>
<a class="nav-link" href="/settings" target="_top" accesskey="8" title="Settings (8)">settings</a> <a class="nav-link" href="/settings" target="_top" accesskey="8" title="Settings (8)">settings</a>
<form class="signout" action="/signout" method="post" target="_top"> <form class="signout" action="/signout" method="post" target="_top">

View File

@ -225,27 +225,11 @@
<div class="status-action"> <div class="status-action">
{{$rt := "retweet"}} {{if .Reblogged}} {{$rt = "unretweet"}} {{end}} {{$rt := "retweet"}} {{if .Reblogged}} {{$rt = "unretweet"}} {{end}}
<form class="status-retweet" data-action="{{$rt}}" action="/{{$rt}}/{{.ID}}" method="post" target="_self"> <form class="status-retweet" data-action="{{$rt}}" action="/{{$rt}}/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}"> <input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}"> <input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}"> <input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<div class="more-container">
<input type="submit" value="{{$rt}}" class="btn-link" <input type="submit" value="{{$rt}}" class="btn-link"
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}title="this status cannot be retweeted" disabled{{end}}> {{if or (eq .Visibility "private") (eq .Visibility "direct")}}title="this status cannot be retweeted" disabled{{end}}>
<div class="more-content">
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}
Locked
{{else}}
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="public" checked>
<label for="retweet_visibility">public</label>
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="unlisted">
<label for="retweet_visibility">unlisted</label>
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="private">
<label for="retweet_visibility">private</label>
{{end}}
</div>
</div>
<a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list"> <a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list">
{{if and (not $.Ctx.AntiDopamineMode) .ReblogsCount}} {{if and (not $.Ctx.AntiDopamineMode) .ReblogsCount}}
({{DisplayInteractionCount .ReblogsCount}}) ({{DisplayInteractionCount .ReblogsCount}})

View File

@ -14,16 +14,6 @@
<button type="submit"> Submit </button> <button type="submit"> Submit </button>
</form> </form>
{{end}} {{end}}
{{if eq .Type "tag"}}
<form class="search-form" action="/timeline/tag" method="GET">
<span class="post-form-field">
<label for="tag"> Tag </label>
<input id="tag" name="tag" value="">
</span>
<button type="submit"> Submit </button>
</form>
{{end}}
{{range .Statuses}} {{range .Statuses}}
{{template "status.tmpl" (WithContext . $.Ctx)}} {{template "status.tmpl" (WithContext . $.Ctx)}}