Skip to content

Commit

Permalink
minor fix for no loggedin users when they use grew search
Browse files Browse the repository at this point in the history
  • Loading branch information
khansadaoudi committed Nov 29, 2024
1 parent 221913d commit 7380af5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/grewSearch/GrewSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { mapActions, mapState } from 'pinia';
import { grewSearchResult_t, sample_t } from 'src/api/backend-types';
import { useGrewHistoryStore } from 'src/pinia/modules/grewHistory';
import { useProjectStore } from 'src/pinia/modules/project';
import { useUserStore } from 'src/pinia/modules/user';
import { notifyError } from 'src/utils/notify';
import { PropType, defineComponent } from 'vue';
Expand Down Expand Up @@ -63,6 +64,7 @@ export default defineComponent({
},
computed: {
...mapState(useProjectStore, ['name']),
...mapState(useUserStore, ['isLoggedIn']),
},
methods: {
...mapActions(useGrewHistoryStore, ['saveHistory']),
Expand All @@ -76,7 +78,7 @@ export default defineComponent({
.searchRequest(this.name, data)
.then((response) => {
this.resultSearch = response.data;
this.saveSearchRequest(searchPattern);
if (this.isLoggedIn) this.saveSearchRequest(searchPattern);
this.resultSearchDialog = true;
})
.catch((error) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/grewSearch/ResultView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export default defineComponent({
computed: {
...mapState(useProjectStore, ['name', 'canSaveTreeInProject', 'isValidator']),
...mapState(useGrewSearchStore, ['canRewriteRule']),
...mapState(useUserStore, ['username']),
...mapState(useUserStore, ['username', 'isLoggedIn']),
...mapState(useTreesStore, ['pendingModifications']),
...mapWritableState(useGithubStore, ['reloadCommits']),
projectName(): string {
Expand Down Expand Up @@ -249,7 +249,7 @@ export default defineComponent({
const datasample = { data: this.searchResultsCopy };
api.applyRule(this.projectName, datasample).then(() => {
this.reloadCommits += 1;
this.saveAppliedRule();
if (this.isLoggedIn) this.saveAppliedRule();
notifyMessage({ message: `Rule applied (user "${this.username}" rewrote and saved "${this.toSaveCounter}" at once)` });
this.$emit('closed');
});
Expand Down

0 comments on commit 7380af5

Please sign in to comment.