flag
This commit is contained in:
parent
74156ffc45
commit
04ff974b32
7 changed files with 29 additions and 30 deletions
|
@ -18,7 +18,6 @@ def api_flag_post(pid, v):
|
|||
if existing:
|
||||
return "", 409
|
||||
reason = request.form.get("reason", "")[:100].strip()
|
||||
print(reason)
|
||||
flag = Flag(post_id=post.id,
|
||||
user_id=v.id,
|
||||
reason=reason,
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
<div class="user-info">
|
||||
<span class="comment-collapse d-md-none" onclick="collapse_comment('{{c.base36id}}')"></span>
|
||||
{% if c.banaward %} <i class="fas fa-gavel text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Given the 1-day ban award by @{{c.banaward}}"></i> {% endif %}
|
||||
{% if c.active_flags %} <a class="btn btn-primary" style="padding:1px 5px; font-size:10px;" href="javascript:void(0)" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags}} Flags</a> {% endif %}
|
||||
{% if c.active_flags %} <a class="btn btn-primary" style="padding:1px 5px; font-size:10px;" href="javascript:void(0)" onclick="document.getElementById('flaggers-{{c.id}}').classList.toggle('d-none')">{{c.active_flags}} Reports</a> {% endif %}
|
||||
{% if c.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span> {% endif %}
|
||||
{% if c.is_nsfl %}<span class="badge text-black border-danger border-1 text-small-extra">nsfl</span> {% endif %}
|
||||
{% if v and v.admin_level==6 and c.author.shadowbanned %}<i class="fas fa-user-times text-admin" data-toggle="tooltip" data-placement="bottom" title="Shadowbanned user"></i> {% endif %}
|
||||
|
@ -280,7 +280,7 @@
|
|||
<div class="dropdown-menu border-0 shadow" aria-labelledby="dropdownMoreLink">
|
||||
{% if not (v and v.id==c.author_id) %}
|
||||
{% if v %}
|
||||
<a class="dropdown-item" href="javascript:void(0)" data-toggle="modal" data-target="#reportCommentModal" onclick="report_commentModal('{{c.base36id}}','{{c.author.username if not c.author.is_deleted else '[is_deleted]'}}',)"><i class="fas fa-flag fa-fw"></i>Flag</a>
|
||||
<a class="dropdown-item" href="javascript:void(0)" data-toggle="modal" data-target="#reportCommentModal" onclick="report_commentModal('{{c.base36id}}','{{c.author.username if not c.author.is_deleted else '[is_deleted]'}}',)"><i class="fas fa-flag fa-fw"></i>Report</a>
|
||||
{% else %}
|
||||
<a class="dropdown-item" href="javascript:void(0)" data-toggle="modal" data-target="#reportCommentModal" onclick=""><i class="fas fa-flag fa-fw"></i>Flag</a>
|
||||
{% endif %}
|
||||
|
@ -474,7 +474,7 @@
|
|||
<li class="list-group-item"><a href="{{c.permalink}}?context=5#context"{% if c.author.is_private %} rel="nofollow"{% endif %}><i class="fas fa-dna"></i>Context</a></li>
|
||||
|
||||
{% if not (v and v.id==c.author_id) %}
|
||||
<li class="list-group-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportCommentModal" onclick="report_commentModal('{{c.base36id}}','{{c.author.username if not c.author.is_deleted else '[is_deleted]'}}')" class="d-block"><i class="fas fa-flag"></i>Flag</a></li>
|
||||
<li class="list-group-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportCommentModal" onclick="report_commentModal('{{c.base36id}}','{{c.author.username if not c.author.is_deleted else '[is_deleted]'}}')" class="d-block"><i class="fas fa-flag"></i>Report</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% if v and c.parent_submission and c.author_id==v.id %}
|
||||
|
|
|
@ -219,19 +219,26 @@
|
|||
|
||||
document.getElementById("comment-author").textContent = author;
|
||||
|
||||
//offtopic.disabled=true;
|
||||
|
||||
document.getElementById("reportCommentButton").onclick = function() {
|
||||
|
||||
this.innerHTML='<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Reporting comment';
|
||||
this.disabled = true;
|
||||
post('/api/flag/comment/' + id,
|
||||
callback = function() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", '/api/flag/comment/'+id, true);
|
||||
var form = new FormData()
|
||||
form.append("formkey", formkey());
|
||||
form.append("reason", document.getElementById("reason").value);
|
||||
|
||||
document.getElementById("reportCommentFormBefore").classList.add('d-none');
|
||||
document.getElementById("reportCommentFormAfter").classList.remove('d-none');
|
||||
}
|
||||
)
|
||||
xhr.withCredentials=true;
|
||||
|
||||
xhr.onload=function() {
|
||||
document.getElementById("reportCommentFormBefore").classList.add('d-none');
|
||||
document.getElementById("reportCommentFormAfter").classList.remove('d-none');
|
||||
};
|
||||
|
||||
xhr.onerror=function(){alert(errortext)};
|
||||
xhr.send(form);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -10,23 +10,16 @@
|
|||
</div>
|
||||
<!-- Before report is made, show this -->
|
||||
<div class="" id="reportCommentFormBefore">
|
||||
<form>
|
||||
<form id="report-comment-form" method="post">
|
||||
<div class="modal-body">
|
||||
<div class="h6">We're sorry something here is wrong.</div>
|
||||
<small class="form-text text-muted">Please select a reason for flagging below.</small>
|
||||
<input type="hidden" name="formkey" value="{{v.formkey}}">
|
||||
<select name="report_type" class="custom-select mt-3">
|
||||
<option disabled selected>
|
||||
Reason for flagging?
|
||||
</option>
|
||||
<option value="admin">
|
||||
This comment breaks Drama policy
|
||||
</option>
|
||||
</select>
|
||||
<small class="form-text text-muted">Please enter a reason for reporting below.</small>
|
||||
<pre></pre>
|
||||
<input maxlength="100" id="reason" class="form-control"/>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-link text-muted" data-dismiss="modal">Cancel</button>
|
||||
<button id="reportCommentButton" class="btn btn-danger">Report comment</button>
|
||||
<button type="button" id="reportCommentButton" class="btn btn-danger">Report comment</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<form id="report-post-form" method="post">
|
||||
<div class="modal-body">
|
||||
<div class="h6">We're sorry something here is wrong.</div>
|
||||
<small class="form-text text-muted">Please enter a reason for flagging below.</small>
|
||||
<small class="form-text text-muted">Please enter a reason for reporting below.</small>
|
||||
<pre></pre>
|
||||
<input maxlength="100" id="reason" class="form-control"/>
|
||||
</div>
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
<div class="modal-body">
|
||||
<ul class="list-group post-actions">
|
||||
{% if not (v and v.id==p.author_id) %}
|
||||
<button class="btn btn-link btn-block btn-lg text-left text-muted" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.base36id}}','{{'@'+p.author.username if not p.author.is_deleted else '[deleted account]'}}','{{p.board.name}}')" class="d-block"><i class="far fa-flag text-center text-muted mr-3"></i>Flag</button>
|
||||
<button class="btn btn-link btn-block btn-lg text-left text-muted" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.base36id}}','{{'@'+p.author.username if not p.author.is_deleted else '[deleted account]'}}','{{p.board.name}}')" class="d-block"><i class="far fa-flag text-center text-muted mr-3"></i>Report</button>
|
||||
{% endif %}
|
||||
{% if v and v.id==p.author_id %}
|
||||
{% if p.private %}
|
||||
|
@ -236,7 +236,7 @@
|
|||
{% if p.is_nsfl %}<span class="badge text-black border-danger border-1 text-small-extra">nsfl</span>{% endif %}
|
||||
{% if p.private %}<span class="badge border-warning border-1 text-small-extra">unlisted</span>{% endif %}
|
||||
{% if p.is_repost %}<span class="badge border-warning border-1 text-small-extra"><a class="text-warning" href="{{p.reposts.permalink}}">repost</a></span>{% endif %}
|
||||
{% if p.active_flags %}<a class="btn btn-primary" href="javascript:void(0)" style="padding:1px 5px; font-size:10px;" onclick="document.getElementById('flaggers').classList.toggle('d-none')">{{p.active_flags}} Flags</a>{% endif %}
|
||||
{% if p.active_flags %}<a class="btn btn-primary" href="javascript:void(0)" style="padding:1px 5px; font-size:10px;" onclick="document.getElementById('flaggers').classList.toggle('d-none')">{{p.active_flags}} Reports</a>{% endif %}
|
||||
{% if p.author.is_deleted %}[deleted account]{% else %} <a {% if p.author.animatedname %}class="{% if p.author.patron %}patron{% else %}leaderboard{% endif %}"{% endif %} href="{{p.author.permalink}}" style="color: #{{p.author.namecolor}}; font-weight: bold;" class="user-name"> {{p.author.username}}</a>{% if p.author.customtitle %} <bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>{% endif %}{% endif %}
|
||||
<span data-toggle="tooltip" data-placement="bottom" id="timestamp" title=""> {{p.age_string}}</span>
|
||||
({% if p.realurl(v) %}<a href="/search/posts/?q=domain%3A{{p.domain}}&sort=new&t=all" {% if v and v.newtabexternal %}target="_blank"{% endif %}>{{p.domain}}</a>{% else %}text post{% endif %})
|
||||
|
@ -351,7 +351,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if not (v and v.id==p.author_id) %}
|
||||
<li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.base36id}}', '{{p.author.username}}','{{p.board.name}}')"><i class="fas fa-flag"></i>Flag</a></li>
|
||||
<li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.base36id}}', '{{p.author.username}}','{{p.board.name}}')"><i class="fas fa-flag"></i>Report</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% if v and v.id==p.author_id %}
|
||||
|
|
|
@ -136,7 +136,7 @@
|
|||
{% if p.is_blocked %}<i class="fas fa-user-minus text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="This user is blocking you."></i>{% endif %}
|
||||
{% if p.private %}<span class="badge border-warning border-1 text-small-extra">unlisted</span>{% endif %}
|
||||
{% if p.is_repost %} <span class="badge border-warning border-1 text-small-extra"><a class="text-warning" href="{{p.reposts.permalink}}">repost</a></span>{% endif %}
|
||||
{% if p.active_flags %}<a class="btn btn-primary" href="javascript:void(0)" style="padding:1px 5px; font-size:10px;" onclick="document.getElementById('flaggers-{{p.id}}').classList.toggle('d-none')">{{p.active_flags}} Flags</a>{% endif %}
|
||||
{% if p.active_flags %}<a class="btn btn-primary" href="javascript:void(0)" style="padding:1px 5px; font-size:10px;" onclick="document.getElementById('flaggers-{{p.id}}').classList.toggle('d-none')">{{p.active_flags}} Reports</a>{% endif %}
|
||||
{% if p.author.is_deleted %}[deleted account]{% else %} <a {% if p.author.animatedname %}class="{% if p.author.patron %}patron{% else %}leaderboard{% endif %}"{% endif %} href="{{p.author.permalink}}" style="color: #{{p.author.namecolor}}; font-weight: bold;" class="user-name">{{p.author.username}}</a>{% if p.author.customtitle %}<bdi style="color: #{{p.author.titlecolor}}"> {{p.author.customtitle | safe}}</bdi>{% endif %}{% endif %}
|
||||
<span data-toggle="tooltip" data-placement="bottom" id="timestamp-{{p.id}}" title=""> {{p.age_string}}</span>
|
||||
|
||||
|
@ -191,7 +191,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if not (v and v.id==p.author_id) %}
|
||||
<li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.base36id}}', '{{p.author.username}}','{{p.board.name}}')"><i class="fas fa-flag"></i>Flag</a></li>
|
||||
<li class="list-inline-item"><a href="javascript:void(0)" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.base36id}}', '{{p.author.username}}','{{p.board.name}}')"><i class="fas fa-flag"></i>Report</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% if v and v.id==p.author_id %}
|
||||
|
@ -375,7 +375,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if not (v and v.id==p.author_id) %}
|
||||
<button class="btn btn-link btn-block btn-lg text-left text-muted" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.base36id}}','{{'@'+p.author.username if not p.author.is_deleted else '[deleted account]'}}','{{p.board.name}}')" class="d-block"><i class="far fa-flag text-center text-muted mr-3"></i>Flag</button>
|
||||
<button class="btn btn-link btn-block btn-lg text-left text-muted" data-toggle="modal" data-dismiss="modal" data-target="#reportPostModal" onclick="report_postModal('{{p.base36id}}','{{'@'+p.author.username if not p.author.is_deleted else '[deleted account]'}}','{{p.board.name}}')" class="d-block"><i class="far fa-flag text-center text-muted mr-3"></i>Report</button>
|
||||
{% endif %}
|
||||
{% if v and v.id==p.author_id %}
|
||||
<button class="btn btn-link btn-block btn-lg text-info text-left" id="pin-post-{{p.base36id}}" href="javascript:void(0)" onclick="post('/api/pin/{{p.base36id}}',callback=function(){window.location.reload(true);})"><i class="fas fa-thumbtack text-center text-muted mr-3"></i>{% if p.is_pinned %}Unpin from your profile{% else %}Pin to your profile{% endif %}</button>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue