Reporting challenges (#14756)

* initial commit

* update logic to display flagged challenges properly to users and admins

* add report button to pages 'My Challenges' and 'Discover Challenges'

* allow mods to view flagged messages on challengeDetail view

* update showing flagged challenges for group challenges

* update showing flagged challenges for a specific challenge

* disallow closing a flagged challenge

* update notes to reflect apiParams properly

* fix css spacing

* update challenge en locales

* fix spacing

* update title of closeChallengeModal

* let user know flagged challenges cannot be cloned

* fix linting errors

* ensure flagged challenges cannot be declared with a winner and cloned via API

* define a non user challenge properly

* fix logic to check for a nonParticipant and nonLeader user when grabbing flagged challenges

* fix linting of max character of 100 / line

* remove reporting on 'my challenges' and 'discover challenges'

* WIP(challenges): disable clone button and add notes to new functions

* WIP(challenges): smol changes

* WIP(challenges): clone button only disabled for admin and flagged user; other users can still clone but the flag goes along with the clone

* WIP(challenges): stop flags carrying over on cloned challenges

* WIP(challenges): typo fixing, undoing a smol change

* fix(challenges): improved query logic for flags

* WIP(challenges): more smol changes

* fix(challenges): refactor queries

* fix(challenges): correct My Challenges tab logic

* WIP(challenges): fix clone button state

* WIP(challenges): really fixed clone button & clear flags from clones

* WIP(challenge): implement new design for reporting modal

* WIP(challenge): making things pretty

* WIP(challenge): conquering the close button

* WIP(challenge): fixin some spacing

* WIP(challenge): smol fix

* WIP(challenge): making sure the button is actually disabled

* WIP(challenge): fix blockquote css

* fix(tests): no private guilds

* fix(lint): curlies etc

* fix(test): moderator permission

* fix(lint): sure man whatever

* fix(lint): bad vim no tabby

* fix(test): permissions not contrib lol

* fix(challenges): add icon and fix leaky CSS

* fix(challenge): correct clone button behavior

---------

Co-authored-by: Julius Jung <me@matchajune.io>
Co-authored-by: SabreCat <sabe@habitica.com>
Co-authored-by: Sabe Jones <sabrecat@gmail.com>
This commit is contained in:
Natalie
2023-10-24 10:24:56 -04:00
committed by GitHub
parent 8537793308
commit 581271e930
14 changed files with 820 additions and 65 deletions

View File

@@ -2,7 +2,7 @@
<div>
<b-modal
id="close-challenge-modal"
:title="$t('createGuild')"
:title="$t('endChallenge')"
size="md"
>
<div
@@ -17,31 +17,42 @@
</h2>
</div>
<div class="row text-center">
<div class="col-12">
<div class="support-habitica">
<!-- @TODO: Add challenge achievement badge here-->
<span
v-if="isFlagged"
class="col-12"
>
<div>{{ $t('cannotClose') }}</div>
</span>
<span
v-else
class="col-12"
>
<div class="col-12">
<div class="support-habitica">
<!-- @TODO: Add challenge achievement badge here-->
</div>
</div>
</div>
<div class="col-12">
<strong v-once>{{ $t('selectChallengeWinnersDescription') }}</strong>
</div>
<div class="col-12">
<member-search-dropdown
:text="winnerText"
:members="members"
:challenge-id="challengeId"
@member-selected="selectMember"
/>
</div>
<div class="col-12">
<button
v-once
class="btn btn-primary"
@click="closeChallenge"
>
{{ $t('awardWinners') }}
</button>
</div>
<div class="col-12">
<strong v-once>{{ $t('selectChallengeWinnersDescription') }}</strong>
</div>
<div class="col-12">
<member-search-dropdown
:text="winnerText"
:members="members"
:challenge-id="challengeId"
@member-selected="selectMember"
/>
</div>
<div class="col-12">
<button
v-once
class="btn btn-primary"
@click="closeChallenge"
>
{{ $t('awardWinners') }}
</button>
</div>
</span>
<div class="col-12">
<hr>
<div class="or">
@@ -123,7 +134,7 @@ export default {
components: {
memberSearchDropdown,
},
props: ['challengeId', 'members', 'prize'],
props: ['challengeId', 'members', 'prize', 'flagCount'],
data () {
return {
winner: {},
@@ -134,6 +145,9 @@ export default {
if (!this.winner.profile) return this.$t('selectMember');
return this.winner.profile.name;
},
isFlagged () {
return this.flagCount > 0;
},
},
methods: {
selectMember (member) {