Add mention to user actions

This commit is contained in:
Jason McBrayer 2018-06-11 19:19:22 -04:00
parent 9122a44216
commit d0bed792b2
3 changed files with 13 additions and 2 deletions

View File

@ -55,6 +55,10 @@ Brutaldon - {{ timeline }} timelime
href="{{ user.url }}" title="home">
<span class="is-hidden">View on home site</span>
</a>
<a class="level-item fa fa-envelope"
href="{% url 'toot' user.acct %}" title="mention">
<span class="is-hidden">Mention</span>
</a>
</div>
<div class="level-right">
{% if not relationship.muting %}

View File

@ -40,6 +40,7 @@ urlpatterns = [
path('thread/<int:id>', views.thread, name='thread'),
path('tags/<tag>', views.tag, name='tag'),
path('user/<username>', views.user, name='user'),
path('toot/<mention>', views.toot, name='toot'),
path('toot', views.toot, name="toot"),
path('reply/<int:id>', views.reply, name='reply'),
path('fav/<int:id>', views.fav, name='fav'),

View File

@ -292,8 +292,14 @@ def settings(request):
{ 'form': form, 'fullbrutalism': fullbrutalism_p(request)})
@never_cache
def toot(request):
def toot(request, mention=None):
if request.method == 'GET':
if mention:
if not mention.startswith('@'):
mention = '@'+mention
form = PostForm(initial={'visibility': request.session['user'].source.privacy,
'status': mention + '\n' })
else:
form = PostForm(initial={'visibility': request.session['user'].source.privacy})
return render(request, 'main/post.html',
{'form': form,