feat: complete Ancestor quote bot with production-ready Docker support
This commit is contained in:
59
node_modules/matrix-js-sdk/lib/models/user.js
generated
vendored
59
node_modules/matrix-js-sdk/lib/models/user.js
generated
vendored
@@ -1,4 +1,12 @@
|
||||
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
||||
"use strict";
|
||||
|
||||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.UserEvent = exports.User = void 0;
|
||||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
||||
var _typedEventEmitter = require("./typed-event-emitter");
|
||||
/*
|
||||
Copyright 2015 - 2021 The Matrix.org Foundation C.I.C.
|
||||
|
||||
@@ -14,9 +22,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { TypedEventEmitter } from "./typed-event-emitter.js";
|
||||
export let UserEvent = /*#__PURE__*/function (UserEvent) {
|
||||
let UserEvent = /*#__PURE__*/function (UserEvent) {
|
||||
UserEvent["DisplayName"] = "User.displayName";
|
||||
UserEvent["AvatarUrl"] = "User.avatarUrl";
|
||||
UserEvent["Presence"] = "User.presence";
|
||||
@@ -24,91 +30,73 @@ export let UserEvent = /*#__PURE__*/function (UserEvent) {
|
||||
UserEvent["LastPresenceTs"] = "User.lastPresenceTs";
|
||||
return UserEvent;
|
||||
}({});
|
||||
|
||||
/**
|
||||
* An object of extended profile attributes for a user as it arrives down the sync stream.
|
||||
*/
|
||||
|
||||
export class User extends TypedEventEmitter {
|
||||
exports.UserEvent = UserEvent;
|
||||
class User extends _typedEventEmitter.TypedEventEmitter {
|
||||
/**
|
||||
* Construct a new User. A User must have an ID and can optionally have extra information associated with it.
|
||||
* @param userId - Required. The ID of this user.
|
||||
* @deprecated use `User.createUser`
|
||||
*/
|
||||
constructor(userId) {
|
||||
super();
|
||||
_defineProperty(this, "modified", -1);
|
||||
this.userId = userId;
|
||||
(0, _defineProperty2.default)(this, "modified", -1);
|
||||
/**
|
||||
* The 'displayname' of the user if known.
|
||||
* @privateRemarks
|
||||
* Should be read-only
|
||||
*/
|
||||
_defineProperty(this, "displayName", void 0);
|
||||
_defineProperty(this, "rawDisplayName", void 0);
|
||||
(0, _defineProperty2.default)(this, "displayName", void 0);
|
||||
(0, _defineProperty2.default)(this, "rawDisplayName", void 0);
|
||||
/**
|
||||
* The 'avatar_url' of the user if known.
|
||||
* @privateRemarks
|
||||
* Should be read-only
|
||||
*/
|
||||
_defineProperty(this, "avatarUrl", void 0);
|
||||
(0, _defineProperty2.default)(this, "avatarUrl", void 0);
|
||||
/**
|
||||
* The presence status message if known.
|
||||
* @privateRemarks
|
||||
* Should be read-only
|
||||
*/
|
||||
_defineProperty(this, "presenceStatusMsg", void 0);
|
||||
(0, _defineProperty2.default)(this, "presenceStatusMsg", void 0);
|
||||
/**
|
||||
* The presence enum if known.
|
||||
* @privateRemarks
|
||||
* Should be read-only
|
||||
*/
|
||||
_defineProperty(this, "presence", "offline");
|
||||
(0, _defineProperty2.default)(this, "presence", "offline");
|
||||
/**
|
||||
* Timestamp (ms since the epoch) for when we last received presence data for this user.
|
||||
* We can subtract lastActiveAgo from this to approximate an absolute value for when a user was last active.
|
||||
* @privateRemarks
|
||||
* Should be read-only
|
||||
*/
|
||||
_defineProperty(this, "lastActiveAgo", 0);
|
||||
(0, _defineProperty2.default)(this, "lastActiveAgo", 0);
|
||||
/**
|
||||
* The time elapsed in ms since the user interacted proactively with the server,
|
||||
* or we saw a message from the user
|
||||
* @privateRemarks
|
||||
* Should be read-only
|
||||
*/
|
||||
_defineProperty(this, "lastPresenceTs", 0);
|
||||
(0, _defineProperty2.default)(this, "lastPresenceTs", 0);
|
||||
/**
|
||||
* Whether we should consider lastActiveAgo to be an approximation
|
||||
* and that the user should be seen as active 'now'
|
||||
* @privateRemarks
|
||||
* Should be read-only
|
||||
*/
|
||||
_defineProperty(this, "currentlyActive", false);
|
||||
(0, _defineProperty2.default)(this, "currentlyActive", false);
|
||||
/**
|
||||
* The events describing this user.
|
||||
* @privateRemarks
|
||||
* Should be read-only
|
||||
*/
|
||||
_defineProperty(this, "events", {});
|
||||
this.userId = userId;
|
||||
(0, _defineProperty2.default)(this, "events", {});
|
||||
this.displayName = userId;
|
||||
this.rawDisplayName = userId;
|
||||
this.updateModifiedTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new User whose events will also emit on MatrixClient.
|
||||
* A User must have an ID and can optionally have extra information associated with it.
|
||||
* @param userId - Required. The ID of this user.
|
||||
* @param client - An instance of MatrixClient object
|
||||
* @returns User object with reEmitter setup on client
|
||||
*/
|
||||
static createUser(userId, client) {
|
||||
const user = new User(userId);
|
||||
client.reEmitter.reEmit(user, [UserEvent.AvatarUrl, UserEvent.DisplayName, UserEvent.Presence, UserEvent.CurrentlyActive, UserEvent.LastPresenceTs]);
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update this User with the given presence event. May fire "User.presence",
|
||||
* "User.avatarUrl" and/or "User.displayName" if this event updates this user's
|
||||
@@ -220,4 +208,5 @@ export class User extends TypedEventEmitter {
|
||||
return this.lastPresenceTs - this.lastActiveAgo;
|
||||
}
|
||||
}
|
||||
exports.User = User;
|
||||
//# sourceMappingURL=user.js.map
|
||||
Reference in New Issue
Block a user