Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,42 +14,44 @@ GEM
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
ast (2.4.2)
ast (2.4.3)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.9)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
drb (2.2.1)
connection_pool (2.5.3)
drb (2.2.3)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.10.2)
language_server-protocol (3.17.0.4)
json (2.12.2)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.6.6)
logger (1.7.0)
minitest (5.25.5)
parallel (1.26.3)
parser (3.3.7.1)
parallel (1.27.0)
parser (3.3.8.0)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
prism (1.4.0)
racc (1.8.1)
rack (3.1.12)
rack (3.1.15)
rainbow (3.1.1)
regexp_parser (2.10.0)
rubocop (1.74.0)
rubocop (1.75.8)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.1)
parser (>= 3.3.1.0)
rubocop-ast (1.44.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-capybara (2.22.1)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
Expand All @@ -65,13 +67,13 @@ GEM
rubocop-factory_bot (2.27.1)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rails (2.30.3)
rubocop-rails (2.32.0)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
rubocop (>= 1.72.1, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rspec (3.5.0)
rubocop (>= 1.75.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0)
rubocop-rspec (3.6.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rspec_rails (2.31.0)
Expand All @@ -97,4 +99,4 @@ DEPENDENCIES
syntax_tree

BUNDLED WITH
2.6.6
2.6.9
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ const SolvedStatus = <template>
>{{icon "far-square"}}</span>
{{~/if~}}
</template>;

export default SolvedStatus;
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Component from "@glimmer/component";
import { hash } from "@ember/helper";
import { action } from "@ember/object";
import { service } from "@ember/service";
import { i18n } from "discourse-i18n";
import ComboBox from "select-kit/components/combo-box";

const QUERY_PARAM_VALUES = {
solved: "yes",
Expand Down Expand Up @@ -57,4 +59,19 @@ export default class SolvedStatusFilter extends Component {
queryParams: { solved: QUERY_PARAM_VALUES[newStatus] },
});
}

<template>
{{#if this.siteSettings.solved_enabled}}
<li>
<ComboBox
@content={{this.statuses}}
@value={{this.status}}
@valueProperty="value"
@options={{hash caretDownIcon="caret-right" caretUpIcon="caret-down"}}
@onChange={{this.changeStatus}}
class="solved-status-filter"
/>
</li>
{{/if}}
</template>
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import Component from "@ember/component";
import { on } from "@ember/modifier";
import { action } from "@ember/object";
import { classNames, tagName } from "@ember-decorators/component";
import { i18n } from "discourse-i18n";

@tagName("")
@classNames("category-custom-settings-outlet", "solved-settings")
export default class SolvedSettings extends Component {
@action
onChangeSetting(value) {
this.set(
"category.custom_fields.enable_accepted_answers",
value ? "true" : "false"
);
}

<template>
<h3>{{i18n "solved.title"}}</h3>

{{#unless this.siteSettings.allow_solved_on_all_topics}}
<section class="field">
<div class="enable-accepted-answer">
<label class="checkbox-label">
<input
{{on "change" (action "onChangeSetting" value="target.checked")}}
checked={{this.category.enable_accepted_answers}}
type="checkbox"
/>
{{i18n "solved.allow_accepted_answers"}}
</label>
</div>
</section>
{{/unless}}

<section class="field auto-close-solved-topics">
<label for="auto-close-solved-topics">
{{i18n "solved.solved_topics_auto_close_hours"}}
</label>
<input
{{on
"input"
(action
(mut this.category.custom_fields.solved_topics_auto_close_hours)
value="target.value"
)
}}
value={{this.category.custom_fields.solved_topics_auto_close_hours}}
type="number"
min="0"
id="auto-close-solved-topics"
/>
</section>
</template>
}

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import Component from "@ember/component";
import { later } from "@ember/runloop";
import { classNames, tagName } from "@ember-decorators/component";
import TopicNavigationPopup from "discourse/components/topic-navigation-popup";
import { isTesting } from "discourse/lib/environment";
import { i18n } from "discourse-i18n";

const ONE_WEEK = 7 * 24 * 60 * 60 * 1000; // milliseconds
const MAX_DURATION_WITH_NO_ANSWER = ONE_WEEK;
const DISPLAY_DELAY = isTesting() ? 0 : 2000;

@tagName("div")
@classNames("topic-navigation-outlet", "no-answer")
export default class NoAnswer extends Component {
static shouldRender(args, context) {
return !context.site.mobileView;
}

init() {
super.init(...arguments);
this.set("show", false);
this.setProperties({
oneWeek: ONE_WEEK,
show: false,
});
later(() => {
if (!this.element || this.isDestroying || this.isDestroyed) {
return;
}
const topic = this.topic;
const currentUser = this.currentUser;

// show notice if:
// - user can accept answer
// - it does not have an accepted answer
// - topic is old
// - topic has at least one reply from another user that can be accepted
if (
!topic.accepted_answer &&
currentUser &&
topic.user_id === currentUser.id &&
moment() - moment(topic.created_at) > MAX_DURATION_WITH_NO_ANSWER &&
topic.postStream.posts.some(
(post) => post.user_id !== currentUser.id && post.can_accept_answer
)
) {
this.set("show", true);
}
}, DISPLAY_DELAY);
}

<template>
{{#if this.show}}
<TopicNavigationPopup
@popupId="solved-notice"
@dismissDuration={{this.oneWeek}}
>
<h3>{{i18n "solved.no_answer.title"}}</h3>
<p>{{i18n "solved.no_answer.description"}}</p>
</TopicNavigationPopup>
{{/if}}
</template>
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Component from "@glimmer/component";
import { LinkTo } from "@ember/routing";
import { service } from "@ember/service";
import icon from "discourse/helpers/d-icon";
import { i18n } from "discourse-i18n";

export default class SolvedList extends Component {
@service siteSettings;

<template>
{{#if this.siteSettings.solved_enabled}}
<li class="user-activity-bottom-outlet solved-list">
<LinkTo @route="userActivity.solved">
{{icon "square-check"}}
{{i18n "solved.title"}}
</LinkTo>
</li>
{{/if}}
</template>
}

This file was deleted.

Loading