aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2020-06-18 05:02:45 +0000
committerr <r@freesoftwareextremist.com>2020-06-18 05:04:18 +0000
commit34c1d087afd26b2ca8426333c02c943d13f3fdb0 (patch)
treee05a72d81cdd1ad8034eccf3c2cc73f93c17f37d
parentbd3f9ac9668d1363158b13efab41e734eaae2aed (diff)
downloadbloat-34c1d087afd26b2ca8426333c02c943d13f3fdb0.tar.gz
bloat-34c1d087afd26b2ca8426333c02c943d13f3fdb0.zip
Disable scope selection when replying to a direct post
-rw-r--r--model/post.go7
-rw-r--r--service/service.go18
-rw-r--r--templates/postform.tmpl2
3 files changed, 13 insertions, 14 deletions
diff --git a/model/post.go b/model/post.go
index 58997f7..7cfead7 100644
--- a/model/post.go
+++ b/model/post.go
@@ -13,7 +13,8 @@ type PostContext struct {
}
type ReplyContext struct {
- InReplyToID string
- InReplyToName string
- ReplyContent string
+ InReplyToID string
+ InReplyToName string
+ ReplyContent string
+ ForceVisibility bool
}
diff --git a/service/service.go b/service/service.go
index 2c4f0b0..2cc8e5a 100644
--- a/service/service.go
+++ b/service/service.go
@@ -313,12 +313,9 @@ func (svc *service) ServeThreadPage(c *model.Client, id string, reply bool) (err
}
}
- if c.Session.Settings.CopyScope {
- s, err := c.GetStatus(ctx, id)
- if err != nil {
- return err
- }
- visibility = s.Visibility
+ isDirect := status.Visibility == "direct"
+ if isDirect || c.Session.Settings.CopyScope {
+ visibility = status.Visibility
} else {
visibility = c.Session.Settings.DefaultVisibility
}
@@ -327,9 +324,10 @@ func (svc *service) ServeThreadPage(c *model.Client, id string, reply bool) (err
DefaultVisibility: visibility,
Formats: svc.postFormats,
ReplyContext: &model.ReplyContext{
- InReplyToID: id,
- InReplyToName: status.Account.Acct,
- ReplyContent: content,
+ InReplyToID: id,
+ InReplyToName: status.Account.Acct,
+ ReplyContent: content,
+ ForceVisibility: isDirect,
},
DarkMode: c.Session.Settings.DarkMode,
}
@@ -351,7 +349,7 @@ func (svc *service) ServeThreadPage(c *model.Client, id string, reply bool) (err
idNumbers[statuses[i].ID] = i + 1
statuses[i].IDReplies = replies
- addToReplyMap(replies, statuses[i].InReplyToID, statuses[i].ID, i + 1)
+ addToReplyMap(replies, statuses[i].InReplyToID, statuses[i].ID, i+1)
}
commonData := svc.getCommonData(c, "post by "+status.Account.DisplayName)
diff --git a/templates/postform.tmpl b/templates/postform.tmpl
index 9c674e9..3bb2457 100644
--- a/templates/postform.tmpl
+++ b/templates/postform.tmpl
@@ -24,7 +24,7 @@
{{end}}
<span class="post-form-field">
<label for="post-visilibity"> Scope </label>
- <select id="post-visilibity" name="visibility">
+ <select id="post-visilibity" name="visibility" {{if .ReplyContext}}{{if .ReplyContext.ForceVisibility}}disabled{{end}}{{end}}>
<option value="public" {{if eq .DefaultVisibility "public"}}selected{{end}}>Public</option>
<option value="unlisted" {{if eq .DefaultVisibility "unlisted"}}selected{{end}}>Unlisted</option>
<option value="private" {{if eq .DefaultVisibility "private"}}selected{{end}}>Private</option>