mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 13:21:01 +08:00

* FEATURE: Added MaxMindDb to resolve IP information. * FEATURE: Added browser detection based on user agent. * FEATURE: Added recently used devices in user preferences. * DEV: Added acceptance test for recently used devices. * UX: Do not show 'Show more' button if there aren't more tokens. * DEV: Fix unit tests. * DEV: Make changes after code review. * Add more detailed unit tests. * Improve logging messages. * Minor coding style fixes. * DEV: Use DropdownSelectBoxComponent and run Prettier. * DEV: Fix unit tests.
42 lines
994 B
JavaScript
42 lines
994 B
JavaScript
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
|
import { ajax } from "discourse/lib/ajax";
|
|
import { userPath } from "discourse/lib/url";
|
|
|
|
export default Ember.Controller.extend(ModalFunctionality, {
|
|
expanded: false,
|
|
|
|
onShow() {
|
|
ajax(
|
|
userPath(`${this.get("currentUser.username_lower")}/activity.json`)
|
|
).then(posts => {
|
|
if (posts.length > 0) {
|
|
this.set("latest_post", posts[0]);
|
|
}
|
|
});
|
|
},
|
|
|
|
actions: {
|
|
toggleExpanded() {
|
|
this.set("expanded", !this.get("expanded"));
|
|
},
|
|
|
|
highlightSecure() {
|
|
this.send("closeModal");
|
|
|
|
Ember.run.next(() => {
|
|
const $prefPasswordDiv = $(".pref-password");
|
|
|
|
$prefPasswordDiv.addClass("highlighted");
|
|
$prefPasswordDiv.on("animationend", () =>
|
|
$prefPasswordDiv.removeClass("highlighted")
|
|
);
|
|
|
|
window.scrollTo({
|
|
top: $prefPasswordDiv.offset().top,
|
|
behavior: "smooth"
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|