Can't accept a friend request after you ignored it
This commit is contained in:
parent
4846a88ab0
commit
7ef22db5e2
|
@ -36,6 +36,14 @@ func AddFriend(sourceUserID, targetUserID uint64) error {
|
||||||
targetUserID, sourceUserID,
|
targetUserID, sourceUserID,
|
||||||
).First(&rev).Error
|
).First(&rev).Error
|
||||||
|
|
||||||
|
// If we have previously Ignored the friend request, we can not Accept it but only Reject it.
|
||||||
|
if reverse == nil && rev.Ignored {
|
||||||
|
return errors.New(
|
||||||
|
"you have previously ignored a friend request from this person and can not accept it now - " +
|
||||||
|
"please go to your Friends page, Ignored tab, and remove the ignored friend request there and try again",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// If the reverse exists (requested us) but not the forward, this completes the friendship.
|
// If the reverse exists (requested us) but not the forward, this completes the friendship.
|
||||||
if reverse == nil && forward != nil {
|
if reverse == nil && forward != nil {
|
||||||
// Approve the reverse.
|
// Approve the reverse.
|
||||||
|
|
|
@ -115,7 +115,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{if or $Root.IsRequests $Root.IsIgnored}}
|
{{if $Root.IsIgnored}}
|
||||||
|
<footer class="card-footer">
|
||||||
|
<button type="submit" name="verdict" value="reject" class="card-footer-item button is-danger is-outlined">
|
||||||
|
<span class="icon"><i class="fa fa-xmark"></i></span>
|
||||||
|
<span>Reject</span>
|
||||||
|
</button>
|
||||||
|
</footer>
|
||||||
|
{{else if $Root.IsRequests}}
|
||||||
<footer class="card-footer">
|
<footer class="card-footer">
|
||||||
<button type="submit" name="verdict" value="approve" class="card-footer-item button is-success">
|
<button type="submit" name="verdict" value="approve" class="card-footer-item button is-success">
|
||||||
<span class="icon"><i class="fa fa-check"></i></span>
|
<span class="icon"><i class="fa fa-check"></i></span>
|
||||||
|
@ -125,12 +132,10 @@
|
||||||
<span class="icon"><i class="fa fa-xmark"></i></span>
|
<span class="icon"><i class="fa fa-xmark"></i></span>
|
||||||
<span>Reject</span>
|
<span>Reject</span>
|
||||||
</button>
|
</button>
|
||||||
{{if not $Root.IsIgnored}}
|
|
||||||
<button type="submit" name="verdict" value="ignore" class="card-footer-item button">
|
<button type="submit" name="verdict" value="ignore" class="card-footer-item button">
|
||||||
<span class="icon"><i class="fa fa-moon"></i></span>
|
<span class="icon"><i class="fa fa-moon"></i></span>
|
||||||
<span>Ignore</span>
|
<span>Ignore</span>
|
||||||
</button>
|
</button>
|
||||||
{{end}}
|
|
||||||
</footer>
|
</footer>
|
||||||
{{else}}
|
{{else}}
|
||||||
<footer class="card-footer">
|
<footer class="card-footer">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user