mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 22:34:47 +00:00
* Chat improvements * Delete/reset account via API for Flutter app * Fix tests. * Add "contact us" to settings * Update mobile/lib/screens/chat_conversation_screen.dart Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Juan José Mata <jjmata@jjmata.com> * Improve LLM special token detection * Deactivated user shouldn't have API working * Fix tests * API-Key usage * Flutter app launch failure on no network * Handle deletion/reset delays * Local cached data may become stale * Use X-Api-Key correctly! --------- Signed-off-by: Juan José Mata <jjmata@jjmata.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
28 lines
649 B
Ruby
28 lines
649 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::V1::UsersController < Api::V1::BaseController
|
|
before_action :ensure_write_scope
|
|
|
|
def reset
|
|
FamilyResetJob.perform_later(Current.family)
|
|
render json: { message: "Account reset has been initiated" }
|
|
end
|
|
|
|
def destroy
|
|
user = current_resource_owner
|
|
|
|
if user.deactivate
|
|
Current.session&.destroy
|
|
render json: { message: "Account has been deleted" }
|
|
else
|
|
render json: { error: "Failed to delete account", details: user.errors.full_messages }, status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def ensure_write_scope
|
|
authorize_scope!(:write)
|
|
end
|
|
end
|